forked from filipdanic/compact-timezone-list
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue filipdanic#3 Add CommonJS and Typescript compatibility
Based on guide @ https://redfin.engineering/node-modules-at-war-why-commonjs-and-es-modules-cant-get-along-9617135eeca1
- Loading branch information
Adam Fanello
committed
Aug 18, 2020
1 parent
a2742dc
commit d54d763
Showing
4 changed files
with
84 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* @fileoverview | ||
* | ||
* This package contains an array of timezones based on conventional options found online. | ||
* It does not follow any complete data set, but all names are according to the tz format: | ||
* https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. | ||
* | ||
* More specifically, the fields in the array are: | ||
* – offset, a string from '-11:00' to '+14:00' representing the UTC offset | ||
* - label, a readable label that contains the offset and a longer, descriptive name of the timezone | ||
* - tzCode, the value from the tz standard | ||
* | ||
* Install: | ||
* `npm install compact-timezone-list --save` | ||
* # or | ||
* `yarn add compact-timezone-list` | ||
* | ||
* | ||
* Example: | ||
* import timezones from 'compact-timezone-list'; | ||
* // or | ||
* import { minimalTimezoneSet } from 'compact-timezone-list'; | ||
* | ||
* Details: | ||
* - The default export provides a long list of options, with multiple | ||
* suggestions for each UTC offset. | ||
* – The `minimalTimezoneSet` export provides one option per offset type, with | ||
* a favourite chosen to represent each offset. This is mostly targeted to small, | ||
* western-focused apps. But, every UTC offset is included. | ||
*/ | ||
|
||
import cjsModule from '../index.js'; | ||
|
||
export default cjsModule.defaultTimezoneSet; | ||
export var defaultTimezoneSet = cjsModule.defaultTimezoneSet; | ||
export var minimalTimezoneSet = cjsModule.minimalTimezoneSet; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* @fileoverview | ||
* | ||
* This package contains an array of timezones based on conventional options found online. | ||
* It does not follow any complete data set, but all names are according to the tz format: | ||
* https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. | ||
* | ||
* Install: | ||
* `npm install compact-timezone-list --save` | ||
* # or | ||
* `yarn add compact-timezone-list` | ||
* | ||
* | ||
* Example: | ||
* import { defaultTimezoneSet } from 'compact-timezone-list'; | ||
* // or | ||
* import { minimalTimezoneSet } from 'compact-timezone-list'; | ||
* | ||
* Details: | ||
* - The 'defaultTimezoneSet' export provides a long list of options, with multiple | ||
* suggestions for each UTC offset. | ||
* – The `minimalTimezoneSet` export provides one option per offset type, with | ||
* a favourite chosen to represent each offset. This is mostly targeted to small, | ||
* western-focused apps. But, every UTC offset is included. | ||
*/ | ||
export interface TimezoneEntry { | ||
/** a string from '-11:00' to '+14:00' representing the UTC offset */ | ||
offset: string; | ||
/** a readable label that contains the offset and a longer, descriptive name of the timezone */ | ||
label: string; | ||
/** the value from the tz standard */ | ||
tzCode: string; | ||
} | ||
|
||
export declare var defaultTimezoneSet: TimezoneEntry[]; | ||
export declare var minimalTimezoneSet: TimezoneEntry[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters