indicator-ui 0.0.121 → 0.0.122
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/dist/index.js
CHANGED
|
@@ -6922,15 +6922,33 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6922
6922
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6923
6923
|
/* harmony export */ saveFormatDate: () => (/* binding */ saveFormatDate)
|
|
6924
6924
|
/* harmony export */ });
|
|
6925
|
-
/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! date-fns */ "./node_modules/date-fns/format.js");
|
|
6926
6925
|
/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! date-fns */ "./node_modules/date-fns/parse.js");
|
|
6926
|
+
/* harmony import */ var date_fns_tz__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! date-fns-tz */ "./node_modules/date-fns-tz/dist/esm/index.js");
|
|
6927
6927
|
|
|
6928
|
-
|
|
6928
|
+
|
|
6929
|
+
function saveFormatDate(date, { from, to, errorNull = false, locale, toTimeZone, fromTimeZone }) {
|
|
6929
6930
|
try {
|
|
6930
|
-
|
|
6931
|
-
|
|
6931
|
+
let parsedDate;
|
|
6932
|
+
if (typeof date === "string") {
|
|
6933
|
+
if (from) {
|
|
6934
|
+
parsedDate = (0,date_fns__WEBPACK_IMPORTED_MODULE_1__.parse)(date, from, new Date());
|
|
6935
|
+
}
|
|
6936
|
+
else {
|
|
6937
|
+
parsedDate = new Date(date);
|
|
6938
|
+
}
|
|
6939
|
+
}
|
|
6940
|
+
else {
|
|
6941
|
+
parsedDate = date;
|
|
6942
|
+
}
|
|
6943
|
+
// Применяем fromTimeZone, если указан
|
|
6944
|
+
if (fromTimeZone) {
|
|
6945
|
+
parsedDate = (0,date_fns_tz__WEBPACK_IMPORTED_MODULE_0__.fromZonedTime)(parsedDate, fromTimeZone);
|
|
6946
|
+
}
|
|
6947
|
+
// Переводим в целевую timeZone, если указана
|
|
6948
|
+
if (toTimeZone) {
|
|
6949
|
+
parsedDate = (0,date_fns_tz__WEBPACK_IMPORTED_MODULE_0__.toZonedTime)(parsedDate, toTimeZone);
|
|
6932
6950
|
}
|
|
6933
|
-
return (0,
|
|
6951
|
+
return (0,date_fns_tz__WEBPACK_IMPORTED_MODULE_0__.format)(parsedDate, to, { locale: locale, timeZone: toTimeZone });
|
|
6934
6952
|
}
|
|
6935
6953
|
catch (e) {
|
|
6936
6954
|
console.warn(e);
|
|
@@ -6952,11 +6970,18 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6952
6970
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6953
6971
|
/* harmony export */ saveParseDate: () => (/* binding */ saveParseDate)
|
|
6954
6972
|
/* harmony export */ });
|
|
6955
|
-
/* harmony import */ var
|
|
6973
|
+
/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! date-fns */ "./node_modules/date-fns/parse.js");
|
|
6974
|
+
/* harmony import */ var date_fns_tz__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! date-fns-tz */ "./node_modules/date-fns-tz/dist/esm/index.js");
|
|
6975
|
+
|
|
6956
6976
|
|
|
6957
|
-
function saveParseDate(date, { from, locale }) {
|
|
6977
|
+
function saveParseDate(date, { from, locale, fromTimeZone }) {
|
|
6958
6978
|
try {
|
|
6959
|
-
|
|
6979
|
+
let parsedDate = (0,date_fns__WEBPACK_IMPORTED_MODULE_1__.parse)(date, from, new Date(), { locale: locale });
|
|
6980
|
+
// Применяем fromTimeZone, если указан
|
|
6981
|
+
if (fromTimeZone) {
|
|
6982
|
+
parsedDate = (0,date_fns_tz__WEBPACK_IMPORTED_MODULE_0__.fromZonedTime)(parsedDate, fromTimeZone);
|
|
6983
|
+
}
|
|
6984
|
+
return parsedDate;
|
|
6960
6985
|
}
|
|
6961
6986
|
catch (e) {
|
|
6962
6987
|
console.warn(e);
|
|
@@ -12153,6 +12178,1470 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
12153
12178
|
/* harmony export */ });
|
|
12154
12179
|
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (clsx);
|
|
12155
12180
|
|
|
12181
|
+
/***/ }),
|
|
12182
|
+
|
|
12183
|
+
/***/ "./node_modules/date-fns-tz/dist/esm/_lib/getTimezoneOffsetInMilliseconds/index.js":
|
|
12184
|
+
/*!*****************************************************************************************!*\
|
|
12185
|
+
!*** ./node_modules/date-fns-tz/dist/esm/_lib/getTimezoneOffsetInMilliseconds/index.js ***!
|
|
12186
|
+
\*****************************************************************************************/
|
|
12187
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
12188
|
+
|
|
12189
|
+
"use strict";
|
|
12190
|
+
__webpack_require__.r(__webpack_exports__);
|
|
12191
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
12192
|
+
/* harmony export */ getTimezoneOffsetInMilliseconds: () => (/* binding */ getTimezoneOffsetInMilliseconds)
|
|
12193
|
+
/* harmony export */ });
|
|
12194
|
+
/**
|
|
12195
|
+
* Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
|
|
12196
|
+
* They usually appear for dates that denote time before the timezones were introduced
|
|
12197
|
+
* (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
|
|
12198
|
+
* and GMT+01:00:00 after that date)
|
|
12199
|
+
*
|
|
12200
|
+
* Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
|
|
12201
|
+
* which would lead to incorrect calculations.
|
|
12202
|
+
*
|
|
12203
|
+
* This function returns the timezone offset in milliseconds that takes seconds in account.
|
|
12204
|
+
*/
|
|
12205
|
+
function getTimezoneOffsetInMilliseconds(date) {
|
|
12206
|
+
const utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
|
|
12207
|
+
utcDate.setUTCFullYear(date.getFullYear());
|
|
12208
|
+
return +date - +utcDate;
|
|
12209
|
+
}
|
|
12210
|
+
|
|
12211
|
+
|
|
12212
|
+
/***/ }),
|
|
12213
|
+
|
|
12214
|
+
/***/ "./node_modules/date-fns-tz/dist/esm/_lib/newDateUTC/index.js":
|
|
12215
|
+
/*!********************************************************************!*\
|
|
12216
|
+
!*** ./node_modules/date-fns-tz/dist/esm/_lib/newDateUTC/index.js ***!
|
|
12217
|
+
\********************************************************************/
|
|
12218
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
12219
|
+
|
|
12220
|
+
"use strict";
|
|
12221
|
+
__webpack_require__.r(__webpack_exports__);
|
|
12222
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
12223
|
+
/* harmony export */ newDateUTC: () => (/* binding */ newDateUTC)
|
|
12224
|
+
/* harmony export */ });
|
|
12225
|
+
/**
|
|
12226
|
+
* Use instead of `new Date(Date.UTC(...))` to support years below 100 which doesn't work
|
|
12227
|
+
* otherwise due to the nature of the
|
|
12228
|
+
* [`Date` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years.
|
|
12229
|
+
*
|
|
12230
|
+
* For `Date.UTC(...)`, use `newDateUTC(...).getTime()`.
|
|
12231
|
+
*/
|
|
12232
|
+
function newDateUTC(fullYear, month, day, hour, minute, second, millisecond) {
|
|
12233
|
+
const utcDate = new Date(0);
|
|
12234
|
+
utcDate.setUTCFullYear(fullYear, month, day);
|
|
12235
|
+
utcDate.setUTCHours(hour, minute, second, millisecond);
|
|
12236
|
+
return utcDate;
|
|
12237
|
+
}
|
|
12238
|
+
|
|
12239
|
+
|
|
12240
|
+
/***/ }),
|
|
12241
|
+
|
|
12242
|
+
/***/ "./node_modules/date-fns-tz/dist/esm/_lib/tzIntlTimeZoneName/index.js":
|
|
12243
|
+
/*!****************************************************************************!*\
|
|
12244
|
+
!*** ./node_modules/date-fns-tz/dist/esm/_lib/tzIntlTimeZoneName/index.js ***!
|
|
12245
|
+
\****************************************************************************/
|
|
12246
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
12247
|
+
|
|
12248
|
+
"use strict";
|
|
12249
|
+
__webpack_require__.r(__webpack_exports__);
|
|
12250
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
12251
|
+
/* harmony export */ tzIntlTimeZoneName: () => (/* binding */ tzIntlTimeZoneName)
|
|
12252
|
+
/* harmony export */ });
|
|
12253
|
+
/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! date-fns */ "./node_modules/date-fns/getDefaultOptions.js");
|
|
12254
|
+
|
|
12255
|
+
/**
|
|
12256
|
+
* Returns the formatted time zone name of the provided `timeZone` or the current
|
|
12257
|
+
* system time zone if omitted, accounting for DST according to the UTC value of
|
|
12258
|
+
* the date.
|
|
12259
|
+
*/
|
|
12260
|
+
function tzIntlTimeZoneName(length, date, options) {
|
|
12261
|
+
const defaultOptions = (0,date_fns__WEBPACK_IMPORTED_MODULE_0__.getDefaultOptions)();
|
|
12262
|
+
const dtf = getDTF(length, options.timeZone, options.locale ?? defaultOptions.locale);
|
|
12263
|
+
return 'formatToParts' in dtf ? partsTimeZone(dtf, date) : hackyTimeZone(dtf, date);
|
|
12264
|
+
}
|
|
12265
|
+
function partsTimeZone(dtf, date) {
|
|
12266
|
+
const formatted = dtf.formatToParts(date);
|
|
12267
|
+
for (let i = formatted.length - 1; i >= 0; --i) {
|
|
12268
|
+
if (formatted[i].type === 'timeZoneName') {
|
|
12269
|
+
return formatted[i].value;
|
|
12270
|
+
}
|
|
12271
|
+
}
|
|
12272
|
+
return undefined;
|
|
12273
|
+
}
|
|
12274
|
+
function hackyTimeZone(dtf, date) {
|
|
12275
|
+
const formatted = dtf.format(date).replace(/\u200E/g, '');
|
|
12276
|
+
const tzNameMatch = / [\w-+ ]+$/.exec(formatted);
|
|
12277
|
+
return tzNameMatch ? tzNameMatch[0].substr(1) : '';
|
|
12278
|
+
}
|
|
12279
|
+
// If a locale has been provided `en-US` is used as a fallback in case it is an
|
|
12280
|
+
// invalid locale, otherwise the locale is left undefined to use the system locale.
|
|
12281
|
+
function getDTF(length, timeZone, locale) {
|
|
12282
|
+
return new Intl.DateTimeFormat(locale ? [locale.code, 'en-US'] : undefined, {
|
|
12283
|
+
timeZone: timeZone,
|
|
12284
|
+
timeZoneName: length,
|
|
12285
|
+
});
|
|
12286
|
+
}
|
|
12287
|
+
|
|
12288
|
+
|
|
12289
|
+
/***/ }),
|
|
12290
|
+
|
|
12291
|
+
/***/ "./node_modules/date-fns-tz/dist/esm/_lib/tzParseTimezone/index.js":
|
|
12292
|
+
/*!*************************************************************************!*\
|
|
12293
|
+
!*** ./node_modules/date-fns-tz/dist/esm/_lib/tzParseTimezone/index.js ***!
|
|
12294
|
+
\*************************************************************************/
|
|
12295
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
12296
|
+
|
|
12297
|
+
"use strict";
|
|
12298
|
+
__webpack_require__.r(__webpack_exports__);
|
|
12299
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
12300
|
+
/* harmony export */ tzParseTimezone: () => (/* binding */ tzParseTimezone)
|
|
12301
|
+
/* harmony export */ });
|
|
12302
|
+
/* harmony import */ var _tzTokenizeDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../tzTokenizeDate/index.js */ "./node_modules/date-fns-tz/dist/esm/_lib/tzTokenizeDate/index.js");
|
|
12303
|
+
/* harmony import */ var _newDateUTC_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../newDateUTC/index.js */ "./node_modules/date-fns-tz/dist/esm/_lib/newDateUTC/index.js");
|
|
12304
|
+
|
|
12305
|
+
|
|
12306
|
+
const MILLISECONDS_IN_HOUR = 3600000;
|
|
12307
|
+
const MILLISECONDS_IN_MINUTE = 60000;
|
|
12308
|
+
const patterns = {
|
|
12309
|
+
timezone: /([Z+-].*)$/,
|
|
12310
|
+
timezoneZ: /^(Z)$/,
|
|
12311
|
+
timezoneHH: /^([+-]\d{2})$/,
|
|
12312
|
+
timezoneHHMM: /^([+-])(\d{2}):?(\d{2})$/,
|
|
12313
|
+
};
|
|
12314
|
+
// Parse constious time zone offset formats to an offset in milliseconds
|
|
12315
|
+
function tzParseTimezone(timezoneString, date, isUtcDate) {
|
|
12316
|
+
// Empty string
|
|
12317
|
+
if (!timezoneString) {
|
|
12318
|
+
return 0;
|
|
12319
|
+
}
|
|
12320
|
+
// Z
|
|
12321
|
+
let token = patterns.timezoneZ.exec(timezoneString);
|
|
12322
|
+
if (token) {
|
|
12323
|
+
return 0;
|
|
12324
|
+
}
|
|
12325
|
+
let hours;
|
|
12326
|
+
let absoluteOffset;
|
|
12327
|
+
// ±hh
|
|
12328
|
+
token = patterns.timezoneHH.exec(timezoneString);
|
|
12329
|
+
if (token) {
|
|
12330
|
+
hours = parseInt(token[1], 10);
|
|
12331
|
+
if (!validateTimezone(hours)) {
|
|
12332
|
+
return NaN;
|
|
12333
|
+
}
|
|
12334
|
+
return -(hours * MILLISECONDS_IN_HOUR);
|
|
12335
|
+
}
|
|
12336
|
+
// ±hh:mm or ±hhmm
|
|
12337
|
+
token = patterns.timezoneHHMM.exec(timezoneString);
|
|
12338
|
+
if (token) {
|
|
12339
|
+
hours = parseInt(token[2], 10);
|
|
12340
|
+
const minutes = parseInt(token[3], 10);
|
|
12341
|
+
if (!validateTimezone(hours, minutes)) {
|
|
12342
|
+
return NaN;
|
|
12343
|
+
}
|
|
12344
|
+
absoluteOffset = Math.abs(hours) * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE;
|
|
12345
|
+
return token[1] === '+' ? -absoluteOffset : absoluteOffset;
|
|
12346
|
+
}
|
|
12347
|
+
// IANA time zone
|
|
12348
|
+
if (isValidTimezoneIANAString(timezoneString)) {
|
|
12349
|
+
date = new Date(date || Date.now());
|
|
12350
|
+
const utcDate = isUtcDate ? date : toUtcDate(date);
|
|
12351
|
+
const offset = calcOffset(utcDate, timezoneString);
|
|
12352
|
+
const fixedOffset = isUtcDate ? offset : fixOffset(date, offset, timezoneString);
|
|
12353
|
+
return -fixedOffset;
|
|
12354
|
+
}
|
|
12355
|
+
return NaN;
|
|
12356
|
+
}
|
|
12357
|
+
function toUtcDate(date) {
|
|
12358
|
+
return (0,_newDateUTC_index_js__WEBPACK_IMPORTED_MODULE_1__.newDateUTC)(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
|
|
12359
|
+
}
|
|
12360
|
+
function calcOffset(date, timezoneString) {
|
|
12361
|
+
const tokens = (0,_tzTokenizeDate_index_js__WEBPACK_IMPORTED_MODULE_0__.tzTokenizeDate)(date, timezoneString);
|
|
12362
|
+
// ms dropped because it's not provided by tzTokenizeDate
|
|
12363
|
+
const asUTC = (0,_newDateUTC_index_js__WEBPACK_IMPORTED_MODULE_1__.newDateUTC)(tokens[0], tokens[1] - 1, tokens[2], tokens[3] % 24, tokens[4], tokens[5], 0).getTime();
|
|
12364
|
+
let asTS = date.getTime();
|
|
12365
|
+
const over = asTS % 1000;
|
|
12366
|
+
asTS -= over >= 0 ? over : 1000 + over;
|
|
12367
|
+
return asUTC - asTS;
|
|
12368
|
+
}
|
|
12369
|
+
function fixOffset(date, offset, timezoneString) {
|
|
12370
|
+
const localTS = date.getTime();
|
|
12371
|
+
// Our UTC time is just a guess because our offset is just a guess
|
|
12372
|
+
let utcGuess = localTS - offset;
|
|
12373
|
+
// Test whether the zone matches the offset for this ts
|
|
12374
|
+
const o2 = calcOffset(new Date(utcGuess), timezoneString);
|
|
12375
|
+
// If so, offset didn't change, and we're done
|
|
12376
|
+
if (offset === o2) {
|
|
12377
|
+
return offset;
|
|
12378
|
+
}
|
|
12379
|
+
// If not, change the ts by the difference in the offset
|
|
12380
|
+
utcGuess -= o2 - offset;
|
|
12381
|
+
// If that gives us the local time we want, we're done
|
|
12382
|
+
const o3 = calcOffset(new Date(utcGuess), timezoneString);
|
|
12383
|
+
if (o2 === o3) {
|
|
12384
|
+
return o2;
|
|
12385
|
+
}
|
|
12386
|
+
// If it's different, we're in a hole time. The offset has changed, but we don't adjust the time
|
|
12387
|
+
return Math.max(o2, o3);
|
|
12388
|
+
}
|
|
12389
|
+
function validateTimezone(hours, minutes) {
|
|
12390
|
+
return -23 <= hours && hours <= 23 && (minutes == null || (0 <= minutes && minutes <= 59));
|
|
12391
|
+
}
|
|
12392
|
+
const validIANATimezoneCache = {};
|
|
12393
|
+
function isValidTimezoneIANAString(timeZoneString) {
|
|
12394
|
+
if (validIANATimezoneCache[timeZoneString])
|
|
12395
|
+
return true;
|
|
12396
|
+
try {
|
|
12397
|
+
new Intl.DateTimeFormat(undefined, { timeZone: timeZoneString });
|
|
12398
|
+
validIANATimezoneCache[timeZoneString] = true;
|
|
12399
|
+
return true;
|
|
12400
|
+
}
|
|
12401
|
+
catch (error) {
|
|
12402
|
+
return false;
|
|
12403
|
+
}
|
|
12404
|
+
}
|
|
12405
|
+
|
|
12406
|
+
|
|
12407
|
+
/***/ }),
|
|
12408
|
+
|
|
12409
|
+
/***/ "./node_modules/date-fns-tz/dist/esm/_lib/tzPattern/index.js":
|
|
12410
|
+
/*!*******************************************************************!*\
|
|
12411
|
+
!*** ./node_modules/date-fns-tz/dist/esm/_lib/tzPattern/index.js ***!
|
|
12412
|
+
\*******************************************************************/
|
|
12413
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
12414
|
+
|
|
12415
|
+
"use strict";
|
|
12416
|
+
__webpack_require__.r(__webpack_exports__);
|
|
12417
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
12418
|
+
/* harmony export */ tzPattern: () => (/* binding */ tzPattern)
|
|
12419
|
+
/* harmony export */ });
|
|
12420
|
+
/** Regex to identify the presence of a time zone specifier in a date string */
|
|
12421
|
+
const tzPattern = /(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/;
|
|
12422
|
+
|
|
12423
|
+
|
|
12424
|
+
/***/ }),
|
|
12425
|
+
|
|
12426
|
+
/***/ "./node_modules/date-fns-tz/dist/esm/_lib/tzTokenizeDate/index.js":
|
|
12427
|
+
/*!************************************************************************!*\
|
|
12428
|
+
!*** ./node_modules/date-fns-tz/dist/esm/_lib/tzTokenizeDate/index.js ***!
|
|
12429
|
+
\************************************************************************/
|
|
12430
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
12431
|
+
|
|
12432
|
+
"use strict";
|
|
12433
|
+
__webpack_require__.r(__webpack_exports__);
|
|
12434
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
12435
|
+
/* harmony export */ tzTokenizeDate: () => (/* binding */ tzTokenizeDate)
|
|
12436
|
+
/* harmony export */ });
|
|
12437
|
+
/**
|
|
12438
|
+
* Returns the [year, month, day, hour, minute, seconds] tokens of the provided
|
|
12439
|
+
* `date` as it will be rendered in the `timeZone`.
|
|
12440
|
+
*/
|
|
12441
|
+
function tzTokenizeDate(date, timeZone) {
|
|
12442
|
+
const dtf = getDateTimeFormat(timeZone);
|
|
12443
|
+
return 'formatToParts' in dtf ? partsOffset(dtf, date) : hackyOffset(dtf, date);
|
|
12444
|
+
}
|
|
12445
|
+
const typeToPos = {
|
|
12446
|
+
year: 0,
|
|
12447
|
+
month: 1,
|
|
12448
|
+
day: 2,
|
|
12449
|
+
hour: 3,
|
|
12450
|
+
minute: 4,
|
|
12451
|
+
second: 5,
|
|
12452
|
+
};
|
|
12453
|
+
function partsOffset(dtf, date) {
|
|
12454
|
+
try {
|
|
12455
|
+
const formatted = dtf.formatToParts(date);
|
|
12456
|
+
const filled = [];
|
|
12457
|
+
for (let i = 0; i < formatted.length; i++) {
|
|
12458
|
+
const pos = typeToPos[formatted[i].type];
|
|
12459
|
+
if (pos !== undefined) {
|
|
12460
|
+
filled[pos] = parseInt(formatted[i].value, 10);
|
|
12461
|
+
}
|
|
12462
|
+
}
|
|
12463
|
+
return filled;
|
|
12464
|
+
}
|
|
12465
|
+
catch (error) {
|
|
12466
|
+
if (error instanceof RangeError) {
|
|
12467
|
+
return [NaN];
|
|
12468
|
+
}
|
|
12469
|
+
throw error;
|
|
12470
|
+
}
|
|
12471
|
+
}
|
|
12472
|
+
function hackyOffset(dtf, date) {
|
|
12473
|
+
const formatted = dtf.format(date);
|
|
12474
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
12475
|
+
const parsed = /(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(formatted);
|
|
12476
|
+
// const [, fMonth, fDay, fYear, fHour, fMinute, fSecond] = parsed
|
|
12477
|
+
// return [fYear, fMonth, fDay, fHour, fMinute, fSecond]
|
|
12478
|
+
return [
|
|
12479
|
+
parseInt(parsed[3], 10),
|
|
12480
|
+
parseInt(parsed[1], 10),
|
|
12481
|
+
parseInt(parsed[2], 10),
|
|
12482
|
+
parseInt(parsed[4], 10),
|
|
12483
|
+
parseInt(parsed[5], 10),
|
|
12484
|
+
parseInt(parsed[6], 10),
|
|
12485
|
+
];
|
|
12486
|
+
}
|
|
12487
|
+
// Get a cached Intl.DateTimeFormat instance for the IANA `timeZone`. This can be used
|
|
12488
|
+
// to get deterministic local date/time output according to the `en-US` locale which
|
|
12489
|
+
// can be used to extract local time parts as necessary.
|
|
12490
|
+
const dtfCache = {};
|
|
12491
|
+
// New browsers use `hourCycle`, IE and Chrome <73 does not support it and uses `hour12`
|
|
12492
|
+
const testDateFormatted = new Intl.DateTimeFormat('en-US', {
|
|
12493
|
+
hourCycle: 'h23',
|
|
12494
|
+
timeZone: 'America/New_York',
|
|
12495
|
+
year: 'numeric',
|
|
12496
|
+
month: '2-digit',
|
|
12497
|
+
day: '2-digit',
|
|
12498
|
+
hour: '2-digit',
|
|
12499
|
+
minute: '2-digit',
|
|
12500
|
+
second: '2-digit',
|
|
12501
|
+
}).format(new Date('2014-06-25T04:00:00.123Z'));
|
|
12502
|
+
const hourCycleSupported = testDateFormatted === '06/25/2014, 00:00:00' ||
|
|
12503
|
+
testDateFormatted === '06/25/2014 00:00:00';
|
|
12504
|
+
function getDateTimeFormat(timeZone) {
|
|
12505
|
+
if (!dtfCache[timeZone]) {
|
|
12506
|
+
dtfCache[timeZone] = hourCycleSupported
|
|
12507
|
+
? new Intl.DateTimeFormat('en-US', {
|
|
12508
|
+
hourCycle: 'h23',
|
|
12509
|
+
timeZone: timeZone,
|
|
12510
|
+
year: 'numeric',
|
|
12511
|
+
month: 'numeric',
|
|
12512
|
+
day: '2-digit',
|
|
12513
|
+
hour: '2-digit',
|
|
12514
|
+
minute: '2-digit',
|
|
12515
|
+
second: '2-digit',
|
|
12516
|
+
})
|
|
12517
|
+
: new Intl.DateTimeFormat('en-US', {
|
|
12518
|
+
hour12: false,
|
|
12519
|
+
timeZone: timeZone,
|
|
12520
|
+
year: 'numeric',
|
|
12521
|
+
month: 'numeric',
|
|
12522
|
+
day: '2-digit',
|
|
12523
|
+
hour: '2-digit',
|
|
12524
|
+
minute: '2-digit',
|
|
12525
|
+
second: '2-digit',
|
|
12526
|
+
});
|
|
12527
|
+
}
|
|
12528
|
+
return dtfCache[timeZone];
|
|
12529
|
+
}
|
|
12530
|
+
|
|
12531
|
+
|
|
12532
|
+
/***/ }),
|
|
12533
|
+
|
|
12534
|
+
/***/ "./node_modules/date-fns-tz/dist/esm/formatInTimeZone/index.js":
|
|
12535
|
+
/*!*********************************************************************!*\
|
|
12536
|
+
!*** ./node_modules/date-fns-tz/dist/esm/formatInTimeZone/index.js ***!
|
|
12537
|
+
\*********************************************************************/
|
|
12538
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
12539
|
+
|
|
12540
|
+
"use strict";
|
|
12541
|
+
__webpack_require__.r(__webpack_exports__);
|
|
12542
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
12543
|
+
/* harmony export */ formatInTimeZone: () => (/* binding */ formatInTimeZone)
|
|
12544
|
+
/* harmony export */ });
|
|
12545
|
+
/* harmony import */ var _format_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../format/index.js */ "./node_modules/date-fns-tz/dist/esm/format/index.js");
|
|
12546
|
+
/* harmony import */ var _toZonedTime_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toZonedTime/index.js */ "./node_modules/date-fns-tz/dist/esm/toZonedTime/index.js");
|
|
12547
|
+
|
|
12548
|
+
|
|
12549
|
+
/**
|
|
12550
|
+
* @name formatInTimeZone
|
|
12551
|
+
* @category Time Zone Helpers
|
|
12552
|
+
* @summary Gets the offset in milliseconds between the time zone and Universal Coordinated Time (UTC)
|
|
12553
|
+
*
|
|
12554
|
+
* @param date the date representing the local time / real UTC time
|
|
12555
|
+
* @param timeZone the time zone this date should be formatted for; can be an offset or IANA time zone
|
|
12556
|
+
* @param formatStr the string of tokens
|
|
12557
|
+
* @param options the object with options. See [Options]{@link https://date-fns.org/docs/Options}
|
|
12558
|
+
* @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link
|
|
12559
|
+
* https://date-fns.org/docs/toDate}
|
|
12560
|
+
* @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
|
|
12561
|
+
* @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
|
|
12562
|
+
* @param {Locale} [options.locale=defaultLocale] - the locale object. See
|
|
12563
|
+
* [Locale]{@link https://date-fns.org/docs/Locale}
|
|
12564
|
+
* @param {Boolean} [options.awareOfUnicodeTokens=false] - if true, allows usage of Unicode tokens causes confusion:
|
|
12565
|
+
* - Some of the day of year tokens (`D`, `DD`) that are confused with the day of month tokens (`d`, `dd`).
|
|
12566
|
+
* - Some of the local week-numbering year tokens (`YY`, `YYYY`) that are confused with the calendar year tokens
|
|
12567
|
+
* (`yy`, `yyyy`). See: https://git.io/fxCyr
|
|
12568
|
+
* @param {String} [options.timeZone=''] - used to specify the IANA time zone offset of a date String.
|
|
12569
|
+
*/
|
|
12570
|
+
function formatInTimeZone(date, timeZone, formatStr, options) {
|
|
12571
|
+
options = {
|
|
12572
|
+
...options,
|
|
12573
|
+
timeZone,
|
|
12574
|
+
originalDate: date,
|
|
12575
|
+
};
|
|
12576
|
+
return (0,_format_index_js__WEBPACK_IMPORTED_MODULE_0__.format)((0,_toZonedTime_index_js__WEBPACK_IMPORTED_MODULE_1__.toZonedTime)(date, timeZone, { timeZone: options.timeZone }), formatStr, options);
|
|
12577
|
+
}
|
|
12578
|
+
|
|
12579
|
+
|
|
12580
|
+
/***/ }),
|
|
12581
|
+
|
|
12582
|
+
/***/ "./node_modules/date-fns-tz/dist/esm/format/formatters/index.js":
|
|
12583
|
+
/*!**********************************************************************!*\
|
|
12584
|
+
!*** ./node_modules/date-fns-tz/dist/esm/format/formatters/index.js ***!
|
|
12585
|
+
\**********************************************************************/
|
|
12586
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
12587
|
+
|
|
12588
|
+
"use strict";
|
|
12589
|
+
__webpack_require__.r(__webpack_exports__);
|
|
12590
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
12591
|
+
/* harmony export */ formatters: () => (/* binding */ formatters)
|
|
12592
|
+
/* harmony export */ });
|
|
12593
|
+
/* harmony import */ var _lib_tzIntlTimeZoneName_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../_lib/tzIntlTimeZoneName/index.js */ "./node_modules/date-fns-tz/dist/esm/_lib/tzIntlTimeZoneName/index.js");
|
|
12594
|
+
/* harmony import */ var _lib_tzParseTimezone_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../_lib/tzParseTimezone/index.js */ "./node_modules/date-fns-tz/dist/esm/_lib/tzParseTimezone/index.js");
|
|
12595
|
+
|
|
12596
|
+
|
|
12597
|
+
const MILLISECONDS_IN_MINUTE = 60 * 1000;
|
|
12598
|
+
const formatters = {
|
|
12599
|
+
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
|
|
12600
|
+
X: function (date, token, options) {
|
|
12601
|
+
const timezoneOffset = getTimeZoneOffset(options.timeZone, date);
|
|
12602
|
+
if (timezoneOffset === 0) {
|
|
12603
|
+
return 'Z';
|
|
12604
|
+
}
|
|
12605
|
+
switch (token) {
|
|
12606
|
+
// Hours and optional minutes
|
|
12607
|
+
case 'X':
|
|
12608
|
+
return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
12609
|
+
// Hours, minutes and optional seconds without `:` delimeter
|
|
12610
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
12611
|
+
// so this token always has the same output as `XX`
|
|
12612
|
+
case 'XXXX':
|
|
12613
|
+
case 'XX': // Hours and minutes without `:` delimeter
|
|
12614
|
+
return formatTimezone(timezoneOffset);
|
|
12615
|
+
// Hours, minutes and optional seconds with `:` delimeter
|
|
12616
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
12617
|
+
// so this token always has the same output as `XXX`
|
|
12618
|
+
case 'XXXXX':
|
|
12619
|
+
case 'XXX': // Hours and minutes with `:` delimeter
|
|
12620
|
+
default:
|
|
12621
|
+
return formatTimezone(timezoneOffset, ':');
|
|
12622
|
+
}
|
|
12623
|
+
},
|
|
12624
|
+
// Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
|
|
12625
|
+
x: function (date, token, options) {
|
|
12626
|
+
const timezoneOffset = getTimeZoneOffset(options.timeZone, date);
|
|
12627
|
+
switch (token) {
|
|
12628
|
+
// Hours and optional minutes
|
|
12629
|
+
case 'x':
|
|
12630
|
+
return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
12631
|
+
// Hours, minutes and optional seconds without `:` delimeter
|
|
12632
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
12633
|
+
// so this token always has the same output as `xx`
|
|
12634
|
+
case 'xxxx':
|
|
12635
|
+
case 'xx': // Hours and minutes without `:` delimeter
|
|
12636
|
+
return formatTimezone(timezoneOffset);
|
|
12637
|
+
// Hours, minutes and optional seconds with `:` delimeter
|
|
12638
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
12639
|
+
// so this token always has the same output as `xxx`
|
|
12640
|
+
case 'xxxxx':
|
|
12641
|
+
case 'xxx': // Hours and minutes with `:` delimeter
|
|
12642
|
+
default:
|
|
12643
|
+
return formatTimezone(timezoneOffset, ':');
|
|
12644
|
+
}
|
|
12645
|
+
},
|
|
12646
|
+
// Timezone (GMT)
|
|
12647
|
+
O: function (date, token, options) {
|
|
12648
|
+
const timezoneOffset = getTimeZoneOffset(options.timeZone, date);
|
|
12649
|
+
switch (token) {
|
|
12650
|
+
// Short
|
|
12651
|
+
case 'O':
|
|
12652
|
+
case 'OO':
|
|
12653
|
+
case 'OOO':
|
|
12654
|
+
return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
|
|
12655
|
+
// Long
|
|
12656
|
+
case 'OOOO':
|
|
12657
|
+
default:
|
|
12658
|
+
return 'GMT' + formatTimezone(timezoneOffset, ':');
|
|
12659
|
+
}
|
|
12660
|
+
},
|
|
12661
|
+
// Timezone (specific non-location)
|
|
12662
|
+
z: function (date, token, options) {
|
|
12663
|
+
switch (token) {
|
|
12664
|
+
// Short
|
|
12665
|
+
case 'z':
|
|
12666
|
+
case 'zz':
|
|
12667
|
+
case 'zzz':
|
|
12668
|
+
return (0,_lib_tzIntlTimeZoneName_index_js__WEBPACK_IMPORTED_MODULE_0__.tzIntlTimeZoneName)('short', date, options);
|
|
12669
|
+
// Long
|
|
12670
|
+
case 'zzzz':
|
|
12671
|
+
default:
|
|
12672
|
+
return (0,_lib_tzIntlTimeZoneName_index_js__WEBPACK_IMPORTED_MODULE_0__.tzIntlTimeZoneName)('long', date, options);
|
|
12673
|
+
}
|
|
12674
|
+
},
|
|
12675
|
+
};
|
|
12676
|
+
function getTimeZoneOffset(timeZone, originalDate) {
|
|
12677
|
+
const timeZoneOffset = timeZone
|
|
12678
|
+
? (0,_lib_tzParseTimezone_index_js__WEBPACK_IMPORTED_MODULE_1__.tzParseTimezone)(timeZone, originalDate, true) / MILLISECONDS_IN_MINUTE
|
|
12679
|
+
: originalDate?.getTimezoneOffset() ?? 0;
|
|
12680
|
+
if (Number.isNaN(timeZoneOffset)) {
|
|
12681
|
+
throw new RangeError('Invalid time zone specified: ' + timeZone);
|
|
12682
|
+
}
|
|
12683
|
+
return timeZoneOffset;
|
|
12684
|
+
}
|
|
12685
|
+
function addLeadingZeros(number, targetLength) {
|
|
12686
|
+
const sign = number < 0 ? '-' : '';
|
|
12687
|
+
let output = Math.abs(number).toString();
|
|
12688
|
+
while (output.length < targetLength) {
|
|
12689
|
+
output = '0' + output;
|
|
12690
|
+
}
|
|
12691
|
+
return sign + output;
|
|
12692
|
+
}
|
|
12693
|
+
function formatTimezone(offset, delimiter = '') {
|
|
12694
|
+
const sign = offset > 0 ? '-' : '+';
|
|
12695
|
+
const absOffset = Math.abs(offset);
|
|
12696
|
+
const hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
|
|
12697
|
+
const minutes = addLeadingZeros(Math.floor(absOffset % 60), 2);
|
|
12698
|
+
return sign + hours + delimiter + minutes;
|
|
12699
|
+
}
|
|
12700
|
+
function formatTimezoneWithOptionalMinutes(offset, delimiter) {
|
|
12701
|
+
if (offset % 60 === 0) {
|
|
12702
|
+
const sign = offset > 0 ? '-' : '+';
|
|
12703
|
+
return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
|
|
12704
|
+
}
|
|
12705
|
+
return formatTimezone(offset, delimiter);
|
|
12706
|
+
}
|
|
12707
|
+
function formatTimezoneShort(offset, delimiter = '') {
|
|
12708
|
+
const sign = offset > 0 ? '-' : '+';
|
|
12709
|
+
const absOffset = Math.abs(offset);
|
|
12710
|
+
const hours = Math.floor(absOffset / 60);
|
|
12711
|
+
const minutes = absOffset % 60;
|
|
12712
|
+
if (minutes === 0) {
|
|
12713
|
+
return sign + String(hours);
|
|
12714
|
+
}
|
|
12715
|
+
return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
|
|
12716
|
+
}
|
|
12717
|
+
|
|
12718
|
+
|
|
12719
|
+
/***/ }),
|
|
12720
|
+
|
|
12721
|
+
/***/ "./node_modules/date-fns-tz/dist/esm/format/index.js":
|
|
12722
|
+
/*!***********************************************************!*\
|
|
12723
|
+
!*** ./node_modules/date-fns-tz/dist/esm/format/index.js ***!
|
|
12724
|
+
\***********************************************************/
|
|
12725
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
12726
|
+
|
|
12727
|
+
"use strict";
|
|
12728
|
+
__webpack_require__.r(__webpack_exports__);
|
|
12729
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
12730
|
+
/* harmony export */ format: () => (/* binding */ format)
|
|
12731
|
+
/* harmony export */ });
|
|
12732
|
+
/* harmony import */ var date_fns_format__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! date-fns/format */ "./node_modules/date-fns/format.js");
|
|
12733
|
+
/* harmony import */ var _formatters_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./formatters/index.js */ "./node_modules/date-fns-tz/dist/esm/format/formatters/index.js");
|
|
12734
|
+
/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns-tz/dist/esm/toDate/index.js");
|
|
12735
|
+
|
|
12736
|
+
|
|
12737
|
+
|
|
12738
|
+
const tzFormattingTokensRegExp = /([xXOz]+)|''|'(''|[^'])+('|$)/g;
|
|
12739
|
+
/**
|
|
12740
|
+
* @name format
|
|
12741
|
+
* @category Common Helpers
|
|
12742
|
+
* @summary Format the date.
|
|
12743
|
+
*
|
|
12744
|
+
* @description
|
|
12745
|
+
* Return the formatted date string in the given format. The result may consty by locale.
|
|
12746
|
+
*
|
|
12747
|
+
* > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
|
|
12748
|
+
* > See: https://git.io/fxCyr
|
|
12749
|
+
*
|
|
12750
|
+
* The characters wrapped between two single quotes characters (') are escaped.
|
|
12751
|
+
* Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
|
|
12752
|
+
* (see the last example)
|
|
12753
|
+
*
|
|
12754
|
+
* Format of the string is based on Unicode Technical Standard #35:
|
|
12755
|
+
* https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
12756
|
+
* with a few additions (see note 7 below the table).
|
|
12757
|
+
*
|
|
12758
|
+
* Accepted patterns:
|
|
12759
|
+
* | Unit | Pattern | Result examples | Notes |
|
|
12760
|
+
* |---------------------------------|---------|-----------------------------------|-------|
|
|
12761
|
+
* | Era | G..GGG | AD, BC | |
|
|
12762
|
+
* | | GGGG | Anno Domini, Before Christ | 2 |
|
|
12763
|
+
* | | GGGGG | A, B | |
|
|
12764
|
+
* | Calendar year | y | 44, 1, 1900, 2017 | 5 |
|
|
12765
|
+
* | | yo | 44th, 1st, 0th, 17th | 5,7 |
|
|
12766
|
+
* | | yy | 44, 01, 00, 17 | 5 |
|
|
12767
|
+
* | | yyy | 044, 001, 1900, 2017 | 5 |
|
|
12768
|
+
* | | yyyy | 0044, 0001, 1900, 2017 | 5 |
|
|
12769
|
+
* | | yyyyy | ... | 3,5 |
|
|
12770
|
+
* | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
|
|
12771
|
+
* | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
|
|
12772
|
+
* | | YY | 44, 01, 00, 17 | 5,8 |
|
|
12773
|
+
* | | YYY | 044, 001, 1900, 2017 | 5 |
|
|
12774
|
+
* | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
|
|
12775
|
+
* | | YYYYY | ... | 3,5 |
|
|
12776
|
+
* | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
|
|
12777
|
+
* | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
|
|
12778
|
+
* | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
|
|
12779
|
+
* | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
|
|
12780
|
+
* | | RRRRR | ... | 3,5,7 |
|
|
12781
|
+
* | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
|
|
12782
|
+
* | | uu | -43, 01, 1900, 2017 | 5 |
|
|
12783
|
+
* | | uuu | -043, 001, 1900, 2017 | 5 |
|
|
12784
|
+
* | | uuuu | -0043, 0001, 1900, 2017 | 5 |
|
|
12785
|
+
* | | uuuuu | ... | 3,5 |
|
|
12786
|
+
* | Quarter (formatting) | Q | 1, 2, 3, 4 | |
|
|
12787
|
+
* | | Qo | 1st, 2nd, 3rd, 4th | 7 |
|
|
12788
|
+
* | | QQ | 01, 02, 03, 04 | |
|
|
12789
|
+
* | | QQQ | Q1, Q2, Q3, Q4 | |
|
|
12790
|
+
* | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
|
|
12791
|
+
* | | QQQQQ | 1, 2, 3, 4 | 4 |
|
|
12792
|
+
* | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
|
|
12793
|
+
* | | qo | 1st, 2nd, 3rd, 4th | 7 |
|
|
12794
|
+
* | | qq | 01, 02, 03, 04 | |
|
|
12795
|
+
* | | qqq | Q1, Q2, Q3, Q4 | |
|
|
12796
|
+
* | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
|
|
12797
|
+
* | | qqqqq | 1, 2, 3, 4 | 4 |
|
|
12798
|
+
* | Month (formatting) | M | 1, 2, ..., 12 | |
|
|
12799
|
+
* | | Mo | 1st, 2nd, ..., 12th | 7 |
|
|
12800
|
+
* | | MM | 01, 02, ..., 12 | |
|
|
12801
|
+
* | | MMM | Jan, Feb, ..., Dec | |
|
|
12802
|
+
* | | MMMM | January, February, ..., December | 2 |
|
|
12803
|
+
* | | MMMMM | J, F, ..., D | |
|
|
12804
|
+
* | Month (stand-alone) | L | 1, 2, ..., 12 | |
|
|
12805
|
+
* | | Lo | 1st, 2nd, ..., 12th | 7 |
|
|
12806
|
+
* | | LL | 01, 02, ..., 12 | |
|
|
12807
|
+
* | | LLL | Jan, Feb, ..., Dec | |
|
|
12808
|
+
* | | LLLL | January, February, ..., December | 2 |
|
|
12809
|
+
* | | LLLLL | J, F, ..., D | |
|
|
12810
|
+
* | Local week of year | w | 1, 2, ..., 53 | |
|
|
12811
|
+
* | | wo | 1st, 2nd, ..., 53th | 7 |
|
|
12812
|
+
* | | ww | 01, 02, ..., 53 | |
|
|
12813
|
+
* | ISO week of year | I | 1, 2, ..., 53 | 7 |
|
|
12814
|
+
* | | Io | 1st, 2nd, ..., 53th | 7 |
|
|
12815
|
+
* | | II | 01, 02, ..., 53 | 7 |
|
|
12816
|
+
* | Day of month | d | 1, 2, ..., 31 | |
|
|
12817
|
+
* | | do | 1st, 2nd, ..., 31st | 7 |
|
|
12818
|
+
* | | dd | 01, 02, ..., 31 | |
|
|
12819
|
+
* | Day of year | D | 1, 2, ..., 365, 366 | 8 |
|
|
12820
|
+
* | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
|
|
12821
|
+
* | | DD | 01, 02, ..., 365, 366 | 8 |
|
|
12822
|
+
* | | DDD | 001, 002, ..., 365, 366 | |
|
|
12823
|
+
* | | DDDD | ... | 3 |
|
|
12824
|
+
* | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Su | |
|
|
12825
|
+
* | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
|
|
12826
|
+
* | | EEEEE | M, T, W, T, F, S, S | |
|
|
12827
|
+
* | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | |
|
|
12828
|
+
* | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
|
|
12829
|
+
* | | io | 1st, 2nd, ..., 7th | 7 |
|
|
12830
|
+
* | | ii | 01, 02, ..., 07 | 7 |
|
|
12831
|
+
* | | iii | Mon, Tue, Wed, ..., Su | 7 |
|
|
12832
|
+
* | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
|
|
12833
|
+
* | | iiiii | M, T, W, T, F, S, S | 7 |
|
|
12834
|
+
* | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 7 |
|
|
12835
|
+
* | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
|
|
12836
|
+
* | | eo | 2nd, 3rd, ..., 1st | 7 |
|
|
12837
|
+
* | | ee | 02, 03, ..., 01 | |
|
|
12838
|
+
* | | eee | Mon, Tue, Wed, ..., Su | |
|
|
12839
|
+
* | | eeee | Monday, Tuesday, ..., Sunday | 2 |
|
|
12840
|
+
* | | eeeee | M, T, W, T, F, S, S | |
|
|
12841
|
+
* | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | |
|
|
12842
|
+
* | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
|
|
12843
|
+
* | | co | 2nd, 3rd, ..., 1st | 7 |
|
|
12844
|
+
* | | cc | 02, 03, ..., 01 | |
|
|
12845
|
+
* | | ccc | Mon, Tue, Wed, ..., Su | |
|
|
12846
|
+
* | | cccc | Monday, Tuesday, ..., Sunday | 2 |
|
|
12847
|
+
* | | ccccc | M, T, W, T, F, S, S | |
|
|
12848
|
+
* | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | |
|
|
12849
|
+
* | AM, PM | a..aaa | AM, PM | |
|
|
12850
|
+
* | | aaaa | a.m., p.m. | 2 |
|
|
12851
|
+
* | | aaaaa | a, p | |
|
|
12852
|
+
* | AM, PM, noon, midnight | b..bbb | AM, PM, noon, midnight | |
|
|
12853
|
+
* | | bbbb | a.m., p.m., noon, midnight | 2 |
|
|
12854
|
+
* | | bbbbb | a, p, n, mi | |
|
|
12855
|
+
* | Flexible day period | B..BBB | at night, in the morning, ... | |
|
|
12856
|
+
* | | BBBB | at night, in the morning, ... | 2 |
|
|
12857
|
+
* | | BBBBB | at night, in the morning, ... | |
|
|
12858
|
+
* | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
|
|
12859
|
+
* | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
|
|
12860
|
+
* | | hh | 01, 02, ..., 11, 12 | |
|
|
12861
|
+
* | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
|
|
12862
|
+
* | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
|
|
12863
|
+
* | | HH | 00, 01, 02, ..., 23 | |
|
|
12864
|
+
* | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
|
|
12865
|
+
* | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
|
|
12866
|
+
* | | KK | 1, 2, ..., 11, 0 | |
|
|
12867
|
+
* | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
|
|
12868
|
+
* | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
|
|
12869
|
+
* | | kk | 24, 01, 02, ..., 23 | |
|
|
12870
|
+
* | Minute | m | 0, 1, ..., 59 | |
|
|
12871
|
+
* | | mo | 0th, 1st, ..., 59th | 7 |
|
|
12872
|
+
* | | mm | 00, 01, ..., 59 | |
|
|
12873
|
+
* | Second | s | 0, 1, ..., 59 | |
|
|
12874
|
+
* | | so | 0th, 1st, ..., 59th | 7 |
|
|
12875
|
+
* | | ss | 00, 01, ..., 59 | |
|
|
12876
|
+
* | Fraction of second | S | 0, 1, ..., 9 | |
|
|
12877
|
+
* | | SS | 00, 01, ..., 99 | |
|
|
12878
|
+
* | | SSS | 000, 0001, ..., 999 | |
|
|
12879
|
+
* | | SSSS | ... | 3 |
|
|
12880
|
+
* | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
|
|
12881
|
+
* | | XX | -0800, +0530, Z | |
|
|
12882
|
+
* | | XXX | -08:00, +05:30, Z | |
|
|
12883
|
+
* | | XXXX | -0800, +0530, Z, +123456 | 2 |
|
|
12884
|
+
* | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
|
|
12885
|
+
* | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
|
|
12886
|
+
* | | xx | -0800, +0530, +0000 | |
|
|
12887
|
+
* | | xxx | -08:00, +05:30, +00:00 | 2 |
|
|
12888
|
+
* | | xxxx | -0800, +0530, +0000, +123456 | |
|
|
12889
|
+
* | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
|
|
12890
|
+
* | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
|
|
12891
|
+
* | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
|
|
12892
|
+
* | Timezone (specific non-locat.) | z...zzz | PDT, EST, CEST | 6 |
|
|
12893
|
+
* | | zzzz | Pacific Daylight Time | 2,6 |
|
|
12894
|
+
* | Seconds timestamp | t | 512969520 | 7 |
|
|
12895
|
+
* | | tt | ... | 3,7 |
|
|
12896
|
+
* | Milliseconds timestamp | T | 512969520900 | 7 |
|
|
12897
|
+
* | | TT | ... | 3,7 |
|
|
12898
|
+
* | Long localized date | P | 05/29/1453 | 7 |
|
|
12899
|
+
* | | PP | May 29, 1453 | 7 |
|
|
12900
|
+
* | | PPP | May 29th, 1453 | 7 |
|
|
12901
|
+
* | | PPPP | Sunday, May 29th, 1453 | 2,7 |
|
|
12902
|
+
* | Long localized time | p | 12:00 AM | 7 |
|
|
12903
|
+
* | | pp | 12:00:00 AM | 7 |
|
|
12904
|
+
* | | ppp | 12:00:00 AM GMT+2 | 7 |
|
|
12905
|
+
* | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
|
|
12906
|
+
* | Combination of date and time | Pp | 05/29/1453, 12:00 AM | 7 |
|
|
12907
|
+
* | | PPpp | May 29, 1453, 12:00:00 AM | 7 |
|
|
12908
|
+
* | | PPPppp | May 29th, 1453 at ... | 7 |
|
|
12909
|
+
* | | PPPPpppp| Sunday, May 29th, 1453 at ... | 2,7 |
|
|
12910
|
+
* Notes:
|
|
12911
|
+
* 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
|
|
12912
|
+
* are the same as "stand-alone" units, but are different in some languages.
|
|
12913
|
+
* "Formatting" units are declined according to the rules of the language
|
|
12914
|
+
* in the context of a date. "Stand-alone" units are always nominative singular:
|
|
12915
|
+
*
|
|
12916
|
+
* `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
|
|
12917
|
+
*
|
|
12918
|
+
* `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
|
|
12919
|
+
*
|
|
12920
|
+
* 2. Any sequence of the identical letters is a pattern, unless it is escaped by
|
|
12921
|
+
* the single quote characters (see below).
|
|
12922
|
+
* If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
|
|
12923
|
+
* the output will be the same as default pattern for this unit, usually
|
|
12924
|
+
* the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
|
|
12925
|
+
* are marked with "2" in the last column of the table.
|
|
12926
|
+
*
|
|
12927
|
+
* `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
|
|
12928
|
+
*
|
|
12929
|
+
* `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
|
|
12930
|
+
*
|
|
12931
|
+
* `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
|
|
12932
|
+
*
|
|
12933
|
+
* `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
|
|
12934
|
+
*
|
|
12935
|
+
* `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
|
|
12936
|
+
*
|
|
12937
|
+
* 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
|
|
12938
|
+
* The output will be padded with zeros to match the length of the pattern.
|
|
12939
|
+
*
|
|
12940
|
+
* `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
|
|
12941
|
+
*
|
|
12942
|
+
* 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
|
|
12943
|
+
* These tokens represent the shortest form of the quarter.
|
|
12944
|
+
*
|
|
12945
|
+
* 5. The main difference between `y` and `u` patterns are B.C. years:
|
|
12946
|
+
*
|
|
12947
|
+
* | Year | `y` | `u` |
|
|
12948
|
+
* |------|-----|-----|
|
|
12949
|
+
* | AC 1 | 1 | 1 |
|
|
12950
|
+
* | BC 1 | 1 | 0 |
|
|
12951
|
+
* | BC 2 | 2 | -1 |
|
|
12952
|
+
*
|
|
12953
|
+
* Also `yy` always returns the last two digits of a year,
|
|
12954
|
+
* while `uu` pads single digit years to 2 characters and returns other years unchanged:
|
|
12955
|
+
*
|
|
12956
|
+
* | Year | `yy` | `uu` |
|
|
12957
|
+
* |------|------|------|
|
|
12958
|
+
* | 1 | 01 | 01 |
|
|
12959
|
+
* | 14 | 14 | 14 |
|
|
12960
|
+
* | 376 | 76 | 376 |
|
|
12961
|
+
* | 1453 | 53 | 1453 |
|
|
12962
|
+
*
|
|
12963
|
+
* The same difference is true for local and ISO week-numbering years (`Y` and `R`),
|
|
12964
|
+
* except local week-numbering years are dependent on `options.weekStartsOn`
|
|
12965
|
+
* and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
|
|
12966
|
+
* and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
|
|
12967
|
+
*
|
|
12968
|
+
* 6. Specific non-location timezones are created using the Intl browser API. The output is determined by the
|
|
12969
|
+
* preferred standard of the current locale (en-US by default) which may not always give the expected result.
|
|
12970
|
+
* For this reason it is recommended to supply a `locale` in the format options when formatting a time zone name.
|
|
12971
|
+
*
|
|
12972
|
+
* 7. These patterns are not in the Unicode Technical Standard #35:
|
|
12973
|
+
* - `i`: ISO day of week
|
|
12974
|
+
* - `I`: ISO week of year
|
|
12975
|
+
* - `R`: ISO week-numbering year
|
|
12976
|
+
* - `t`: seconds timestamp
|
|
12977
|
+
* - `T`: milliseconds timestamp
|
|
12978
|
+
* - `o`: ordinal number modifier
|
|
12979
|
+
* - `P`: long localized date
|
|
12980
|
+
* - `p`: long localized time
|
|
12981
|
+
*
|
|
12982
|
+
* 8. These tokens are often confused with others. See: https://git.io/fxCyr
|
|
12983
|
+
*
|
|
12984
|
+
*
|
|
12985
|
+
* ### v2.0.0 breaking changes:
|
|
12986
|
+
*
|
|
12987
|
+
* - [Changes that are common for the whole
|
|
12988
|
+
* library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
12989
|
+
*
|
|
12990
|
+
* - The second argument is now required for the sake of explicitness.
|
|
12991
|
+
*
|
|
12992
|
+
* ```javascript
|
|
12993
|
+
* // Before v2.0.0
|
|
12994
|
+
* format(new Date(2016, 0, 1))
|
|
12995
|
+
*
|
|
12996
|
+
* // v2.0.0 onward
|
|
12997
|
+
* format(new Date(2016, 0, 1), "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")
|
|
12998
|
+
* ```
|
|
12999
|
+
*
|
|
13000
|
+
* - New format string API for `format` function
|
|
13001
|
+
* which is based on [Unicode Technical Standard
|
|
13002
|
+
* #35](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table). See [this
|
|
13003
|
+
* post](https://blog.date-fns.org/post/unicode-tokens-in-date-fns-v2-sreatyki91jg) for more details.
|
|
13004
|
+
*
|
|
13005
|
+
* - Characters are now escaped using single quote symbols (`'`) instead of square brackets.
|
|
13006
|
+
*
|
|
13007
|
+
* @param date the original date
|
|
13008
|
+
* @param formatStr the string of tokens
|
|
13009
|
+
* @param options the object with options. See [Options]{@link https://date-fns.org/docs/Options}
|
|
13010
|
+
* @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link
|
|
13011
|
+
* https://date-fns.org/docs/toDate}
|
|
13012
|
+
* @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
|
|
13013
|
+
* @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
|
|
13014
|
+
* @param {Locale} [options.locale=defaultLocale] - the locale object. See
|
|
13015
|
+
* [Locale]{@link https://date-fns.org/docs/Locale}
|
|
13016
|
+
* @param {Boolean} [options.awareOfUnicodeTokens=false] - if true, allows usage of Unicode tokens causes confusion:
|
|
13017
|
+
* - Some of the day of year tokens (`D`, `DD`) that are confused with the day of month tokens (`d`, `dd`).
|
|
13018
|
+
* - Some of the local week-numbering year tokens (`YY`, `YYYY`) that are confused with the calendar year tokens
|
|
13019
|
+
* (`yy`, `yyyy`). See: https://git.io/fxCyr
|
|
13020
|
+
* @param {String} [options.timeZone=''] - used to specify the IANA time zone offset of a date String.
|
|
13021
|
+
* @param {Date|Number} [options.originalDate] - can be used to pass the original unmodified date to `format` to
|
|
13022
|
+
* improve correctness of the replaced timezone token close to the DST threshold.
|
|
13023
|
+
* @throws {TypeError} 2 arguments required
|
|
13024
|
+
* @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
|
|
13025
|
+
* @throws {RangeError} `options.locale` must contain `localize` property
|
|
13026
|
+
* @throws {RangeError} `options.locale` must contain `formatLong` property
|
|
13027
|
+
* @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
|
|
13028
|
+
* @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
|
|
13029
|
+
* @throws {RangeError} `options.awareOfUnicodeTokens` must be set to `true` to use `XX` token; see:
|
|
13030
|
+
* https://git.io/fxCyr
|
|
13031
|
+
*
|
|
13032
|
+
* @example
|
|
13033
|
+
* // Represent 11 February 2014 in middle-endian format:
|
|
13034
|
+
* const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
|
|
13035
|
+
* //=> '02/11/2014'
|
|
13036
|
+
*
|
|
13037
|
+
* @example
|
|
13038
|
+
* // Represent 2 July 2014 in Esperanto:
|
|
13039
|
+
* import { eoLocale } from 'date-fns/locale/eo'
|
|
13040
|
+
* const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
|
|
13041
|
+
* locale: eoLocale
|
|
13042
|
+
* })
|
|
13043
|
+
* //=> '2-a de julio 2014'
|
|
13044
|
+
*
|
|
13045
|
+
* @example
|
|
13046
|
+
* // Escape string by single quote characters:
|
|
13047
|
+
* const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
|
|
13048
|
+
* //=> "3 o'clock"
|
|
13049
|
+
*/
|
|
13050
|
+
function format(date, formatStr, options = {}) {
|
|
13051
|
+
formatStr = String(formatStr);
|
|
13052
|
+
const matches = formatStr.match(tzFormattingTokensRegExp);
|
|
13053
|
+
if (matches) {
|
|
13054
|
+
const d = (0,_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__.toDate)(options.originalDate || date, options);
|
|
13055
|
+
// Work through each match and replace the tz token in the format string with the quoted
|
|
13056
|
+
// formatted time zone so the remaining tokens can be filled in by date-fns#format.
|
|
13057
|
+
formatStr = matches.reduce(function (result, token) {
|
|
13058
|
+
if (token[0] === "'") {
|
|
13059
|
+
return result; // This is a quoted portion, matched only to ensure we don't match inside it
|
|
13060
|
+
}
|
|
13061
|
+
const pos = result.indexOf(token);
|
|
13062
|
+
const precededByQuotedSection = result[pos - 1] === "'";
|
|
13063
|
+
const replaced = result.replace(token, "'" + _formatters_index_js__WEBPACK_IMPORTED_MODULE_0__.formatters[token[0]](d, token, options) + "'");
|
|
13064
|
+
// If the replacement results in two adjoining quoted strings, the back to back quotes
|
|
13065
|
+
// are removed, so it doesn't look like an escaped quote.
|
|
13066
|
+
return precededByQuotedSection
|
|
13067
|
+
? replaced.substring(0, pos - 1) + replaced.substring(pos + 1)
|
|
13068
|
+
: replaced;
|
|
13069
|
+
}, formatStr);
|
|
13070
|
+
}
|
|
13071
|
+
return (0,date_fns_format__WEBPACK_IMPORTED_MODULE_2__.format)(date, formatStr, options);
|
|
13072
|
+
}
|
|
13073
|
+
|
|
13074
|
+
|
|
13075
|
+
/***/ }),
|
|
13076
|
+
|
|
13077
|
+
/***/ "./node_modules/date-fns-tz/dist/esm/fromZonedTime/index.js":
|
|
13078
|
+
/*!******************************************************************!*\
|
|
13079
|
+
!*** ./node_modules/date-fns-tz/dist/esm/fromZonedTime/index.js ***!
|
|
13080
|
+
\******************************************************************/
|
|
13081
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
13082
|
+
|
|
13083
|
+
"use strict";
|
|
13084
|
+
__webpack_require__.r(__webpack_exports__);
|
|
13085
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
13086
|
+
/* harmony export */ fromZonedTime: () => (/* binding */ fromZonedTime)
|
|
13087
|
+
/* harmony export */ });
|
|
13088
|
+
/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns-tz/dist/esm/toDate/index.js");
|
|
13089
|
+
/* harmony import */ var _lib_tzPattern_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../_lib/tzPattern/index.js */ "./node_modules/date-fns-tz/dist/esm/_lib/tzPattern/index.js");
|
|
13090
|
+
/* harmony import */ var _lib_tzParseTimezone_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../_lib/tzParseTimezone/index.js */ "./node_modules/date-fns-tz/dist/esm/_lib/tzParseTimezone/index.js");
|
|
13091
|
+
/* harmony import */ var _lib_newDateUTC_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../_lib/newDateUTC/index.js */ "./node_modules/date-fns-tz/dist/esm/_lib/newDateUTC/index.js");
|
|
13092
|
+
|
|
13093
|
+
|
|
13094
|
+
|
|
13095
|
+
|
|
13096
|
+
/**
|
|
13097
|
+
* @name fromZonedTime
|
|
13098
|
+
* @category Time Zone Helpers
|
|
13099
|
+
* @summary Get the UTC date/time from a date representing local time in a given time zone
|
|
13100
|
+
*
|
|
13101
|
+
* @description
|
|
13102
|
+
* Returns a date instance with the UTC time of the provided date of which the values
|
|
13103
|
+
* represented the local time in the time zone specified. In other words, if the input
|
|
13104
|
+
* date represented local time in time zone, the timestamp of the output date will
|
|
13105
|
+
* give the equivalent UTC of that local time regardless of the current system time zone.
|
|
13106
|
+
*
|
|
13107
|
+
* @param date the date with values representing the local time
|
|
13108
|
+
* @param timeZone the time zone of this local time, can be an offset or IANA time zone
|
|
13109
|
+
* @param options the object with options. See [Options]{@link https://date-fns.org/docs/Options}
|
|
13110
|
+
* @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
|
|
13111
|
+
* @throws {TypeError} 2 arguments required
|
|
13112
|
+
* @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
|
|
13113
|
+
*
|
|
13114
|
+
* @example
|
|
13115
|
+
* // In June 10am in Los Angeles is 5pm UTC
|
|
13116
|
+
* const result = fromZonedTime(new Date(2014, 5, 25, 10, 0, 0), 'America/Los_Angeles')
|
|
13117
|
+
* //=> 2014-06-25T17:00:00.000Z
|
|
13118
|
+
*/
|
|
13119
|
+
function fromZonedTime(date, timeZone, options) {
|
|
13120
|
+
if (typeof date === 'string' && !date.match(_lib_tzPattern_index_js__WEBPACK_IMPORTED_MODULE_1__.tzPattern)) {
|
|
13121
|
+
return (0,_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__.toDate)(date, { ...options, timeZone });
|
|
13122
|
+
}
|
|
13123
|
+
date = (0,_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__.toDate)(date, options);
|
|
13124
|
+
const utc = (0,_lib_newDateUTC_index_js__WEBPACK_IMPORTED_MODULE_3__.newDateUTC)(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()).getTime();
|
|
13125
|
+
const offsetMilliseconds = (0,_lib_tzParseTimezone_index_js__WEBPACK_IMPORTED_MODULE_2__.tzParseTimezone)(timeZone, new Date(utc));
|
|
13126
|
+
return new Date(utc + offsetMilliseconds);
|
|
13127
|
+
}
|
|
13128
|
+
|
|
13129
|
+
|
|
13130
|
+
/***/ }),
|
|
13131
|
+
|
|
13132
|
+
/***/ "./node_modules/date-fns-tz/dist/esm/getTimezoneOffset/index.js":
|
|
13133
|
+
/*!**********************************************************************!*\
|
|
13134
|
+
!*** ./node_modules/date-fns-tz/dist/esm/getTimezoneOffset/index.js ***!
|
|
13135
|
+
\**********************************************************************/
|
|
13136
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
13137
|
+
|
|
13138
|
+
"use strict";
|
|
13139
|
+
__webpack_require__.r(__webpack_exports__);
|
|
13140
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
13141
|
+
/* harmony export */ getTimezoneOffset: () => (/* binding */ getTimezoneOffset)
|
|
13142
|
+
/* harmony export */ });
|
|
13143
|
+
/* harmony import */ var _lib_tzParseTimezone_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/tzParseTimezone/index.js */ "./node_modules/date-fns-tz/dist/esm/_lib/tzParseTimezone/index.js");
|
|
13144
|
+
|
|
13145
|
+
/**
|
|
13146
|
+
* @name getTimezoneOffset
|
|
13147
|
+
* @category Time Zone Helpers
|
|
13148
|
+
* @summary Gets the offset in milliseconds between the time zone and Universal Coordinated Time (UTC)
|
|
13149
|
+
*
|
|
13150
|
+
* @description
|
|
13151
|
+
* Returns the time zone offset from UTC time in milliseconds for IANA time zones as well
|
|
13152
|
+
* as other time zone offset string formats.
|
|
13153
|
+
*
|
|
13154
|
+
* For time zones where daylight savings time is applicable a `Date` should be passed on
|
|
13155
|
+
* the second parameter to ensure the offset correctly accounts for DST at that time of
|
|
13156
|
+
* year. When omitted, the current date is used.
|
|
13157
|
+
*
|
|
13158
|
+
* @param timeZone the time zone of this local time, can be an offset or IANA time zone
|
|
13159
|
+
* @param date the date with values representing the local time
|
|
13160
|
+
*
|
|
13161
|
+
* @example
|
|
13162
|
+
* const result = getTimezoneOffset('-07:00')
|
|
13163
|
+
* //=> -18000000 (-7 * 60 * 60 * 1000)
|
|
13164
|
+
* const result = getTimezoneOffset('Africa/Johannesburg')
|
|
13165
|
+
* //=> 7200000 (2 * 60 * 60 * 1000)
|
|
13166
|
+
* const result = getTimezoneOffset('America/New_York', new Date(2016, 0, 1))
|
|
13167
|
+
* //=> -18000000 (-5 * 60 * 60 * 1000)
|
|
13168
|
+
* const result = getTimezoneOffset('America/New_York', new Date(2016, 6, 1))
|
|
13169
|
+
* //=> -14400000 (-4 * 60 * 60 * 1000)
|
|
13170
|
+
*/
|
|
13171
|
+
function getTimezoneOffset(timeZone, date) {
|
|
13172
|
+
return -(0,_lib_tzParseTimezone_index_js__WEBPACK_IMPORTED_MODULE_0__.tzParseTimezone)(timeZone, date);
|
|
13173
|
+
}
|
|
13174
|
+
|
|
13175
|
+
|
|
13176
|
+
/***/ }),
|
|
13177
|
+
|
|
13178
|
+
/***/ "./node_modules/date-fns-tz/dist/esm/index.js":
|
|
13179
|
+
/*!****************************************************!*\
|
|
13180
|
+
!*** ./node_modules/date-fns-tz/dist/esm/index.js ***!
|
|
13181
|
+
\****************************************************/
|
|
13182
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
13183
|
+
|
|
13184
|
+
"use strict";
|
|
13185
|
+
__webpack_require__.r(__webpack_exports__);
|
|
13186
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
13187
|
+
/* harmony export */ format: () => (/* reexport safe */ _format_index_js__WEBPACK_IMPORTED_MODULE_0__.format),
|
|
13188
|
+
/* harmony export */ formatInTimeZone: () => (/* reexport safe */ _formatInTimeZone_index_js__WEBPACK_IMPORTED_MODULE_1__.formatInTimeZone),
|
|
13189
|
+
/* harmony export */ fromZonedTime: () => (/* reexport safe */ _fromZonedTime_index_js__WEBPACK_IMPORTED_MODULE_2__.fromZonedTime),
|
|
13190
|
+
/* harmony export */ getTimezoneOffset: () => (/* reexport safe */ _getTimezoneOffset_index_js__WEBPACK_IMPORTED_MODULE_4__.getTimezoneOffset),
|
|
13191
|
+
/* harmony export */ toDate: () => (/* reexport safe */ _toDate_index_js__WEBPACK_IMPORTED_MODULE_5__.toDate),
|
|
13192
|
+
/* harmony export */ toZonedTime: () => (/* reexport safe */ _toZonedTime_index_js__WEBPACK_IMPORTED_MODULE_3__.toZonedTime)
|
|
13193
|
+
/* harmony export */ });
|
|
13194
|
+
/* harmony import */ var _format_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./format/index.js */ "./node_modules/date-fns-tz/dist/esm/format/index.js");
|
|
13195
|
+
/* harmony import */ var _formatInTimeZone_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./formatInTimeZone/index.js */ "./node_modules/date-fns-tz/dist/esm/formatInTimeZone/index.js");
|
|
13196
|
+
/* harmony import */ var _fromZonedTime_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fromZonedTime/index.js */ "./node_modules/date-fns-tz/dist/esm/fromZonedTime/index.js");
|
|
13197
|
+
/* harmony import */ var _toZonedTime_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./toZonedTime/index.js */ "./node_modules/date-fns-tz/dist/esm/toZonedTime/index.js");
|
|
13198
|
+
/* harmony import */ var _getTimezoneOffset_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./getTimezoneOffset/index.js */ "./node_modules/date-fns-tz/dist/esm/getTimezoneOffset/index.js");
|
|
13199
|
+
/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./toDate/index.js */ "./node_modules/date-fns-tz/dist/esm/toDate/index.js");
|
|
13200
|
+
|
|
13201
|
+
|
|
13202
|
+
|
|
13203
|
+
|
|
13204
|
+
|
|
13205
|
+
|
|
13206
|
+
|
|
13207
|
+
|
|
13208
|
+
/***/ }),
|
|
13209
|
+
|
|
13210
|
+
/***/ "./node_modules/date-fns-tz/dist/esm/toDate/index.js":
|
|
13211
|
+
/*!***********************************************************!*\
|
|
13212
|
+
!*** ./node_modules/date-fns-tz/dist/esm/toDate/index.js ***!
|
|
13213
|
+
\***********************************************************/
|
|
13214
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
13215
|
+
|
|
13216
|
+
"use strict";
|
|
13217
|
+
__webpack_require__.r(__webpack_exports__);
|
|
13218
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
13219
|
+
/* harmony export */ toDate: () => (/* binding */ toDate)
|
|
13220
|
+
/* harmony export */ });
|
|
13221
|
+
/* harmony import */ var _lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/getTimezoneOffsetInMilliseconds/index.js */ "./node_modules/date-fns-tz/dist/esm/_lib/getTimezoneOffsetInMilliseconds/index.js");
|
|
13222
|
+
/* harmony import */ var _lib_tzParseTimezone_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../_lib/tzParseTimezone/index.js */ "./node_modules/date-fns-tz/dist/esm/_lib/tzParseTimezone/index.js");
|
|
13223
|
+
/* harmony import */ var _lib_tzPattern_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../_lib/tzPattern/index.js */ "./node_modules/date-fns-tz/dist/esm/_lib/tzPattern/index.js");
|
|
13224
|
+
|
|
13225
|
+
|
|
13226
|
+
|
|
13227
|
+
const MILLISECONDS_IN_HOUR = 3600000;
|
|
13228
|
+
const MILLISECONDS_IN_MINUTE = 60000;
|
|
13229
|
+
const DEFAULT_ADDITIONAL_DIGITS = 2;
|
|
13230
|
+
const patterns = {
|
|
13231
|
+
dateTimePattern: /^([0-9W+-]+)(T| )(.*)/,
|
|
13232
|
+
datePattern: /^([0-9W+-]+)(.*)/,
|
|
13233
|
+
plainTime: /:/,
|
|
13234
|
+
// year tokens
|
|
13235
|
+
YY: /^(\d{2})$/,
|
|
13236
|
+
YYY: [
|
|
13237
|
+
/^([+-]\d{2})$/, // 0 additional digits
|
|
13238
|
+
/^([+-]\d{3})$/, // 1 additional digit
|
|
13239
|
+
/^([+-]\d{4})$/, // 2 additional digits
|
|
13240
|
+
],
|
|
13241
|
+
YYYY: /^(\d{4})/,
|
|
13242
|
+
YYYYY: [
|
|
13243
|
+
/^([+-]\d{4})/, // 0 additional digits
|
|
13244
|
+
/^([+-]\d{5})/, // 1 additional digit
|
|
13245
|
+
/^([+-]\d{6})/, // 2 additional digits
|
|
13246
|
+
],
|
|
13247
|
+
// date tokens
|
|
13248
|
+
MM: /^-(\d{2})$/,
|
|
13249
|
+
DDD: /^-?(\d{3})$/,
|
|
13250
|
+
MMDD: /^-?(\d{2})-?(\d{2})$/,
|
|
13251
|
+
Www: /^-?W(\d{2})$/,
|
|
13252
|
+
WwwD: /^-?W(\d{2})-?(\d{1})$/,
|
|
13253
|
+
HH: /^(\d{2}([.,]\d*)?)$/,
|
|
13254
|
+
HHMM: /^(\d{2}):?(\d{2}([.,]\d*)?)$/,
|
|
13255
|
+
HHMMSS: /^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,
|
|
13256
|
+
// time zone tokens (to identify the presence of a tz)
|
|
13257
|
+
timeZone: _lib_tzPattern_index_js__WEBPACK_IMPORTED_MODULE_2__.tzPattern,
|
|
13258
|
+
};
|
|
13259
|
+
/**
|
|
13260
|
+
* @name toDate
|
|
13261
|
+
* @category Common Helpers
|
|
13262
|
+
* @summary Convert the given argument to an instance of Date.
|
|
13263
|
+
*
|
|
13264
|
+
* @description
|
|
13265
|
+
* Convert the given argument to an instance of Date.
|
|
13266
|
+
*
|
|
13267
|
+
* If the argument is an instance of Date, the function returns its clone.
|
|
13268
|
+
*
|
|
13269
|
+
* If the argument is a number, it is treated as a timestamp.
|
|
13270
|
+
*
|
|
13271
|
+
* If an argument is a string, the function tries to parse it.
|
|
13272
|
+
* Function accepts complete ISO 8601 formats as well as partial implementations.
|
|
13273
|
+
* ISO 8601: http://en.wikipedia.org/wiki/ISO_8601
|
|
13274
|
+
* If the function cannot parse the string or the values are invalid, it returns Invalid Date.
|
|
13275
|
+
*
|
|
13276
|
+
* If the argument is none of the above, the function returns Invalid Date.
|
|
13277
|
+
*
|
|
13278
|
+
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
|
|
13279
|
+
* All *date-fns* functions will throw `RangeError` if `options.additionalDigits` is not 0, 1, 2 or undefined.
|
|
13280
|
+
*
|
|
13281
|
+
* @param argument the value to convert
|
|
13282
|
+
* @param options the object with options. See [Options]{@link https://date-fns.org/docs/Options}
|
|
13283
|
+
* @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format
|
|
13284
|
+
* @param {string} [options.timeZone=''] - used to specify the IANA time zone offset of a date String.
|
|
13285
|
+
*
|
|
13286
|
+
* @returns the parsed date in the local time zone
|
|
13287
|
+
* @throws {TypeError} 1 argument required
|
|
13288
|
+
* @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
|
|
13289
|
+
*
|
|
13290
|
+
* @example
|
|
13291
|
+
* // Convert string '2014-02-11T11:30:30' to date:
|
|
13292
|
+
* const result = toDate('2014-02-11T11:30:30')
|
|
13293
|
+
* //=> Tue Feb 11 2014 11:30:30
|
|
13294
|
+
*
|
|
13295
|
+
* @example
|
|
13296
|
+
* // Convert string '+02014101' to date,
|
|
13297
|
+
* // if the additional number of digits in the extended year format is 1:
|
|
13298
|
+
* const result = toDate('+02014101', {additionalDigits: 1})
|
|
13299
|
+
* //=> Fri Apr 11 2014 00:00:00
|
|
13300
|
+
*/
|
|
13301
|
+
function toDate(argument, options = {}) {
|
|
13302
|
+
if (arguments.length < 1) {
|
|
13303
|
+
throw new TypeError('1 argument required, but only ' + arguments.length + ' present');
|
|
13304
|
+
}
|
|
13305
|
+
if (argument === null) {
|
|
13306
|
+
return new Date(NaN);
|
|
13307
|
+
}
|
|
13308
|
+
const additionalDigits = options.additionalDigits == null ? DEFAULT_ADDITIONAL_DIGITS : Number(options.additionalDigits);
|
|
13309
|
+
if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {
|
|
13310
|
+
throw new RangeError('additionalDigits must be 0, 1 or 2');
|
|
13311
|
+
}
|
|
13312
|
+
// Clone the date
|
|
13313
|
+
if (argument instanceof Date ||
|
|
13314
|
+
(typeof argument === 'object' && Object.prototype.toString.call(argument) === '[object Date]')) {
|
|
13315
|
+
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
|
|
13316
|
+
return new Date(argument.getTime());
|
|
13317
|
+
}
|
|
13318
|
+
else if (typeof argument === 'number' ||
|
|
13319
|
+
Object.prototype.toString.call(argument) === '[object Number]') {
|
|
13320
|
+
return new Date(argument);
|
|
13321
|
+
}
|
|
13322
|
+
else if (!(Object.prototype.toString.call(argument) === '[object String]')) {
|
|
13323
|
+
return new Date(NaN);
|
|
13324
|
+
}
|
|
13325
|
+
const dateStrings = splitDateString(argument);
|
|
13326
|
+
const { year, restDateString } = parseYear(dateStrings.date, additionalDigits);
|
|
13327
|
+
const date = parseDate(restDateString, year);
|
|
13328
|
+
if (date === null || isNaN(date.getTime())) {
|
|
13329
|
+
return new Date(NaN);
|
|
13330
|
+
}
|
|
13331
|
+
if (date) {
|
|
13332
|
+
const timestamp = date.getTime();
|
|
13333
|
+
let time = 0;
|
|
13334
|
+
let offset;
|
|
13335
|
+
if (dateStrings.time) {
|
|
13336
|
+
time = parseTime(dateStrings.time);
|
|
13337
|
+
if (time === null || isNaN(time)) {
|
|
13338
|
+
return new Date(NaN);
|
|
13339
|
+
}
|
|
13340
|
+
}
|
|
13341
|
+
if (dateStrings.timeZone || options.timeZone) {
|
|
13342
|
+
offset = (0,_lib_tzParseTimezone_index_js__WEBPACK_IMPORTED_MODULE_1__.tzParseTimezone)(dateStrings.timeZone || options.timeZone, new Date(timestamp + time));
|
|
13343
|
+
if (isNaN(offset)) {
|
|
13344
|
+
return new Date(NaN);
|
|
13345
|
+
}
|
|
13346
|
+
}
|
|
13347
|
+
else {
|
|
13348
|
+
// get offset accurate to hour in time zones that change offset
|
|
13349
|
+
offset = (0,_lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__.getTimezoneOffsetInMilliseconds)(new Date(timestamp + time));
|
|
13350
|
+
offset = (0,_lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__.getTimezoneOffsetInMilliseconds)(new Date(timestamp + time + offset));
|
|
13351
|
+
}
|
|
13352
|
+
return new Date(timestamp + time + offset);
|
|
13353
|
+
}
|
|
13354
|
+
else {
|
|
13355
|
+
return new Date(NaN);
|
|
13356
|
+
}
|
|
13357
|
+
}
|
|
13358
|
+
function splitDateString(dateString) {
|
|
13359
|
+
const dateStrings = {};
|
|
13360
|
+
let parts = patterns.dateTimePattern.exec(dateString);
|
|
13361
|
+
let timeString;
|
|
13362
|
+
if (!parts) {
|
|
13363
|
+
parts = patterns.datePattern.exec(dateString);
|
|
13364
|
+
if (parts) {
|
|
13365
|
+
dateStrings.date = parts[1];
|
|
13366
|
+
timeString = parts[2];
|
|
13367
|
+
}
|
|
13368
|
+
else {
|
|
13369
|
+
dateStrings.date = null;
|
|
13370
|
+
timeString = dateString;
|
|
13371
|
+
}
|
|
13372
|
+
}
|
|
13373
|
+
else {
|
|
13374
|
+
dateStrings.date = parts[1];
|
|
13375
|
+
timeString = parts[3];
|
|
13376
|
+
}
|
|
13377
|
+
if (timeString) {
|
|
13378
|
+
const token = patterns.timeZone.exec(timeString);
|
|
13379
|
+
if (token) {
|
|
13380
|
+
dateStrings.time = timeString.replace(token[1], '');
|
|
13381
|
+
dateStrings.timeZone = token[1].trim();
|
|
13382
|
+
}
|
|
13383
|
+
else {
|
|
13384
|
+
dateStrings.time = timeString;
|
|
13385
|
+
}
|
|
13386
|
+
}
|
|
13387
|
+
return dateStrings;
|
|
13388
|
+
}
|
|
13389
|
+
function parseYear(dateString, additionalDigits) {
|
|
13390
|
+
if (dateString) {
|
|
13391
|
+
const patternYYY = patterns.YYY[additionalDigits];
|
|
13392
|
+
const patternYYYYY = patterns.YYYYY[additionalDigits];
|
|
13393
|
+
// YYYY or ±YYYYY
|
|
13394
|
+
let token = patterns.YYYY.exec(dateString) || patternYYYYY.exec(dateString);
|
|
13395
|
+
if (token) {
|
|
13396
|
+
const yearString = token[1];
|
|
13397
|
+
return {
|
|
13398
|
+
year: parseInt(yearString, 10),
|
|
13399
|
+
restDateString: dateString.slice(yearString.length),
|
|
13400
|
+
};
|
|
13401
|
+
}
|
|
13402
|
+
// YY or ±YYY
|
|
13403
|
+
token = patterns.YY.exec(dateString) || patternYYY.exec(dateString);
|
|
13404
|
+
if (token) {
|
|
13405
|
+
const centuryString = token[1];
|
|
13406
|
+
return {
|
|
13407
|
+
year: parseInt(centuryString, 10) * 100,
|
|
13408
|
+
restDateString: dateString.slice(centuryString.length),
|
|
13409
|
+
};
|
|
13410
|
+
}
|
|
13411
|
+
}
|
|
13412
|
+
// Invalid ISO-formatted year
|
|
13413
|
+
return {
|
|
13414
|
+
year: null,
|
|
13415
|
+
};
|
|
13416
|
+
}
|
|
13417
|
+
function parseDate(dateString, year) {
|
|
13418
|
+
// Invalid ISO-formatted year
|
|
13419
|
+
if (year === null) {
|
|
13420
|
+
return null;
|
|
13421
|
+
}
|
|
13422
|
+
let date;
|
|
13423
|
+
let month;
|
|
13424
|
+
let week;
|
|
13425
|
+
// YYYY
|
|
13426
|
+
if (!dateString || !dateString.length) {
|
|
13427
|
+
date = new Date(0);
|
|
13428
|
+
date.setUTCFullYear(year);
|
|
13429
|
+
return date;
|
|
13430
|
+
}
|
|
13431
|
+
// YYYY-MM
|
|
13432
|
+
let token = patterns.MM.exec(dateString);
|
|
13433
|
+
if (token) {
|
|
13434
|
+
date = new Date(0);
|
|
13435
|
+
month = parseInt(token[1], 10) - 1;
|
|
13436
|
+
if (!validateDate(year, month)) {
|
|
13437
|
+
return new Date(NaN);
|
|
13438
|
+
}
|
|
13439
|
+
date.setUTCFullYear(year, month);
|
|
13440
|
+
return date;
|
|
13441
|
+
}
|
|
13442
|
+
// YYYY-DDD or YYYYDDD
|
|
13443
|
+
token = patterns.DDD.exec(dateString);
|
|
13444
|
+
if (token) {
|
|
13445
|
+
date = new Date(0);
|
|
13446
|
+
const dayOfYear = parseInt(token[1], 10);
|
|
13447
|
+
if (!validateDayOfYearDate(year, dayOfYear)) {
|
|
13448
|
+
return new Date(NaN);
|
|
13449
|
+
}
|
|
13450
|
+
date.setUTCFullYear(year, 0, dayOfYear);
|
|
13451
|
+
return date;
|
|
13452
|
+
}
|
|
13453
|
+
// yyyy-MM-dd or YYYYMMDD
|
|
13454
|
+
token = patterns.MMDD.exec(dateString);
|
|
13455
|
+
if (token) {
|
|
13456
|
+
date = new Date(0);
|
|
13457
|
+
month = parseInt(token[1], 10) - 1;
|
|
13458
|
+
const day = parseInt(token[2], 10);
|
|
13459
|
+
if (!validateDate(year, month, day)) {
|
|
13460
|
+
return new Date(NaN);
|
|
13461
|
+
}
|
|
13462
|
+
date.setUTCFullYear(year, month, day);
|
|
13463
|
+
return date;
|
|
13464
|
+
}
|
|
13465
|
+
// YYYY-Www or YYYYWww
|
|
13466
|
+
token = patterns.Www.exec(dateString);
|
|
13467
|
+
if (token) {
|
|
13468
|
+
week = parseInt(token[1], 10) - 1;
|
|
13469
|
+
if (!validateWeekDate(week)) {
|
|
13470
|
+
return new Date(NaN);
|
|
13471
|
+
}
|
|
13472
|
+
return dayOfISOWeekYear(year, week);
|
|
13473
|
+
}
|
|
13474
|
+
// YYYY-Www-D or YYYYWwwD
|
|
13475
|
+
token = patterns.WwwD.exec(dateString);
|
|
13476
|
+
if (token) {
|
|
13477
|
+
week = parseInt(token[1], 10) - 1;
|
|
13478
|
+
const dayOfWeek = parseInt(token[2], 10) - 1;
|
|
13479
|
+
if (!validateWeekDate(week, dayOfWeek)) {
|
|
13480
|
+
return new Date(NaN);
|
|
13481
|
+
}
|
|
13482
|
+
return dayOfISOWeekYear(year, week, dayOfWeek);
|
|
13483
|
+
}
|
|
13484
|
+
// Invalid ISO-formatted date
|
|
13485
|
+
return null;
|
|
13486
|
+
}
|
|
13487
|
+
function parseTime(timeString) {
|
|
13488
|
+
let hours;
|
|
13489
|
+
let minutes;
|
|
13490
|
+
// hh
|
|
13491
|
+
let token = patterns.HH.exec(timeString);
|
|
13492
|
+
if (token) {
|
|
13493
|
+
hours = parseFloat(token[1].replace(',', '.'));
|
|
13494
|
+
if (!validateTime(hours)) {
|
|
13495
|
+
return NaN;
|
|
13496
|
+
}
|
|
13497
|
+
return (hours % 24) * MILLISECONDS_IN_HOUR;
|
|
13498
|
+
}
|
|
13499
|
+
// hh:mm or hhmm
|
|
13500
|
+
token = patterns.HHMM.exec(timeString);
|
|
13501
|
+
if (token) {
|
|
13502
|
+
hours = parseInt(token[1], 10);
|
|
13503
|
+
minutes = parseFloat(token[2].replace(',', '.'));
|
|
13504
|
+
if (!validateTime(hours, minutes)) {
|
|
13505
|
+
return NaN;
|
|
13506
|
+
}
|
|
13507
|
+
return (hours % 24) * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE;
|
|
13508
|
+
}
|
|
13509
|
+
// hh:mm:ss or hhmmss
|
|
13510
|
+
token = patterns.HHMMSS.exec(timeString);
|
|
13511
|
+
if (token) {
|
|
13512
|
+
hours = parseInt(token[1], 10);
|
|
13513
|
+
minutes = parseInt(token[2], 10);
|
|
13514
|
+
const seconds = parseFloat(token[3].replace(',', '.'));
|
|
13515
|
+
if (!validateTime(hours, minutes, seconds)) {
|
|
13516
|
+
return NaN;
|
|
13517
|
+
}
|
|
13518
|
+
return (hours % 24) * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE + seconds * 1000;
|
|
13519
|
+
}
|
|
13520
|
+
// Invalid ISO-formatted time
|
|
13521
|
+
return null;
|
|
13522
|
+
}
|
|
13523
|
+
function dayOfISOWeekYear(isoWeekYear, week, day) {
|
|
13524
|
+
week = week || 0;
|
|
13525
|
+
day = day || 0;
|
|
13526
|
+
const date = new Date(0);
|
|
13527
|
+
date.setUTCFullYear(isoWeekYear, 0, 4);
|
|
13528
|
+
const fourthOfJanuaryDay = date.getUTCDay() || 7;
|
|
13529
|
+
const diff = week * 7 + day + 1 - fourthOfJanuaryDay;
|
|
13530
|
+
date.setUTCDate(date.getUTCDate() + diff);
|
|
13531
|
+
return date;
|
|
13532
|
+
}
|
|
13533
|
+
// Validation functions
|
|
13534
|
+
const DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
13535
|
+
const DAYS_IN_MONTH_LEAP_YEAR = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
13536
|
+
function isLeapYearIndex(year) {
|
|
13537
|
+
return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0);
|
|
13538
|
+
}
|
|
13539
|
+
function validateDate(year, month, date) {
|
|
13540
|
+
if (month < 0 || month > 11) {
|
|
13541
|
+
return false;
|
|
13542
|
+
}
|
|
13543
|
+
if (date != null) {
|
|
13544
|
+
if (date < 1) {
|
|
13545
|
+
return false;
|
|
13546
|
+
}
|
|
13547
|
+
const isLeapYear = isLeapYearIndex(year);
|
|
13548
|
+
if (isLeapYear && date > DAYS_IN_MONTH_LEAP_YEAR[month]) {
|
|
13549
|
+
return false;
|
|
13550
|
+
}
|
|
13551
|
+
if (!isLeapYear && date > DAYS_IN_MONTH[month]) {
|
|
13552
|
+
return false;
|
|
13553
|
+
}
|
|
13554
|
+
}
|
|
13555
|
+
return true;
|
|
13556
|
+
}
|
|
13557
|
+
function validateDayOfYearDate(year, dayOfYear) {
|
|
13558
|
+
if (dayOfYear < 1) {
|
|
13559
|
+
return false;
|
|
13560
|
+
}
|
|
13561
|
+
const isLeapYear = isLeapYearIndex(year);
|
|
13562
|
+
if (isLeapYear && dayOfYear > 366) {
|
|
13563
|
+
return false;
|
|
13564
|
+
}
|
|
13565
|
+
if (!isLeapYear && dayOfYear > 365) {
|
|
13566
|
+
return false;
|
|
13567
|
+
}
|
|
13568
|
+
return true;
|
|
13569
|
+
}
|
|
13570
|
+
function validateWeekDate(week, day) {
|
|
13571
|
+
if (week < 0 || week > 52) {
|
|
13572
|
+
return false;
|
|
13573
|
+
}
|
|
13574
|
+
if (day != null && (day < 0 || day > 6)) {
|
|
13575
|
+
return false;
|
|
13576
|
+
}
|
|
13577
|
+
return true;
|
|
13578
|
+
}
|
|
13579
|
+
function validateTime(hours, minutes, seconds) {
|
|
13580
|
+
if (hours < 0 || hours >= 25) {
|
|
13581
|
+
return false;
|
|
13582
|
+
}
|
|
13583
|
+
if (minutes != null && (minutes < 0 || minutes >= 60)) {
|
|
13584
|
+
return false;
|
|
13585
|
+
}
|
|
13586
|
+
if (seconds != null && (seconds < 0 || seconds >= 60)) {
|
|
13587
|
+
return false;
|
|
13588
|
+
}
|
|
13589
|
+
return true;
|
|
13590
|
+
}
|
|
13591
|
+
|
|
13592
|
+
|
|
13593
|
+
/***/ }),
|
|
13594
|
+
|
|
13595
|
+
/***/ "./node_modules/date-fns-tz/dist/esm/toZonedTime/index.js":
|
|
13596
|
+
/*!****************************************************************!*\
|
|
13597
|
+
!*** ./node_modules/date-fns-tz/dist/esm/toZonedTime/index.js ***!
|
|
13598
|
+
\****************************************************************/
|
|
13599
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
13600
|
+
|
|
13601
|
+
"use strict";
|
|
13602
|
+
__webpack_require__.r(__webpack_exports__);
|
|
13603
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
13604
|
+
/* harmony export */ toZonedTime: () => (/* binding */ toZonedTime)
|
|
13605
|
+
/* harmony export */ });
|
|
13606
|
+
/* harmony import */ var _lib_tzParseTimezone_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/tzParseTimezone/index.js */ "./node_modules/date-fns-tz/dist/esm/_lib/tzParseTimezone/index.js");
|
|
13607
|
+
/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns-tz/dist/esm/toDate/index.js");
|
|
13608
|
+
|
|
13609
|
+
|
|
13610
|
+
/**
|
|
13611
|
+
* @name toZonedTime
|
|
13612
|
+
* @category Time Zone Helpers
|
|
13613
|
+
* @summary Get a date/time representing local time in a given time zone from the UTC date
|
|
13614
|
+
*
|
|
13615
|
+
* @description
|
|
13616
|
+
* Returns a date instance with values representing the local time in the time zone
|
|
13617
|
+
* specified of the UTC time from the date provided. In other words, when the new date
|
|
13618
|
+
* is formatted it will show the equivalent hours in the target time zone regardless
|
|
13619
|
+
* of the current system time zone.
|
|
13620
|
+
*
|
|
13621
|
+
* @param date the date with the relevant UTC time
|
|
13622
|
+
* @param timeZone the time zone to get local time for, can be an offset or IANA time zone
|
|
13623
|
+
* @param options the object with options. See [Options]{@link https://date-fns.org/docs/Options}
|
|
13624
|
+
* @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
|
|
13625
|
+
*
|
|
13626
|
+
* @throws {TypeError} 2 arguments required
|
|
13627
|
+
* @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
|
|
13628
|
+
*
|
|
13629
|
+
* @example
|
|
13630
|
+
* // In June 10am UTC is 6am in New York (-04:00)
|
|
13631
|
+
* const result = toZonedTime('2014-06-25T10:00:00.000Z', 'America/New_York')
|
|
13632
|
+
* //=> Jun 25 2014 06:00:00
|
|
13633
|
+
*/
|
|
13634
|
+
function toZonedTime(date, timeZone, options) {
|
|
13635
|
+
date = (0,_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__.toDate)(date, options);
|
|
13636
|
+
const offsetMilliseconds = (0,_lib_tzParseTimezone_index_js__WEBPACK_IMPORTED_MODULE_0__.tzParseTimezone)(timeZone, date, true);
|
|
13637
|
+
const d = new Date(date.getTime() - offsetMilliseconds);
|
|
13638
|
+
const resultDate = new Date(0);
|
|
13639
|
+
resultDate.setFullYear(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate());
|
|
13640
|
+
resultDate.setHours(d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), d.getUTCMilliseconds());
|
|
13641
|
+
return resultDate;
|
|
13642
|
+
}
|
|
13643
|
+
|
|
13644
|
+
|
|
12156
13645
|
/***/ }),
|
|
12157
13646
|
|
|
12158
13647
|
/***/ "./node_modules/date-fns/_lib/addLeadingZeros.js":
|