date-vir 0.0.0 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-CC0 +121 -0
- package/LICENSE-MIT +21 -0
- package/README.md +148 -0
- package/dist/cjs/full-date/create-full-date.js +67 -0
- package/dist/cjs/full-date/date-like.js +2 -0
- package/dist/cjs/full-date/format-presets.js +32 -0
- package/dist/cjs/full-date/full-date-shape.js +33 -0
- package/dist/cjs/full-date/is-valid-full-date.js +24 -0
- package/dist/cjs/full-date/luxon-date-time-conversion.js +43 -0
- package/dist/cjs/full-date/parsing.js +43 -0
- package/dist/cjs/full-date/primitive-conversions.js +74 -0
- package/dist/cjs/full-date/string-format-types.js +2 -0
- package/dist/cjs/index.js +29 -0
- package/dist/cjs/locales.js +5 -0
- package/dist/cjs/timezone/timezone-checks.js +34 -0
- package/dist/cjs/timezone/timezone-names.js +479 -0
- package/dist/cjs/timezone/timezones.js +14 -0
- package/dist/full-date/create-full-date.d.ts +20 -0
- package/dist/full-date/create-full-date.js +67 -0
- package/dist/full-date/date-like.d.ts +4 -0
- package/dist/full-date/date-like.js +2 -0
- package/dist/full-date/format-presets.d.ts +28 -0
- package/dist/full-date/format-presets.js +32 -0
- package/dist/full-date/full-date-shape.d.ts +65 -0
- package/dist/full-date/full-date-shape.js +33 -0
- package/dist/full-date/is-valid-full-date.d.ts +3 -0
- package/dist/full-date/is-valid-full-date.js +24 -0
- package/dist/full-date/luxon-date-time-conversion.d.ts +14 -0
- package/dist/full-date/luxon-date-time-conversion.js +43 -0
- package/dist/full-date/parsing.d.ts +27 -0
- package/dist/full-date/parsing.js +43 -0
- package/dist/full-date/primitive-conversions.d.ts +42 -0
- package/dist/full-date/primitive-conversions.js +74 -0
- package/dist/full-date/string-format-types.d.ts +4 -0
- package/dist/full-date/string-format-types.js +2 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +29 -0
- package/dist/locales.d.ts +1 -0
- package/dist/locales.js +5 -0
- package/dist/timezone/timezone-checks.d.ts +17 -0
- package/dist/timezone/timezone-checks.js +34 -0
- package/dist/timezone/timezone-names.d.ts +9 -0
- package/dist/timezone/timezone-names.js +479 -0
- package/dist/timezone/timezones.d.ts +479 -0
- package/dist/timezone/timezones.js +14 -0
- package/package.json +72 -10
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isValidTimezone = exports.assertValidTimezone = void 0;
|
|
4
|
+
const luxon_1 = require("luxon");
|
|
5
|
+
/**
|
|
6
|
+
* Asserts that the given timezoneName is a valid timezone name.
|
|
7
|
+
*
|
|
8
|
+
* Note that this may actually allow names beyond what is currently in the exact TimezoneName type,
|
|
9
|
+
* because this function uses luxon to check that it is able to generate a date with the given
|
|
10
|
+
* timezone, regardless of whether it's in our typed list or not.
|
|
11
|
+
*/
|
|
12
|
+
function assertValidTimezone(potentialTimezoneName) {
|
|
13
|
+
if (!luxon_1.Info.isValidIANAZone(potentialTimezoneName)) {
|
|
14
|
+
throw new Error(`'${potentialTimezoneName}' is not a valid time zone`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.assertValidTimezone = assertValidTimezone;
|
|
18
|
+
/**
|
|
19
|
+
* Checks that the given timezoneName is a valid timezone name.
|
|
20
|
+
*
|
|
21
|
+
* Note that this may actually allow names beyond what is currently in the exact TimezoneName type,
|
|
22
|
+
* because this function uses luxon to check that it is able to generate a date with the given
|
|
23
|
+
* timezone, regardless of whether it's in our typed list or not.
|
|
24
|
+
*/
|
|
25
|
+
function isValidTimezone(potentialTimezoneName) {
|
|
26
|
+
try {
|
|
27
|
+
assertValidTimezone(potentialTimezoneName);
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.isValidTimezone = isValidTimezone;
|
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.allTimezoneNames = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* This list was generated from Firefox 106.0.2 (which gave me the longest list out of all the
|
|
6
|
+
* browsers I had immediately available to me at the time) with the following code:
|
|
7
|
+
*
|
|
8
|
+
* Intl.supportedValuesOf('timeZone').map(zone => `'${zone}'`).join(',')
|
|
9
|
+
*/
|
|
10
|
+
exports.allTimezoneNames = [
|
|
11
|
+
'Africa/Abidjan',
|
|
12
|
+
'Africa/Accra',
|
|
13
|
+
'Africa/Addis_Ababa',
|
|
14
|
+
'Africa/Algiers',
|
|
15
|
+
'Africa/Asmara',
|
|
16
|
+
'Africa/Bamako',
|
|
17
|
+
'Africa/Bangui',
|
|
18
|
+
'Africa/Banjul',
|
|
19
|
+
'Africa/Bissau',
|
|
20
|
+
'Africa/Blantyre',
|
|
21
|
+
'Africa/Brazzaville',
|
|
22
|
+
'Africa/Bujumbura',
|
|
23
|
+
'Africa/Cairo',
|
|
24
|
+
'Africa/Casablanca',
|
|
25
|
+
'Africa/Ceuta',
|
|
26
|
+
'Africa/Conakry',
|
|
27
|
+
'Africa/Dakar',
|
|
28
|
+
'Africa/Dar_es_Salaam',
|
|
29
|
+
'Africa/Djibouti',
|
|
30
|
+
'Africa/Douala',
|
|
31
|
+
'Africa/El_Aaiun',
|
|
32
|
+
'Africa/Freetown',
|
|
33
|
+
'Africa/Gaborone',
|
|
34
|
+
'Africa/Harare',
|
|
35
|
+
'Africa/Johannesburg',
|
|
36
|
+
'Africa/Juba',
|
|
37
|
+
'Africa/Kampala',
|
|
38
|
+
'Africa/Khartoum',
|
|
39
|
+
'Africa/Kigali',
|
|
40
|
+
'Africa/Kinshasa',
|
|
41
|
+
'Africa/Lagos',
|
|
42
|
+
'Africa/Libreville',
|
|
43
|
+
'Africa/Lome',
|
|
44
|
+
'Africa/Luanda',
|
|
45
|
+
'Africa/Lubumbashi',
|
|
46
|
+
'Africa/Lusaka',
|
|
47
|
+
'Africa/Malabo',
|
|
48
|
+
'Africa/Maputo',
|
|
49
|
+
'Africa/Maseru',
|
|
50
|
+
'Africa/Mbabane',
|
|
51
|
+
'Africa/Mogadishu',
|
|
52
|
+
'Africa/Monrovia',
|
|
53
|
+
'Africa/Nairobi',
|
|
54
|
+
'Africa/Ndjamena',
|
|
55
|
+
'Africa/Niamey',
|
|
56
|
+
'Africa/Nouakchott',
|
|
57
|
+
'Africa/Ouagadougou',
|
|
58
|
+
'Africa/Porto-Novo',
|
|
59
|
+
'Africa/Sao_Tome',
|
|
60
|
+
'Africa/Timbuktu',
|
|
61
|
+
'Africa/Tripoli',
|
|
62
|
+
'Africa/Tunis',
|
|
63
|
+
'Africa/Windhoek',
|
|
64
|
+
'America/Adak',
|
|
65
|
+
'America/Anchorage',
|
|
66
|
+
'America/Anguilla',
|
|
67
|
+
'America/Antigua',
|
|
68
|
+
'America/Araguaina',
|
|
69
|
+
'America/Argentina/Buenos_Aires',
|
|
70
|
+
'America/Argentina/Catamarca',
|
|
71
|
+
'America/Argentina/ComodRivadavia',
|
|
72
|
+
'America/Argentina/Cordoba',
|
|
73
|
+
'America/Argentina/Jujuy',
|
|
74
|
+
'America/Argentina/La_Rioja',
|
|
75
|
+
'America/Argentina/Mendoza',
|
|
76
|
+
'America/Argentina/Rio_Gallegos',
|
|
77
|
+
'America/Argentina/Salta',
|
|
78
|
+
'America/Argentina/San_Juan',
|
|
79
|
+
'America/Argentina/San_Luis',
|
|
80
|
+
'America/Argentina/Tucuman',
|
|
81
|
+
'America/Argentina/Ushuaia',
|
|
82
|
+
'America/Aruba',
|
|
83
|
+
'America/Asuncion',
|
|
84
|
+
'America/Atikokan',
|
|
85
|
+
'America/Bahia',
|
|
86
|
+
'America/Bahia_Banderas',
|
|
87
|
+
'America/Barbados',
|
|
88
|
+
'America/Belem',
|
|
89
|
+
'America/Belize',
|
|
90
|
+
'America/Blanc-Sablon',
|
|
91
|
+
'America/Boa_Vista',
|
|
92
|
+
'America/Bogota',
|
|
93
|
+
'America/Boise',
|
|
94
|
+
'America/Cambridge_Bay',
|
|
95
|
+
'America/Campo_Grande',
|
|
96
|
+
'America/Cancun',
|
|
97
|
+
'America/Caracas',
|
|
98
|
+
'America/Cayenne',
|
|
99
|
+
'America/Cayman',
|
|
100
|
+
'America/Chicago',
|
|
101
|
+
'America/Chihuahua',
|
|
102
|
+
'America/Coral_Harbour',
|
|
103
|
+
'America/Costa_Rica',
|
|
104
|
+
'America/Creston',
|
|
105
|
+
'America/Cuiaba',
|
|
106
|
+
'America/Curacao',
|
|
107
|
+
'America/Danmarkshavn',
|
|
108
|
+
'America/Dawson',
|
|
109
|
+
'America/Dawson_Creek',
|
|
110
|
+
'America/Denver',
|
|
111
|
+
'America/Detroit',
|
|
112
|
+
'America/Dominica',
|
|
113
|
+
'America/Edmonton',
|
|
114
|
+
'America/Eirunepe',
|
|
115
|
+
'America/El_Salvador',
|
|
116
|
+
'America/Ensenada',
|
|
117
|
+
'America/Fort_Nelson',
|
|
118
|
+
'America/Fortaleza',
|
|
119
|
+
'America/Glace_Bay',
|
|
120
|
+
'America/Goose_Bay',
|
|
121
|
+
'America/Grand_Turk',
|
|
122
|
+
'America/Grenada',
|
|
123
|
+
'America/Guadeloupe',
|
|
124
|
+
'America/Guatemala',
|
|
125
|
+
'America/Guayaquil',
|
|
126
|
+
'America/Guyana',
|
|
127
|
+
'America/Halifax',
|
|
128
|
+
'America/Havana',
|
|
129
|
+
'America/Hermosillo',
|
|
130
|
+
'America/Indiana/Indianapolis',
|
|
131
|
+
'America/Indiana/Knox',
|
|
132
|
+
'America/Indiana/Marengo',
|
|
133
|
+
'America/Indiana/Petersburg',
|
|
134
|
+
'America/Indiana/Tell_City',
|
|
135
|
+
'America/Indiana/Vevay',
|
|
136
|
+
'America/Indiana/Vincennes',
|
|
137
|
+
'America/Indiana/Winamac',
|
|
138
|
+
'America/Inuvik',
|
|
139
|
+
'America/Iqaluit',
|
|
140
|
+
'America/Jamaica',
|
|
141
|
+
'America/Juneau',
|
|
142
|
+
'America/Kentucky/Louisville',
|
|
143
|
+
'America/Kentucky/Monticello',
|
|
144
|
+
'America/La_Paz',
|
|
145
|
+
'America/Lima',
|
|
146
|
+
'America/Los_Angeles',
|
|
147
|
+
'America/Maceio',
|
|
148
|
+
'America/Managua',
|
|
149
|
+
'America/Manaus',
|
|
150
|
+
'America/Martinique',
|
|
151
|
+
'America/Matamoros',
|
|
152
|
+
'America/Mazatlan',
|
|
153
|
+
'America/Menominee',
|
|
154
|
+
'America/Merida',
|
|
155
|
+
'America/Metlakatla',
|
|
156
|
+
'America/Mexico_City',
|
|
157
|
+
'America/Miquelon',
|
|
158
|
+
'America/Moncton',
|
|
159
|
+
'America/Monterrey',
|
|
160
|
+
'America/Montevideo',
|
|
161
|
+
'America/Montreal',
|
|
162
|
+
'America/Montserrat',
|
|
163
|
+
'America/Nassau',
|
|
164
|
+
'America/New_York',
|
|
165
|
+
'America/Nipigon',
|
|
166
|
+
'America/Nome',
|
|
167
|
+
'America/Noronha',
|
|
168
|
+
'America/North_Dakota/Beulah',
|
|
169
|
+
'America/North_Dakota/Center',
|
|
170
|
+
'America/North_Dakota/New_Salem',
|
|
171
|
+
'America/Nuuk',
|
|
172
|
+
'America/Ojinaga',
|
|
173
|
+
'America/Panama',
|
|
174
|
+
'America/Pangnirtung',
|
|
175
|
+
'America/Paramaribo',
|
|
176
|
+
'America/Phoenix',
|
|
177
|
+
'America/Port-au-Prince',
|
|
178
|
+
'America/Port_of_Spain',
|
|
179
|
+
'America/Porto_Velho',
|
|
180
|
+
'America/Puerto_Rico',
|
|
181
|
+
'America/Punta_Arenas',
|
|
182
|
+
'America/Rainy_River',
|
|
183
|
+
'America/Rankin_Inlet',
|
|
184
|
+
'America/Recife',
|
|
185
|
+
'America/Regina',
|
|
186
|
+
'America/Resolute',
|
|
187
|
+
'America/Rio_Branco',
|
|
188
|
+
'America/Rosario',
|
|
189
|
+
'America/Santarem',
|
|
190
|
+
'America/Santiago',
|
|
191
|
+
'America/Santo_Domingo',
|
|
192
|
+
'America/Sao_Paulo',
|
|
193
|
+
'America/Scoresbysund',
|
|
194
|
+
'America/Sitka',
|
|
195
|
+
'America/St_Johns',
|
|
196
|
+
'America/St_Kitts',
|
|
197
|
+
'America/St_Lucia',
|
|
198
|
+
'America/St_Thomas',
|
|
199
|
+
'America/St_Vincent',
|
|
200
|
+
'America/Swift_Current',
|
|
201
|
+
'America/Tegucigalpa',
|
|
202
|
+
'America/Thule',
|
|
203
|
+
'America/Thunder_Bay',
|
|
204
|
+
'America/Tijuana',
|
|
205
|
+
'America/Toronto',
|
|
206
|
+
'America/Tortola',
|
|
207
|
+
'America/Vancouver',
|
|
208
|
+
'America/Whitehorse',
|
|
209
|
+
'America/Winnipeg',
|
|
210
|
+
'America/Yakutat',
|
|
211
|
+
'America/Yellowknife',
|
|
212
|
+
'Antarctica/Casey',
|
|
213
|
+
'Antarctica/Davis',
|
|
214
|
+
'Antarctica/DumontDUrville',
|
|
215
|
+
'Antarctica/Macquarie',
|
|
216
|
+
'Antarctica/Mawson',
|
|
217
|
+
'Antarctica/McMurdo',
|
|
218
|
+
'Antarctica/Palmer',
|
|
219
|
+
'Antarctica/Rothera',
|
|
220
|
+
'Antarctica/Syowa',
|
|
221
|
+
'Antarctica/Troll',
|
|
222
|
+
'Antarctica/Vostok',
|
|
223
|
+
'Asia/Aden',
|
|
224
|
+
'Asia/Almaty',
|
|
225
|
+
'Asia/Amman',
|
|
226
|
+
'Asia/Anadyr',
|
|
227
|
+
'Asia/Aqtau',
|
|
228
|
+
'Asia/Aqtobe',
|
|
229
|
+
'Asia/Ashgabat',
|
|
230
|
+
'Asia/Atyrau',
|
|
231
|
+
'Asia/Baghdad',
|
|
232
|
+
'Asia/Bahrain',
|
|
233
|
+
'Asia/Baku',
|
|
234
|
+
'Asia/Bangkok',
|
|
235
|
+
'Asia/Barnaul',
|
|
236
|
+
'Asia/Beirut',
|
|
237
|
+
'Asia/Bishkek',
|
|
238
|
+
'Asia/Brunei',
|
|
239
|
+
'Asia/Chita',
|
|
240
|
+
'Asia/Choibalsan',
|
|
241
|
+
'Asia/Chongqing',
|
|
242
|
+
'Asia/Colombo',
|
|
243
|
+
'Asia/Damascus',
|
|
244
|
+
'Asia/Dhaka',
|
|
245
|
+
'Asia/Dili',
|
|
246
|
+
'Asia/Dubai',
|
|
247
|
+
'Asia/Dushanbe',
|
|
248
|
+
'Asia/Famagusta',
|
|
249
|
+
'Asia/Gaza',
|
|
250
|
+
'Asia/Harbin',
|
|
251
|
+
'Asia/Hebron',
|
|
252
|
+
'Asia/Ho_Chi_Minh',
|
|
253
|
+
'Asia/Hong_Kong',
|
|
254
|
+
'Asia/Hovd',
|
|
255
|
+
'Asia/Irkutsk',
|
|
256
|
+
'Asia/Jakarta',
|
|
257
|
+
'Asia/Jayapura',
|
|
258
|
+
'Asia/Jerusalem',
|
|
259
|
+
'Asia/Kabul',
|
|
260
|
+
'Asia/Kamchatka',
|
|
261
|
+
'Asia/Karachi',
|
|
262
|
+
'Asia/Kashgar',
|
|
263
|
+
'Asia/Kathmandu',
|
|
264
|
+
'Asia/Khandyga',
|
|
265
|
+
'Asia/Kolkata',
|
|
266
|
+
'Asia/Krasnoyarsk',
|
|
267
|
+
'Asia/Kuala_Lumpur',
|
|
268
|
+
'Asia/Kuching',
|
|
269
|
+
'Asia/Kuwait',
|
|
270
|
+
'Asia/Macau',
|
|
271
|
+
'Asia/Magadan',
|
|
272
|
+
'Asia/Makassar',
|
|
273
|
+
'Asia/Manila',
|
|
274
|
+
'Asia/Muscat',
|
|
275
|
+
'Asia/Nicosia',
|
|
276
|
+
'Asia/Novokuznetsk',
|
|
277
|
+
'Asia/Novosibirsk',
|
|
278
|
+
'Asia/Omsk',
|
|
279
|
+
'Asia/Oral',
|
|
280
|
+
'Asia/Phnom_Penh',
|
|
281
|
+
'Asia/Pontianak',
|
|
282
|
+
'Asia/Pyongyang',
|
|
283
|
+
'Asia/Qatar',
|
|
284
|
+
'Asia/Qostanay',
|
|
285
|
+
'Asia/Qyzylorda',
|
|
286
|
+
'Asia/Riyadh',
|
|
287
|
+
'Asia/Sakhalin',
|
|
288
|
+
'Asia/Samarkand',
|
|
289
|
+
'Asia/Seoul',
|
|
290
|
+
'Asia/Shanghai',
|
|
291
|
+
'Asia/Singapore',
|
|
292
|
+
'Asia/Srednekolymsk',
|
|
293
|
+
'Asia/Taipei',
|
|
294
|
+
'Asia/Tashkent',
|
|
295
|
+
'Asia/Tbilisi',
|
|
296
|
+
'Asia/Tehran',
|
|
297
|
+
'Asia/Tel_Aviv',
|
|
298
|
+
'Asia/Thimphu',
|
|
299
|
+
'Asia/Tokyo',
|
|
300
|
+
'Asia/Tomsk',
|
|
301
|
+
'Asia/Ulaanbaatar',
|
|
302
|
+
'Asia/Urumqi',
|
|
303
|
+
'Asia/Ust-Nera',
|
|
304
|
+
'Asia/Vientiane',
|
|
305
|
+
'Asia/Vladivostok',
|
|
306
|
+
'Asia/Yakutsk',
|
|
307
|
+
'Asia/Yangon',
|
|
308
|
+
'Asia/Yekaterinburg',
|
|
309
|
+
'Asia/Yerevan',
|
|
310
|
+
'Atlantic/Azores',
|
|
311
|
+
'Atlantic/Bermuda',
|
|
312
|
+
'Atlantic/Canary',
|
|
313
|
+
'Atlantic/Cape_Verde',
|
|
314
|
+
'Atlantic/Faroe',
|
|
315
|
+
'Atlantic/Jan_Mayen',
|
|
316
|
+
'Atlantic/Madeira',
|
|
317
|
+
'Atlantic/Reykjavik',
|
|
318
|
+
'Atlantic/South_Georgia',
|
|
319
|
+
'Atlantic/St_Helena',
|
|
320
|
+
'Atlantic/Stanley',
|
|
321
|
+
'Australia/Adelaide',
|
|
322
|
+
'Australia/Brisbane',
|
|
323
|
+
'Australia/Broken_Hill',
|
|
324
|
+
'Australia/Currie',
|
|
325
|
+
'Australia/Darwin',
|
|
326
|
+
'Australia/Eucla',
|
|
327
|
+
'Australia/Hobart',
|
|
328
|
+
'Australia/Lindeman',
|
|
329
|
+
'Australia/Lord_Howe',
|
|
330
|
+
'Australia/Melbourne',
|
|
331
|
+
'Australia/Perth',
|
|
332
|
+
'Australia/Sydney',
|
|
333
|
+
'CET',
|
|
334
|
+
'CST6CDT',
|
|
335
|
+
'EET',
|
|
336
|
+
'EST',
|
|
337
|
+
'EST5EDT',
|
|
338
|
+
'Etc/GMT+1',
|
|
339
|
+
'Etc/GMT+10',
|
|
340
|
+
'Etc/GMT+11',
|
|
341
|
+
'Etc/GMT+12',
|
|
342
|
+
'Etc/GMT+2',
|
|
343
|
+
'Etc/GMT+3',
|
|
344
|
+
'Etc/GMT+4',
|
|
345
|
+
'Etc/GMT+5',
|
|
346
|
+
'Etc/GMT+6',
|
|
347
|
+
'Etc/GMT+7',
|
|
348
|
+
'Etc/GMT+8',
|
|
349
|
+
'Etc/GMT+9',
|
|
350
|
+
'Etc/GMT-1',
|
|
351
|
+
'Etc/GMT-10',
|
|
352
|
+
'Etc/GMT-11',
|
|
353
|
+
'Etc/GMT-12',
|
|
354
|
+
'Etc/GMT-13',
|
|
355
|
+
'Etc/GMT-14',
|
|
356
|
+
'Etc/GMT-2',
|
|
357
|
+
'Etc/GMT-3',
|
|
358
|
+
'Etc/GMT-4',
|
|
359
|
+
'Etc/GMT-5',
|
|
360
|
+
'Etc/GMT-6',
|
|
361
|
+
'Etc/GMT-7',
|
|
362
|
+
'Etc/GMT-8',
|
|
363
|
+
'Etc/GMT-9',
|
|
364
|
+
'Europe/Amsterdam',
|
|
365
|
+
'Europe/Andorra',
|
|
366
|
+
'Europe/Astrakhan',
|
|
367
|
+
'Europe/Athens',
|
|
368
|
+
'Europe/Belfast',
|
|
369
|
+
'Europe/Belgrade',
|
|
370
|
+
'Europe/Berlin',
|
|
371
|
+
'Europe/Brussels',
|
|
372
|
+
'Europe/Bucharest',
|
|
373
|
+
'Europe/Budapest',
|
|
374
|
+
'Europe/Chisinau',
|
|
375
|
+
'Europe/Copenhagen',
|
|
376
|
+
'Europe/Dublin',
|
|
377
|
+
'Europe/Gibraltar',
|
|
378
|
+
'Europe/Guernsey',
|
|
379
|
+
'Europe/Helsinki',
|
|
380
|
+
'Europe/Isle_of_Man',
|
|
381
|
+
'Europe/Istanbul',
|
|
382
|
+
'Europe/Jersey',
|
|
383
|
+
'Europe/Kaliningrad',
|
|
384
|
+
'Europe/Kirov',
|
|
385
|
+
'Europe/Kyiv',
|
|
386
|
+
'Europe/Lisbon',
|
|
387
|
+
'Europe/Ljubljana',
|
|
388
|
+
'Europe/London',
|
|
389
|
+
'Europe/Luxembourg',
|
|
390
|
+
'Europe/Madrid',
|
|
391
|
+
'Europe/Malta',
|
|
392
|
+
'Europe/Minsk',
|
|
393
|
+
'Europe/Monaco',
|
|
394
|
+
'Europe/Moscow',
|
|
395
|
+
'Europe/Oslo',
|
|
396
|
+
'Europe/Paris',
|
|
397
|
+
'Europe/Prague',
|
|
398
|
+
'Europe/Riga',
|
|
399
|
+
'Europe/Rome',
|
|
400
|
+
'Europe/Samara',
|
|
401
|
+
'Europe/Sarajevo',
|
|
402
|
+
'Europe/Saratov',
|
|
403
|
+
'Europe/Simferopol',
|
|
404
|
+
'Europe/Skopje',
|
|
405
|
+
'Europe/Sofia',
|
|
406
|
+
'Europe/Stockholm',
|
|
407
|
+
'Europe/Tallinn',
|
|
408
|
+
'Europe/Tirane',
|
|
409
|
+
'Europe/Tiraspol',
|
|
410
|
+
'Europe/Ulyanovsk',
|
|
411
|
+
'Europe/Uzhgorod',
|
|
412
|
+
'Europe/Vaduz',
|
|
413
|
+
'Europe/Vienna',
|
|
414
|
+
'Europe/Vilnius',
|
|
415
|
+
'Europe/Volgograd',
|
|
416
|
+
'Europe/Warsaw',
|
|
417
|
+
'Europe/Zagreb',
|
|
418
|
+
'Europe/Zaporozhye',
|
|
419
|
+
'Europe/Zurich',
|
|
420
|
+
'Factory',
|
|
421
|
+
'HST',
|
|
422
|
+
'Indian/Antananarivo',
|
|
423
|
+
'Indian/Chagos',
|
|
424
|
+
'Indian/Christmas',
|
|
425
|
+
'Indian/Cocos',
|
|
426
|
+
'Indian/Comoro',
|
|
427
|
+
'Indian/Kerguelen',
|
|
428
|
+
'Indian/Mahe',
|
|
429
|
+
'Indian/Maldives',
|
|
430
|
+
'Indian/Mauritius',
|
|
431
|
+
'Indian/Mayotte',
|
|
432
|
+
'Indian/Reunion',
|
|
433
|
+
'MET',
|
|
434
|
+
'MST',
|
|
435
|
+
'MST7MDT',
|
|
436
|
+
'PST8PDT',
|
|
437
|
+
'Pacific/Apia',
|
|
438
|
+
'Pacific/Auckland',
|
|
439
|
+
'Pacific/Bougainville',
|
|
440
|
+
'Pacific/Chatham',
|
|
441
|
+
'Pacific/Chuuk',
|
|
442
|
+
'Pacific/Easter',
|
|
443
|
+
'Pacific/Efate',
|
|
444
|
+
'Pacific/Enderbury',
|
|
445
|
+
'Pacific/Fakaofo',
|
|
446
|
+
'Pacific/Fiji',
|
|
447
|
+
'Pacific/Funafuti',
|
|
448
|
+
'Pacific/Galapagos',
|
|
449
|
+
'Pacific/Gambier',
|
|
450
|
+
'Pacific/Guadalcanal',
|
|
451
|
+
'Pacific/Guam',
|
|
452
|
+
'Pacific/Honolulu',
|
|
453
|
+
'Pacific/Johnston',
|
|
454
|
+
'Pacific/Kanton',
|
|
455
|
+
'Pacific/Kiritimati',
|
|
456
|
+
'Pacific/Kosrae',
|
|
457
|
+
'Pacific/Kwajalein',
|
|
458
|
+
'Pacific/Majuro',
|
|
459
|
+
'Pacific/Marquesas',
|
|
460
|
+
'Pacific/Midway',
|
|
461
|
+
'Pacific/Nauru',
|
|
462
|
+
'Pacific/Niue',
|
|
463
|
+
'Pacific/Norfolk',
|
|
464
|
+
'Pacific/Noumea',
|
|
465
|
+
'Pacific/Pago_Pago',
|
|
466
|
+
'Pacific/Palau',
|
|
467
|
+
'Pacific/Pitcairn',
|
|
468
|
+
'Pacific/Pohnpei',
|
|
469
|
+
'Pacific/Port_Moresby',
|
|
470
|
+
'Pacific/Rarotonga',
|
|
471
|
+
'Pacific/Saipan',
|
|
472
|
+
'Pacific/Tahiti',
|
|
473
|
+
'Pacific/Tarawa',
|
|
474
|
+
'Pacific/Tongatapu',
|
|
475
|
+
'Pacific/Wake',
|
|
476
|
+
'Pacific/Wallis',
|
|
477
|
+
'UTC',
|
|
478
|
+
'WET',
|
|
479
|
+
];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.utcTimezone = exports.userTimezone = exports.timezones = void 0;
|
|
4
|
+
const luxon_1 = require("luxon");
|
|
5
|
+
const timezone_names_1 = require("./timezone-names");
|
|
6
|
+
/** A typed object of all known timezones, as of the writing of this message. */
|
|
7
|
+
exports.timezones = timezone_names_1.allTimezoneNames.reduce((accum, timezoneName) => {
|
|
8
|
+
accum[timezoneName] = timezoneName;
|
|
9
|
+
return accum;
|
|
10
|
+
}, {});
|
|
11
|
+
/** The timezone of the current user's environment. */
|
|
12
|
+
exports.userTimezone = luxon_1.Settings.defaultZone.name;
|
|
13
|
+
/** The UTC timezone. */
|
|
14
|
+
exports.utcTimezone = exports.timezones.UTC;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Timezone } from '../timezone/timezone-names';
|
|
2
|
+
import { DateLike } from './date-like';
|
|
3
|
+
import { FullDate } from './full-date-shape';
|
|
4
|
+
export declare function createFullDateInUserTimezone(dateLike: DateLike): FullDate;
|
|
5
|
+
export declare function createUtcFullDate(dateLike: DateLike): FullDate;
|
|
6
|
+
/**
|
|
7
|
+
* Parses the given dateLike and then reads the fullDate properties from that parsed value as if it
|
|
8
|
+
* were in the given timezone.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createFullDate(
|
|
11
|
+
/** The original date representation to be converted into a FullDate. */
|
|
12
|
+
dateLike: DateLike,
|
|
13
|
+
/** The timezone that this date/time is meant for / originated from. */
|
|
14
|
+
timezone: Timezone): FullDate;
|
|
15
|
+
/**
|
|
16
|
+
* Creates and returns a new FullDate object with its values shifted to be the same original time
|
|
17
|
+
* but represented in a new timezone.
|
|
18
|
+
*/
|
|
19
|
+
export declare function toNewTimezone(fullDate: FullDate, timezone: Timezone): FullDate;
|
|
20
|
+
export declare function getNowFullDate(timezone: Timezone): FullDate;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNowFullDate = exports.toNewTimezone = exports.createFullDate = exports.createUtcFullDate = exports.createFullDateInUserTimezone = void 0;
|
|
4
|
+
const common_1 = require("@augment-vir/common");
|
|
5
|
+
const luxon_1 = require("luxon");
|
|
6
|
+
const timezones_1 = require("../timezone/timezones");
|
|
7
|
+
const is_valid_full_date_1 = require("./is-valid-full-date");
|
|
8
|
+
const luxon_date_time_conversion_1 = require("./luxon-date-time-conversion");
|
|
9
|
+
function createFullDateInUserTimezone(dateLike) {
|
|
10
|
+
return createFullDate(dateLike, timezones_1.userTimezone);
|
|
11
|
+
}
|
|
12
|
+
exports.createFullDateInUserTimezone = createFullDateInUserTimezone;
|
|
13
|
+
function createUtcFullDate(dateLike) {
|
|
14
|
+
return createFullDate(dateLike, timezones_1.utcTimezone);
|
|
15
|
+
}
|
|
16
|
+
exports.createUtcFullDate = createUtcFullDate;
|
|
17
|
+
/**
|
|
18
|
+
* Parses the given dateLike and then reads the fullDate properties from that parsed value as if it
|
|
19
|
+
* were in the given timezone.
|
|
20
|
+
*/
|
|
21
|
+
function createFullDate(
|
|
22
|
+
/** The original date representation to be converted into a FullDate. */
|
|
23
|
+
dateLike,
|
|
24
|
+
/** The timezone that this date/time is meant for / originated from. */
|
|
25
|
+
timezone) {
|
|
26
|
+
const dateTime = convertDateLikeToLuxonDateTime(dateLike, timezone);
|
|
27
|
+
if (!dateTime || !dateTime.isValid) {
|
|
28
|
+
throw new Error(`Failed to parse date input '${dateLike}'`);
|
|
29
|
+
}
|
|
30
|
+
return (0, luxon_date_time_conversion_1.parseLuxonDateTime)(dateTime);
|
|
31
|
+
}
|
|
32
|
+
exports.createFullDate = createFullDate;
|
|
33
|
+
/**
|
|
34
|
+
* Creates and returns a new FullDate object with its values shifted to be the same original time
|
|
35
|
+
* but represented in a new timezone.
|
|
36
|
+
*/
|
|
37
|
+
function toNewTimezone(fullDate, timezone) {
|
|
38
|
+
return createFullDate(fullDate, timezone);
|
|
39
|
+
}
|
|
40
|
+
exports.toNewTimezone = toNewTimezone;
|
|
41
|
+
function convertDateLikeToLuxonDateTime(dateLike, timezone) {
|
|
42
|
+
if ((0, is_valid_full_date_1.isValidFullDate)(dateLike)) {
|
|
43
|
+
dateLike = (0, luxon_date_time_conversion_1.toLuxonDateTime)(dateLike).toMillis();
|
|
44
|
+
}
|
|
45
|
+
if (luxon_1.DateTime.isDateTime(dateLike)) {
|
|
46
|
+
return dateLike.setZone(timezone);
|
|
47
|
+
}
|
|
48
|
+
else if ((0, common_1.isRuntimeTypeOf)(dateLike, 'number')) {
|
|
49
|
+
return luxon_1.DateTime.fromMillis(dateLike, { zone: timezones_1.utcTimezone }).setZone(timezone);
|
|
50
|
+
}
|
|
51
|
+
else if ((0, common_1.isRuntimeTypeOf)(dateLike, 'string')) {
|
|
52
|
+
const dateTime = luxon_1.DateTime.fromISO(dateLike, { zone: timezone });
|
|
53
|
+
if (!dateTime.isValid) {
|
|
54
|
+
throw new Error(`Failed to parse date string '${dateLike}': unexpected string format. Please use parseStringToFullDate instead to have more control over the parsing format.`);
|
|
55
|
+
}
|
|
56
|
+
return dateTime;
|
|
57
|
+
}
|
|
58
|
+
else if (dateLike instanceof Date) {
|
|
59
|
+
const dateTime = luxon_1.DateTime.fromJSDate(dateLike);
|
|
60
|
+
return dateTime.setZone(timezone);
|
|
61
|
+
}
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
function getNowFullDate(timezone) {
|
|
65
|
+
return createFullDate(Date.now(), timezone);
|
|
66
|
+
}
|
|
67
|
+
exports.getNowFullDate = getNowFullDate;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format preset re-exported from luxon to be used with toLocaleString. To see examples of all
|
|
3
|
+
* presets, go here: https://moment.github.io/luxon/#/formatting?id=presets
|
|
4
|
+
*/
|
|
5
|
+
export declare const formatPresets: {
|
|
6
|
+
readonly DateShort: Intl.DateTimeFormatOptions;
|
|
7
|
+
readonly DateMed: Intl.DateTimeFormatOptions;
|
|
8
|
+
readonly DateMedWithWeekday: Intl.DateTimeFormatOptions;
|
|
9
|
+
readonly DateFull: Intl.DateTimeFormatOptions;
|
|
10
|
+
readonly DateHuge: Intl.DateTimeFormatOptions;
|
|
11
|
+
readonly TimeSimple: Intl.DateTimeFormatOptions;
|
|
12
|
+
readonly TimeWithSeconds: Intl.DateTimeFormatOptions;
|
|
13
|
+
readonly TimeWithShortOffset: Intl.DateTimeFormatOptions;
|
|
14
|
+
readonly TimeWithLongOffset: Intl.DateTimeFormatOptions;
|
|
15
|
+
readonly Time24Simple: Intl.DateTimeFormatOptions;
|
|
16
|
+
readonly Time24WithSeconds: Intl.DateTimeFormatOptions;
|
|
17
|
+
readonly Time24WithShortOffset: Intl.DateTimeFormatOptions;
|
|
18
|
+
readonly Time24WithLongOffset: Intl.DateTimeFormatOptions;
|
|
19
|
+
readonly DatetimeShort: Intl.DateTimeFormatOptions;
|
|
20
|
+
readonly DatetimeShortWithSeconds: Intl.DateTimeFormatOptions;
|
|
21
|
+
readonly DatetimeMed: Intl.DateTimeFormatOptions;
|
|
22
|
+
readonly DatetimeMedWithSeconds: Intl.DateTimeFormatOptions;
|
|
23
|
+
readonly DatetimeMedWithWeekday: Intl.DateTimeFormatOptions;
|
|
24
|
+
readonly DatetimeFull: Intl.DateTimeFormatOptions;
|
|
25
|
+
readonly DatetimeFullWithSeconds: Intl.DateTimeFormatOptions;
|
|
26
|
+
readonly DatetimeHuge: Intl.DateTimeFormatOptions;
|
|
27
|
+
readonly DatetimeHugeWithSeconds: Intl.DateTimeFormatOptions;
|
|
28
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatPresets = void 0;
|
|
4
|
+
const luxon_1 = require("luxon");
|
|
5
|
+
/**
|
|
6
|
+
* Format preset re-exported from luxon to be used with toLocaleString. To see examples of all
|
|
7
|
+
* presets, go here: https://moment.github.io/luxon/#/formatting?id=presets
|
|
8
|
+
*/
|
|
9
|
+
exports.formatPresets = {
|
|
10
|
+
DateShort: luxon_1.DateTime.DATE_SHORT,
|
|
11
|
+
DateMed: luxon_1.DateTime.DATE_MED,
|
|
12
|
+
DateMedWithWeekday: luxon_1.DateTime.DATE_MED_WITH_WEEKDAY,
|
|
13
|
+
DateFull: luxon_1.DateTime.DATE_FULL,
|
|
14
|
+
DateHuge: luxon_1.DateTime.DATE_HUGE,
|
|
15
|
+
TimeSimple: luxon_1.DateTime.TIME_SIMPLE,
|
|
16
|
+
TimeWithSeconds: luxon_1.DateTime.TIME_WITH_SECONDS,
|
|
17
|
+
TimeWithShortOffset: luxon_1.DateTime.TIME_WITH_SHORT_OFFSET,
|
|
18
|
+
TimeWithLongOffset: luxon_1.DateTime.TIME_WITH_LONG_OFFSET,
|
|
19
|
+
Time24Simple: luxon_1.DateTime.TIME_24_SIMPLE,
|
|
20
|
+
Time24WithSeconds: luxon_1.DateTime.TIME_24_WITH_SECONDS,
|
|
21
|
+
Time24WithShortOffset: luxon_1.DateTime.TIME_24_WITH_SHORT_OFFSET,
|
|
22
|
+
Time24WithLongOffset: luxon_1.DateTime.TIME_24_WITH_LONG_OFFSET,
|
|
23
|
+
DatetimeShort: luxon_1.DateTime.DATETIME_SHORT,
|
|
24
|
+
DatetimeShortWithSeconds: luxon_1.DateTime.DATETIME_SHORT_WITH_SECONDS,
|
|
25
|
+
DatetimeMed: luxon_1.DateTime.DATETIME_MED,
|
|
26
|
+
DatetimeMedWithSeconds: luxon_1.DateTime.DATETIME_MED_WITH_SECONDS,
|
|
27
|
+
DatetimeMedWithWeekday: luxon_1.DateTime.DATETIME_MED_WITH_WEEKDAY,
|
|
28
|
+
DatetimeFull: luxon_1.DateTime.DATETIME_FULL,
|
|
29
|
+
DatetimeFullWithSeconds: luxon_1.DateTime.DATETIME_FULL_WITH_SECONDS,
|
|
30
|
+
DatetimeHuge: luxon_1.DateTime.DATETIME_HUGE,
|
|
31
|
+
DatetimeHugeWithSeconds: luxon_1.DateTime.DATETIME_HUGE_WITH_SECONDS,
|
|
32
|
+
};
|