@articles-media/articles-dev-box 1.0.30 → 1.0.32
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/README.md +11 -3
- package/dist/Ad-BsG4C_lR.js +668 -0
- package/dist/Ad.js +2 -2
- package/dist/AdConfirmExitModal-heFPJNdX.js +55 -0
- package/dist/AdDetailsModal-D2-4lh9e.js +107 -0
- package/dist/ArticlesAd.js +15 -10
- package/dist/Button-DvEZjsVV.js +32 -0
- package/dist/CreditsModal.js +54 -34
- package/dist/DarkModeHandler.js +21 -13
- package/dist/FriendsList.js +49 -47
- package/dist/GameMenu-BD1HSDJ-.js +84 -0
- package/dist/GameMenu.js +2 -0
- package/dist/GameScoreboard-DVoXXDnM.js +174 -0
- package/dist/GameScoreboard.js +2 -2
- package/dist/GlobalBody.js +58 -23
- package/dist/GlobalHead.js +5 -5
- package/dist/Link-CguWJy6y.js +16 -0
- package/dist/ReturnToLauncherButton.js +26 -22
- package/dist/SessionButton.js +62 -38
- package/dist/SettingsModal-yU_TsVYh.js +430 -0
- package/dist/SettingsModal.js +2 -2
- package/dist/SignInButton.js +21 -17
- package/dist/SocketServerUrlHandler.js +14 -10
- package/dist/StatusModal-BXRbJQ10.js +84 -0
- package/dist/ToontownModeHandler.js +13 -10
- package/dist/ViewUserModal-Dgo1C4sR.js +1798 -0
- package/dist/ViewUserModal.js +2 -2
- package/dist/articles-dev-box.css +498 -2
- package/dist/classnames-No-mjhw1.js +66 -0
- package/dist/index.js +23 -22
- package/dist/numberWithCommas-B0B9bjWC.js +2198 -0
- package/dist/typicalZustandStoreExcludes.js +4 -3
- package/dist/typicalZustandStoreStateSlice.js +57 -46
- package/dist/useAuthSiteStatus-ZK1GbPBV.js +34 -0
- package/dist/useFullscreen.js +38 -18
- package/dist/useUserDetails.js +17 -16
- package/dist/useUserFriends.js +23 -21
- package/dist/useUserToken.js +12 -11
- package/package.json +2 -1
- package/dist/Ad-CFuDgQYL.js +0 -504
- package/dist/AdConfirmExitModal-skW9lp88.js +0 -55
- package/dist/AdDetailsModal-CdTR2Y9l.js +0 -107
- package/dist/Button-sSB4xpOw.js +0 -31
- package/dist/GameScoreboard-9GYlLx72.js +0 -165
- package/dist/Link-8nSDV4sI.js +0 -16
- package/dist/SettingsModal-gPPyBi4S.js +0 -302
- package/dist/StatusModal-PG3i9NKf.js +0 -75
- package/dist/ViewUserModal-C5gjfuJ5.js +0 -1549
- package/dist/classnames-DCsil9eG.js +0 -39
- package/dist/numberWithCommas-DSRplpBy.js +0 -1170
- package/dist/useAuthSiteStatus-Cj9IjMj7.js +0 -29
|
@@ -0,0 +1,2198 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
//#region node_modules/date-fns/constants.js
|
|
3
|
+
/**
|
|
4
|
+
* @constant
|
|
5
|
+
* @name daysInYear
|
|
6
|
+
* @summary Days in 1 year.
|
|
7
|
+
*
|
|
8
|
+
* @description
|
|
9
|
+
* How many days in a year.
|
|
10
|
+
*
|
|
11
|
+
* One years equals 365.2425 days according to the formula:
|
|
12
|
+
*
|
|
13
|
+
* > Leap year occurs every 4 years, except for years that are divisible by 100 and not divisible by 400.
|
|
14
|
+
* > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days
|
|
15
|
+
*/
|
|
16
|
+
var daysInYear = 365.2425;
|
|
17
|
+
-(Math.pow(10, 8) * 24 * 60 * 60 * 1e3);
|
|
18
|
+
/**
|
|
19
|
+
* @constant
|
|
20
|
+
* @name millisecondsInWeek
|
|
21
|
+
* @summary Milliseconds in 1 week.
|
|
22
|
+
*/
|
|
23
|
+
var millisecondsInWeek = 6048e5;
|
|
24
|
+
/**
|
|
25
|
+
* @constant
|
|
26
|
+
* @name millisecondsInDay
|
|
27
|
+
* @summary Milliseconds in 1 day.
|
|
28
|
+
*/
|
|
29
|
+
var millisecondsInDay = 864e5;
|
|
30
|
+
/**
|
|
31
|
+
* @constant
|
|
32
|
+
* @name millisecondsInMinute
|
|
33
|
+
* @summary Milliseconds in 1 minute
|
|
34
|
+
*/
|
|
35
|
+
var millisecondsInMinute = 6e4;
|
|
36
|
+
/**
|
|
37
|
+
* @constant
|
|
38
|
+
* @name secondsInDay
|
|
39
|
+
* @summary Seconds in 1 day.
|
|
40
|
+
*/
|
|
41
|
+
var secondsInDay = 3600 * 24;
|
|
42
|
+
secondsInDay * 7;
|
|
43
|
+
secondsInDay * daysInYear / 12 * 3;
|
|
44
|
+
/**
|
|
45
|
+
* @constant
|
|
46
|
+
* @name constructFromSymbol
|
|
47
|
+
* @summary Symbol enabling Date extensions to inherit properties from the reference date.
|
|
48
|
+
*
|
|
49
|
+
* The symbol is used to enable the `constructFrom` function to construct a date
|
|
50
|
+
* using a reference date and a value. It allows to transfer extra properties
|
|
51
|
+
* from the reference date to the new date. It's useful for extensions like
|
|
52
|
+
* [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as
|
|
53
|
+
* a constructor argument.
|
|
54
|
+
*/
|
|
55
|
+
var constructFromSymbol = Symbol.for("constructDateFrom");
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region node_modules/date-fns/constructFrom.js
|
|
58
|
+
/**
|
|
59
|
+
* @name constructFrom
|
|
60
|
+
* @category Generic Helpers
|
|
61
|
+
* @summary Constructs a date using the reference date and the value
|
|
62
|
+
*
|
|
63
|
+
* @description
|
|
64
|
+
* The function constructs a new date using the constructor from the reference
|
|
65
|
+
* date and the given value. It helps to build generic functions that accept
|
|
66
|
+
* date extensions.
|
|
67
|
+
*
|
|
68
|
+
* It defaults to `Date` if the passed reference date is a number or a string.
|
|
69
|
+
*
|
|
70
|
+
* Starting from v3.7.0, it allows to construct a date using `[Symbol.for("constructDateFrom")]`
|
|
71
|
+
* enabling to transfer extra properties from the reference date to the new date.
|
|
72
|
+
* It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)
|
|
73
|
+
* that accept a time zone as a constructor argument.
|
|
74
|
+
*
|
|
75
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
76
|
+
*
|
|
77
|
+
* @param date - The reference date to take constructor from
|
|
78
|
+
* @param value - The value to create the date
|
|
79
|
+
*
|
|
80
|
+
* @returns Date initialized using the given date and value
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* import { constructFrom } from "./constructFrom/date-fns";
|
|
84
|
+
*
|
|
85
|
+
* // A function that clones a date preserving the original type
|
|
86
|
+
* function cloneDate<DateType extends Date>(date: DateType): DateType {
|
|
87
|
+
* return constructFrom(
|
|
88
|
+
* date, // Use constructor from the given date
|
|
89
|
+
* date.getTime() // Use the date value to create a new date
|
|
90
|
+
* );
|
|
91
|
+
* }
|
|
92
|
+
*/
|
|
93
|
+
function constructFrom(date, value) {
|
|
94
|
+
if (typeof date === "function") return date(value);
|
|
95
|
+
if (date && typeof date === "object" && constructFromSymbol in date) return date[constructFromSymbol](value);
|
|
96
|
+
if (date instanceof Date) return new date.constructor(value);
|
|
97
|
+
return new Date(value);
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region node_modules/date-fns/toDate.js
|
|
101
|
+
/**
|
|
102
|
+
* @name toDate
|
|
103
|
+
* @category Common Helpers
|
|
104
|
+
* @summary Convert the given argument to an instance of Date.
|
|
105
|
+
*
|
|
106
|
+
* @description
|
|
107
|
+
* Convert the given argument to an instance of Date.
|
|
108
|
+
*
|
|
109
|
+
* If the argument is an instance of Date, the function returns its clone.
|
|
110
|
+
*
|
|
111
|
+
* If the argument is a number, it is treated as a timestamp.
|
|
112
|
+
*
|
|
113
|
+
* If the argument is none of the above, the function returns Invalid Date.
|
|
114
|
+
*
|
|
115
|
+
* Starting from v3.7.0, it clones a date using `[Symbol.for("constructDateFrom")]`
|
|
116
|
+
* enabling to transfer extra properties from the reference date to the new date.
|
|
117
|
+
* It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)
|
|
118
|
+
* that accept a time zone as a constructor argument.
|
|
119
|
+
*
|
|
120
|
+
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
|
|
121
|
+
*
|
|
122
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
123
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
124
|
+
*
|
|
125
|
+
* @param argument - The value to convert
|
|
126
|
+
*
|
|
127
|
+
* @returns The parsed date in the local time zone
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* // Clone the date:
|
|
131
|
+
* const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
|
|
132
|
+
* //=> Tue Feb 11 2014 11:30:30
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* // Convert the timestamp to date:
|
|
136
|
+
* const result = toDate(1392098430000)
|
|
137
|
+
* //=> Tue Feb 11 2014 11:30:30
|
|
138
|
+
*/
|
|
139
|
+
function toDate(argument, context) {
|
|
140
|
+
return constructFrom(context || argument, argument);
|
|
141
|
+
}
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region node_modules/date-fns/_lib/defaultOptions.js
|
|
144
|
+
var defaultOptions = {};
|
|
145
|
+
function getDefaultOptions() {
|
|
146
|
+
return defaultOptions;
|
|
147
|
+
}
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region node_modules/date-fns/startOfWeek.js
|
|
150
|
+
/**
|
|
151
|
+
* The {@link startOfWeek} function options.
|
|
152
|
+
*/
|
|
153
|
+
/**
|
|
154
|
+
* @name startOfWeek
|
|
155
|
+
* @category Week Helpers
|
|
156
|
+
* @summary Return the start of a week for the given date.
|
|
157
|
+
*
|
|
158
|
+
* @description
|
|
159
|
+
* Return the start of a week for the given date.
|
|
160
|
+
* The result will be in the local timezone.
|
|
161
|
+
*
|
|
162
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
163
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
164
|
+
*
|
|
165
|
+
* @param date - The original date
|
|
166
|
+
* @param options - An object with options
|
|
167
|
+
*
|
|
168
|
+
* @returns The start of a week
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* // The start of a week for 2 September 2014 11:55:00:
|
|
172
|
+
* const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
|
|
173
|
+
* //=> Sun Aug 31 2014 00:00:00
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
|
|
177
|
+
* const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
|
|
178
|
+
* //=> Mon Sep 01 2014 00:00:00
|
|
179
|
+
*/
|
|
180
|
+
function startOfWeek(date, options) {
|
|
181
|
+
const defaultOptions = getDefaultOptions();
|
|
182
|
+
const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0;
|
|
183
|
+
const _date = toDate(date, options?.in);
|
|
184
|
+
const day = _date.getDay();
|
|
185
|
+
const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
|
186
|
+
_date.setDate(_date.getDate() - diff);
|
|
187
|
+
_date.setHours(0, 0, 0, 0);
|
|
188
|
+
return _date;
|
|
189
|
+
}
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region node_modules/date-fns/startOfISOWeek.js
|
|
192
|
+
/**
|
|
193
|
+
* The {@link startOfISOWeek} function options.
|
|
194
|
+
*/
|
|
195
|
+
/**
|
|
196
|
+
* @name startOfISOWeek
|
|
197
|
+
* @category ISO Week Helpers
|
|
198
|
+
* @summary Return the start of an ISO week for the given date.
|
|
199
|
+
*
|
|
200
|
+
* @description
|
|
201
|
+
* Return the start of an ISO week for the given date.
|
|
202
|
+
* The result will be in the local timezone.
|
|
203
|
+
*
|
|
204
|
+
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
205
|
+
*
|
|
206
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
207
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
208
|
+
*
|
|
209
|
+
* @param date - The original date
|
|
210
|
+
* @param options - An object with options
|
|
211
|
+
*
|
|
212
|
+
* @returns The start of an ISO week
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* // The start of an ISO week for 2 September 2014 11:55:00:
|
|
216
|
+
* const result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))
|
|
217
|
+
* //=> Mon Sep 01 2014 00:00:00
|
|
218
|
+
*/
|
|
219
|
+
function startOfISOWeek(date, options) {
|
|
220
|
+
return startOfWeek(date, {
|
|
221
|
+
...options,
|
|
222
|
+
weekStartsOn: 1
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region node_modules/date-fns/getISOWeekYear.js
|
|
227
|
+
/**
|
|
228
|
+
* The {@link getISOWeekYear} function options.
|
|
229
|
+
*/
|
|
230
|
+
/**
|
|
231
|
+
* @name getISOWeekYear
|
|
232
|
+
* @category ISO Week-Numbering Year Helpers
|
|
233
|
+
* @summary Get the ISO week-numbering year of the given date.
|
|
234
|
+
*
|
|
235
|
+
* @description
|
|
236
|
+
* Get the ISO week-numbering year of the given date,
|
|
237
|
+
* which always starts 3 days before the year's first Thursday.
|
|
238
|
+
*
|
|
239
|
+
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
240
|
+
*
|
|
241
|
+
* @param date - The given date
|
|
242
|
+
*
|
|
243
|
+
* @returns The ISO week-numbering year
|
|
244
|
+
*
|
|
245
|
+
* @example
|
|
246
|
+
* // Which ISO-week numbering year is 2 January 2005?
|
|
247
|
+
* const result = getISOWeekYear(new Date(2005, 0, 2))
|
|
248
|
+
* //=> 2004
|
|
249
|
+
*/
|
|
250
|
+
function getISOWeekYear(date, options) {
|
|
251
|
+
const _date = toDate(date, options?.in);
|
|
252
|
+
const year = _date.getFullYear();
|
|
253
|
+
const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
|
|
254
|
+
fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
|
|
255
|
+
fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
|
|
256
|
+
const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
|
|
257
|
+
const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
|
|
258
|
+
fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
|
|
259
|
+
fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
|
|
260
|
+
const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
|
|
261
|
+
if (_date.getTime() >= startOfNextYear.getTime()) return year + 1;
|
|
262
|
+
else if (_date.getTime() >= startOfThisYear.getTime()) return year;
|
|
263
|
+
else return year - 1;
|
|
264
|
+
}
|
|
265
|
+
//#endregion
|
|
266
|
+
//#region node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
|
|
267
|
+
/**
|
|
268
|
+
* Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
|
|
269
|
+
* They usually appear for dates that denote time before the timezones were introduced
|
|
270
|
+
* (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
|
|
271
|
+
* and GMT+01:00:00 after that date)
|
|
272
|
+
*
|
|
273
|
+
* Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
|
|
274
|
+
* which would lead to incorrect calculations.
|
|
275
|
+
*
|
|
276
|
+
* This function returns the timezone offset in milliseconds that takes seconds in account.
|
|
277
|
+
*/
|
|
278
|
+
function getTimezoneOffsetInMilliseconds(date) {
|
|
279
|
+
const _date = toDate(date);
|
|
280
|
+
const utcDate = new Date(Date.UTC(_date.getFullYear(), _date.getMonth(), _date.getDate(), _date.getHours(), _date.getMinutes(), _date.getSeconds(), _date.getMilliseconds()));
|
|
281
|
+
utcDate.setUTCFullYear(_date.getFullYear());
|
|
282
|
+
return +date - +utcDate;
|
|
283
|
+
}
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region node_modules/date-fns/_lib/normalizeDates.js
|
|
286
|
+
function normalizeDates(context, ...dates) {
|
|
287
|
+
const normalize = constructFrom.bind(null, context || dates.find((date) => typeof date === "object"));
|
|
288
|
+
return dates.map(normalize);
|
|
289
|
+
}
|
|
290
|
+
//#endregion
|
|
291
|
+
//#region node_modules/date-fns/startOfDay.js
|
|
292
|
+
/**
|
|
293
|
+
* The {@link startOfDay} function options.
|
|
294
|
+
*/
|
|
295
|
+
/**
|
|
296
|
+
* @name startOfDay
|
|
297
|
+
* @category Day Helpers
|
|
298
|
+
* @summary Return the start of a day for the given date.
|
|
299
|
+
*
|
|
300
|
+
* @description
|
|
301
|
+
* Return the start of a day for the given date.
|
|
302
|
+
* The result will be in the local timezone.
|
|
303
|
+
*
|
|
304
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
305
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
306
|
+
*
|
|
307
|
+
* @param date - The original date
|
|
308
|
+
* @param options - The options
|
|
309
|
+
*
|
|
310
|
+
* @returns The start of a day
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* // The start of a day for 2 September 2014 11:55:00:
|
|
314
|
+
* const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
|
|
315
|
+
* //=> Tue Sep 02 2014 00:00:00
|
|
316
|
+
*/
|
|
317
|
+
function startOfDay(date, options) {
|
|
318
|
+
const _date = toDate(date, options?.in);
|
|
319
|
+
_date.setHours(0, 0, 0, 0);
|
|
320
|
+
return _date;
|
|
321
|
+
}
|
|
322
|
+
//#endregion
|
|
323
|
+
//#region node_modules/date-fns/differenceInCalendarDays.js
|
|
324
|
+
/**
|
|
325
|
+
* The {@link differenceInCalendarDays} function options.
|
|
326
|
+
*/
|
|
327
|
+
/**
|
|
328
|
+
* @name differenceInCalendarDays
|
|
329
|
+
* @category Day Helpers
|
|
330
|
+
* @summary Get the number of calendar days between the given dates.
|
|
331
|
+
*
|
|
332
|
+
* @description
|
|
333
|
+
* Get the number of calendar days between the given dates. This means that the times are removed
|
|
334
|
+
* from the dates and then the difference in days is calculated.
|
|
335
|
+
*
|
|
336
|
+
* @param laterDate - The later date
|
|
337
|
+
* @param earlierDate - The earlier date
|
|
338
|
+
* @param options - The options object
|
|
339
|
+
*
|
|
340
|
+
* @returns The number of calendar days
|
|
341
|
+
*
|
|
342
|
+
* @example
|
|
343
|
+
* // How many calendar days are between
|
|
344
|
+
* // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
|
|
345
|
+
* const result = differenceInCalendarDays(
|
|
346
|
+
* new Date(2012, 6, 2, 0, 0),
|
|
347
|
+
* new Date(2011, 6, 2, 23, 0)
|
|
348
|
+
* )
|
|
349
|
+
* //=> 366
|
|
350
|
+
* // How many calendar days are between
|
|
351
|
+
* // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
|
|
352
|
+
* const result = differenceInCalendarDays(
|
|
353
|
+
* new Date(2011, 6, 3, 0, 1),
|
|
354
|
+
* new Date(2011, 6, 2, 23, 59)
|
|
355
|
+
* )
|
|
356
|
+
* //=> 1
|
|
357
|
+
*/
|
|
358
|
+
function differenceInCalendarDays(laterDate, earlierDate, options) {
|
|
359
|
+
const [laterDate_, earlierDate_] = normalizeDates(options?.in, laterDate, earlierDate);
|
|
360
|
+
const laterStartOfDay = startOfDay(laterDate_);
|
|
361
|
+
const earlierStartOfDay = startOfDay(earlierDate_);
|
|
362
|
+
const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
|
|
363
|
+
const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
|
|
364
|
+
return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
|
|
365
|
+
}
|
|
366
|
+
//#endregion
|
|
367
|
+
//#region node_modules/date-fns/startOfISOWeekYear.js
|
|
368
|
+
/**
|
|
369
|
+
* The {@link startOfISOWeekYear} function options.
|
|
370
|
+
*/
|
|
371
|
+
/**
|
|
372
|
+
* @name startOfISOWeekYear
|
|
373
|
+
* @category ISO Week-Numbering Year Helpers
|
|
374
|
+
* @summary Return the start of an ISO week-numbering year for the given date.
|
|
375
|
+
*
|
|
376
|
+
* @description
|
|
377
|
+
* Return the start of an ISO week-numbering year,
|
|
378
|
+
* which always starts 3 days before the year's first Thursday.
|
|
379
|
+
* The result will be in the local timezone.
|
|
380
|
+
*
|
|
381
|
+
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
382
|
+
*
|
|
383
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
384
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
385
|
+
*
|
|
386
|
+
* @param date - The original date
|
|
387
|
+
* @param options - An object with options
|
|
388
|
+
*
|
|
389
|
+
* @returns The start of an ISO week-numbering year
|
|
390
|
+
*
|
|
391
|
+
* @example
|
|
392
|
+
* // The start of an ISO week-numbering year for 2 July 2005:
|
|
393
|
+
* const result = startOfISOWeekYear(new Date(2005, 6, 2))
|
|
394
|
+
* //=> Mon Jan 03 2005 00:00:00
|
|
395
|
+
*/
|
|
396
|
+
function startOfISOWeekYear(date, options) {
|
|
397
|
+
const year = getISOWeekYear(date, options);
|
|
398
|
+
const fourthOfJanuary = constructFrom(options?.in || date, 0);
|
|
399
|
+
fourthOfJanuary.setFullYear(year, 0, 4);
|
|
400
|
+
fourthOfJanuary.setHours(0, 0, 0, 0);
|
|
401
|
+
return startOfISOWeek(fourthOfJanuary);
|
|
402
|
+
}
|
|
403
|
+
//#endregion
|
|
404
|
+
//#region node_modules/date-fns/isDate.js
|
|
405
|
+
/**
|
|
406
|
+
* @name isDate
|
|
407
|
+
* @category Common Helpers
|
|
408
|
+
* @summary Is the given value a date?
|
|
409
|
+
*
|
|
410
|
+
* @description
|
|
411
|
+
* Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
|
|
412
|
+
*
|
|
413
|
+
* @param value - The value to check
|
|
414
|
+
*
|
|
415
|
+
* @returns True if the given value is a date
|
|
416
|
+
*
|
|
417
|
+
* @example
|
|
418
|
+
* // For a valid date:
|
|
419
|
+
* const result = isDate(new Date())
|
|
420
|
+
* //=> true
|
|
421
|
+
*
|
|
422
|
+
* @example
|
|
423
|
+
* // For an invalid date:
|
|
424
|
+
* const result = isDate(new Date(NaN))
|
|
425
|
+
* //=> true
|
|
426
|
+
*
|
|
427
|
+
* @example
|
|
428
|
+
* // For some value:
|
|
429
|
+
* const result = isDate('2014-02-31')
|
|
430
|
+
* //=> false
|
|
431
|
+
*
|
|
432
|
+
* @example
|
|
433
|
+
* // For an object:
|
|
434
|
+
* const result = isDate({})
|
|
435
|
+
* //=> false
|
|
436
|
+
*/
|
|
437
|
+
function isDate(value) {
|
|
438
|
+
return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
|
|
439
|
+
}
|
|
440
|
+
//#endregion
|
|
441
|
+
//#region node_modules/date-fns/isValid.js
|
|
442
|
+
/**
|
|
443
|
+
* @name isValid
|
|
444
|
+
* @category Common Helpers
|
|
445
|
+
* @summary Is the given date valid?
|
|
446
|
+
*
|
|
447
|
+
* @description
|
|
448
|
+
* Returns false if argument is Invalid Date and true otherwise.
|
|
449
|
+
* Argument is converted to Date using `toDate`. See [toDate](https://date-fns.org/docs/toDate)
|
|
450
|
+
* Invalid Date is a Date, whose time value is NaN.
|
|
451
|
+
*
|
|
452
|
+
* Time value of Date: http://es5.github.io/#x15.9.1.1
|
|
453
|
+
*
|
|
454
|
+
* @param date - The date to check
|
|
455
|
+
*
|
|
456
|
+
* @returns The date is valid
|
|
457
|
+
*
|
|
458
|
+
* @example
|
|
459
|
+
* // For the valid date:
|
|
460
|
+
* const result = isValid(new Date(2014, 1, 31))
|
|
461
|
+
* //=> true
|
|
462
|
+
*
|
|
463
|
+
* @example
|
|
464
|
+
* // For the value, convertible into a date:
|
|
465
|
+
* const result = isValid(1393804800000)
|
|
466
|
+
* //=> true
|
|
467
|
+
*
|
|
468
|
+
* @example
|
|
469
|
+
* // For the invalid date:
|
|
470
|
+
* const result = isValid(new Date(''))
|
|
471
|
+
* //=> false
|
|
472
|
+
*/
|
|
473
|
+
function isValid(date) {
|
|
474
|
+
return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date)));
|
|
475
|
+
}
|
|
476
|
+
//#endregion
|
|
477
|
+
//#region node_modules/date-fns/startOfYear.js
|
|
478
|
+
/**
|
|
479
|
+
* The {@link startOfYear} function options.
|
|
480
|
+
*/
|
|
481
|
+
/**
|
|
482
|
+
* @name startOfYear
|
|
483
|
+
* @category Year Helpers
|
|
484
|
+
* @summary Return the start of a year for the given date.
|
|
485
|
+
*
|
|
486
|
+
* @description
|
|
487
|
+
* Return the start of a year for the given date.
|
|
488
|
+
* The result will be in the local timezone.
|
|
489
|
+
*
|
|
490
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
491
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
492
|
+
*
|
|
493
|
+
* @param date - The original date
|
|
494
|
+
* @param options - The options
|
|
495
|
+
*
|
|
496
|
+
* @returns The start of a year
|
|
497
|
+
*
|
|
498
|
+
* @example
|
|
499
|
+
* // The start of a year for 2 September 2014 11:55:00:
|
|
500
|
+
* const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00))
|
|
501
|
+
* //=> Wed Jan 01 2014 00:00:00
|
|
502
|
+
*/
|
|
503
|
+
function startOfYear(date, options) {
|
|
504
|
+
const date_ = toDate(date, options?.in);
|
|
505
|
+
date_.setFullYear(date_.getFullYear(), 0, 1);
|
|
506
|
+
date_.setHours(0, 0, 0, 0);
|
|
507
|
+
return date_;
|
|
508
|
+
}
|
|
509
|
+
//#endregion
|
|
510
|
+
//#region node_modules/date-fns/locale/en-US/_lib/formatDistance.js
|
|
511
|
+
var formatDistanceLocale = {
|
|
512
|
+
lessThanXSeconds: {
|
|
513
|
+
one: "less than a second",
|
|
514
|
+
other: "less than {{count}} seconds"
|
|
515
|
+
},
|
|
516
|
+
xSeconds: {
|
|
517
|
+
one: "1 second",
|
|
518
|
+
other: "{{count}} seconds"
|
|
519
|
+
},
|
|
520
|
+
halfAMinute: "half a minute",
|
|
521
|
+
lessThanXMinutes: {
|
|
522
|
+
one: "less than a minute",
|
|
523
|
+
other: "less than {{count}} minutes"
|
|
524
|
+
},
|
|
525
|
+
xMinutes: {
|
|
526
|
+
one: "1 minute",
|
|
527
|
+
other: "{{count}} minutes"
|
|
528
|
+
},
|
|
529
|
+
aboutXHours: {
|
|
530
|
+
one: "about 1 hour",
|
|
531
|
+
other: "about {{count}} hours"
|
|
532
|
+
},
|
|
533
|
+
xHours: {
|
|
534
|
+
one: "1 hour",
|
|
535
|
+
other: "{{count}} hours"
|
|
536
|
+
},
|
|
537
|
+
xDays: {
|
|
538
|
+
one: "1 day",
|
|
539
|
+
other: "{{count}} days"
|
|
540
|
+
},
|
|
541
|
+
aboutXWeeks: {
|
|
542
|
+
one: "about 1 week",
|
|
543
|
+
other: "about {{count}} weeks"
|
|
544
|
+
},
|
|
545
|
+
xWeeks: {
|
|
546
|
+
one: "1 week",
|
|
547
|
+
other: "{{count}} weeks"
|
|
548
|
+
},
|
|
549
|
+
aboutXMonths: {
|
|
550
|
+
one: "about 1 month",
|
|
551
|
+
other: "about {{count}} months"
|
|
552
|
+
},
|
|
553
|
+
xMonths: {
|
|
554
|
+
one: "1 month",
|
|
555
|
+
other: "{{count}} months"
|
|
556
|
+
},
|
|
557
|
+
aboutXYears: {
|
|
558
|
+
one: "about 1 year",
|
|
559
|
+
other: "about {{count}} years"
|
|
560
|
+
},
|
|
561
|
+
xYears: {
|
|
562
|
+
one: "1 year",
|
|
563
|
+
other: "{{count}} years"
|
|
564
|
+
},
|
|
565
|
+
overXYears: {
|
|
566
|
+
one: "over 1 year",
|
|
567
|
+
other: "over {{count}} years"
|
|
568
|
+
},
|
|
569
|
+
almostXYears: {
|
|
570
|
+
one: "almost 1 year",
|
|
571
|
+
other: "almost {{count}} years"
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
var formatDistance = (token, count, options) => {
|
|
575
|
+
let result;
|
|
576
|
+
const tokenValue = formatDistanceLocale[token];
|
|
577
|
+
if (typeof tokenValue === "string") result = tokenValue;
|
|
578
|
+
else if (count === 1) result = tokenValue.one;
|
|
579
|
+
else result = tokenValue.other.replace("{{count}}", count.toString());
|
|
580
|
+
if (options?.addSuffix) if (options.comparison && options.comparison > 0) return "in " + result;
|
|
581
|
+
else return result + " ago";
|
|
582
|
+
return result;
|
|
583
|
+
};
|
|
584
|
+
//#endregion
|
|
585
|
+
//#region node_modules/date-fns/locale/_lib/buildFormatLongFn.js
|
|
586
|
+
function buildFormatLongFn(args) {
|
|
587
|
+
return (options = {}) => {
|
|
588
|
+
const width = options.width ? String(options.width) : args.defaultWidth;
|
|
589
|
+
return args.formats[width] || args.formats[args.defaultWidth];
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
var formatLong = {
|
|
593
|
+
date: buildFormatLongFn({
|
|
594
|
+
formats: {
|
|
595
|
+
full: "EEEE, MMMM do, y",
|
|
596
|
+
long: "MMMM do, y",
|
|
597
|
+
medium: "MMM d, y",
|
|
598
|
+
short: "MM/dd/yyyy"
|
|
599
|
+
},
|
|
600
|
+
defaultWidth: "full"
|
|
601
|
+
}),
|
|
602
|
+
time: buildFormatLongFn({
|
|
603
|
+
formats: {
|
|
604
|
+
full: "h:mm:ss a zzzz",
|
|
605
|
+
long: "h:mm:ss a z",
|
|
606
|
+
medium: "h:mm:ss a",
|
|
607
|
+
short: "h:mm a"
|
|
608
|
+
},
|
|
609
|
+
defaultWidth: "full"
|
|
610
|
+
}),
|
|
611
|
+
dateTime: buildFormatLongFn({
|
|
612
|
+
formats: {
|
|
613
|
+
full: "{{date}} 'at' {{time}}",
|
|
614
|
+
long: "{{date}} 'at' {{time}}",
|
|
615
|
+
medium: "{{date}}, {{time}}",
|
|
616
|
+
short: "{{date}}, {{time}}"
|
|
617
|
+
},
|
|
618
|
+
defaultWidth: "full"
|
|
619
|
+
})
|
|
620
|
+
};
|
|
621
|
+
//#endregion
|
|
622
|
+
//#region node_modules/date-fns/locale/en-US/_lib/formatRelative.js
|
|
623
|
+
var formatRelativeLocale = {
|
|
624
|
+
lastWeek: "'last' eeee 'at' p",
|
|
625
|
+
yesterday: "'yesterday at' p",
|
|
626
|
+
today: "'today at' p",
|
|
627
|
+
tomorrow: "'tomorrow at' p",
|
|
628
|
+
nextWeek: "eeee 'at' p",
|
|
629
|
+
other: "P"
|
|
630
|
+
};
|
|
631
|
+
var formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token];
|
|
632
|
+
//#endregion
|
|
633
|
+
//#region node_modules/date-fns/locale/_lib/buildLocalizeFn.js
|
|
634
|
+
/**
|
|
635
|
+
* The localize function argument callback which allows to convert raw value to
|
|
636
|
+
* the actual type.
|
|
637
|
+
*
|
|
638
|
+
* @param value - The value to convert
|
|
639
|
+
*
|
|
640
|
+
* @returns The converted value
|
|
641
|
+
*/
|
|
642
|
+
/**
|
|
643
|
+
* The map of localized values for each width.
|
|
644
|
+
*/
|
|
645
|
+
/**
|
|
646
|
+
* The index type of the locale unit value. It types conversion of units of
|
|
647
|
+
* values that don't start at 0 (i.e. quarters).
|
|
648
|
+
*/
|
|
649
|
+
/**
|
|
650
|
+
* Converts the unit value to the tuple of values.
|
|
651
|
+
*/
|
|
652
|
+
/**
|
|
653
|
+
* The tuple of localized era values. The first element represents BC,
|
|
654
|
+
* the second element represents AD.
|
|
655
|
+
*/
|
|
656
|
+
/**
|
|
657
|
+
* The tuple of localized quarter values. The first element represents Q1.
|
|
658
|
+
*/
|
|
659
|
+
/**
|
|
660
|
+
* The tuple of localized day values. The first element represents Sunday.
|
|
661
|
+
*/
|
|
662
|
+
/**
|
|
663
|
+
* The tuple of localized month values. The first element represents January.
|
|
664
|
+
*/
|
|
665
|
+
function buildLocalizeFn(args) {
|
|
666
|
+
return (value, options) => {
|
|
667
|
+
const context = options?.context ? String(options.context) : "standalone";
|
|
668
|
+
let valuesArray;
|
|
669
|
+
if (context === "formatting" && args.formattingValues) {
|
|
670
|
+
const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
|
|
671
|
+
const width = options?.width ? String(options.width) : defaultWidth;
|
|
672
|
+
valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
|
|
673
|
+
} else {
|
|
674
|
+
const defaultWidth = args.defaultWidth;
|
|
675
|
+
const width = options?.width ? String(options.width) : args.defaultWidth;
|
|
676
|
+
valuesArray = args.values[width] || args.values[defaultWidth];
|
|
677
|
+
}
|
|
678
|
+
const index = args.argumentCallback ? args.argumentCallback(value) : value;
|
|
679
|
+
return valuesArray[index];
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
//#endregion
|
|
683
|
+
//#region node_modules/date-fns/locale/en-US/_lib/localize.js
|
|
684
|
+
var eraValues = {
|
|
685
|
+
narrow: ["B", "A"],
|
|
686
|
+
abbreviated: ["BC", "AD"],
|
|
687
|
+
wide: ["Before Christ", "Anno Domini"]
|
|
688
|
+
};
|
|
689
|
+
var quarterValues = {
|
|
690
|
+
narrow: [
|
|
691
|
+
"1",
|
|
692
|
+
"2",
|
|
693
|
+
"3",
|
|
694
|
+
"4"
|
|
695
|
+
],
|
|
696
|
+
abbreviated: [
|
|
697
|
+
"Q1",
|
|
698
|
+
"Q2",
|
|
699
|
+
"Q3",
|
|
700
|
+
"Q4"
|
|
701
|
+
],
|
|
702
|
+
wide: [
|
|
703
|
+
"1st quarter",
|
|
704
|
+
"2nd quarter",
|
|
705
|
+
"3rd quarter",
|
|
706
|
+
"4th quarter"
|
|
707
|
+
]
|
|
708
|
+
};
|
|
709
|
+
var monthValues = {
|
|
710
|
+
narrow: [
|
|
711
|
+
"J",
|
|
712
|
+
"F",
|
|
713
|
+
"M",
|
|
714
|
+
"A",
|
|
715
|
+
"M",
|
|
716
|
+
"J",
|
|
717
|
+
"J",
|
|
718
|
+
"A",
|
|
719
|
+
"S",
|
|
720
|
+
"O",
|
|
721
|
+
"N",
|
|
722
|
+
"D"
|
|
723
|
+
],
|
|
724
|
+
abbreviated: [
|
|
725
|
+
"Jan",
|
|
726
|
+
"Feb",
|
|
727
|
+
"Mar",
|
|
728
|
+
"Apr",
|
|
729
|
+
"May",
|
|
730
|
+
"Jun",
|
|
731
|
+
"Jul",
|
|
732
|
+
"Aug",
|
|
733
|
+
"Sep",
|
|
734
|
+
"Oct",
|
|
735
|
+
"Nov",
|
|
736
|
+
"Dec"
|
|
737
|
+
],
|
|
738
|
+
wide: [
|
|
739
|
+
"January",
|
|
740
|
+
"February",
|
|
741
|
+
"March",
|
|
742
|
+
"April",
|
|
743
|
+
"May",
|
|
744
|
+
"June",
|
|
745
|
+
"July",
|
|
746
|
+
"August",
|
|
747
|
+
"September",
|
|
748
|
+
"October",
|
|
749
|
+
"November",
|
|
750
|
+
"December"
|
|
751
|
+
]
|
|
752
|
+
};
|
|
753
|
+
var dayValues = {
|
|
754
|
+
narrow: [
|
|
755
|
+
"S",
|
|
756
|
+
"M",
|
|
757
|
+
"T",
|
|
758
|
+
"W",
|
|
759
|
+
"T",
|
|
760
|
+
"F",
|
|
761
|
+
"S"
|
|
762
|
+
],
|
|
763
|
+
short: [
|
|
764
|
+
"Su",
|
|
765
|
+
"Mo",
|
|
766
|
+
"Tu",
|
|
767
|
+
"We",
|
|
768
|
+
"Th",
|
|
769
|
+
"Fr",
|
|
770
|
+
"Sa"
|
|
771
|
+
],
|
|
772
|
+
abbreviated: [
|
|
773
|
+
"Sun",
|
|
774
|
+
"Mon",
|
|
775
|
+
"Tue",
|
|
776
|
+
"Wed",
|
|
777
|
+
"Thu",
|
|
778
|
+
"Fri",
|
|
779
|
+
"Sat"
|
|
780
|
+
],
|
|
781
|
+
wide: [
|
|
782
|
+
"Sunday",
|
|
783
|
+
"Monday",
|
|
784
|
+
"Tuesday",
|
|
785
|
+
"Wednesday",
|
|
786
|
+
"Thursday",
|
|
787
|
+
"Friday",
|
|
788
|
+
"Saturday"
|
|
789
|
+
]
|
|
790
|
+
};
|
|
791
|
+
var dayPeriodValues = {
|
|
792
|
+
narrow: {
|
|
793
|
+
am: "a",
|
|
794
|
+
pm: "p",
|
|
795
|
+
midnight: "mi",
|
|
796
|
+
noon: "n",
|
|
797
|
+
morning: "morning",
|
|
798
|
+
afternoon: "afternoon",
|
|
799
|
+
evening: "evening",
|
|
800
|
+
night: "night"
|
|
801
|
+
},
|
|
802
|
+
abbreviated: {
|
|
803
|
+
am: "AM",
|
|
804
|
+
pm: "PM",
|
|
805
|
+
midnight: "midnight",
|
|
806
|
+
noon: "noon",
|
|
807
|
+
morning: "morning",
|
|
808
|
+
afternoon: "afternoon",
|
|
809
|
+
evening: "evening",
|
|
810
|
+
night: "night"
|
|
811
|
+
},
|
|
812
|
+
wide: {
|
|
813
|
+
am: "a.m.",
|
|
814
|
+
pm: "p.m.",
|
|
815
|
+
midnight: "midnight",
|
|
816
|
+
noon: "noon",
|
|
817
|
+
morning: "morning",
|
|
818
|
+
afternoon: "afternoon",
|
|
819
|
+
evening: "evening",
|
|
820
|
+
night: "night"
|
|
821
|
+
}
|
|
822
|
+
};
|
|
823
|
+
var formattingDayPeriodValues = {
|
|
824
|
+
narrow: {
|
|
825
|
+
am: "a",
|
|
826
|
+
pm: "p",
|
|
827
|
+
midnight: "mi",
|
|
828
|
+
noon: "n",
|
|
829
|
+
morning: "in the morning",
|
|
830
|
+
afternoon: "in the afternoon",
|
|
831
|
+
evening: "in the evening",
|
|
832
|
+
night: "at night"
|
|
833
|
+
},
|
|
834
|
+
abbreviated: {
|
|
835
|
+
am: "AM",
|
|
836
|
+
pm: "PM",
|
|
837
|
+
midnight: "midnight",
|
|
838
|
+
noon: "noon",
|
|
839
|
+
morning: "in the morning",
|
|
840
|
+
afternoon: "in the afternoon",
|
|
841
|
+
evening: "in the evening",
|
|
842
|
+
night: "at night"
|
|
843
|
+
},
|
|
844
|
+
wide: {
|
|
845
|
+
am: "a.m.",
|
|
846
|
+
pm: "p.m.",
|
|
847
|
+
midnight: "midnight",
|
|
848
|
+
noon: "noon",
|
|
849
|
+
morning: "in the morning",
|
|
850
|
+
afternoon: "in the afternoon",
|
|
851
|
+
evening: "in the evening",
|
|
852
|
+
night: "at night"
|
|
853
|
+
}
|
|
854
|
+
};
|
|
855
|
+
var ordinalNumber = (dirtyNumber, _options) => {
|
|
856
|
+
const number = Number(dirtyNumber);
|
|
857
|
+
const rem100 = number % 100;
|
|
858
|
+
if (rem100 > 20 || rem100 < 10) switch (rem100 % 10) {
|
|
859
|
+
case 1: return number + "st";
|
|
860
|
+
case 2: return number + "nd";
|
|
861
|
+
case 3: return number + "rd";
|
|
862
|
+
}
|
|
863
|
+
return number + "th";
|
|
864
|
+
};
|
|
865
|
+
var localize = {
|
|
866
|
+
ordinalNumber,
|
|
867
|
+
era: buildLocalizeFn({
|
|
868
|
+
values: eraValues,
|
|
869
|
+
defaultWidth: "wide"
|
|
870
|
+
}),
|
|
871
|
+
quarter: buildLocalizeFn({
|
|
872
|
+
values: quarterValues,
|
|
873
|
+
defaultWidth: "wide",
|
|
874
|
+
argumentCallback: (quarter) => quarter - 1
|
|
875
|
+
}),
|
|
876
|
+
month: buildLocalizeFn({
|
|
877
|
+
values: monthValues,
|
|
878
|
+
defaultWidth: "wide"
|
|
879
|
+
}),
|
|
880
|
+
day: buildLocalizeFn({
|
|
881
|
+
values: dayValues,
|
|
882
|
+
defaultWidth: "wide"
|
|
883
|
+
}),
|
|
884
|
+
dayPeriod: buildLocalizeFn({
|
|
885
|
+
values: dayPeriodValues,
|
|
886
|
+
defaultWidth: "wide",
|
|
887
|
+
formattingValues: formattingDayPeriodValues,
|
|
888
|
+
defaultFormattingWidth: "wide"
|
|
889
|
+
})
|
|
890
|
+
};
|
|
891
|
+
//#endregion
|
|
892
|
+
//#region node_modules/date-fns/locale/_lib/buildMatchFn.js
|
|
893
|
+
function buildMatchFn(args) {
|
|
894
|
+
return (string, options = {}) => {
|
|
895
|
+
const width = options.width;
|
|
896
|
+
const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
|
|
897
|
+
const matchResult = string.match(matchPattern);
|
|
898
|
+
if (!matchResult) return null;
|
|
899
|
+
const matchedString = matchResult[0];
|
|
900
|
+
const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
|
|
901
|
+
const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : findKey(parsePatterns, (pattern) => pattern.test(matchedString));
|
|
902
|
+
let value;
|
|
903
|
+
value = args.valueCallback ? args.valueCallback(key) : key;
|
|
904
|
+
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
905
|
+
const rest = string.slice(matchedString.length);
|
|
906
|
+
return {
|
|
907
|
+
value,
|
|
908
|
+
rest
|
|
909
|
+
};
|
|
910
|
+
};
|
|
911
|
+
}
|
|
912
|
+
function findKey(object, predicate) {
|
|
913
|
+
for (const key in object) if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) return key;
|
|
914
|
+
}
|
|
915
|
+
function findIndex(array, predicate) {
|
|
916
|
+
for (let key = 0; key < array.length; key++) if (predicate(array[key])) return key;
|
|
917
|
+
}
|
|
918
|
+
//#endregion
|
|
919
|
+
//#region node_modules/date-fns/locale/_lib/buildMatchPatternFn.js
|
|
920
|
+
function buildMatchPatternFn(args) {
|
|
921
|
+
return (string, options = {}) => {
|
|
922
|
+
const matchResult = string.match(args.matchPattern);
|
|
923
|
+
if (!matchResult) return null;
|
|
924
|
+
const matchedString = matchResult[0];
|
|
925
|
+
const parseResult = string.match(args.parsePattern);
|
|
926
|
+
if (!parseResult) return null;
|
|
927
|
+
let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
|
|
928
|
+
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
929
|
+
const rest = string.slice(matchedString.length);
|
|
930
|
+
return {
|
|
931
|
+
value,
|
|
932
|
+
rest
|
|
933
|
+
};
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
//#endregion
|
|
937
|
+
//#region node_modules/date-fns/locale/en-US.js
|
|
938
|
+
/**
|
|
939
|
+
* @category Locales
|
|
940
|
+
* @summary English locale (United States).
|
|
941
|
+
* @language English
|
|
942
|
+
* @iso-639-2 eng
|
|
943
|
+
* @author Sasha Koss [@kossnocorp](https://github.com/kossnocorp)
|
|
944
|
+
* @author Lesha Koss [@leshakoss](https://github.com/leshakoss)
|
|
945
|
+
*/
|
|
946
|
+
var enUS = {
|
|
947
|
+
code: "en-US",
|
|
948
|
+
formatDistance,
|
|
949
|
+
formatLong,
|
|
950
|
+
formatRelative,
|
|
951
|
+
localize,
|
|
952
|
+
match: {
|
|
953
|
+
ordinalNumber: buildMatchPatternFn({
|
|
954
|
+
matchPattern: /^(\d+)(th|st|nd|rd)?/i,
|
|
955
|
+
parsePattern: /\d+/i,
|
|
956
|
+
valueCallback: (value) => parseInt(value, 10)
|
|
957
|
+
}),
|
|
958
|
+
era: buildMatchFn({
|
|
959
|
+
matchPatterns: {
|
|
960
|
+
narrow: /^(b|a)/i,
|
|
961
|
+
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
|
962
|
+
wide: /^(before christ|before common era|anno domini|common era)/i
|
|
963
|
+
},
|
|
964
|
+
defaultMatchWidth: "wide",
|
|
965
|
+
parsePatterns: { any: [/^b/i, /^(a|c)/i] },
|
|
966
|
+
defaultParseWidth: "any"
|
|
967
|
+
}),
|
|
968
|
+
quarter: buildMatchFn({
|
|
969
|
+
matchPatterns: {
|
|
970
|
+
narrow: /^[1234]/i,
|
|
971
|
+
abbreviated: /^q[1234]/i,
|
|
972
|
+
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
973
|
+
},
|
|
974
|
+
defaultMatchWidth: "wide",
|
|
975
|
+
parsePatterns: { any: [
|
|
976
|
+
/1/i,
|
|
977
|
+
/2/i,
|
|
978
|
+
/3/i,
|
|
979
|
+
/4/i
|
|
980
|
+
] },
|
|
981
|
+
defaultParseWidth: "any",
|
|
982
|
+
valueCallback: (index) => index + 1
|
|
983
|
+
}),
|
|
984
|
+
month: buildMatchFn({
|
|
985
|
+
matchPatterns: {
|
|
986
|
+
narrow: /^[jfmasond]/i,
|
|
987
|
+
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
988
|
+
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
989
|
+
},
|
|
990
|
+
defaultMatchWidth: "wide",
|
|
991
|
+
parsePatterns: {
|
|
992
|
+
narrow: [
|
|
993
|
+
/^j/i,
|
|
994
|
+
/^f/i,
|
|
995
|
+
/^m/i,
|
|
996
|
+
/^a/i,
|
|
997
|
+
/^m/i,
|
|
998
|
+
/^j/i,
|
|
999
|
+
/^j/i,
|
|
1000
|
+
/^a/i,
|
|
1001
|
+
/^s/i,
|
|
1002
|
+
/^o/i,
|
|
1003
|
+
/^n/i,
|
|
1004
|
+
/^d/i
|
|
1005
|
+
],
|
|
1006
|
+
any: [
|
|
1007
|
+
/^ja/i,
|
|
1008
|
+
/^f/i,
|
|
1009
|
+
/^mar/i,
|
|
1010
|
+
/^ap/i,
|
|
1011
|
+
/^may/i,
|
|
1012
|
+
/^jun/i,
|
|
1013
|
+
/^jul/i,
|
|
1014
|
+
/^au/i,
|
|
1015
|
+
/^s/i,
|
|
1016
|
+
/^o/i,
|
|
1017
|
+
/^n/i,
|
|
1018
|
+
/^d/i
|
|
1019
|
+
]
|
|
1020
|
+
},
|
|
1021
|
+
defaultParseWidth: "any"
|
|
1022
|
+
}),
|
|
1023
|
+
day: buildMatchFn({
|
|
1024
|
+
matchPatterns: {
|
|
1025
|
+
narrow: /^[smtwf]/i,
|
|
1026
|
+
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
|
1027
|
+
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
1028
|
+
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
|
1029
|
+
},
|
|
1030
|
+
defaultMatchWidth: "wide",
|
|
1031
|
+
parsePatterns: {
|
|
1032
|
+
narrow: [
|
|
1033
|
+
/^s/i,
|
|
1034
|
+
/^m/i,
|
|
1035
|
+
/^t/i,
|
|
1036
|
+
/^w/i,
|
|
1037
|
+
/^t/i,
|
|
1038
|
+
/^f/i,
|
|
1039
|
+
/^s/i
|
|
1040
|
+
],
|
|
1041
|
+
any: [
|
|
1042
|
+
/^su/i,
|
|
1043
|
+
/^m/i,
|
|
1044
|
+
/^tu/i,
|
|
1045
|
+
/^w/i,
|
|
1046
|
+
/^th/i,
|
|
1047
|
+
/^f/i,
|
|
1048
|
+
/^sa/i
|
|
1049
|
+
]
|
|
1050
|
+
},
|
|
1051
|
+
defaultParseWidth: "any"
|
|
1052
|
+
}),
|
|
1053
|
+
dayPeriod: buildMatchFn({
|
|
1054
|
+
matchPatterns: {
|
|
1055
|
+
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
1056
|
+
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
|
1057
|
+
},
|
|
1058
|
+
defaultMatchWidth: "any",
|
|
1059
|
+
parsePatterns: { any: {
|
|
1060
|
+
am: /^a/i,
|
|
1061
|
+
pm: /^p/i,
|
|
1062
|
+
midnight: /^mi/i,
|
|
1063
|
+
noon: /^no/i,
|
|
1064
|
+
morning: /morning/i,
|
|
1065
|
+
afternoon: /afternoon/i,
|
|
1066
|
+
evening: /evening/i,
|
|
1067
|
+
night: /night/i
|
|
1068
|
+
} },
|
|
1069
|
+
defaultParseWidth: "any"
|
|
1070
|
+
})
|
|
1071
|
+
},
|
|
1072
|
+
options: {
|
|
1073
|
+
weekStartsOn: 0,
|
|
1074
|
+
firstWeekContainsDate: 1
|
|
1075
|
+
}
|
|
1076
|
+
};
|
|
1077
|
+
//#endregion
|
|
1078
|
+
//#region node_modules/date-fns/getDayOfYear.js
|
|
1079
|
+
/**
|
|
1080
|
+
* The {@link getDayOfYear} function options.
|
|
1081
|
+
*/
|
|
1082
|
+
/**
|
|
1083
|
+
* @name getDayOfYear
|
|
1084
|
+
* @category Day Helpers
|
|
1085
|
+
* @summary Get the day of the year of the given date.
|
|
1086
|
+
*
|
|
1087
|
+
* @description
|
|
1088
|
+
* Get the day of the year of the given date.
|
|
1089
|
+
*
|
|
1090
|
+
* @param date - The given date
|
|
1091
|
+
* @param options - The options
|
|
1092
|
+
*
|
|
1093
|
+
* @returns The day of year
|
|
1094
|
+
*
|
|
1095
|
+
* @example
|
|
1096
|
+
* // Which day of the year is 2 July 2014?
|
|
1097
|
+
* const result = getDayOfYear(new Date(2014, 6, 2))
|
|
1098
|
+
* //=> 183
|
|
1099
|
+
*/
|
|
1100
|
+
function getDayOfYear(date, options) {
|
|
1101
|
+
const _date = toDate(date, options?.in);
|
|
1102
|
+
return differenceInCalendarDays(_date, startOfYear(_date)) + 1;
|
|
1103
|
+
}
|
|
1104
|
+
//#endregion
|
|
1105
|
+
//#region node_modules/date-fns/getISOWeek.js
|
|
1106
|
+
/**
|
|
1107
|
+
* The {@link getISOWeek} function options.
|
|
1108
|
+
*/
|
|
1109
|
+
/**
|
|
1110
|
+
* @name getISOWeek
|
|
1111
|
+
* @category ISO Week Helpers
|
|
1112
|
+
* @summary Get the ISO week of the given date.
|
|
1113
|
+
*
|
|
1114
|
+
* @description
|
|
1115
|
+
* Get the ISO week of the given date.
|
|
1116
|
+
*
|
|
1117
|
+
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
1118
|
+
*
|
|
1119
|
+
* @param date - The given date
|
|
1120
|
+
* @param options - The options
|
|
1121
|
+
*
|
|
1122
|
+
* @returns The ISO week
|
|
1123
|
+
*
|
|
1124
|
+
* @example
|
|
1125
|
+
* // Which week of the ISO-week numbering year is 2 January 2005?
|
|
1126
|
+
* const result = getISOWeek(new Date(2005, 0, 2))
|
|
1127
|
+
* //=> 53
|
|
1128
|
+
*/
|
|
1129
|
+
function getISOWeek(date, options) {
|
|
1130
|
+
const _date = toDate(date, options?.in);
|
|
1131
|
+
const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
|
|
1132
|
+
return Math.round(diff / millisecondsInWeek) + 1;
|
|
1133
|
+
}
|
|
1134
|
+
//#endregion
|
|
1135
|
+
//#region node_modules/date-fns/getWeekYear.js
|
|
1136
|
+
/**
|
|
1137
|
+
* The {@link getWeekYear} function options.
|
|
1138
|
+
*/
|
|
1139
|
+
/**
|
|
1140
|
+
* @name getWeekYear
|
|
1141
|
+
* @category Week-Numbering Year Helpers
|
|
1142
|
+
* @summary Get the local week-numbering year of the given date.
|
|
1143
|
+
*
|
|
1144
|
+
* @description
|
|
1145
|
+
* Get the local week-numbering year of the given date.
|
|
1146
|
+
* The exact calculation depends on the values of
|
|
1147
|
+
* `options.weekStartsOn` (which is the index of the first day of the week)
|
|
1148
|
+
* and `options.firstWeekContainsDate` (which is the day of January, which is always in
|
|
1149
|
+
* the first week of the week-numbering year)
|
|
1150
|
+
*
|
|
1151
|
+
* Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
|
|
1152
|
+
*
|
|
1153
|
+
* @param date - The given date
|
|
1154
|
+
* @param options - An object with options.
|
|
1155
|
+
*
|
|
1156
|
+
* @returns The local week-numbering year
|
|
1157
|
+
*
|
|
1158
|
+
* @example
|
|
1159
|
+
* // Which week numbering year is 26 December 2004 with the default settings?
|
|
1160
|
+
* const result = getWeekYear(new Date(2004, 11, 26))
|
|
1161
|
+
* //=> 2005
|
|
1162
|
+
*
|
|
1163
|
+
* @example
|
|
1164
|
+
* // Which week numbering year is 26 December 2004 if week starts on Saturday?
|
|
1165
|
+
* const result = getWeekYear(new Date(2004, 11, 26), { weekStartsOn: 6 })
|
|
1166
|
+
* //=> 2004
|
|
1167
|
+
*
|
|
1168
|
+
* @example
|
|
1169
|
+
* // Which week numbering year is 26 December 2004 if the first week contains 4 January?
|
|
1170
|
+
* const result = getWeekYear(new Date(2004, 11, 26), { firstWeekContainsDate: 4 })
|
|
1171
|
+
* //=> 2004
|
|
1172
|
+
*/
|
|
1173
|
+
function getWeekYear(date, options) {
|
|
1174
|
+
const _date = toDate(date, options?.in);
|
|
1175
|
+
const year = _date.getFullYear();
|
|
1176
|
+
const defaultOptions = getDefaultOptions();
|
|
1177
|
+
const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions.firstWeekContainsDate ?? defaultOptions.locale?.options?.firstWeekContainsDate ?? 1;
|
|
1178
|
+
const firstWeekOfNextYear = constructFrom(options?.in || date, 0);
|
|
1179
|
+
firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
|
|
1180
|
+
firstWeekOfNextYear.setHours(0, 0, 0, 0);
|
|
1181
|
+
const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);
|
|
1182
|
+
const firstWeekOfThisYear = constructFrom(options?.in || date, 0);
|
|
1183
|
+
firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
|
|
1184
|
+
firstWeekOfThisYear.setHours(0, 0, 0, 0);
|
|
1185
|
+
const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);
|
|
1186
|
+
if (+_date >= +startOfNextYear) return year + 1;
|
|
1187
|
+
else if (+_date >= +startOfThisYear) return year;
|
|
1188
|
+
else return year - 1;
|
|
1189
|
+
}
|
|
1190
|
+
//#endregion
|
|
1191
|
+
//#region node_modules/date-fns/startOfWeekYear.js
|
|
1192
|
+
/**
|
|
1193
|
+
* The {@link startOfWeekYear} function options.
|
|
1194
|
+
*/
|
|
1195
|
+
/**
|
|
1196
|
+
* @name startOfWeekYear
|
|
1197
|
+
* @category Week-Numbering Year Helpers
|
|
1198
|
+
* @summary Return the start of a local week-numbering year for the given date.
|
|
1199
|
+
*
|
|
1200
|
+
* @description
|
|
1201
|
+
* Return the start of a local week-numbering year.
|
|
1202
|
+
* The exact calculation depends on the values of
|
|
1203
|
+
* `options.weekStartsOn` (which is the index of the first day of the week)
|
|
1204
|
+
* and `options.firstWeekContainsDate` (which is the day of January, which is always in
|
|
1205
|
+
* the first week of the week-numbering year)
|
|
1206
|
+
*
|
|
1207
|
+
* Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
|
|
1208
|
+
*
|
|
1209
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
1210
|
+
* @typeParam ResultDate - The result `Date` type.
|
|
1211
|
+
*
|
|
1212
|
+
* @param date - The original date
|
|
1213
|
+
* @param options - An object with options
|
|
1214
|
+
*
|
|
1215
|
+
* @returns The start of a week-numbering year
|
|
1216
|
+
*
|
|
1217
|
+
* @example
|
|
1218
|
+
* // The start of an a week-numbering year for 2 July 2005 with default settings:
|
|
1219
|
+
* const result = startOfWeekYear(new Date(2005, 6, 2))
|
|
1220
|
+
* //=> Sun Dec 26 2004 00:00:00
|
|
1221
|
+
*
|
|
1222
|
+
* @example
|
|
1223
|
+
* // The start of a week-numbering year for 2 July 2005
|
|
1224
|
+
* // if Monday is the first day of week
|
|
1225
|
+
* // and 4 January is always in the first week of the year:
|
|
1226
|
+
* const result = startOfWeekYear(new Date(2005, 6, 2), {
|
|
1227
|
+
* weekStartsOn: 1,
|
|
1228
|
+
* firstWeekContainsDate: 4
|
|
1229
|
+
* })
|
|
1230
|
+
* //=> Mon Jan 03 2005 00:00:00
|
|
1231
|
+
*/
|
|
1232
|
+
function startOfWeekYear(date, options) {
|
|
1233
|
+
const defaultOptions = getDefaultOptions();
|
|
1234
|
+
const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions.firstWeekContainsDate ?? defaultOptions.locale?.options?.firstWeekContainsDate ?? 1;
|
|
1235
|
+
const year = getWeekYear(date, options);
|
|
1236
|
+
const firstWeek = constructFrom(options?.in || date, 0);
|
|
1237
|
+
firstWeek.setFullYear(year, 0, firstWeekContainsDate);
|
|
1238
|
+
firstWeek.setHours(0, 0, 0, 0);
|
|
1239
|
+
return startOfWeek(firstWeek, options);
|
|
1240
|
+
}
|
|
1241
|
+
//#endregion
|
|
1242
|
+
//#region node_modules/date-fns/getWeek.js
|
|
1243
|
+
/**
|
|
1244
|
+
* The {@link getWeek} function options.
|
|
1245
|
+
*/
|
|
1246
|
+
/**
|
|
1247
|
+
* @name getWeek
|
|
1248
|
+
* @category Week Helpers
|
|
1249
|
+
* @summary Get the local week index of the given date.
|
|
1250
|
+
*
|
|
1251
|
+
* @description
|
|
1252
|
+
* Get the local week index of the given date.
|
|
1253
|
+
* The exact calculation depends on the values of
|
|
1254
|
+
* `options.weekStartsOn` (which is the index of the first day of the week)
|
|
1255
|
+
* and `options.firstWeekContainsDate` (which is the day of January, which is always in
|
|
1256
|
+
* the first week of the week-numbering year)
|
|
1257
|
+
*
|
|
1258
|
+
* Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
|
|
1259
|
+
*
|
|
1260
|
+
* @param date - The given date
|
|
1261
|
+
* @param options - An object with options
|
|
1262
|
+
*
|
|
1263
|
+
* @returns The week
|
|
1264
|
+
*
|
|
1265
|
+
* @example
|
|
1266
|
+
* // Which week of the local week numbering year is 2 January 2005 with default options?
|
|
1267
|
+
* const result = getWeek(new Date(2005, 0, 2))
|
|
1268
|
+
* //=> 2
|
|
1269
|
+
*
|
|
1270
|
+
* @example
|
|
1271
|
+
* // Which week of the local week numbering year is 2 January 2005,
|
|
1272
|
+
* // if Monday is the first day of the week,
|
|
1273
|
+
* // and the first week of the year always contains 4 January?
|
|
1274
|
+
* const result = getWeek(new Date(2005, 0, 2), {
|
|
1275
|
+
* weekStartsOn: 1,
|
|
1276
|
+
* firstWeekContainsDate: 4
|
|
1277
|
+
* })
|
|
1278
|
+
* //=> 53
|
|
1279
|
+
*/
|
|
1280
|
+
function getWeek(date, options) {
|
|
1281
|
+
const _date = toDate(date, options?.in);
|
|
1282
|
+
const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);
|
|
1283
|
+
return Math.round(diff / millisecondsInWeek) + 1;
|
|
1284
|
+
}
|
|
1285
|
+
//#endregion
|
|
1286
|
+
//#region node_modules/date-fns/_lib/addLeadingZeros.js
|
|
1287
|
+
function addLeadingZeros(number, targetLength) {
|
|
1288
|
+
return (number < 0 ? "-" : "") + Math.abs(number).toString().padStart(targetLength, "0");
|
|
1289
|
+
}
|
|
1290
|
+
//#endregion
|
|
1291
|
+
//#region node_modules/date-fns/_lib/format/lightFormatters.js
|
|
1292
|
+
var lightFormatters = {
|
|
1293
|
+
y(date, token) {
|
|
1294
|
+
const signedYear = date.getFullYear();
|
|
1295
|
+
const year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
1296
|
+
return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
|
|
1297
|
+
},
|
|
1298
|
+
M(date, token) {
|
|
1299
|
+
const month = date.getMonth();
|
|
1300
|
+
return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
|
|
1301
|
+
},
|
|
1302
|
+
d(date, token) {
|
|
1303
|
+
return addLeadingZeros(date.getDate(), token.length);
|
|
1304
|
+
},
|
|
1305
|
+
a(date, token) {
|
|
1306
|
+
const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
|
|
1307
|
+
switch (token) {
|
|
1308
|
+
case "a":
|
|
1309
|
+
case "aa": return dayPeriodEnumValue.toUpperCase();
|
|
1310
|
+
case "aaa": return dayPeriodEnumValue;
|
|
1311
|
+
case "aaaaa": return dayPeriodEnumValue[0];
|
|
1312
|
+
default: return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
|
|
1313
|
+
}
|
|
1314
|
+
},
|
|
1315
|
+
h(date, token) {
|
|
1316
|
+
return addLeadingZeros(date.getHours() % 12 || 12, token.length);
|
|
1317
|
+
},
|
|
1318
|
+
H(date, token) {
|
|
1319
|
+
return addLeadingZeros(date.getHours(), token.length);
|
|
1320
|
+
},
|
|
1321
|
+
m(date, token) {
|
|
1322
|
+
return addLeadingZeros(date.getMinutes(), token.length);
|
|
1323
|
+
},
|
|
1324
|
+
s(date, token) {
|
|
1325
|
+
return addLeadingZeros(date.getSeconds(), token.length);
|
|
1326
|
+
},
|
|
1327
|
+
S(date, token) {
|
|
1328
|
+
const numberOfDigits = token.length;
|
|
1329
|
+
const milliseconds = date.getMilliseconds();
|
|
1330
|
+
return addLeadingZeros(Math.trunc(milliseconds * Math.pow(10, numberOfDigits - 3)), token.length);
|
|
1331
|
+
}
|
|
1332
|
+
};
|
|
1333
|
+
//#endregion
|
|
1334
|
+
//#region node_modules/date-fns/_lib/format/formatters.js
|
|
1335
|
+
var dayPeriodEnum = {
|
|
1336
|
+
am: "am",
|
|
1337
|
+
pm: "pm",
|
|
1338
|
+
midnight: "midnight",
|
|
1339
|
+
noon: "noon",
|
|
1340
|
+
morning: "morning",
|
|
1341
|
+
afternoon: "afternoon",
|
|
1342
|
+
evening: "evening",
|
|
1343
|
+
night: "night"
|
|
1344
|
+
};
|
|
1345
|
+
var formatters = {
|
|
1346
|
+
G: function(date, token, localize) {
|
|
1347
|
+
const era = date.getFullYear() > 0 ? 1 : 0;
|
|
1348
|
+
switch (token) {
|
|
1349
|
+
case "G":
|
|
1350
|
+
case "GG":
|
|
1351
|
+
case "GGG": return localize.era(era, { width: "abbreviated" });
|
|
1352
|
+
case "GGGGG": return localize.era(era, { width: "narrow" });
|
|
1353
|
+
default: return localize.era(era, { width: "wide" });
|
|
1354
|
+
}
|
|
1355
|
+
},
|
|
1356
|
+
y: function(date, token, localize) {
|
|
1357
|
+
if (token === "yo") {
|
|
1358
|
+
const signedYear = date.getFullYear();
|
|
1359
|
+
const year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
1360
|
+
return localize.ordinalNumber(year, { unit: "year" });
|
|
1361
|
+
}
|
|
1362
|
+
return lightFormatters.y(date, token);
|
|
1363
|
+
},
|
|
1364
|
+
Y: function(date, token, localize, options) {
|
|
1365
|
+
const signedWeekYear = getWeekYear(date, options);
|
|
1366
|
+
const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
|
|
1367
|
+
if (token === "YY") return addLeadingZeros(weekYear % 100, 2);
|
|
1368
|
+
if (token === "Yo") return localize.ordinalNumber(weekYear, { unit: "year" });
|
|
1369
|
+
return addLeadingZeros(weekYear, token.length);
|
|
1370
|
+
},
|
|
1371
|
+
R: function(date, token) {
|
|
1372
|
+
return addLeadingZeros(getISOWeekYear(date), token.length);
|
|
1373
|
+
},
|
|
1374
|
+
u: function(date, token) {
|
|
1375
|
+
return addLeadingZeros(date.getFullYear(), token.length);
|
|
1376
|
+
},
|
|
1377
|
+
Q: function(date, token, localize) {
|
|
1378
|
+
const quarter = Math.ceil((date.getMonth() + 1) / 3);
|
|
1379
|
+
switch (token) {
|
|
1380
|
+
case "Q": return String(quarter);
|
|
1381
|
+
case "QQ": return addLeadingZeros(quarter, 2);
|
|
1382
|
+
case "Qo": return localize.ordinalNumber(quarter, { unit: "quarter" });
|
|
1383
|
+
case "QQQ": return localize.quarter(quarter, {
|
|
1384
|
+
width: "abbreviated",
|
|
1385
|
+
context: "formatting"
|
|
1386
|
+
});
|
|
1387
|
+
case "QQQQQ": return localize.quarter(quarter, {
|
|
1388
|
+
width: "narrow",
|
|
1389
|
+
context: "formatting"
|
|
1390
|
+
});
|
|
1391
|
+
default: return localize.quarter(quarter, {
|
|
1392
|
+
width: "wide",
|
|
1393
|
+
context: "formatting"
|
|
1394
|
+
});
|
|
1395
|
+
}
|
|
1396
|
+
},
|
|
1397
|
+
q: function(date, token, localize) {
|
|
1398
|
+
const quarter = Math.ceil((date.getMonth() + 1) / 3);
|
|
1399
|
+
switch (token) {
|
|
1400
|
+
case "q": return String(quarter);
|
|
1401
|
+
case "qq": return addLeadingZeros(quarter, 2);
|
|
1402
|
+
case "qo": return localize.ordinalNumber(quarter, { unit: "quarter" });
|
|
1403
|
+
case "qqq": return localize.quarter(quarter, {
|
|
1404
|
+
width: "abbreviated",
|
|
1405
|
+
context: "standalone"
|
|
1406
|
+
});
|
|
1407
|
+
case "qqqqq": return localize.quarter(quarter, {
|
|
1408
|
+
width: "narrow",
|
|
1409
|
+
context: "standalone"
|
|
1410
|
+
});
|
|
1411
|
+
default: return localize.quarter(quarter, {
|
|
1412
|
+
width: "wide",
|
|
1413
|
+
context: "standalone"
|
|
1414
|
+
});
|
|
1415
|
+
}
|
|
1416
|
+
},
|
|
1417
|
+
M: function(date, token, localize) {
|
|
1418
|
+
const month = date.getMonth();
|
|
1419
|
+
switch (token) {
|
|
1420
|
+
case "M":
|
|
1421
|
+
case "MM": return lightFormatters.M(date, token);
|
|
1422
|
+
case "Mo": return localize.ordinalNumber(month + 1, { unit: "month" });
|
|
1423
|
+
case "MMM": return localize.month(month, {
|
|
1424
|
+
width: "abbreviated",
|
|
1425
|
+
context: "formatting"
|
|
1426
|
+
});
|
|
1427
|
+
case "MMMMM": return localize.month(month, {
|
|
1428
|
+
width: "narrow",
|
|
1429
|
+
context: "formatting"
|
|
1430
|
+
});
|
|
1431
|
+
default: return localize.month(month, {
|
|
1432
|
+
width: "wide",
|
|
1433
|
+
context: "formatting"
|
|
1434
|
+
});
|
|
1435
|
+
}
|
|
1436
|
+
},
|
|
1437
|
+
L: function(date, token, localize) {
|
|
1438
|
+
const month = date.getMonth();
|
|
1439
|
+
switch (token) {
|
|
1440
|
+
case "L": return String(month + 1);
|
|
1441
|
+
case "LL": return addLeadingZeros(month + 1, 2);
|
|
1442
|
+
case "Lo": return localize.ordinalNumber(month + 1, { unit: "month" });
|
|
1443
|
+
case "LLL": return localize.month(month, {
|
|
1444
|
+
width: "abbreviated",
|
|
1445
|
+
context: "standalone"
|
|
1446
|
+
});
|
|
1447
|
+
case "LLLLL": return localize.month(month, {
|
|
1448
|
+
width: "narrow",
|
|
1449
|
+
context: "standalone"
|
|
1450
|
+
});
|
|
1451
|
+
default: return localize.month(month, {
|
|
1452
|
+
width: "wide",
|
|
1453
|
+
context: "standalone"
|
|
1454
|
+
});
|
|
1455
|
+
}
|
|
1456
|
+
},
|
|
1457
|
+
w: function(date, token, localize, options) {
|
|
1458
|
+
const week = getWeek(date, options);
|
|
1459
|
+
if (token === "wo") return localize.ordinalNumber(week, { unit: "week" });
|
|
1460
|
+
return addLeadingZeros(week, token.length);
|
|
1461
|
+
},
|
|
1462
|
+
I: function(date, token, localize) {
|
|
1463
|
+
const isoWeek = getISOWeek(date);
|
|
1464
|
+
if (token === "Io") return localize.ordinalNumber(isoWeek, { unit: "week" });
|
|
1465
|
+
return addLeadingZeros(isoWeek, token.length);
|
|
1466
|
+
},
|
|
1467
|
+
d: function(date, token, localize) {
|
|
1468
|
+
if (token === "do") return localize.ordinalNumber(date.getDate(), { unit: "date" });
|
|
1469
|
+
return lightFormatters.d(date, token);
|
|
1470
|
+
},
|
|
1471
|
+
D: function(date, token, localize) {
|
|
1472
|
+
const dayOfYear = getDayOfYear(date);
|
|
1473
|
+
if (token === "Do") return localize.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
|
|
1474
|
+
return addLeadingZeros(dayOfYear, token.length);
|
|
1475
|
+
},
|
|
1476
|
+
E: function(date, token, localize) {
|
|
1477
|
+
const dayOfWeek = date.getDay();
|
|
1478
|
+
switch (token) {
|
|
1479
|
+
case "E":
|
|
1480
|
+
case "EE":
|
|
1481
|
+
case "EEE": return localize.day(dayOfWeek, {
|
|
1482
|
+
width: "abbreviated",
|
|
1483
|
+
context: "formatting"
|
|
1484
|
+
});
|
|
1485
|
+
case "EEEEE": return localize.day(dayOfWeek, {
|
|
1486
|
+
width: "narrow",
|
|
1487
|
+
context: "formatting"
|
|
1488
|
+
});
|
|
1489
|
+
case "EEEEEE": return localize.day(dayOfWeek, {
|
|
1490
|
+
width: "short",
|
|
1491
|
+
context: "formatting"
|
|
1492
|
+
});
|
|
1493
|
+
default: return localize.day(dayOfWeek, {
|
|
1494
|
+
width: "wide",
|
|
1495
|
+
context: "formatting"
|
|
1496
|
+
});
|
|
1497
|
+
}
|
|
1498
|
+
},
|
|
1499
|
+
e: function(date, token, localize, options) {
|
|
1500
|
+
const dayOfWeek = date.getDay();
|
|
1501
|
+
const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
|
|
1502
|
+
switch (token) {
|
|
1503
|
+
case "e": return String(localDayOfWeek);
|
|
1504
|
+
case "ee": return addLeadingZeros(localDayOfWeek, 2);
|
|
1505
|
+
case "eo": return localize.ordinalNumber(localDayOfWeek, { unit: "day" });
|
|
1506
|
+
case "eee": return localize.day(dayOfWeek, {
|
|
1507
|
+
width: "abbreviated",
|
|
1508
|
+
context: "formatting"
|
|
1509
|
+
});
|
|
1510
|
+
case "eeeee": return localize.day(dayOfWeek, {
|
|
1511
|
+
width: "narrow",
|
|
1512
|
+
context: "formatting"
|
|
1513
|
+
});
|
|
1514
|
+
case "eeeeee": return localize.day(dayOfWeek, {
|
|
1515
|
+
width: "short",
|
|
1516
|
+
context: "formatting"
|
|
1517
|
+
});
|
|
1518
|
+
default: return localize.day(dayOfWeek, {
|
|
1519
|
+
width: "wide",
|
|
1520
|
+
context: "formatting"
|
|
1521
|
+
});
|
|
1522
|
+
}
|
|
1523
|
+
},
|
|
1524
|
+
c: function(date, token, localize, options) {
|
|
1525
|
+
const dayOfWeek = date.getDay();
|
|
1526
|
+
const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
|
|
1527
|
+
switch (token) {
|
|
1528
|
+
case "c": return String(localDayOfWeek);
|
|
1529
|
+
case "cc": return addLeadingZeros(localDayOfWeek, token.length);
|
|
1530
|
+
case "co": return localize.ordinalNumber(localDayOfWeek, { unit: "day" });
|
|
1531
|
+
case "ccc": return localize.day(dayOfWeek, {
|
|
1532
|
+
width: "abbreviated",
|
|
1533
|
+
context: "standalone"
|
|
1534
|
+
});
|
|
1535
|
+
case "ccccc": return localize.day(dayOfWeek, {
|
|
1536
|
+
width: "narrow",
|
|
1537
|
+
context: "standalone"
|
|
1538
|
+
});
|
|
1539
|
+
case "cccccc": return localize.day(dayOfWeek, {
|
|
1540
|
+
width: "short",
|
|
1541
|
+
context: "standalone"
|
|
1542
|
+
});
|
|
1543
|
+
default: return localize.day(dayOfWeek, {
|
|
1544
|
+
width: "wide",
|
|
1545
|
+
context: "standalone"
|
|
1546
|
+
});
|
|
1547
|
+
}
|
|
1548
|
+
},
|
|
1549
|
+
i: function(date, token, localize) {
|
|
1550
|
+
const dayOfWeek = date.getDay();
|
|
1551
|
+
const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
|
|
1552
|
+
switch (token) {
|
|
1553
|
+
case "i": return String(isoDayOfWeek);
|
|
1554
|
+
case "ii": return addLeadingZeros(isoDayOfWeek, token.length);
|
|
1555
|
+
case "io": return localize.ordinalNumber(isoDayOfWeek, { unit: "day" });
|
|
1556
|
+
case "iii": return localize.day(dayOfWeek, {
|
|
1557
|
+
width: "abbreviated",
|
|
1558
|
+
context: "formatting"
|
|
1559
|
+
});
|
|
1560
|
+
case "iiiii": return localize.day(dayOfWeek, {
|
|
1561
|
+
width: "narrow",
|
|
1562
|
+
context: "formatting"
|
|
1563
|
+
});
|
|
1564
|
+
case "iiiiii": return localize.day(dayOfWeek, {
|
|
1565
|
+
width: "short",
|
|
1566
|
+
context: "formatting"
|
|
1567
|
+
});
|
|
1568
|
+
default: return localize.day(dayOfWeek, {
|
|
1569
|
+
width: "wide",
|
|
1570
|
+
context: "formatting"
|
|
1571
|
+
});
|
|
1572
|
+
}
|
|
1573
|
+
},
|
|
1574
|
+
a: function(date, token, localize) {
|
|
1575
|
+
const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
|
|
1576
|
+
switch (token) {
|
|
1577
|
+
case "a":
|
|
1578
|
+
case "aa": return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1579
|
+
width: "abbreviated",
|
|
1580
|
+
context: "formatting"
|
|
1581
|
+
});
|
|
1582
|
+
case "aaa": return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1583
|
+
width: "abbreviated",
|
|
1584
|
+
context: "formatting"
|
|
1585
|
+
}).toLowerCase();
|
|
1586
|
+
case "aaaaa": return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1587
|
+
width: "narrow",
|
|
1588
|
+
context: "formatting"
|
|
1589
|
+
});
|
|
1590
|
+
default: return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1591
|
+
width: "wide",
|
|
1592
|
+
context: "formatting"
|
|
1593
|
+
});
|
|
1594
|
+
}
|
|
1595
|
+
},
|
|
1596
|
+
b: function(date, token, localize) {
|
|
1597
|
+
const hours = date.getHours();
|
|
1598
|
+
let dayPeriodEnumValue;
|
|
1599
|
+
if (hours === 12) dayPeriodEnumValue = dayPeriodEnum.noon;
|
|
1600
|
+
else if (hours === 0) dayPeriodEnumValue = dayPeriodEnum.midnight;
|
|
1601
|
+
else dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
|
|
1602
|
+
switch (token) {
|
|
1603
|
+
case "b":
|
|
1604
|
+
case "bb": return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1605
|
+
width: "abbreviated",
|
|
1606
|
+
context: "formatting"
|
|
1607
|
+
});
|
|
1608
|
+
case "bbb": return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1609
|
+
width: "abbreviated",
|
|
1610
|
+
context: "formatting"
|
|
1611
|
+
}).toLowerCase();
|
|
1612
|
+
case "bbbbb": return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1613
|
+
width: "narrow",
|
|
1614
|
+
context: "formatting"
|
|
1615
|
+
});
|
|
1616
|
+
default: return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1617
|
+
width: "wide",
|
|
1618
|
+
context: "formatting"
|
|
1619
|
+
});
|
|
1620
|
+
}
|
|
1621
|
+
},
|
|
1622
|
+
B: function(date, token, localize) {
|
|
1623
|
+
const hours = date.getHours();
|
|
1624
|
+
let dayPeriodEnumValue;
|
|
1625
|
+
if (hours >= 17) dayPeriodEnumValue = dayPeriodEnum.evening;
|
|
1626
|
+
else if (hours >= 12) dayPeriodEnumValue = dayPeriodEnum.afternoon;
|
|
1627
|
+
else if (hours >= 4) dayPeriodEnumValue = dayPeriodEnum.morning;
|
|
1628
|
+
else dayPeriodEnumValue = dayPeriodEnum.night;
|
|
1629
|
+
switch (token) {
|
|
1630
|
+
case "B":
|
|
1631
|
+
case "BB":
|
|
1632
|
+
case "BBB": return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1633
|
+
width: "abbreviated",
|
|
1634
|
+
context: "formatting"
|
|
1635
|
+
});
|
|
1636
|
+
case "BBBBB": return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1637
|
+
width: "narrow",
|
|
1638
|
+
context: "formatting"
|
|
1639
|
+
});
|
|
1640
|
+
default: return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1641
|
+
width: "wide",
|
|
1642
|
+
context: "formatting"
|
|
1643
|
+
});
|
|
1644
|
+
}
|
|
1645
|
+
},
|
|
1646
|
+
h: function(date, token, localize) {
|
|
1647
|
+
if (token === "ho") {
|
|
1648
|
+
let hours = date.getHours() % 12;
|
|
1649
|
+
if (hours === 0) hours = 12;
|
|
1650
|
+
return localize.ordinalNumber(hours, { unit: "hour" });
|
|
1651
|
+
}
|
|
1652
|
+
return lightFormatters.h(date, token);
|
|
1653
|
+
},
|
|
1654
|
+
H: function(date, token, localize) {
|
|
1655
|
+
if (token === "Ho") return localize.ordinalNumber(date.getHours(), { unit: "hour" });
|
|
1656
|
+
return lightFormatters.H(date, token);
|
|
1657
|
+
},
|
|
1658
|
+
K: function(date, token, localize) {
|
|
1659
|
+
const hours = date.getHours() % 12;
|
|
1660
|
+
if (token === "Ko") return localize.ordinalNumber(hours, { unit: "hour" });
|
|
1661
|
+
return addLeadingZeros(hours, token.length);
|
|
1662
|
+
},
|
|
1663
|
+
k: function(date, token, localize) {
|
|
1664
|
+
let hours = date.getHours();
|
|
1665
|
+
if (hours === 0) hours = 24;
|
|
1666
|
+
if (token === "ko") return localize.ordinalNumber(hours, { unit: "hour" });
|
|
1667
|
+
return addLeadingZeros(hours, token.length);
|
|
1668
|
+
},
|
|
1669
|
+
m: function(date, token, localize) {
|
|
1670
|
+
if (token === "mo") return localize.ordinalNumber(date.getMinutes(), { unit: "minute" });
|
|
1671
|
+
return lightFormatters.m(date, token);
|
|
1672
|
+
},
|
|
1673
|
+
s: function(date, token, localize) {
|
|
1674
|
+
if (token === "so") return localize.ordinalNumber(date.getSeconds(), { unit: "second" });
|
|
1675
|
+
return lightFormatters.s(date, token);
|
|
1676
|
+
},
|
|
1677
|
+
S: function(date, token) {
|
|
1678
|
+
return lightFormatters.S(date, token);
|
|
1679
|
+
},
|
|
1680
|
+
X: function(date, token, _localize) {
|
|
1681
|
+
const timezoneOffset = date.getTimezoneOffset();
|
|
1682
|
+
if (timezoneOffset === 0) return "Z";
|
|
1683
|
+
switch (token) {
|
|
1684
|
+
case "X": return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
1685
|
+
case "XXXX":
|
|
1686
|
+
case "XX": return formatTimezone(timezoneOffset);
|
|
1687
|
+
default: return formatTimezone(timezoneOffset, ":");
|
|
1688
|
+
}
|
|
1689
|
+
},
|
|
1690
|
+
x: function(date, token, _localize) {
|
|
1691
|
+
const timezoneOffset = date.getTimezoneOffset();
|
|
1692
|
+
switch (token) {
|
|
1693
|
+
case "x": return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
1694
|
+
case "xxxx":
|
|
1695
|
+
case "xx": return formatTimezone(timezoneOffset);
|
|
1696
|
+
default: return formatTimezone(timezoneOffset, ":");
|
|
1697
|
+
}
|
|
1698
|
+
},
|
|
1699
|
+
O: function(date, token, _localize) {
|
|
1700
|
+
const timezoneOffset = date.getTimezoneOffset();
|
|
1701
|
+
switch (token) {
|
|
1702
|
+
case "O":
|
|
1703
|
+
case "OO":
|
|
1704
|
+
case "OOO": return "GMT" + formatTimezoneShort(timezoneOffset, ":");
|
|
1705
|
+
default: return "GMT" + formatTimezone(timezoneOffset, ":");
|
|
1706
|
+
}
|
|
1707
|
+
},
|
|
1708
|
+
z: function(date, token, _localize) {
|
|
1709
|
+
const timezoneOffset = date.getTimezoneOffset();
|
|
1710
|
+
switch (token) {
|
|
1711
|
+
case "z":
|
|
1712
|
+
case "zz":
|
|
1713
|
+
case "zzz": return "GMT" + formatTimezoneShort(timezoneOffset, ":");
|
|
1714
|
+
default: return "GMT" + formatTimezone(timezoneOffset, ":");
|
|
1715
|
+
}
|
|
1716
|
+
},
|
|
1717
|
+
t: function(date, token, _localize) {
|
|
1718
|
+
return addLeadingZeros(Math.trunc(+date / 1e3), token.length);
|
|
1719
|
+
},
|
|
1720
|
+
T: function(date, token, _localize) {
|
|
1721
|
+
return addLeadingZeros(+date, token.length);
|
|
1722
|
+
}
|
|
1723
|
+
};
|
|
1724
|
+
function formatTimezoneShort(offset, delimiter = "") {
|
|
1725
|
+
const sign = offset > 0 ? "-" : "+";
|
|
1726
|
+
const absOffset = Math.abs(offset);
|
|
1727
|
+
const hours = Math.trunc(absOffset / 60);
|
|
1728
|
+
const minutes = absOffset % 60;
|
|
1729
|
+
if (minutes === 0) return sign + String(hours);
|
|
1730
|
+
return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
|
|
1731
|
+
}
|
|
1732
|
+
function formatTimezoneWithOptionalMinutes(offset, delimiter) {
|
|
1733
|
+
if (offset % 60 === 0) return (offset > 0 ? "-" : "+") + addLeadingZeros(Math.abs(offset) / 60, 2);
|
|
1734
|
+
return formatTimezone(offset, delimiter);
|
|
1735
|
+
}
|
|
1736
|
+
function formatTimezone(offset, delimiter = "") {
|
|
1737
|
+
const sign = offset > 0 ? "-" : "+";
|
|
1738
|
+
const absOffset = Math.abs(offset);
|
|
1739
|
+
const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
|
|
1740
|
+
const minutes = addLeadingZeros(absOffset % 60, 2);
|
|
1741
|
+
return sign + hours + delimiter + minutes;
|
|
1742
|
+
}
|
|
1743
|
+
//#endregion
|
|
1744
|
+
//#region node_modules/date-fns/_lib/format/longFormatters.js
|
|
1745
|
+
var dateLongFormatter = (pattern, formatLong) => {
|
|
1746
|
+
switch (pattern) {
|
|
1747
|
+
case "P": return formatLong.date({ width: "short" });
|
|
1748
|
+
case "PP": return formatLong.date({ width: "medium" });
|
|
1749
|
+
case "PPP": return formatLong.date({ width: "long" });
|
|
1750
|
+
default: return formatLong.date({ width: "full" });
|
|
1751
|
+
}
|
|
1752
|
+
};
|
|
1753
|
+
var timeLongFormatter = (pattern, formatLong) => {
|
|
1754
|
+
switch (pattern) {
|
|
1755
|
+
case "p": return formatLong.time({ width: "short" });
|
|
1756
|
+
case "pp": return formatLong.time({ width: "medium" });
|
|
1757
|
+
case "ppp": return formatLong.time({ width: "long" });
|
|
1758
|
+
default: return formatLong.time({ width: "full" });
|
|
1759
|
+
}
|
|
1760
|
+
};
|
|
1761
|
+
var dateTimeLongFormatter = (pattern, formatLong) => {
|
|
1762
|
+
const matchResult = pattern.match(/(P+)(p+)?/) || [];
|
|
1763
|
+
const datePattern = matchResult[1];
|
|
1764
|
+
const timePattern = matchResult[2];
|
|
1765
|
+
if (!timePattern) return dateLongFormatter(pattern, formatLong);
|
|
1766
|
+
let dateTimeFormat;
|
|
1767
|
+
switch (datePattern) {
|
|
1768
|
+
case "P":
|
|
1769
|
+
dateTimeFormat = formatLong.dateTime({ width: "short" });
|
|
1770
|
+
break;
|
|
1771
|
+
case "PP":
|
|
1772
|
+
dateTimeFormat = formatLong.dateTime({ width: "medium" });
|
|
1773
|
+
break;
|
|
1774
|
+
case "PPP":
|
|
1775
|
+
dateTimeFormat = formatLong.dateTime({ width: "long" });
|
|
1776
|
+
break;
|
|
1777
|
+
default:
|
|
1778
|
+
dateTimeFormat = formatLong.dateTime({ width: "full" });
|
|
1779
|
+
break;
|
|
1780
|
+
}
|
|
1781
|
+
return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong)).replace("{{time}}", timeLongFormatter(timePattern, formatLong));
|
|
1782
|
+
};
|
|
1783
|
+
var longFormatters = {
|
|
1784
|
+
p: timeLongFormatter,
|
|
1785
|
+
P: dateTimeLongFormatter
|
|
1786
|
+
};
|
|
1787
|
+
//#endregion
|
|
1788
|
+
//#region node_modules/date-fns/_lib/protectedTokens.js
|
|
1789
|
+
var dayOfYearTokenRE = /^D+$/;
|
|
1790
|
+
var weekYearTokenRE = /^Y+$/;
|
|
1791
|
+
var throwTokens = [
|
|
1792
|
+
"D",
|
|
1793
|
+
"DD",
|
|
1794
|
+
"YY",
|
|
1795
|
+
"YYYY"
|
|
1796
|
+
];
|
|
1797
|
+
function isProtectedDayOfYearToken(token) {
|
|
1798
|
+
return dayOfYearTokenRE.test(token);
|
|
1799
|
+
}
|
|
1800
|
+
function isProtectedWeekYearToken(token) {
|
|
1801
|
+
return weekYearTokenRE.test(token);
|
|
1802
|
+
}
|
|
1803
|
+
function warnOrThrowProtectedError(token, format, input) {
|
|
1804
|
+
const _message = message(token, format, input);
|
|
1805
|
+
console.warn(_message);
|
|
1806
|
+
if (throwTokens.includes(token)) throw new RangeError(_message);
|
|
1807
|
+
}
|
|
1808
|
+
function message(token, format, input) {
|
|
1809
|
+
const subject = token[0] === "Y" ? "years" : "days of the month";
|
|
1810
|
+
return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
|
|
1811
|
+
}
|
|
1812
|
+
//#endregion
|
|
1813
|
+
//#region node_modules/date-fns/format.js
|
|
1814
|
+
var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
|
1815
|
+
var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
|
1816
|
+
var escapedStringRegExp = /^'([^]*?)'?$/;
|
|
1817
|
+
var doubleQuoteRegExp = /''/g;
|
|
1818
|
+
var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
1819
|
+
/**
|
|
1820
|
+
* The {@link format} function options.
|
|
1821
|
+
*/
|
|
1822
|
+
/**
|
|
1823
|
+
* @name format
|
|
1824
|
+
* @alias formatDate
|
|
1825
|
+
* @category Common Helpers
|
|
1826
|
+
* @summary Format the date.
|
|
1827
|
+
*
|
|
1828
|
+
* @description
|
|
1829
|
+
* Return the formatted date string in the given format. The result may vary by locale.
|
|
1830
|
+
*
|
|
1831
|
+
* > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
|
|
1832
|
+
* > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
1833
|
+
*
|
|
1834
|
+
* The characters wrapped between two single quotes characters (') are escaped.
|
|
1835
|
+
* Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
|
|
1836
|
+
* (see the last example)
|
|
1837
|
+
*
|
|
1838
|
+
* Format of the string is based on Unicode Technical Standard #35:
|
|
1839
|
+
* https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
1840
|
+
* with a few additions (see note 7 below the table).
|
|
1841
|
+
*
|
|
1842
|
+
* Accepted patterns:
|
|
1843
|
+
* | Unit | Pattern | Result examples | Notes |
|
|
1844
|
+
* |---------------------------------|---------|-----------------------------------|-------|
|
|
1845
|
+
* | Era | G..GGG | AD, BC | |
|
|
1846
|
+
* | | GGGG | Anno Domini, Before Christ | 2 |
|
|
1847
|
+
* | | GGGGG | A, B | |
|
|
1848
|
+
* | Calendar year | y | 44, 1, 1900, 2017 | 5 |
|
|
1849
|
+
* | | yo | 44th, 1st, 0th, 17th | 5,7 |
|
|
1850
|
+
* | | yy | 44, 01, 00, 17 | 5 |
|
|
1851
|
+
* | | yyy | 044, 001, 1900, 2017 | 5 |
|
|
1852
|
+
* | | yyyy | 0044, 0001, 1900, 2017 | 5 |
|
|
1853
|
+
* | | yyyyy | ... | 3,5 |
|
|
1854
|
+
* | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
|
|
1855
|
+
* | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
|
|
1856
|
+
* | | YY | 44, 01, 00, 17 | 5,8 |
|
|
1857
|
+
* | | YYY | 044, 001, 1900, 2017 | 5 |
|
|
1858
|
+
* | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
|
|
1859
|
+
* | | YYYYY | ... | 3,5 |
|
|
1860
|
+
* | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
|
|
1861
|
+
* | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
|
|
1862
|
+
* | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
|
|
1863
|
+
* | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
|
|
1864
|
+
* | | RRRRR | ... | 3,5,7 |
|
|
1865
|
+
* | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
|
|
1866
|
+
* | | uu | -43, 01, 1900, 2017 | 5 |
|
|
1867
|
+
* | | uuu | -043, 001, 1900, 2017 | 5 |
|
|
1868
|
+
* | | uuuu | -0043, 0001, 1900, 2017 | 5 |
|
|
1869
|
+
* | | uuuuu | ... | 3,5 |
|
|
1870
|
+
* | Quarter (formatting) | Q | 1, 2, 3, 4 | |
|
|
1871
|
+
* | | Qo | 1st, 2nd, 3rd, 4th | 7 |
|
|
1872
|
+
* | | QQ | 01, 02, 03, 04 | |
|
|
1873
|
+
* | | QQQ | Q1, Q2, Q3, Q4 | |
|
|
1874
|
+
* | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
|
|
1875
|
+
* | | QQQQQ | 1, 2, 3, 4 | 4 |
|
|
1876
|
+
* | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
|
|
1877
|
+
* | | qo | 1st, 2nd, 3rd, 4th | 7 |
|
|
1878
|
+
* | | qq | 01, 02, 03, 04 | |
|
|
1879
|
+
* | | qqq | Q1, Q2, Q3, Q4 | |
|
|
1880
|
+
* | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
|
|
1881
|
+
* | | qqqqq | 1, 2, 3, 4 | 4 |
|
|
1882
|
+
* | Month (formatting) | M | 1, 2, ..., 12 | |
|
|
1883
|
+
* | | Mo | 1st, 2nd, ..., 12th | 7 |
|
|
1884
|
+
* | | MM | 01, 02, ..., 12 | |
|
|
1885
|
+
* | | MMM | Jan, Feb, ..., Dec | |
|
|
1886
|
+
* | | MMMM | January, February, ..., December | 2 |
|
|
1887
|
+
* | | MMMMM | J, F, ..., D | |
|
|
1888
|
+
* | Month (stand-alone) | L | 1, 2, ..., 12 | |
|
|
1889
|
+
* | | Lo | 1st, 2nd, ..., 12th | 7 |
|
|
1890
|
+
* | | LL | 01, 02, ..., 12 | |
|
|
1891
|
+
* | | LLL | Jan, Feb, ..., Dec | |
|
|
1892
|
+
* | | LLLL | January, February, ..., December | 2 |
|
|
1893
|
+
* | | LLLLL | J, F, ..., D | |
|
|
1894
|
+
* | Local week of year | w | 1, 2, ..., 53 | |
|
|
1895
|
+
* | | wo | 1st, 2nd, ..., 53th | 7 |
|
|
1896
|
+
* | | ww | 01, 02, ..., 53 | |
|
|
1897
|
+
* | ISO week of year | I | 1, 2, ..., 53 | 7 |
|
|
1898
|
+
* | | Io | 1st, 2nd, ..., 53th | 7 |
|
|
1899
|
+
* | | II | 01, 02, ..., 53 | 7 |
|
|
1900
|
+
* | Day of month | d | 1, 2, ..., 31 | |
|
|
1901
|
+
* | | do | 1st, 2nd, ..., 31st | 7 |
|
|
1902
|
+
* | | dd | 01, 02, ..., 31 | |
|
|
1903
|
+
* | Day of year | D | 1, 2, ..., 365, 366 | 9 |
|
|
1904
|
+
* | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
|
|
1905
|
+
* | | DD | 01, 02, ..., 365, 366 | 9 |
|
|
1906
|
+
* | | DDD | 001, 002, ..., 365, 366 | |
|
|
1907
|
+
* | | DDDD | ... | 3 |
|
|
1908
|
+
* | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
|
|
1909
|
+
* | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
|
|
1910
|
+
* | | EEEEE | M, T, W, T, F, S, S | |
|
|
1911
|
+
* | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
1912
|
+
* | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
|
|
1913
|
+
* | | io | 1st, 2nd, ..., 7th | 7 |
|
|
1914
|
+
* | | ii | 01, 02, ..., 07 | 7 |
|
|
1915
|
+
* | | iii | Mon, Tue, Wed, ..., Sun | 7 |
|
|
1916
|
+
* | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
|
|
1917
|
+
* | | iiiii | M, T, W, T, F, S, S | 7 |
|
|
1918
|
+
* | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
|
|
1919
|
+
* | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
|
|
1920
|
+
* | | eo | 2nd, 3rd, ..., 1st | 7 |
|
|
1921
|
+
* | | ee | 02, 03, ..., 01 | |
|
|
1922
|
+
* | | eee | Mon, Tue, Wed, ..., Sun | |
|
|
1923
|
+
* | | eeee | Monday, Tuesday, ..., Sunday | 2 |
|
|
1924
|
+
* | | eeeee | M, T, W, T, F, S, S | |
|
|
1925
|
+
* | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
1926
|
+
* | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
|
|
1927
|
+
* | | co | 2nd, 3rd, ..., 1st | 7 |
|
|
1928
|
+
* | | cc | 02, 03, ..., 01 | |
|
|
1929
|
+
* | | ccc | Mon, Tue, Wed, ..., Sun | |
|
|
1930
|
+
* | | cccc | Monday, Tuesday, ..., Sunday | 2 |
|
|
1931
|
+
* | | ccccc | M, T, W, T, F, S, S | |
|
|
1932
|
+
* | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
1933
|
+
* | AM, PM | a..aa | AM, PM | |
|
|
1934
|
+
* | | aaa | am, pm | |
|
|
1935
|
+
* | | aaaa | a.m., p.m. | 2 |
|
|
1936
|
+
* | | aaaaa | a, p | |
|
|
1937
|
+
* | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
|
|
1938
|
+
* | | bbb | am, pm, noon, midnight | |
|
|
1939
|
+
* | | bbbb | a.m., p.m., noon, midnight | 2 |
|
|
1940
|
+
* | | bbbbb | a, p, n, mi | |
|
|
1941
|
+
* | Flexible day period | B..BBB | at night, in the morning, ... | |
|
|
1942
|
+
* | | BBBB | at night, in the morning, ... | 2 |
|
|
1943
|
+
* | | BBBBB | at night, in the morning, ... | |
|
|
1944
|
+
* | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
|
|
1945
|
+
* | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
|
|
1946
|
+
* | | hh | 01, 02, ..., 11, 12 | |
|
|
1947
|
+
* | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
|
|
1948
|
+
* | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
|
|
1949
|
+
* | | HH | 00, 01, 02, ..., 23 | |
|
|
1950
|
+
* | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
|
|
1951
|
+
* | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
|
|
1952
|
+
* | | KK | 01, 02, ..., 11, 00 | |
|
|
1953
|
+
* | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
|
|
1954
|
+
* | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
|
|
1955
|
+
* | | kk | 24, 01, 02, ..., 23 | |
|
|
1956
|
+
* | Minute | m | 0, 1, ..., 59 | |
|
|
1957
|
+
* | | mo | 0th, 1st, ..., 59th | 7 |
|
|
1958
|
+
* | | mm | 00, 01, ..., 59 | |
|
|
1959
|
+
* | Second | s | 0, 1, ..., 59 | |
|
|
1960
|
+
* | | so | 0th, 1st, ..., 59th | 7 |
|
|
1961
|
+
* | | ss | 00, 01, ..., 59 | |
|
|
1962
|
+
* | Fraction of second | S | 0, 1, ..., 9 | |
|
|
1963
|
+
* | | SS | 00, 01, ..., 99 | |
|
|
1964
|
+
* | | SSS | 000, 001, ..., 999 | |
|
|
1965
|
+
* | | SSSS | ... | 3 |
|
|
1966
|
+
* | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
|
|
1967
|
+
* | | XX | -0800, +0530, Z | |
|
|
1968
|
+
* | | XXX | -08:00, +05:30, Z | |
|
|
1969
|
+
* | | XXXX | -0800, +0530, Z, +123456 | 2 |
|
|
1970
|
+
* | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
|
|
1971
|
+
* | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
|
|
1972
|
+
* | | xx | -0800, +0530, +0000 | |
|
|
1973
|
+
* | | xxx | -08:00, +05:30, +00:00 | 2 |
|
|
1974
|
+
* | | xxxx | -0800, +0530, +0000, +123456 | |
|
|
1975
|
+
* | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
|
|
1976
|
+
* | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
|
|
1977
|
+
* | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
|
|
1978
|
+
* | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
|
|
1979
|
+
* | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
|
|
1980
|
+
* | Seconds timestamp | t | 512969520 | 7 |
|
|
1981
|
+
* | | tt | ... | 3,7 |
|
|
1982
|
+
* | Milliseconds timestamp | T | 512969520900 | 7 |
|
|
1983
|
+
* | | TT | ... | 3,7 |
|
|
1984
|
+
* | Long localized date | P | 04/29/1453 | 7 |
|
|
1985
|
+
* | | PP | Apr 29, 1453 | 7 |
|
|
1986
|
+
* | | PPP | April 29th, 1453 | 7 |
|
|
1987
|
+
* | | PPPP | Friday, April 29th, 1453 | 2,7 |
|
|
1988
|
+
* | Long localized time | p | 12:00 AM | 7 |
|
|
1989
|
+
* | | pp | 12:00:00 AM | 7 |
|
|
1990
|
+
* | | ppp | 12:00:00 AM GMT+2 | 7 |
|
|
1991
|
+
* | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
|
|
1992
|
+
* | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
|
|
1993
|
+
* | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
|
|
1994
|
+
* | | PPPppp | April 29th, 1453 at ... | 7 |
|
|
1995
|
+
* | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
|
|
1996
|
+
* Notes:
|
|
1997
|
+
* 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
|
|
1998
|
+
* are the same as "stand-alone" units, but are different in some languages.
|
|
1999
|
+
* "Formatting" units are declined according to the rules of the language
|
|
2000
|
+
* in the context of a date. "Stand-alone" units are always nominative singular:
|
|
2001
|
+
*
|
|
2002
|
+
* `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
|
|
2003
|
+
*
|
|
2004
|
+
* `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
|
|
2005
|
+
*
|
|
2006
|
+
* 2. Any sequence of the identical letters is a pattern, unless it is escaped by
|
|
2007
|
+
* the single quote characters (see below).
|
|
2008
|
+
* If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
|
|
2009
|
+
* the output will be the same as default pattern for this unit, usually
|
|
2010
|
+
* the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
|
|
2011
|
+
* are marked with "2" in the last column of the table.
|
|
2012
|
+
*
|
|
2013
|
+
* `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
|
|
2014
|
+
*
|
|
2015
|
+
* `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
|
|
2016
|
+
*
|
|
2017
|
+
* `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
|
|
2018
|
+
*
|
|
2019
|
+
* `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
|
|
2020
|
+
*
|
|
2021
|
+
* `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
|
|
2022
|
+
*
|
|
2023
|
+
* 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
|
|
2024
|
+
* The output will be padded with zeros to match the length of the pattern.
|
|
2025
|
+
*
|
|
2026
|
+
* `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
|
|
2027
|
+
*
|
|
2028
|
+
* 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
|
|
2029
|
+
* These tokens represent the shortest form of the quarter.
|
|
2030
|
+
*
|
|
2031
|
+
* 5. The main difference between `y` and `u` patterns are B.C. years:
|
|
2032
|
+
*
|
|
2033
|
+
* | Year | `y` | `u` |
|
|
2034
|
+
* |------|-----|-----|
|
|
2035
|
+
* | AC 1 | 1 | 1 |
|
|
2036
|
+
* | BC 1 | 1 | 0 |
|
|
2037
|
+
* | BC 2 | 2 | -1 |
|
|
2038
|
+
*
|
|
2039
|
+
* Also `yy` always returns the last two digits of a year,
|
|
2040
|
+
* while `uu` pads single digit years to 2 characters and returns other years unchanged:
|
|
2041
|
+
*
|
|
2042
|
+
* | Year | `yy` | `uu` |
|
|
2043
|
+
* |------|------|------|
|
|
2044
|
+
* | 1 | 01 | 01 |
|
|
2045
|
+
* | 14 | 14 | 14 |
|
|
2046
|
+
* | 376 | 76 | 376 |
|
|
2047
|
+
* | 1453 | 53 | 1453 |
|
|
2048
|
+
*
|
|
2049
|
+
* The same difference is true for local and ISO week-numbering years (`Y` and `R`),
|
|
2050
|
+
* except local week-numbering years are dependent on `options.weekStartsOn`
|
|
2051
|
+
* and `options.firstWeekContainsDate` (compare [getISOWeekYear](https://date-fns.org/docs/getISOWeekYear)
|
|
2052
|
+
* and [getWeekYear](https://date-fns.org/docs/getWeekYear)).
|
|
2053
|
+
*
|
|
2054
|
+
* 6. Specific non-location timezones are currently unavailable in `date-fns`,
|
|
2055
|
+
* so right now these tokens fall back to GMT timezones.
|
|
2056
|
+
*
|
|
2057
|
+
* 7. These patterns are not in the Unicode Technical Standard #35:
|
|
2058
|
+
* - `i`: ISO day of week
|
|
2059
|
+
* - `I`: ISO week of year
|
|
2060
|
+
* - `R`: ISO week-numbering year
|
|
2061
|
+
* - `t`: seconds timestamp
|
|
2062
|
+
* - `T`: milliseconds timestamp
|
|
2063
|
+
* - `o`: ordinal number modifier
|
|
2064
|
+
* - `P`: long localized date
|
|
2065
|
+
* - `p`: long localized time
|
|
2066
|
+
*
|
|
2067
|
+
* 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
|
|
2068
|
+
* You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
2069
|
+
*
|
|
2070
|
+
* 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
|
|
2071
|
+
* You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
2072
|
+
*
|
|
2073
|
+
* @param date - The original date
|
|
2074
|
+
* @param format - The string of tokens
|
|
2075
|
+
* @param options - An object with options
|
|
2076
|
+
*
|
|
2077
|
+
* @returns The formatted date string
|
|
2078
|
+
*
|
|
2079
|
+
* @throws `date` must not be Invalid Date
|
|
2080
|
+
* @throws `options.locale` must contain `localize` property
|
|
2081
|
+
* @throws `options.locale` must contain `formatLong` property
|
|
2082
|
+
* @throws use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
2083
|
+
* @throws use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
2084
|
+
* @throws use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
2085
|
+
* @throws use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
2086
|
+
* @throws format string contains an unescaped latin alphabet character
|
|
2087
|
+
*
|
|
2088
|
+
* @example
|
|
2089
|
+
* // Represent 11 February 2014 in middle-endian format:
|
|
2090
|
+
* const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
|
|
2091
|
+
* //=> '02/11/2014'
|
|
2092
|
+
*
|
|
2093
|
+
* @example
|
|
2094
|
+
* // Represent 2 July 2014 in Esperanto:
|
|
2095
|
+
* import { eoLocale } from 'date-fns/locale/eo'
|
|
2096
|
+
* const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
|
|
2097
|
+
* locale: eoLocale
|
|
2098
|
+
* })
|
|
2099
|
+
* //=> '2-a de julio 2014'
|
|
2100
|
+
*
|
|
2101
|
+
* @example
|
|
2102
|
+
* // Escape string by single quote characters:
|
|
2103
|
+
* const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
|
|
2104
|
+
* //=> "3 o'clock"
|
|
2105
|
+
*/
|
|
2106
|
+
function format(date, formatStr, options) {
|
|
2107
|
+
const defaultOptions = getDefaultOptions();
|
|
2108
|
+
const locale = options?.locale ?? defaultOptions.locale ?? enUS;
|
|
2109
|
+
const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions.firstWeekContainsDate ?? defaultOptions.locale?.options?.firstWeekContainsDate ?? 1;
|
|
2110
|
+
const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0;
|
|
2111
|
+
const originalDate = toDate(date, options?.in);
|
|
2112
|
+
if (!isValid(originalDate)) throw new RangeError("Invalid time value");
|
|
2113
|
+
let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => {
|
|
2114
|
+
const firstCharacter = substring[0];
|
|
2115
|
+
if (firstCharacter === "p" || firstCharacter === "P") {
|
|
2116
|
+
const longFormatter = longFormatters[firstCharacter];
|
|
2117
|
+
return longFormatter(substring, locale.formatLong);
|
|
2118
|
+
}
|
|
2119
|
+
return substring;
|
|
2120
|
+
}).join("").match(formattingTokensRegExp).map((substring) => {
|
|
2121
|
+
if (substring === "''") return {
|
|
2122
|
+
isToken: false,
|
|
2123
|
+
value: "'"
|
|
2124
|
+
};
|
|
2125
|
+
const firstCharacter = substring[0];
|
|
2126
|
+
if (firstCharacter === "'") return {
|
|
2127
|
+
isToken: false,
|
|
2128
|
+
value: cleanEscapedString(substring)
|
|
2129
|
+
};
|
|
2130
|
+
if (formatters[firstCharacter]) return {
|
|
2131
|
+
isToken: true,
|
|
2132
|
+
value: substring
|
|
2133
|
+
};
|
|
2134
|
+
if (firstCharacter.match(unescapedLatinCharacterRegExp)) throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`");
|
|
2135
|
+
return {
|
|
2136
|
+
isToken: false,
|
|
2137
|
+
value: substring
|
|
2138
|
+
};
|
|
2139
|
+
});
|
|
2140
|
+
if (locale.localize.preprocessor) parts = locale.localize.preprocessor(originalDate, parts);
|
|
2141
|
+
const formatterOptions = {
|
|
2142
|
+
firstWeekContainsDate,
|
|
2143
|
+
weekStartsOn,
|
|
2144
|
+
locale
|
|
2145
|
+
};
|
|
2146
|
+
return parts.map((part) => {
|
|
2147
|
+
if (!part.isToken) return part.value;
|
|
2148
|
+
const token = part.value;
|
|
2149
|
+
if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token) || !options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) warnOrThrowProtectedError(token, formatStr, String(date));
|
|
2150
|
+
const formatter = formatters[token[0]];
|
|
2151
|
+
return formatter(originalDate, token, locale.localize, formatterOptions);
|
|
2152
|
+
}).join("");
|
|
2153
|
+
}
|
|
2154
|
+
function cleanEscapedString(input) {
|
|
2155
|
+
const matched = input.match(escapedStringRegExp);
|
|
2156
|
+
if (!matched) return input;
|
|
2157
|
+
return matched[1].replace(doubleQuoteRegExp, "'");
|
|
2158
|
+
}
|
|
2159
|
+
//#endregion
|
|
2160
|
+
//#region node_modules/date-fns/minutesToMilliseconds.js
|
|
2161
|
+
/**
|
|
2162
|
+
* @name minutesToMilliseconds
|
|
2163
|
+
* @category Conversion Helpers
|
|
2164
|
+
* @summary Convert minutes to milliseconds.
|
|
2165
|
+
*
|
|
2166
|
+
* @description
|
|
2167
|
+
* Convert a number of minutes to a full number of milliseconds.
|
|
2168
|
+
*
|
|
2169
|
+
* @param minutes - The number of minutes to be converted
|
|
2170
|
+
*
|
|
2171
|
+
* @returns The number of minutes converted in milliseconds
|
|
2172
|
+
*
|
|
2173
|
+
* @example
|
|
2174
|
+
* // Convert 2 minutes to milliseconds
|
|
2175
|
+
* const result = minutesToMilliseconds(2)
|
|
2176
|
+
* //=> 120000
|
|
2177
|
+
*/
|
|
2178
|
+
function minutesToMilliseconds(minutes) {
|
|
2179
|
+
return Math.trunc(minutes * millisecondsInMinute);
|
|
2180
|
+
}
|
|
2181
|
+
//#endregion
|
|
2182
|
+
//#region src/components/UI/ArticlesDate.jsx
|
|
2183
|
+
function ArticlesDate(props) {
|
|
2184
|
+
let input_date = props?.date;
|
|
2185
|
+
let date_format = props?.format;
|
|
2186
|
+
if (!input_date) return "Need date prop";
|
|
2187
|
+
return /* @__PURE__ */ jsx("span", {
|
|
2188
|
+
"date-renderer": "ArticlesDate",
|
|
2189
|
+
children: format(new Date(input_date), date_format || "MM/dd/yy - h:mmaa")
|
|
2190
|
+
});
|
|
2191
|
+
}
|
|
2192
|
+
//#endregion
|
|
2193
|
+
//#region src/util/numberWithCommas.js
|
|
2194
|
+
function numberWithCommas(x) {
|
|
2195
|
+
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
2196
|
+
}
|
|
2197
|
+
//#endregion
|
|
2198
|
+
export { normalizeDates as a, format as i, ArticlesDate as n, toDate as o, minutesToMilliseconds as r, millisecondsInMinute as s, numberWithCommas as t };
|