@verdocs/web-sdk 4.2.113 → 4.2.115

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.
Files changed (103) hide show
  1. package/dist/{esm/format-2bf71189.js → cjs/format-0f565a28.js} +325 -719
  2. package/dist/cjs/{utils-2da37620.js → utils-c878d0c2.js} +4 -4
  3. package/dist/cjs/verdocs-contact-picker_2.cjs.entry.js +2 -2
  4. package/dist/cjs/verdocs-envelope-document-page.cjs.entry.js +2 -2
  5. package/dist/cjs/verdocs-envelope-sidebar.cjs.entry.js +3 -3
  6. package/dist/cjs/verdocs-envelopes-list.cjs.entry.js +2 -2
  7. package/dist/cjs/verdocs-field-attachment_13.cjs.entry.js +3 -4
  8. package/dist/cjs/verdocs-kba-dialog_2.cjs.entry.js +2 -2
  9. package/dist/cjs/verdocs-organization-card_2.cjs.entry.js +7 -16068
  10. package/dist/cjs/verdocs-pagination_2.cjs.entry.js +2 -2
  11. package/dist/cjs/verdocs-preview_9.cjs.entry.js +3 -3
  12. package/dist/cjs/verdocs-sign.cjs.entry.js +2 -2
  13. package/dist/cjs/verdocs-template-document-page_2.cjs.entry.js +2 -2
  14. package/dist/cjs/verdocs-templates-list.cjs.entry.js +2 -2
  15. package/dist/collection/components/envelopes/verdocs-contact-picker/verdocs-contact-picker.js +1 -1
  16. package/dist/components/EnvelopeStore.js +2 -2
  17. package/dist/components/TemplateFieldStore.js +1 -1
  18. package/dist/components/TemplateRoleStore.js +1 -1
  19. package/dist/components/TemplateStore.js +2 -2
  20. package/dist/components/format.js +323 -719
  21. package/dist/components/index2.js +193 -2
  22. package/dist/components/index3.js +3692 -167
  23. package/dist/components/utils.js +4 -4
  24. package/dist/components/verdocs-envelope-sidebar.js +3 -3
  25. package/dist/components/verdocs-field-date2.js +2 -16063
  26. package/dist/components/verdocs-field-timestamp2.js +2 -2
  27. package/dist/components/verdocs-organization-card.js +2 -2
  28. package/dist/components/verdocs-template-build-tabs2.js +2 -2
  29. package/dist/components/verdocs-templates-list.js +2 -2
  30. package/dist/{cjs/format-187ebc36.js → esm/format-0771834a.js} +323 -745
  31. package/dist/esm/{utils-a79aa5dd.js → utils-0a9eb6f8.js} +4 -4
  32. package/dist/esm/verdocs-contact-picker_2.entry.js +2 -2
  33. package/dist/esm/verdocs-envelope-document-page.entry.js +2 -2
  34. package/dist/esm/verdocs-envelope-sidebar.entry.js +3 -3
  35. package/dist/esm/verdocs-envelopes-list.entry.js +2 -2
  36. package/dist/esm/verdocs-field-attachment_13.entry.js +3 -4
  37. package/dist/esm/verdocs-kba-dialog_2.entry.js +2 -2
  38. package/dist/esm/verdocs-organization-card_2.entry.js +2 -16063
  39. package/dist/esm/verdocs-pagination_2.entry.js +2 -2
  40. package/dist/esm/verdocs-preview_9.entry.js +3 -3
  41. package/dist/esm/verdocs-sign.entry.js +2 -2
  42. package/dist/esm/verdocs-template-document-page_2.entry.js +2 -2
  43. package/dist/esm/verdocs-templates-list.entry.js +2 -2
  44. package/dist/esm-es5/format-0771834a.js +1 -0
  45. package/dist/esm-es5/{utils-a79aa5dd.js → utils-0a9eb6f8.js} +2 -2
  46. package/dist/esm-es5/verdocs-contact-picker_2.entry.js +1 -1
  47. package/dist/esm-es5/verdocs-envelope-document-page.entry.js +1 -1
  48. package/dist/esm-es5/verdocs-envelope-sidebar.entry.js +1 -1
  49. package/dist/esm-es5/verdocs-envelopes-list.entry.js +1 -1
  50. package/dist/esm-es5/verdocs-field-attachment_13.entry.js +1 -1
  51. package/dist/esm-es5/verdocs-kba-dialog_2.entry.js +1 -1
  52. package/dist/esm-es5/verdocs-organization-card_2.entry.js +1 -1
  53. package/dist/esm-es5/verdocs-pagination_2.entry.js +1 -1
  54. package/dist/esm-es5/verdocs-preview_9.entry.js +1 -1
  55. package/dist/esm-es5/verdocs-sign.entry.js +1 -1
  56. package/dist/esm-es5/verdocs-template-document-page_2.entry.js +1 -1
  57. package/dist/esm-es5/verdocs-templates-list.entry.js +1 -1
  58. package/dist/verdocs-web-sdk/p-0ee8319c.system.entry.js +1 -0
  59. package/dist/verdocs-web-sdk/{p-522c4c25.entry.js → p-123768d7.entry.js} +1 -1
  60. package/dist/verdocs-web-sdk/{p-85f88369.system.entry.js → p-1f4feeff.system.entry.js} +1 -1
  61. package/dist/verdocs-web-sdk/p-226ae566.entry.js +1 -0
  62. package/dist/verdocs-web-sdk/p-267df026.system.js +1 -1
  63. package/dist/verdocs-web-sdk/{p-b13cfe1d.entry.js → p-3a0db043.entry.js} +1 -1
  64. package/dist/verdocs-web-sdk/p-476996a3.system.entry.js +1 -0
  65. package/dist/verdocs-web-sdk/{p-50eea95a.system.entry.js → p-66f9af42.system.entry.js} +1 -1
  66. package/dist/verdocs-web-sdk/{p-ae347813.system.js → p-7933fc15.system.js} +2 -2
  67. package/dist/verdocs-web-sdk/{p-0757a442.entry.js → p-7c233a05.entry.js} +1 -1
  68. package/dist/verdocs-web-sdk/{p-5c58db62.entry.js → p-8bd00498.entry.js} +1 -1
  69. package/dist/verdocs-web-sdk/p-8f29bffd.system.entry.js +1 -0
  70. package/dist/verdocs-web-sdk/{p-ca7ef3ff.js → p-925f6ad5.js} +1 -1
  71. package/dist/verdocs-web-sdk/{p-5588ad8b.entry.js → p-97e16d5d.entry.js} +1 -1
  72. package/dist/verdocs-web-sdk/{p-9d67be0c.system.entry.js → p-98b60918.system.entry.js} +1 -1
  73. package/dist/verdocs-web-sdk/p-9ee3f90d.entry.js +1 -0
  74. package/dist/verdocs-web-sdk/{p-43d82aaa.system.entry.js → p-a24ad229.system.entry.js} +1 -1
  75. package/dist/verdocs-web-sdk/{p-01abd683.system.entry.js → p-a583ffe0.system.entry.js} +1 -1
  76. package/dist/verdocs-web-sdk/{p-8acbd1f4.system.entry.js → p-b57446bb.system.entry.js} +1 -1
  77. package/dist/verdocs-web-sdk/{p-bc297485.system.entry.js → p-c6786b1f.system.entry.js} +1 -1
  78. package/dist/verdocs-web-sdk/{p-6631d2e4.entry.js → p-c7606304.entry.js} +1 -1
  79. package/dist/verdocs-web-sdk/p-c9063efa.entry.js +1 -0
  80. package/dist/verdocs-web-sdk/{p-707322d0.entry.js → p-d1241532.entry.js} +1 -1
  81. package/dist/verdocs-web-sdk/p-d38f1299.js +1 -0
  82. package/dist/verdocs-web-sdk/{p-2cf4f3d4.entry.js → p-d41c5eae.entry.js} +1 -1
  83. package/dist/verdocs-web-sdk/p-db854498.system.js +1 -0
  84. package/dist/verdocs-web-sdk/{p-6edb5d8c.system.entry.js → p-e0d7224c.system.entry.js} +1 -1
  85. package/dist/verdocs-web-sdk/{p-a7c89171.entry.js → p-e5b0751b.entry.js} +1 -1
  86. package/dist/verdocs-web-sdk/{p-0dc92b1c.system.entry.js → p-fd27aa1a.system.entry.js} +1 -1
  87. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  88. package/package.json +3 -3
  89. package/dist/cjs/index-5f130ec0.js +0 -5
  90. package/dist/components/index4.js +0 -3719
  91. package/dist/esm/index-0329eed3.js +0 -3
  92. package/dist/esm-es5/format-2bf71189.js +0 -1
  93. package/dist/esm-es5/index-0329eed3.js +0 -1
  94. package/dist/verdocs-web-sdk/p-09897118.entry.js +0 -1
  95. package/dist/verdocs-web-sdk/p-128e17f1.entry.js +0 -1
  96. package/dist/verdocs-web-sdk/p-12f6450a.entry.js +0 -1
  97. package/dist/verdocs-web-sdk/p-3f088fd6.system.js +0 -1
  98. package/dist/verdocs-web-sdk/p-56a7b8df.system.entry.js +0 -1
  99. package/dist/verdocs-web-sdk/p-630835f4.js +0 -1
  100. package/dist/verdocs-web-sdk/p-6c23338e.system.entry.js +0 -1
  101. package/dist/verdocs-web-sdk/p-85114f35.system.entry.js +0 -1
  102. package/dist/verdocs-web-sdk/p-edaec1b6.js +0 -1
  103. package/dist/verdocs-web-sdk/p-f24d887c.system.js +0 -1
@@ -1,66 +1,48 @@
1
- var toDate$1 = {};
2
-
3
- toDate$1.toDate = toDate;
1
+ 'use strict';
4
2
 
5
3
  /**
6
- * @name toDate
7
- * @category Common Helpers
8
- * @summary Convert the given argument to an instance of Date.
9
- *
4
+ * @module constants
5
+ * @summary Useful constants
10
6
  * @description
11
- * Convert the given argument to an instance of Date.
12
- *
13
- * If the argument is an instance of Date, the function returns its clone.
14
- *
15
- * If the argument is a number, it is treated as a timestamp.
16
- *
17
- * If the argument is none of the above, the function returns Invalid Date.
18
- *
19
- * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
20
- *
21
- * @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).
22
- *
23
- * @param argument - The value to convert
7
+ * Collection of useful date constants.
24
8
  *
25
- * @returns The parsed date in the local time zone
9
+ * The constants could be imported from `date-fns/constants`:
26
10
  *
27
- * @example
28
- * // Clone the date:
29
- * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
30
- * //=> Tue Feb 11 2014 11:30:30
11
+ * ```ts
12
+ * import { maxTime, minTime } from "./constants/date-fns/constants";
31
13
  *
32
- * @example
33
- * // Convert the timestamp to date:
34
- * const result = toDate(1392098430000)
35
- * //=> Tue Feb 11 2014 11:30:30
14
+ * function isAllowedTime(time) {
15
+ * return time <= maxTime && time >= minTime;
16
+ * }
17
+ * ```
36
18
  */
37
- function toDate(argument) {
38
- const argStr = Object.prototype.toString.call(argument);
39
19
 
40
- // Clone the date
41
- if (
42
- argument instanceof Date ||
43
- (typeof argument === "object" && argStr === "[object Date]")
44
- ) {
45
- // Prevent the date to lose the milliseconds when passed to new Date() in IE10
46
- return new argument.constructor(+argument);
47
- } else if (
48
- typeof argument === "number" ||
49
- argStr === "[object Number]" ||
50
- typeof argument === "string" ||
51
- argStr === "[object String]"
52
- ) {
53
- // TODO: Can we get rid of as?
54
- return new Date(argument);
55
- } else {
56
- // TODO: Can we get rid of as?
57
- return new Date(NaN);
58
- }
59
- }
20
+ /**
21
+ * @constant
22
+ * @name millisecondsInWeek
23
+ * @summary Milliseconds in 1 week.
24
+ */
25
+ const millisecondsInWeek = 604800000;
60
26
 
61
- var constructFrom$1 = {};
27
+ /**
28
+ * @constant
29
+ * @name millisecondsInDay
30
+ * @summary Milliseconds in 1 day.
31
+ */
32
+ const millisecondsInDay = 86400000;
62
33
 
63
- constructFrom$1.constructFrom = constructFrom;
34
+ /**
35
+ * @constant
36
+ * @name constructFromSymbol
37
+ * @summary Symbol enabling Date extensions to inherit properties from the reference date.
38
+ *
39
+ * The symbol is used to enable the `constructFrom` function to construct a date
40
+ * using a reference date and a value. It allows to transfer extra properties
41
+ * from the reference date to the new date. It's useful for extensions like
42
+ * [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as
43
+ * a constructor argument.
44
+ */
45
+ const constructFromSymbol = Symbol.for("constructDateFrom");
64
46
 
65
47
  /**
66
48
  * @name constructFrom
@@ -74,6 +56,11 @@ constructFrom$1.constructFrom = constructFrom;
74
56
  *
75
57
  * It defaults to `Date` if the passed reference date is a number or a string.
76
58
  *
59
+ * Starting from v3.7.0, it allows to construct a date using `[Symbol.for("constructDateFrom")]`
60
+ * enabling to transfer extra properties from the reference date to the new date.
61
+ * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)
62
+ * that accept a time zone as a constructor argument.
63
+ *
77
64
  * @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).
78
65
  *
79
66
  * @param date - The reference date to take constructor from
@@ -82,263 +69,93 @@ constructFrom$1.constructFrom = constructFrom;
82
69
  * @returns Date initialized using the given date and value
83
70
  *
84
71
  * @example
85
- * import { constructFrom } from 'date-fns'
72
+ * import { constructFrom } from "./constructFrom/date-fns";
86
73
  *
87
74
  * // A function that clones a date preserving the original type
88
- * function cloneDate<DateType extends Date(date: DateType): DateType {
75
+ * function cloneDate<DateType extends Date>(date: DateType): DateType {
89
76
  * return constructFrom(
90
- * date, // Use contrustor from the given date
77
+ * date, // Use constructor from the given date
91
78
  * date.getTime() // Use the date value to create a new date
92
- * )
79
+ * );
93
80
  * }
94
81
  */
95
82
  function constructFrom(date, value) {
96
- if (date instanceof Date) {
97
- return new date.constructor(value);
98
- } else {
99
- return new Date(value);
100
- }
101
- }
83
+ if (typeof date === "function") return date(value);
102
84
 
103
- var constants = {};
104
-
105
- constants.secondsInYear =
106
- constants.secondsInWeek =
107
- constants.secondsInQuarter =
108
- constants.secondsInMonth =
109
- constants.secondsInMinute =
110
- constants.secondsInHour =
111
- constants.secondsInDay =
112
- constants.quartersInYear =
113
- constants.monthsInYear =
114
- constants.monthsInQuarter =
115
- constants.minutesInYear =
116
- constants.minutesInMonth =
117
- constants.minutesInHour =
118
- constants.minutesInDay =
119
- constants.minTime =
120
- constants.millisecondsInWeek =
121
- constants.millisecondsInSecond =
122
- constants.millisecondsInMinute =
123
- constants.millisecondsInHour =
124
- constants.millisecondsInDay =
125
- constants.maxTime =
126
- constants.daysInYear =
127
- constants.daysInWeek =
128
- void 0; /**
129
- * @module constants
130
- * @summary Useful constants
131
- * @description
132
- * Collection of useful date constants.
133
- *
134
- * The constants could be imported from `date-fns/constants`:
135
- *
136
- * ```ts
137
- * import { maxTime, minTime } from "date-fns/constants";
138
- *
139
- * function isAllowedTime(time) {
140
- * return time <= maxTime && time >= minTime;
141
- * }
142
- * ```
143
- */
85
+ if (typeof date === "object" && constructFromSymbol in date)
86
+ return date[constructFromSymbol](value);
144
87
 
145
- /**
146
- * @constant
147
- * @name daysInWeek
148
- * @summary Days in 1 week.
149
- */
150
- (constants.daysInWeek = 7);
88
+ if (date instanceof Date) return new date.constructor(value);
89
+
90
+ return new Date(value);
91
+ }
151
92
 
152
93
  /**
153
- * @constant
154
- * @name daysInYear
155
- * @summary Days in 1 year.
94
+ * @name toDate
95
+ * @category Common Helpers
96
+ * @summary Convert the given argument to an instance of Date.
156
97
  *
157
98
  * @description
158
- * How many days in a year.
99
+ * Convert the given argument to an instance of Date.
159
100
  *
160
- * One years equals 365.2425 days according to the formula:
101
+ * If the argument is an instance of Date, the function returns its clone.
161
102
  *
162
- * > Leap year occures every 4 years, except for years that are divisable by 100 and not divisable by 400.
163
- * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days
164
- */
165
- const daysInYear = (constants.daysInYear = 365.2425);
166
-
167
- /**
168
- * @constant
169
- * @name maxTime
170
- * @summary Maximum allowed time.
103
+ * If the argument is a number, it is treated as a timestamp.
171
104
  *
172
- * @example
173
- * import { maxTime } from "date-fns/constants";
105
+ * If the argument is none of the above, the function returns Invalid Date.
174
106
  *
175
- * const isValid = 8640000000000001 <= maxTime;
176
- * //=> false
107
+ * Starting from v3.7.0, it clones a date using `[Symbol.for("constructDateFrom")]`
108
+ * enabling to transfer extra properties from the reference date to the new date.
109
+ * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)
110
+ * that accept a time zone as a constructor argument.
177
111
  *
178
- * new Date(8640000000000001);
179
- * //=> Invalid Date
180
- */
181
- const maxTime = (constants.maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000);
182
-
183
- /**
184
- * @constant
185
- * @name minTime
186
- * @summary Minimum allowed time.
112
+ * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
187
113
  *
188
- * @example
189
- * import { minTime } from "date-fns/constants";
114
+ * @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).
115
+ * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
190
116
  *
191
- * const isValid = -8640000000000001 >= minTime;
192
- * //=> false
117
+ * @param argument - The value to convert
193
118
  *
194
- * new Date(-8640000000000001)
195
- * //=> Invalid Date
196
- */
197
- (constants.minTime = -maxTime);
198
-
199
- /**
200
- * @constant
201
- * @name millisecondsInWeek
202
- * @summary Milliseconds in 1 week.
203
- */
204
- (constants.millisecondsInWeek = 604800000);
205
-
206
- /**
207
- * @constant
208
- * @name millisecondsInDay
209
- * @summary Milliseconds in 1 day.
210
- */
211
- (constants.millisecondsInDay = 86400000);
212
-
213
- /**
214
- * @constant
215
- * @name millisecondsInMinute
216
- * @summary Milliseconds in 1 minute
217
- */
218
- (constants.millisecondsInMinute = 60000);
219
-
220
- /**
221
- * @constant
222
- * @name millisecondsInHour
223
- * @summary Milliseconds in 1 hour
224
- */
225
- (constants.millisecondsInHour = 3600000);
226
-
227
- /**
228
- * @constant
229
- * @name millisecondsInSecond
230
- * @summary Milliseconds in 1 second
231
- */
232
- (constants.millisecondsInSecond = 1000);
233
-
234
- /**
235
- * @constant
236
- * @name minutesInYear
237
- * @summary Minutes in 1 year.
238
- */
239
- (constants.minutesInYear = 525600);
240
-
241
- /**
242
- * @constant
243
- * @name minutesInMonth
244
- * @summary Minutes in 1 month.
245
- */
246
- (constants.minutesInMonth = 43200);
247
-
248
- /**
249
- * @constant
250
- * @name minutesInDay
251
- * @summary Minutes in 1 day.
252
- */
253
- (constants.minutesInDay = 1440);
254
-
255
- /**
256
- * @constant
257
- * @name minutesInHour
258
- * @summary Minutes in 1 hour.
259
- */
260
- (constants.minutesInHour = 60);
261
-
262
- /**
263
- * @constant
264
- * @name monthsInQuarter
265
- * @summary Months in 1 quarter.
266
- */
267
- (constants.monthsInQuarter = 3);
268
-
269
- /**
270
- * @constant
271
- * @name monthsInYear
272
- * @summary Months in 1 year.
273
- */
274
- (constants.monthsInYear = 12);
275
-
276
- /**
277
- * @constant
278
- * @name quartersInYear
279
- * @summary Quarters in 1 year
280
- */
281
- (constants.quartersInYear = 4);
282
-
283
- /**
284
- * @constant
285
- * @name secondsInHour
286
- * @summary Seconds in 1 hour.
287
- */
288
- const secondsInHour = (constants.secondsInHour = 3600);
289
-
290
- /**
291
- * @constant
292
- * @name secondsInMinute
293
- * @summary Seconds in 1 minute.
294
- */
295
- (constants.secondsInMinute = 60);
296
-
297
- /**
298
- * @constant
299
- * @name secondsInDay
300
- * @summary Seconds in 1 day.
301
- */
302
- const secondsInDay = (constants.secondsInDay = secondsInHour * 24);
303
-
304
- /**
305
- * @constant
306
- * @name secondsInWeek
307
- * @summary Seconds in 1 week.
308
- */
309
- (constants.secondsInWeek = secondsInDay * 7);
310
-
311
- /**
312
- * @constant
313
- * @name secondsInYear
314
- * @summary Seconds in 1 year.
315
- */
316
- const secondsInYear = (constants.secondsInYear = secondsInDay * daysInYear);
317
-
318
- /**
319
- * @constant
320
- * @name secondsInMonth
321
- * @summary Seconds in 1 month
322
- */
323
- const secondsInMonth = (constants.secondsInMonth = secondsInYear / 12);
324
-
325
- /**
326
- * @constant
327
- * @name secondsInQuarter
328
- * @summary Seconds in 1 quarter.
119
+ * @returns The parsed date in the local time zone
120
+ *
121
+ * @example
122
+ * // Clone the date:
123
+ * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
124
+ * //=> Tue Feb 11 2014 11:30:30
125
+ *
126
+ * @example
127
+ * // Convert the timestamp to date:
128
+ * const result = toDate(1392098430000)
129
+ * //=> Tue Feb 11 2014 11:30:30
329
130
  */
330
- (constants.secondsInQuarter = secondsInMonth * 3);
331
-
332
- var getISOWeekYear$1 = {};
333
-
334
- var startOfISOWeek$1 = {};
131
+ function toDate(argument, context) {
132
+ // [TODO] Use constructFrom here instead?
133
+ if (context) return context(argument);
335
134
 
336
- var startOfWeek$1 = {};
337
-
338
- var defaultOptions$1 = {};
135
+ const argStr = Object.prototype.toString.call(argument);
339
136
 
340
- defaultOptions$1.getDefaultOptions = getDefaultOptions;
341
- defaultOptions$1.setDefaultOptions = setDefaultOptions;
137
+ // Clone the date
138
+ if (typeof argument === "object" && constructFromSymbol in argument) {
139
+ return argument[constructFromSymbol](argument);
140
+ } else if (
141
+ argument instanceof Date ||
142
+ (typeof argument === "object" && argStr === "[object Date]")
143
+ ) {
144
+ // Prevent the date to lose the milliseconds when passed to new Date() in IE10
145
+ return new argument.constructor(+argument);
146
+ } else if (
147
+ typeof argument === "number" ||
148
+ argStr === "[object Number]" ||
149
+ typeof argument === "string" ||
150
+ argStr === "[object String]"
151
+ ) {
152
+ // TODO: Can we get rid of as?
153
+ return new Date(argument);
154
+ } else {
155
+ // TODO: Can we get rid of as?
156
+ return new Date(NaN);
157
+ }
158
+ }
342
159
 
343
160
  let defaultOptions = {};
344
161
 
@@ -346,15 +163,6 @@ function getDefaultOptions() {
346
163
  return defaultOptions;
347
164
  }
348
165
 
349
- function setDefaultOptions(newOptions) {
350
- defaultOptions = newOptions;
351
- }
352
-
353
- startOfWeek$1.startOfWeek = startOfWeek;
354
- var _index$j = toDate$1;
355
-
356
- var _index2$d = defaultOptions$1;
357
-
358
166
  /**
359
167
  * The {@link startOfWeek} function options.
360
168
  */
@@ -369,6 +177,7 @@ var _index2$d = defaultOptions$1;
369
177
  * The result will be in the local timezone.
370
178
  *
371
179
  * @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).
180
+ * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
372
181
  *
373
182
  * @param date - The original date
374
183
  * @param options - An object with options
@@ -386,7 +195,7 @@ var _index2$d = defaultOptions$1;
386
195
  * //=> Mon Sep 01 2014 00:00:00
387
196
  */
388
197
  function startOfWeek(date, options) {
389
- const defaultOptions = (0, _index2$d.getDefaultOptions)();
198
+ const defaultOptions = getDefaultOptions();
390
199
  const weekStartsOn =
391
200
  options?.weekStartsOn ??
392
201
  options?.locale?.options?.weekStartsOn ??
@@ -394,7 +203,7 @@ function startOfWeek(date, options) {
394
203
  defaultOptions.locale?.options?.weekStartsOn ??
395
204
  0;
396
205
 
397
- const _date = (0, _index$j.toDate)(date);
206
+ const _date = toDate(date, options?.in);
398
207
  const day = _date.getDay();
399
208
  const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
400
209
 
@@ -403,8 +212,9 @@ function startOfWeek(date, options) {
403
212
  return _date;
404
213
  }
405
214
 
406
- startOfISOWeek$1.startOfISOWeek = startOfISOWeek;
407
- var _index$i = startOfWeek$1;
215
+ /**
216
+ * The {@link startOfISOWeek} function options.
217
+ */
408
218
 
409
219
  /**
410
220
  * @name startOfISOWeek
@@ -418,8 +228,10 @@ var _index$i = startOfWeek$1;
418
228
  * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
419
229
  *
420
230
  * @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).
231
+ * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
421
232
  *
422
233
  * @param date - The original date
234
+ * @param options - An object with options
423
235
  *
424
236
  * @returns The start of an ISO week
425
237
  *
@@ -428,14 +240,13 @@ var _index$i = startOfWeek$1;
428
240
  * const result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))
429
241
  * //=> Mon Sep 01 2014 00:00:00
430
242
  */
431
- function startOfISOWeek(date) {
432
- return (0, _index$i.startOfWeek)(date, { weekStartsOn: 1 });
243
+ function startOfISOWeek(date, options) {
244
+ return startOfWeek(date, { ...options, weekStartsOn: 1 });
433
245
  }
434
246
 
435
- getISOWeekYear$1.getISOWeekYear = getISOWeekYear;
436
- var _index$h = constructFrom$1;
437
- var _index2$c = startOfISOWeek$1;
438
- var _index3$9 = toDate$1;
247
+ /**
248
+ * The {@link getISOWeekYear} function options.
249
+ */
439
250
 
440
251
  /**
441
252
  * @name getISOWeekYear
@@ -448,8 +259,6 @@ var _index3$9 = toDate$1;
448
259
  *
449
260
  * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
450
261
  *
451
- * @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).
452
- *
453
262
  * @param date - The given date
454
263
  *
455
264
  * @returns The ISO week-numbering year
@@ -459,23 +268,19 @@ var _index3$9 = toDate$1;
459
268
  * const result = getISOWeekYear(new Date(2005, 0, 2))
460
269
  * //=> 2004
461
270
  */
462
- function getISOWeekYear(date) {
463
- const _date = (0, _index3$9.toDate)(date);
271
+ function getISOWeekYear(date, options) {
272
+ const _date = toDate(date, options?.in);
464
273
  const year = _date.getFullYear();
465
274
 
466
- const fourthOfJanuaryOfNextYear = (0, _index$h.constructFrom)(date, 0);
275
+ const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
467
276
  fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
468
277
  fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
469
- const startOfNextYear = (0, _index2$c.startOfISOWeek)(
470
- fourthOfJanuaryOfNextYear,
471
- );
278
+ const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
472
279
 
473
- const fourthOfJanuaryOfThisYear = (0, _index$h.constructFrom)(date, 0);
280
+ const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
474
281
  fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
475
282
  fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
476
- const startOfThisYear = (0, _index2$c.startOfISOWeek)(
477
- fourthOfJanuaryOfThisYear,
478
- );
283
+ const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
479
284
 
480
285
  if (_date.getTime() >= startOfNextYear.getTime()) {
481
286
  return year + 1;
@@ -486,12 +291,47 @@ function getISOWeekYear(date) {
486
291
  }
487
292
  }
488
293
 
489
- var differenceInCalendarDays$1 = {};
294
+ /**
295
+ * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
296
+ * They usually appear for dates that denote time before the timezones were introduced
297
+ * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
298
+ * and GMT+01:00:00 after that date)
299
+ *
300
+ * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
301
+ * which would lead to incorrect calculations.
302
+ *
303
+ * This function returns the timezone offset in milliseconds that takes seconds in account.
304
+ */
305
+ function getTimezoneOffsetInMilliseconds(date) {
306
+ const _date = toDate(date);
307
+ const utcDate = new Date(
308
+ Date.UTC(
309
+ _date.getFullYear(),
310
+ _date.getMonth(),
311
+ _date.getDate(),
312
+ _date.getHours(),
313
+ _date.getMinutes(),
314
+ _date.getSeconds(),
315
+ _date.getMilliseconds(),
316
+ ),
317
+ );
318
+ utcDate.setUTCFullYear(_date.getFullYear());
319
+ return +date - +utcDate;
320
+ }
490
321
 
491
- var startOfDay$1 = {};
322
+ function normalizeDates(context, ...dates) {
323
+ const normalize =
324
+ context ||
325
+ constructFrom.bind(
326
+ null,
327
+ dates.find((date) => typeof date === "object"),
328
+ );
329
+ return dates.map(normalize);
330
+ }
492
331
 
493
- startOfDay$1.startOfDay = startOfDay;
494
- var _index$g = toDate$1;
332
+ /**
333
+ * The {@link startOfDay} function options.
334
+ */
495
335
 
496
336
  /**
497
337
  * @name startOfDay
@@ -503,8 +343,10 @@ var _index$g = toDate$1;
503
343
  * The result will be in the local timezone.
504
344
  *
505
345
  * @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).
346
+ * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
506
347
  *
507
348
  * @param date - The original date
349
+ * @param options - The options
508
350
  *
509
351
  * @returns The start of a day
510
352
  *
@@ -513,49 +355,15 @@ var _index$g = toDate$1;
513
355
  * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
514
356
  * //=> Tue Sep 02 2014 00:00:00
515
357
  */
516
- function startOfDay(date) {
517
- const _date = (0, _index$g.toDate)(date);
358
+ function startOfDay(date, options) {
359
+ const _date = toDate(date, options?.in);
518
360
  _date.setHours(0, 0, 0, 0);
519
361
  return _date;
520
362
  }
521
363
 
522
- var getTimezoneOffsetInMilliseconds$1 = {};
523
-
524
- getTimezoneOffsetInMilliseconds$1.getTimezoneOffsetInMilliseconds = getTimezoneOffsetInMilliseconds;
525
- var _index$f = toDate$1;
526
-
527
364
  /**
528
- * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
529
- * They usually appear for dates that denote time before the timezones were introduced
530
- * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
531
- * and GMT+01:00:00 after that date)
532
- *
533
- * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
534
- * which would lead to incorrect calculations.
535
- *
536
- * This function returns the timezone offset in milliseconds that takes seconds in account.
365
+ * The {@link differenceInCalendarDays} function options.
537
366
  */
538
- function getTimezoneOffsetInMilliseconds(date) {
539
- const _date = (0, _index$f.toDate)(date);
540
- const utcDate = new Date(
541
- Date.UTC(
542
- _date.getFullYear(),
543
- _date.getMonth(),
544
- _date.getDate(),
545
- _date.getHours(),
546
- _date.getMinutes(),
547
- _date.getSeconds(),
548
- _date.getMilliseconds(),
549
- ),
550
- );
551
- utcDate.setUTCFullYear(_date.getFullYear());
552
- return +date - +utcDate;
553
- }
554
-
555
- differenceInCalendarDays$1.differenceInCalendarDays = differenceInCalendarDays;
556
- var _index$e = constants;
557
- var _index2$b = startOfDay$1;
558
- var _index3$8 = getTimezoneOffsetInMilliseconds$1;
559
367
 
560
368
  /**
561
369
  * @name differenceInCalendarDays
@@ -566,10 +374,9 @@ var _index3$8 = getTimezoneOffsetInMilliseconds$1;
566
374
  * Get the number of calendar days between the given dates. This means that the times are removed
567
375
  * from the dates and then the difference in days is calculated.
568
376
  *
569
- * @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).
570
- *
571
- * @param dateLeft - The later date
572
- * @param dateRight - The earlier date
377
+ * @param laterDate - The later date
378
+ * @param earlierDate - The earlier date
379
+ * @param options - The options object
573
380
  *
574
381
  * @returns The number of calendar days
575
382
  *
@@ -589,31 +396,30 @@ var _index3$8 = getTimezoneOffsetInMilliseconds$1;
589
396
  * )
590
397
  * //=> 1
591
398
  */
592
- function differenceInCalendarDays(dateLeft, dateRight) {
593
- const startOfDayLeft = (0, _index2$b.startOfDay)(dateLeft);
594
- const startOfDayRight = (0, _index2$b.startOfDay)(dateRight);
399
+ function differenceInCalendarDays(laterDate, earlierDate, options) {
400
+ const [laterDate_, earlierDate_] = normalizeDates(
401
+ options?.in,
402
+ laterDate,
403
+ earlierDate,
404
+ );
595
405
 
596
- const timestampLeft =
597
- +startOfDayLeft -
598
- (0, _index3$8.getTimezoneOffsetInMilliseconds)(startOfDayLeft);
599
- const timestampRight =
600
- +startOfDayRight -
601
- (0, _index3$8.getTimezoneOffsetInMilliseconds)(startOfDayRight);
406
+ const laterStartOfDay = startOfDay(laterDate_);
407
+ const earlierStartOfDay = startOfDay(earlierDate_);
408
+
409
+ const laterTimestamp =
410
+ +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
411
+ const earlierTimestamp =
412
+ +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
602
413
 
603
414
  // Round the number of days to the nearest integer because the number of
604
415
  // milliseconds in a day is not constant (e.g. it's different in the week of
605
416
  // the daylight saving time clock shift).
606
- return Math.round(
607
- (timestampLeft - timestampRight) / _index$e.millisecondsInDay,
608
- );
417
+ return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
609
418
  }
610
419
 
611
- var startOfISOWeekYear$1 = {};
612
-
613
- startOfISOWeekYear$1.startOfISOWeekYear = startOfISOWeekYear;
614
- var _index$d = getISOWeekYear$1;
615
- var _index2$a = startOfISOWeek$1;
616
- var _index3$7 = constructFrom$1;
420
+ /**
421
+ * The {@link startOfISOWeekYear} function options.
422
+ */
617
423
 
618
424
  /**
619
425
  * @name startOfISOWeekYear
@@ -628,8 +434,10 @@ var _index3$7 = constructFrom$1;
628
434
  * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
629
435
  *
630
436
  * @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).
437
+ * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
631
438
  *
632
439
  * @param date - The original date
440
+ * @param options - An object with options
633
441
  *
634
442
  * @returns The start of an ISO week-numbering year
635
443
  *
@@ -638,19 +446,15 @@ var _index3$7 = constructFrom$1;
638
446
  * const result = startOfISOWeekYear(new Date(2005, 6, 2))
639
447
  * //=> Mon Jan 03 2005 00:00:00
640
448
  */
641
- function startOfISOWeekYear(date) {
642
- const year = (0, _index$d.getISOWeekYear)(date);
643
- const fourthOfJanuary = (0, _index3$7.constructFrom)(date, 0);
449
+ function startOfISOWeekYear(date, options) {
450
+ const year = getISOWeekYear(date, options);
451
+ const fourthOfJanuary = constructFrom(options?.in || date, 0);
644
452
  fourthOfJanuary.setFullYear(year, 0, 4);
645
453
  fourthOfJanuary.setHours(0, 0, 0, 0);
646
- return (0, _index2$a.startOfISOWeek)(fourthOfJanuary);
454
+ return startOfISOWeek(fourthOfJanuary);
647
455
  }
648
456
 
649
- var isValid$1 = {};
650
-
651
- var isDate$1 = {};
652
-
653
- isDate$1.isDate = isDate; /**
457
+ /**
654
458
  * @name isDate
655
459
  * @category Common Helpers
656
460
  * @summary Is the given value a date?
@@ -690,10 +494,6 @@ function isDate(value) {
690
494
  );
691
495
  }
692
496
 
693
- isValid$1.isValid = isValid;
694
- var _index$c = isDate$1;
695
- var _index2$9 = toDate$1;
696
-
697
497
  /**
698
498
  * @name isValid
699
499
  * @category Common Helpers
@@ -706,8 +506,6 @@ var _index2$9 = toDate$1;
706
506
  *
707
507
  * Time value of Date: http://es5.github.io/#x15.9.1.1
708
508
  *
709
- * @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).
710
- *
711
509
  * @param date - The date to check
712
510
  *
713
511
  * @returns The date is valid
@@ -718,7 +516,7 @@ var _index2$9 = toDate$1;
718
516
  * //=> true
719
517
  *
720
518
  * @example
721
- * // For the value, convertable into a date:
519
+ * // For the value, convertible into a date:
722
520
  * const result = isValid(1393804800000)
723
521
  * //=> true
724
522
  *
@@ -728,18 +526,12 @@ var _index2$9 = toDate$1;
728
526
  * //=> false
729
527
  */
730
528
  function isValid(date) {
731
- if (!(0, _index$c.isDate)(date) && typeof date !== "number") {
732
- return false;
733
- }
734
- const _date = (0, _index2$9.toDate)(date);
735
- return !isNaN(Number(_date));
529
+ return !((!isDate(date) && typeof date !== "number") || isNaN(+toDate(date)));
736
530
  }
737
531
 
738
- var startOfYear$1 = {};
739
-
740
- startOfYear$1.startOfYear = startOfYear;
741
- var _index$b = toDate$1;
742
- var _index2$8 = constructFrom$1;
532
+ /**
533
+ * The {@link startOfYear} function options.
534
+ */
743
535
 
744
536
  /**
745
537
  * @name startOfYear
@@ -751,8 +543,10 @@ var _index2$8 = constructFrom$1;
751
543
  * The result will be in the local timezone.
752
544
  *
753
545
  * @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).
546
+ * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
754
547
  *
755
548
  * @param date - The original date
549
+ * @param options - The options
756
550
  *
757
551
  * @returns The start of a year
758
552
  *
@@ -761,24 +555,13 @@ var _index2$8 = constructFrom$1;
761
555
  * const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00))
762
556
  * //=> Wed Jan 01 2014 00:00:00
763
557
  */
764
- function startOfYear(date) {
765
- const cleanDate = (0, _index$b.toDate)(date);
766
- const _date = (0, _index2$8.constructFrom)(date, 0);
767
- _date.setFullYear(cleanDate.getFullYear(), 0, 1);
768
- _date.setHours(0, 0, 0, 0);
769
- return _date;
558
+ function startOfYear(date, options) {
559
+ const date_ = toDate(date, options?.in);
560
+ date_.setFullYear(date_.getFullYear(), 0, 1);
561
+ date_.setHours(0, 0, 0, 0);
562
+ return date_;
770
563
  }
771
564
 
772
- var format = {};
773
-
774
- var defaultLocale = {};
775
-
776
- var enUS = {};
777
-
778
- var formatDistance$1 = {};
779
-
780
- formatDistance$1.formatDistance = void 0;
781
-
782
565
  const formatDistanceLocale = {
783
566
  lessThanXSeconds: {
784
567
  one: "less than a second",
@@ -880,13 +663,6 @@ const formatDistance = (token, count, options) => {
880
663
 
881
664
  return result;
882
665
  };
883
- formatDistance$1.formatDistance = formatDistance;
884
-
885
- var formatLong = {};
886
-
887
- var buildFormatLongFn$1 = {};
888
-
889
- buildFormatLongFn$1.buildFormatLongFn = buildFormatLongFn;
890
666
 
891
667
  function buildFormatLongFn(args) {
892
668
  return (options = {}) => {
@@ -897,9 +673,6 @@ function buildFormatLongFn(args) {
897
673
  };
898
674
  }
899
675
 
900
- formatLong.formatLong = void 0;
901
- var _index$a = buildFormatLongFn$1;
902
-
903
676
  const dateFormats = {
904
677
  full: "EEEE, MMMM do, y",
905
678
  long: "MMMM do, y",
@@ -921,26 +694,22 @@ const dateTimeFormats = {
921
694
  short: "{{date}}, {{time}}",
922
695
  };
923
696
 
924
- (formatLong.formatLong = {
925
- date: (0, _index$a.buildFormatLongFn)({
697
+ const formatLong = {
698
+ date: buildFormatLongFn({
926
699
  formats: dateFormats,
927
700
  defaultWidth: "full",
928
701
  }),
929
702
 
930
- time: (0, _index$a.buildFormatLongFn)({
703
+ time: buildFormatLongFn({
931
704
  formats: timeFormats,
932
705
  defaultWidth: "full",
933
706
  }),
934
707
 
935
- dateTime: (0, _index$a.buildFormatLongFn)({
708
+ dateTime: buildFormatLongFn({
936
709
  formats: dateTimeFormats,
937
710
  defaultWidth: "full",
938
711
  }),
939
- });
940
-
941
- var formatRelative$1 = {};
942
-
943
- formatRelative$1.formatRelative = void 0;
712
+ };
944
713
 
945
714
  const formatRelativeLocale = {
946
715
  lastWeek: "'last' eeee 'at' p",
@@ -953,13 +722,6 @@ const formatRelativeLocale = {
953
722
 
954
723
  const formatRelative = (token, _date, _baseDate, _options) =>
955
724
  formatRelativeLocale[token];
956
- formatRelative$1.formatRelative = formatRelative;
957
-
958
- var localize = {};
959
-
960
- var buildLocalizeFn$1 = {};
961
-
962
- buildLocalizeFn$1.buildLocalizeFn = buildLocalizeFn; /* eslint-disable no-unused-vars */
963
725
 
964
726
  /**
965
727
  * The localize function argument callback which allows to convert raw value to
@@ -1024,9 +786,6 @@ function buildLocalizeFn(args) {
1024
786
  };
1025
787
  }
1026
788
 
1027
- localize.localize = void 0;
1028
- var _index$9 = buildLocalizeFn$1;
1029
-
1030
789
  const eraValues = {
1031
790
  narrow: ["B", "A"],
1032
791
  abbreviated: ["BC", "AD"],
@@ -1181,43 +940,37 @@ const ordinalNumber = (dirtyNumber, _options) => {
1181
940
  return number + "th";
1182
941
  };
1183
942
 
1184
- (localize.localize = {
943
+ const localize = {
1185
944
  ordinalNumber,
1186
945
 
1187
- era: (0, _index$9.buildLocalizeFn)({
946
+ era: buildLocalizeFn({
1188
947
  values: eraValues,
1189
948
  defaultWidth: "wide",
1190
949
  }),
1191
950
 
1192
- quarter: (0, _index$9.buildLocalizeFn)({
951
+ quarter: buildLocalizeFn({
1193
952
  values: quarterValues,
1194
953
  defaultWidth: "wide",
1195
954
  argumentCallback: (quarter) => quarter - 1,
1196
955
  }),
1197
956
 
1198
- month: (0, _index$9.buildLocalizeFn)({
957
+ month: buildLocalizeFn({
1199
958
  values: monthValues,
1200
959
  defaultWidth: "wide",
1201
960
  }),
1202
961
 
1203
- day: (0, _index$9.buildLocalizeFn)({
962
+ day: buildLocalizeFn({
1204
963
  values: dayValues,
1205
964
  defaultWidth: "wide",
1206
965
  }),
1207
966
 
1208
- dayPeriod: (0, _index$9.buildLocalizeFn)({
967
+ dayPeriod: buildLocalizeFn({
1209
968
  values: dayPeriodValues,
1210
969
  defaultWidth: "wide",
1211
970
  formattingValues: formattingDayPeriodValues,
1212
971
  defaultFormattingWidth: "wide",
1213
972
  }),
1214
- });
1215
-
1216
- var match = {};
1217
-
1218
- var buildMatchFn$1 = {};
1219
-
1220
- buildMatchFn$1.buildMatchFn = buildMatchFn;
973
+ };
1221
974
 
1222
975
  function buildMatchFn(args) {
1223
976
  return (string, options = {}) => {
@@ -1239,14 +992,14 @@ function buildMatchFn(args) {
1239
992
 
1240
993
  const key = Array.isArray(parsePatterns)
1241
994
  ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString))
1242
- : // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
995
+ : // [TODO] -- I challenge you to fix the type
1243
996
  findKey(parsePatterns, (pattern) => pattern.test(matchedString));
1244
997
 
1245
998
  let value;
1246
999
 
1247
1000
  value = args.valueCallback ? args.valueCallback(key) : key;
1248
1001
  value = options.valueCallback
1249
- ? // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
1002
+ ? // [TODO] -- I challenge you to fix the type
1250
1003
  options.valueCallback(value)
1251
1004
  : value;
1252
1005
 
@@ -1277,10 +1030,6 @@ function findIndex(array, predicate) {
1277
1030
  return undefined;
1278
1031
  }
1279
1032
 
1280
- var buildMatchPatternFn$1 = {};
1281
-
1282
- buildMatchPatternFn$1.buildMatchPatternFn = buildMatchPatternFn;
1283
-
1284
1033
  function buildMatchPatternFn(args) {
1285
1034
  return (string, options = {}) => {
1286
1035
  const matchResult = string.match(args.matchPattern);
@@ -1293,7 +1042,7 @@ function buildMatchPatternFn(args) {
1293
1042
  ? args.valueCallback(parseResult[0])
1294
1043
  : parseResult[0];
1295
1044
 
1296
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
1045
+ // [TODO] I challenge you to fix the type
1297
1046
  value = options.valueCallback ? options.valueCallback(value) : value;
1298
1047
 
1299
1048
  const rest = string.slice(matchedString.length);
@@ -1302,11 +1051,6 @@ function buildMatchPatternFn(args) {
1302
1051
  };
1303
1052
  }
1304
1053
 
1305
- match.match = void 0;
1306
-
1307
- var _index$8 = buildMatchFn$1;
1308
- var _index2$7 = buildMatchPatternFn$1;
1309
-
1310
1054
  const matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
1311
1055
  const parseOrdinalNumberPattern = /\d+/i;
1312
1056
 
@@ -1393,21 +1137,21 @@ const parseDayPeriodPatterns = {
1393
1137
  },
1394
1138
  };
1395
1139
 
1396
- (match.match = {
1397
- ordinalNumber: (0, _index2$7.buildMatchPatternFn)({
1140
+ const match = {
1141
+ ordinalNumber: buildMatchPatternFn({
1398
1142
  matchPattern: matchOrdinalNumberPattern,
1399
1143
  parsePattern: parseOrdinalNumberPattern,
1400
1144
  valueCallback: (value) => parseInt(value, 10),
1401
1145
  }),
1402
1146
 
1403
- era: (0, _index$8.buildMatchFn)({
1147
+ era: buildMatchFn({
1404
1148
  matchPatterns: matchEraPatterns,
1405
1149
  defaultMatchWidth: "wide",
1406
1150
  parsePatterns: parseEraPatterns,
1407
1151
  defaultParseWidth: "any",
1408
1152
  }),
1409
1153
 
1410
- quarter: (0, _index$8.buildMatchFn)({
1154
+ quarter: buildMatchFn({
1411
1155
  matchPatterns: matchQuarterPatterns,
1412
1156
  defaultMatchWidth: "wide",
1413
1157
  parsePatterns: parseQuarterPatterns,
@@ -1415,34 +1159,27 @@ const parseDayPeriodPatterns = {
1415
1159
  valueCallback: (index) => index + 1,
1416
1160
  }),
1417
1161
 
1418
- month: (0, _index$8.buildMatchFn)({
1162
+ month: buildMatchFn({
1419
1163
  matchPatterns: matchMonthPatterns,
1420
1164
  defaultMatchWidth: "wide",
1421
1165
  parsePatterns: parseMonthPatterns,
1422
1166
  defaultParseWidth: "any",
1423
1167
  }),
1424
1168
 
1425
- day: (0, _index$8.buildMatchFn)({
1169
+ day: buildMatchFn({
1426
1170
  matchPatterns: matchDayPatterns,
1427
1171
  defaultMatchWidth: "wide",
1428
1172
  parsePatterns: parseDayPatterns,
1429
1173
  defaultParseWidth: "any",
1430
1174
  }),
1431
1175
 
1432
- dayPeriod: (0, _index$8.buildMatchFn)({
1176
+ dayPeriod: buildMatchFn({
1433
1177
  matchPatterns: matchDayPeriodPatterns,
1434
1178
  defaultMatchWidth: "any",
1435
1179
  parsePatterns: parseDayPeriodPatterns,
1436
1180
  defaultParseWidth: "any",
1437
1181
  }),
1438
- });
1439
-
1440
- enUS.enUS = void 0;
1441
- var _index$7 = formatDistance$1;
1442
- var _index2$6 = formatLong;
1443
- var _index3$6 = formatRelative$1;
1444
- var _index4$5 = localize;
1445
- var _index5$1 = match;
1182
+ };
1446
1183
 
1447
1184
  /**
1448
1185
  * @category Locales
@@ -1452,37 +1189,22 @@ var _index5$1 = match;
1452
1189
  * @author Sasha Koss [@kossnocorp](https://github.com/kossnocorp)
1453
1190
  * @author Lesha Koss [@leshakoss](https://github.com/leshakoss)
1454
1191
  */
1455
- (enUS.enUS = {
1192
+ const enUS = {
1456
1193
  code: "en-US",
1457
- formatDistance: _index$7.formatDistance,
1458
- formatLong: _index2$6.formatLong,
1459
- formatRelative: _index3$6.formatRelative,
1460
- localize: _index4$5.localize,
1461
- match: _index5$1.match,
1194
+ formatDistance: formatDistance,
1195
+ formatLong: formatLong,
1196
+ formatRelative: formatRelative,
1197
+ localize: localize,
1198
+ match: match,
1462
1199
  options: {
1463
1200
  weekStartsOn: 0 /* Sunday */,
1464
1201
  firstWeekContainsDate: 1,
1465
1202
  },
1466
- });
1467
-
1468
- (function (exports) {
1469
- Object.defineProperty(exports, "defaultLocale", {
1470
- enumerable: true,
1471
- get: function () {
1472
- return _index.enUS;
1473
- },
1474
- });
1475
- var _index = enUS;
1476
- }(defaultLocale));
1477
-
1478
- var formatters = {};
1479
-
1480
- var getDayOfYear$1 = {};
1203
+ };
1481
1204
 
1482
- getDayOfYear$1.getDayOfYear = getDayOfYear;
1483
- var _index$6 = differenceInCalendarDays$1;
1484
- var _index2$5 = startOfYear$1;
1485
- var _index3$5 = toDate$1;
1205
+ /**
1206
+ * The {@link getDayOfYear} function options.
1207
+ */
1486
1208
 
1487
1209
  /**
1488
1210
  * @name getDayOfYear
@@ -1492,9 +1214,8 @@ var _index3$5 = toDate$1;
1492
1214
  * @description
1493
1215
  * Get the day of the year of the given date.
1494
1216
  *
1495
- * @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).
1496
- *
1497
1217
  * @param date - The given date
1218
+ * @param options - The options
1498
1219
  *
1499
1220
  * @returns The day of year
1500
1221
  *
@@ -1503,23 +1224,16 @@ var _index3$5 = toDate$1;
1503
1224
  * const result = getDayOfYear(new Date(2014, 6, 2))
1504
1225
  * //=> 183
1505
1226
  */
1506
- function getDayOfYear(date) {
1507
- const _date = (0, _index3$5.toDate)(date);
1508
- const diff = (0, _index$6.differenceInCalendarDays)(
1509
- _date,
1510
- (0, _index2$5.startOfYear)(_date),
1511
- );
1227
+ function getDayOfYear(date, options) {
1228
+ const _date = toDate(date, options?.in);
1229
+ const diff = differenceInCalendarDays(_date, startOfYear(_date));
1512
1230
  const dayOfYear = diff + 1;
1513
1231
  return dayOfYear;
1514
1232
  }
1515
1233
 
1516
- var getISOWeek$1 = {};
1517
-
1518
- getISOWeek$1.getISOWeek = getISOWeek;
1519
- var _index$5 = constants;
1520
- var _index2$4 = startOfISOWeek$1;
1521
- var _index3$4 = startOfISOWeekYear$1;
1522
- var _index4$4 = toDate$1;
1234
+ /**
1235
+ * The {@link getISOWeek} function options.
1236
+ */
1523
1237
 
1524
1238
  /**
1525
1239
  * @name getISOWeek
@@ -1531,9 +1245,8 @@ var _index4$4 = toDate$1;
1531
1245
  *
1532
1246
  * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
1533
1247
  *
1534
- * @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).
1535
- *
1536
1248
  * @param date - The given date
1249
+ * @param options - The options
1537
1250
  *
1538
1251
  * @returns The ISO week
1539
1252
  *
@@ -1542,31 +1255,16 @@ var _index4$4 = toDate$1;
1542
1255
  * const result = getISOWeek(new Date(2005, 0, 2))
1543
1256
  * //=> 53
1544
1257
  */
1545
- function getISOWeek(date) {
1546
- const _date = (0, _index4$4.toDate)(date);
1547
- const diff =
1548
- +(0, _index2$4.startOfISOWeek)(_date) -
1549
- +(0, _index3$4.startOfISOWeekYear)(_date);
1258
+ function getISOWeek(date, options) {
1259
+ const _date = toDate(date, options?.in);
1260
+ const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
1550
1261
 
1551
1262
  // Round the number of weeks to the nearest integer because the number of
1552
1263
  // milliseconds in a week is not constant (e.g. it's different in the week of
1553
1264
  // the daylight saving time clock shift).
1554
- return Math.round(diff / _index$5.millisecondsInWeek) + 1;
1265
+ return Math.round(diff / millisecondsInWeek) + 1;
1555
1266
  }
1556
1267
 
1557
- var getWeek$1 = {};
1558
-
1559
- var startOfWeekYear$1 = {};
1560
-
1561
- var getWeekYear$1 = {};
1562
-
1563
- getWeekYear$1.getWeekYear = getWeekYear;
1564
- var _index$4 = constructFrom$1;
1565
- var _index2$3 = startOfWeek$1;
1566
- var _index3$3 = toDate$1;
1567
-
1568
- var _index4$3 = defaultOptions$1;
1569
-
1570
1268
  /**
1571
1269
  * The {@link getWeekYear} function options.
1572
1270
  */
@@ -1585,8 +1283,6 @@ var _index4$3 = defaultOptions$1;
1585
1283
  *
1586
1284
  * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
1587
1285
  *
1588
- * @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).
1589
- *
1590
1286
  * @param date - The given date
1591
1287
  * @param options - An object with options.
1592
1288
  *
@@ -1608,10 +1304,10 @@ var _index4$3 = defaultOptions$1;
1608
1304
  * //=> 2004
1609
1305
  */
1610
1306
  function getWeekYear(date, options) {
1611
- const _date = (0, _index3$3.toDate)(date);
1307
+ const _date = toDate(date, options?.in);
1612
1308
  const year = _date.getFullYear();
1613
1309
 
1614
- const defaultOptions = (0, _index4$3.getDefaultOptions)();
1310
+ const defaultOptions = getDefaultOptions();
1615
1311
  const firstWeekContainsDate =
1616
1312
  options?.firstWeekContainsDate ??
1617
1313
  options?.locale?.options?.firstWeekContainsDate ??
@@ -1619,38 +1315,25 @@ function getWeekYear(date, options) {
1619
1315
  defaultOptions.locale?.options?.firstWeekContainsDate ??
1620
1316
  1;
1621
1317
 
1622
- const firstWeekOfNextYear = (0, _index$4.constructFrom)(date, 0);
1318
+ const firstWeekOfNextYear = constructFrom(options?.in || date, 0);
1623
1319
  firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
1624
1320
  firstWeekOfNextYear.setHours(0, 0, 0, 0);
1625
- const startOfNextYear = (0, _index2$3.startOfWeek)(
1626
- firstWeekOfNextYear,
1627
- options,
1628
- );
1321
+ const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);
1629
1322
 
1630
- const firstWeekOfThisYear = (0, _index$4.constructFrom)(date, 0);
1323
+ const firstWeekOfThisYear = constructFrom(options?.in || date, 0);
1631
1324
  firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
1632
1325
  firstWeekOfThisYear.setHours(0, 0, 0, 0);
1633
- const startOfThisYear = (0, _index2$3.startOfWeek)(
1634
- firstWeekOfThisYear,
1635
- options,
1636
- );
1326
+ const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);
1637
1327
 
1638
- if (_date.getTime() >= startOfNextYear.getTime()) {
1328
+ if (+_date >= +startOfNextYear) {
1639
1329
  return year + 1;
1640
- } else if (_date.getTime() >= startOfThisYear.getTime()) {
1330
+ } else if (+_date >= +startOfThisYear) {
1641
1331
  return year;
1642
1332
  } else {
1643
1333
  return year - 1;
1644
1334
  }
1645
1335
  }
1646
1336
 
1647
- startOfWeekYear$1.startOfWeekYear = startOfWeekYear;
1648
- var _index$3 = constructFrom$1;
1649
- var _index2$2 = getWeekYear$1;
1650
- var _index3$2 = startOfWeek$1;
1651
-
1652
- var _index4$2 = defaultOptions$1;
1653
-
1654
1337
  /**
1655
1338
  * The {@link startOfWeekYear} function options.
1656
1339
  */
@@ -1670,6 +1353,7 @@ var _index4$2 = defaultOptions$1;
1670
1353
  * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
1671
1354
  *
1672
1355
  * @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).
1356
+ * @typeParam ResultDate - The result `Date` type.
1673
1357
  *
1674
1358
  * @param date - The original date
1675
1359
  * @param options - An object with options
@@ -1692,7 +1376,7 @@ var _index4$2 = defaultOptions$1;
1692
1376
  * //=> Mon Jan 03 2005 00:00:00
1693
1377
  */
1694
1378
  function startOfWeekYear(date, options) {
1695
- const defaultOptions = (0, _index4$2.getDefaultOptions)();
1379
+ const defaultOptions = getDefaultOptions();
1696
1380
  const firstWeekContainsDate =
1697
1381
  options?.firstWeekContainsDate ??
1698
1382
  options?.locale?.options?.firstWeekContainsDate ??
@@ -1700,20 +1384,14 @@ function startOfWeekYear(date, options) {
1700
1384
  defaultOptions.locale?.options?.firstWeekContainsDate ??
1701
1385
  1;
1702
1386
 
1703
- const year = (0, _index2$2.getWeekYear)(date, options);
1704
- const firstWeek = (0, _index$3.constructFrom)(date, 0);
1387
+ const year = getWeekYear(date, options);
1388
+ const firstWeek = constructFrom(options?.in || date, 0);
1705
1389
  firstWeek.setFullYear(year, 0, firstWeekContainsDate);
1706
1390
  firstWeek.setHours(0, 0, 0, 0);
1707
- const _date = (0, _index3$2.startOfWeek)(firstWeek, options);
1391
+ const _date = startOfWeek(firstWeek, options);
1708
1392
  return _date;
1709
1393
  }
1710
1394
 
1711
- getWeek$1.getWeek = getWeek;
1712
- var _index$2 = constants;
1713
- var _index2$1 = startOfWeek$1;
1714
- var _index3$1 = startOfWeekYear$1;
1715
- var _index4$1 = toDate$1;
1716
-
1717
1395
  /**
1718
1396
  * The {@link getWeek} function options.
1719
1397
  */
@@ -1732,8 +1410,6 @@ var _index4$1 = toDate$1;
1732
1410
  *
1733
1411
  * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
1734
1412
  *
1735
- * @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).
1736
- *
1737
1413
  * @param date - The given date
1738
1414
  * @param options - An object with options
1739
1415
  *
@@ -1754,33 +1430,22 @@ var _index4$1 = toDate$1;
1754
1430
  * })
1755
1431
  * //=> 53
1756
1432
  */
1757
-
1758
1433
  function getWeek(date, options) {
1759
- const _date = (0, _index4$1.toDate)(date);
1760
- const diff =
1761
- +(0, _index2$1.startOfWeek)(_date, options) -
1762
- +(0, _index3$1.startOfWeekYear)(_date, options);
1434
+ const _date = toDate(date, options?.in);
1435
+ const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);
1763
1436
 
1764
1437
  // Round the number of weeks to the nearest integer because the number of
1765
1438
  // milliseconds in a week is not constant (e.g. it's different in the week of
1766
1439
  // the daylight saving time clock shift).
1767
- return Math.round(diff / _index$2.millisecondsInWeek) + 1;
1440
+ return Math.round(diff / millisecondsInWeek) + 1;
1768
1441
  }
1769
1442
 
1770
- var addLeadingZeros$1 = {};
1771
-
1772
- addLeadingZeros$1.addLeadingZeros = addLeadingZeros;
1773
1443
  function addLeadingZeros(number, targetLength) {
1774
1444
  const sign = number < 0 ? "-" : "";
1775
1445
  const output = Math.abs(number).toString().padStart(targetLength, "0");
1776
1446
  return sign + output;
1777
1447
  }
1778
1448
 
1779
- var lightFormatters = {};
1780
-
1781
- lightFormatters.lightFormatters = void 0;
1782
- var _index$1 = addLeadingZeros$1;
1783
-
1784
1449
  /*
1785
1450
  * | | Unit | | Unit |
1786
1451
  * |-----|--------------------------------|-----|--------------------------------|
@@ -1794,7 +1459,7 @@ var _index$1 = addLeadingZeros$1;
1794
1459
  * Letters marked by * are not implemented but reserved by Unicode standard.
1795
1460
  */
1796
1461
 
1797
- (lightFormatters.lightFormatters = {
1462
+ const lightFormatters = {
1798
1463
  // Year
1799
1464
  y(date, token) {
1800
1465
  // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
@@ -1809,23 +1474,18 @@ var _index$1 = addLeadingZeros$1;
1809
1474
  const signedYear = date.getFullYear();
1810
1475
  // Returns 1 for 1 BC (which is year 0 in JavaScript)
1811
1476
  const year = signedYear > 0 ? signedYear : 1 - signedYear;
1812
- return (0, _index$1.addLeadingZeros)(
1813
- token === "yy" ? year % 100 : year,
1814
- token.length,
1815
- );
1477
+ return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
1816
1478
  },
1817
1479
 
1818
1480
  // Month
1819
1481
  M(date, token) {
1820
1482
  const month = date.getMonth();
1821
- return token === "M"
1822
- ? String(month + 1)
1823
- : (0, _index$1.addLeadingZeros)(month + 1, 2);
1483
+ return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
1824
1484
  },
1825
1485
 
1826
1486
  // Day of the month
1827
1487
  d(date, token) {
1828
- return (0, _index$1.addLeadingZeros)(date.getDate(), token.length);
1488
+ return addLeadingZeros(date.getDate(), token.length);
1829
1489
  },
1830
1490
 
1831
1491
  // AM or PM
@@ -1848,25 +1508,22 @@ var _index$1 = addLeadingZeros$1;
1848
1508
 
1849
1509
  // Hour [1-12]
1850
1510
  h(date, token) {
1851
- return (0, _index$1.addLeadingZeros)(
1852
- date.getHours() % 12 || 12,
1853
- token.length,
1854
- );
1511
+ return addLeadingZeros(date.getHours() % 12 || 12, token.length);
1855
1512
  },
1856
1513
 
1857
1514
  // Hour [0-23]
1858
1515
  H(date, token) {
1859
- return (0, _index$1.addLeadingZeros)(date.getHours(), token.length);
1516
+ return addLeadingZeros(date.getHours(), token.length);
1860
1517
  },
1861
1518
 
1862
1519
  // Minute
1863
1520
  m(date, token) {
1864
- return (0, _index$1.addLeadingZeros)(date.getMinutes(), token.length);
1521
+ return addLeadingZeros(date.getMinutes(), token.length);
1865
1522
  },
1866
1523
 
1867
1524
  // Second
1868
1525
  s(date, token) {
1869
- return (0, _index$1.addLeadingZeros)(date.getSeconds(), token.length);
1526
+ return addLeadingZeros(date.getSeconds(), token.length);
1870
1527
  },
1871
1528
 
1872
1529
  // Fraction of second
@@ -1876,19 +1533,9 @@ var _index$1 = addLeadingZeros$1;
1876
1533
  const fractionalSeconds = Math.trunc(
1877
1534
  milliseconds * Math.pow(10, numberOfDigits - 3),
1878
1535
  );
1879
- return (0, _index$1.addLeadingZeros)(fractionalSeconds, token.length);
1536
+ return addLeadingZeros(fractionalSeconds, token.length);
1880
1537
  },
1881
- });
1882
-
1883
- formatters.formatters = void 0;
1884
- var _index = getDayOfYear$1;
1885
- var _index2 = getISOWeek$1;
1886
- var _index3 = getISOWeekYear$1;
1887
- var _index4 = getWeek$1;
1888
- var _index5 = getWeekYear$1;
1889
-
1890
- var _index6 = addLeadingZeros$1;
1891
- var _index7 = lightFormatters;
1538
+ };
1892
1539
 
1893
1540
  const dayPeriodEnum = {
1894
1541
  am: "am",
@@ -1947,7 +1594,7 @@ const dayPeriodEnum = {
1947
1594
  * - `p` is long localized time format
1948
1595
  */
1949
1596
 
1950
- (formatters.formatters = {
1597
+ const formatters = {
1951
1598
  // Era
1952
1599
  G: function (date, token, localize) {
1953
1600
  const era = date.getFullYear() > 0 ? 1 : 0;
@@ -1977,19 +1624,19 @@ const dayPeriodEnum = {
1977
1624
  return localize.ordinalNumber(year, { unit: "year" });
1978
1625
  }
1979
1626
 
1980
- return _index7.lightFormatters.y(date, token);
1627
+ return lightFormatters.y(date, token);
1981
1628
  },
1982
1629
 
1983
1630
  // Local week-numbering year
1984
1631
  Y: function (date, token, localize, options) {
1985
- const signedWeekYear = (0, _index5.getWeekYear)(date, options);
1632
+ const signedWeekYear = getWeekYear(date, options);
1986
1633
  // Returns 1 for 1 BC (which is year 0 in JavaScript)
1987
1634
  const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
1988
1635
 
1989
1636
  // Two digit year
1990
1637
  if (token === "YY") {
1991
1638
  const twoDigitYear = weekYear % 100;
1992
- return (0, _index6.addLeadingZeros)(twoDigitYear, 2);
1639
+ return addLeadingZeros(twoDigitYear, 2);
1993
1640
  }
1994
1641
 
1995
1642
  // Ordinal number
@@ -1998,15 +1645,15 @@ const dayPeriodEnum = {
1998
1645
  }
1999
1646
 
2000
1647
  // Padding
2001
- return (0, _index6.addLeadingZeros)(weekYear, token.length);
1648
+ return addLeadingZeros(weekYear, token.length);
2002
1649
  },
2003
1650
 
2004
1651
  // ISO week-numbering year
2005
1652
  R: function (date, token) {
2006
- const isoWeekYear = (0, _index3.getISOWeekYear)(date);
1653
+ const isoWeekYear = getISOWeekYear(date);
2007
1654
 
2008
1655
  // Padding
2009
- return (0, _index6.addLeadingZeros)(isoWeekYear, token.length);
1656
+ return addLeadingZeros(isoWeekYear, token.length);
2010
1657
  },
2011
1658
 
2012
1659
  // Extended year. This is a single number designating the year of this calendar system.
@@ -2020,7 +1667,7 @@ const dayPeriodEnum = {
2020
1667
  // while `uu` pads single digit years to 2 characters and returns other years unchanged.
2021
1668
  u: function (date, token) {
2022
1669
  const year = date.getFullYear();
2023
- return (0, _index6.addLeadingZeros)(year, token.length);
1670
+ return addLeadingZeros(year, token.length);
2024
1671
  },
2025
1672
 
2026
1673
  // Quarter
@@ -2032,7 +1679,7 @@ const dayPeriodEnum = {
2032
1679
  return String(quarter);
2033
1680
  // 01, 02, 03, 04
2034
1681
  case "QQ":
2035
- return (0, _index6.addLeadingZeros)(quarter, 2);
1682
+ return addLeadingZeros(quarter, 2);
2036
1683
  // 1st, 2nd, 3rd, 4th
2037
1684
  case "Qo":
2038
1685
  return localize.ordinalNumber(quarter, { unit: "quarter" });
@@ -2067,7 +1714,7 @@ const dayPeriodEnum = {
2067
1714
  return String(quarter);
2068
1715
  // 01, 02, 03, 04
2069
1716
  case "qq":
2070
- return (0, _index6.addLeadingZeros)(quarter, 2);
1717
+ return addLeadingZeros(quarter, 2);
2071
1718
  // 1st, 2nd, 3rd, 4th
2072
1719
  case "qo":
2073
1720
  return localize.ordinalNumber(quarter, { unit: "quarter" });
@@ -2099,7 +1746,7 @@ const dayPeriodEnum = {
2099
1746
  switch (token) {
2100
1747
  case "M":
2101
1748
  case "MM":
2102
- return _index7.lightFormatters.M(date, token);
1749
+ return lightFormatters.M(date, token);
2103
1750
  // 1st, 2nd, ..., 12th
2104
1751
  case "Mo":
2105
1752
  return localize.ordinalNumber(month + 1, { unit: "month" });
@@ -2131,7 +1778,7 @@ const dayPeriodEnum = {
2131
1778
  return String(month + 1);
2132
1779
  // 01, 02, ..., 12
2133
1780
  case "LL":
2134
- return (0, _index6.addLeadingZeros)(month + 1, 2);
1781
+ return addLeadingZeros(month + 1, 2);
2135
1782
  // 1st, 2nd, ..., 12th
2136
1783
  case "Lo":
2137
1784
  return localize.ordinalNumber(month + 1, { unit: "month" });
@@ -2156,24 +1803,24 @@ const dayPeriodEnum = {
2156
1803
 
2157
1804
  // Local week of year
2158
1805
  w: function (date, token, localize, options) {
2159
- const week = (0, _index4.getWeek)(date, options);
1806
+ const week = getWeek(date, options);
2160
1807
 
2161
1808
  if (token === "wo") {
2162
1809
  return localize.ordinalNumber(week, { unit: "week" });
2163
1810
  }
2164
1811
 
2165
- return (0, _index6.addLeadingZeros)(week, token.length);
1812
+ return addLeadingZeros(week, token.length);
2166
1813
  },
2167
1814
 
2168
1815
  // ISO week of year
2169
1816
  I: function (date, token, localize) {
2170
- const isoWeek = (0, _index2.getISOWeek)(date);
1817
+ const isoWeek = getISOWeek(date);
2171
1818
 
2172
1819
  if (token === "Io") {
2173
1820
  return localize.ordinalNumber(isoWeek, { unit: "week" });
2174
1821
  }
2175
1822
 
2176
- return (0, _index6.addLeadingZeros)(isoWeek, token.length);
1823
+ return addLeadingZeros(isoWeek, token.length);
2177
1824
  },
2178
1825
 
2179
1826
  // Day of the month
@@ -2182,18 +1829,18 @@ const dayPeriodEnum = {
2182
1829
  return localize.ordinalNumber(date.getDate(), { unit: "date" });
2183
1830
  }
2184
1831
 
2185
- return _index7.lightFormatters.d(date, token);
1832
+ return lightFormatters.d(date, token);
2186
1833
  },
2187
1834
 
2188
1835
  // Day of year
2189
1836
  D: function (date, token, localize) {
2190
- const dayOfYear = (0, _index.getDayOfYear)(date);
1837
+ const dayOfYear = getDayOfYear(date);
2191
1838
 
2192
1839
  if (token === "Do") {
2193
1840
  return localize.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
2194
1841
  }
2195
1842
 
2196
- return (0, _index6.addLeadingZeros)(dayOfYear, token.length);
1843
+ return addLeadingZeros(dayOfYear, token.length);
2197
1844
  },
2198
1845
 
2199
1846
  // Day of week
@@ -2240,7 +1887,7 @@ const dayPeriodEnum = {
2240
1887
  return String(localDayOfWeek);
2241
1888
  // Padded numerical value
2242
1889
  case "ee":
2243
- return (0, _index6.addLeadingZeros)(localDayOfWeek, 2);
1890
+ return addLeadingZeros(localDayOfWeek, 2);
2244
1891
  // 1st, 2nd, ..., 7th
2245
1892
  case "eo":
2246
1893
  return localize.ordinalNumber(localDayOfWeek, { unit: "day" });
@@ -2281,7 +1928,7 @@ const dayPeriodEnum = {
2281
1928
  return String(localDayOfWeek);
2282
1929
  // Padded numerical value
2283
1930
  case "cc":
2284
- return (0, _index6.addLeadingZeros)(localDayOfWeek, token.length);
1931
+ return addLeadingZeros(localDayOfWeek, token.length);
2285
1932
  // 1st, 2nd, ..., 7th
2286
1933
  case "co":
2287
1934
  return localize.ordinalNumber(localDayOfWeek, { unit: "day" });
@@ -2322,7 +1969,7 @@ const dayPeriodEnum = {
2322
1969
  return String(isoDayOfWeek);
2323
1970
  // 02
2324
1971
  case "ii":
2325
- return (0, _index6.addLeadingZeros)(isoDayOfWeek, token.length);
1972
+ return addLeadingZeros(isoDayOfWeek, token.length);
2326
1973
  // 2nd
2327
1974
  case "io":
2328
1975
  return localize.ordinalNumber(isoDayOfWeek, { unit: "day" });
@@ -2471,7 +2118,7 @@ const dayPeriodEnum = {
2471
2118
  return localize.ordinalNumber(hours, { unit: "hour" });
2472
2119
  }
2473
2120
 
2474
- return _index7.lightFormatters.h(date, token);
2121
+ return lightFormatters.h(date, token);
2475
2122
  },
2476
2123
 
2477
2124
  // Hour [0-23]
@@ -2480,7 +2127,7 @@ const dayPeriodEnum = {
2480
2127
  return localize.ordinalNumber(date.getHours(), { unit: "hour" });
2481
2128
  }
2482
2129
 
2483
- return _index7.lightFormatters.H(date, token);
2130
+ return lightFormatters.H(date, token);
2484
2131
  },
2485
2132
 
2486
2133
  // Hour [0-11]
@@ -2491,7 +2138,7 @@ const dayPeriodEnum = {
2491
2138
  return localize.ordinalNumber(hours, { unit: "hour" });
2492
2139
  }
2493
2140
 
2494
- return (0, _index6.addLeadingZeros)(hours, token.length);
2141
+ return addLeadingZeros(hours, token.length);
2495
2142
  },
2496
2143
 
2497
2144
  // Hour [1-24]
@@ -2503,7 +2150,7 @@ const dayPeriodEnum = {
2503
2150
  return localize.ordinalNumber(hours, { unit: "hour" });
2504
2151
  }
2505
2152
 
2506
- return (0, _index6.addLeadingZeros)(hours, token.length);
2153
+ return addLeadingZeros(hours, token.length);
2507
2154
  },
2508
2155
 
2509
2156
  // Minute
@@ -2512,7 +2159,7 @@ const dayPeriodEnum = {
2512
2159
  return localize.ordinalNumber(date.getMinutes(), { unit: "minute" });
2513
2160
  }
2514
2161
 
2515
- return _index7.lightFormatters.m(date, token);
2162
+ return lightFormatters.m(date, token);
2516
2163
  },
2517
2164
 
2518
2165
  // Second
@@ -2521,12 +2168,12 @@ const dayPeriodEnum = {
2521
2168
  return localize.ordinalNumber(date.getSeconds(), { unit: "second" });
2522
2169
  }
2523
2170
 
2524
- return _index7.lightFormatters.s(date, token);
2171
+ return lightFormatters.s(date, token);
2525
2172
  },
2526
2173
 
2527
2174
  // Fraction of second
2528
2175
  S: function (date, token) {
2529
- return _index7.lightFormatters.S(date, token);
2176
+ return lightFormatters.S(date, token);
2530
2177
  },
2531
2178
 
2532
2179
  // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
@@ -2622,15 +2269,15 @@ const dayPeriodEnum = {
2622
2269
  // Seconds timestamp
2623
2270
  t: function (date, token, _localize) {
2624
2271
  const timestamp = Math.trunc(date.getTime() / 1000);
2625
- return (0, _index6.addLeadingZeros)(timestamp, token.length);
2272
+ return addLeadingZeros(timestamp, token.length);
2626
2273
  },
2627
2274
 
2628
2275
  // Milliseconds timestamp
2629
2276
  T: function (date, token, _localize) {
2630
2277
  const timestamp = date.getTime();
2631
- return (0, _index6.addLeadingZeros)(timestamp, token.length);
2278
+ return addLeadingZeros(timestamp, token.length);
2632
2279
  },
2633
- });
2280
+ };
2634
2281
 
2635
2282
  function formatTimezoneShort(offset, delimiter = "") {
2636
2283
  const sign = offset > 0 ? "-" : "+";
@@ -2640,15 +2287,13 @@ function formatTimezoneShort(offset, delimiter = "") {
2640
2287
  if (minutes === 0) {
2641
2288
  return sign + String(hours);
2642
2289
  }
2643
- return (
2644
- sign + String(hours) + delimiter + (0, _index6.addLeadingZeros)(minutes, 2)
2645
- );
2290
+ return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
2646
2291
  }
2647
2292
 
2648
2293
  function formatTimezoneWithOptionalMinutes(offset, delimiter) {
2649
2294
  if (offset % 60 === 0) {
2650
2295
  const sign = offset > 0 ? "-" : "+";
2651
- return sign + (0, _index6.addLeadingZeros)(Math.abs(offset) / 60, 2);
2296
+ return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
2652
2297
  }
2653
2298
  return formatTimezone(offset, delimiter);
2654
2299
  }
@@ -2656,15 +2301,11 @@ function formatTimezoneWithOptionalMinutes(offset, delimiter) {
2656
2301
  function formatTimezone(offset, delimiter = "") {
2657
2302
  const sign = offset > 0 ? "-" : "+";
2658
2303
  const absOffset = Math.abs(offset);
2659
- const hours = (0, _index6.addLeadingZeros)(Math.trunc(absOffset / 60), 2);
2660
- const minutes = (0, _index6.addLeadingZeros)(absOffset % 60, 2);
2304
+ const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
2305
+ const minutes = addLeadingZeros(absOffset % 60, 2);
2661
2306
  return sign + hours + delimiter + minutes;
2662
2307
  }
2663
2308
 
2664
- var longFormatters = {};
2665
-
2666
- longFormatters.longFormatters = void 0;
2667
-
2668
2309
  const dateLongFormatter = (pattern, formatLong) => {
2669
2310
  switch (pattern) {
2670
2311
  case "P":
@@ -2725,16 +2366,11 @@ const dateTimeLongFormatter = (pattern, formatLong) => {
2725
2366
  .replace("{{time}}", timeLongFormatter(timePattern, formatLong));
2726
2367
  };
2727
2368
 
2728
- (longFormatters.longFormatters = {
2369
+ const longFormatters = {
2729
2370
  p: timeLongFormatter,
2730
2371
  P: dateTimeLongFormatter,
2731
- });
2732
-
2733
- var protectedTokens = {};
2372
+ };
2734
2373
 
2735
- protectedTokens.isProtectedDayOfYearToken = isProtectedDayOfYearToken;
2736
- protectedTokens.isProtectedWeekYearToken = isProtectedWeekYearToken;
2737
- protectedTokens.warnOrThrowProtectedError = warnOrThrowProtectedError;
2738
2374
  const dayOfYearTokenRE = /^D+$/;
2739
2375
  const weekYearTokenRE = /^Y+$/;
2740
2376
 
@@ -2759,32 +2395,6 @@ function message(token, format, input) {
2759
2395
  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`;
2760
2396
  }
2761
2397
 
2762
- (function (exports) {
2763
- exports.format = exports.formatDate = format;
2764
- Object.defineProperty(exports, "formatters", {
2765
- enumerable: true,
2766
- get: function () {
2767
- return _index3.formatters;
2768
- },
2769
- });
2770
- Object.defineProperty(exports, "longFormatters", {
2771
- enumerable: true,
2772
- get: function () {
2773
- return _index4.longFormatters;
2774
- },
2775
- });
2776
- var _index = defaultLocale;
2777
- var _index2 = defaultOptions$1;
2778
- var _index3 = formatters;
2779
- var _index4 = longFormatters;
2780
- var _index5 = protectedTokens;
2781
-
2782
- var _index6 = isValid$1;
2783
- var _index7 = toDate$1;
2784
-
2785
- // Rexports of internal for libraries to use.
2786
- // See: https://github.com/date-fns/date-fns/issues/3638#issuecomment-1877082874
2787
-
2788
2398
  // This RegExp consists of three parts separated by `|`:
2789
2399
  // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
2790
2400
  // (one of the certain letters followed by `o`)
@@ -3062,8 +2672,6 @@ const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
3062
2672
  * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
3063
2673
  * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
3064
2674
  *
3065
- * @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).
3066
- *
3067
2675
  * @param date - The original date
3068
2676
  * @param format - The string of tokens
3069
2677
  * @param options - An object with options
@@ -3098,9 +2706,8 @@ const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
3098
2706
  * //=> "3 o'clock"
3099
2707
  */
3100
2708
  function format(date, formatStr, options) {
3101
- const defaultOptions = (0, _index2.getDefaultOptions)();
3102
- const locale =
3103
- options?.locale ?? defaultOptions.locale ?? _index.defaultLocale;
2709
+ const defaultOptions = getDefaultOptions();
2710
+ const locale = options?.locale ?? defaultOptions.locale ?? enUS;
3104
2711
 
3105
2712
  const firstWeekContainsDate =
3106
2713
  options?.firstWeekContainsDate ??
@@ -3116,9 +2723,9 @@ function format(date, formatStr, options) {
3116
2723
  defaultOptions.locale?.options?.weekStartsOn ??
3117
2724
  0;
3118
2725
 
3119
- const originalDate = (0, _index7.toDate)(date);
2726
+ const originalDate = toDate(date);
3120
2727
 
3121
- if (!(0, _index6.isValid)(originalDate)) {
2728
+ if (!isValid(originalDate)) {
3122
2729
  throw new RangeError("Invalid time value");
3123
2730
  }
3124
2731
 
@@ -3127,7 +2734,7 @@ function format(date, formatStr, options) {
3127
2734
  .map((substring) => {
3128
2735
  const firstCharacter = substring[0];
3129
2736
  if (firstCharacter === "p" || firstCharacter === "P") {
3130
- const longFormatter = _index4.longFormatters[firstCharacter];
2737
+ const longFormatter = longFormatters[firstCharacter];
3131
2738
  return longFormatter(substring, locale.formatLong);
3132
2739
  }
3133
2740
  return substring;
@@ -3145,7 +2752,7 @@ function format(date, formatStr, options) {
3145
2752
  return { isToken: false, value: cleanEscapedString(substring) };
3146
2753
  }
3147
2754
 
3148
- if (_index3.formatters[firstCharacter]) {
2755
+ if (formatters[firstCharacter]) {
3149
2756
  return { isToken: true, value: substring };
3150
2757
  }
3151
2758
 
@@ -3179,14 +2786,14 @@ function format(date, formatStr, options) {
3179
2786
 
3180
2787
  if (
3181
2788
  (!options?.useAdditionalWeekYearTokens &&
3182
- (0, _index5.isProtectedWeekYearToken)(token)) ||
2789
+ isProtectedWeekYearToken(token)) ||
3183
2790
  (!options?.useAdditionalDayOfYearTokens &&
3184
- (0, _index5.isProtectedDayOfYearToken)(token))
2791
+ isProtectedDayOfYearToken(token))
3185
2792
  ) {
3186
- (0, _index5.warnOrThrowProtectedError)(token, formatStr, String(date));
2793
+ warnOrThrowProtectedError(token, formatStr, String(date));
3187
2794
  }
3188
2795
 
3189
- const formatter = _index3.formatters[token[0]];
2796
+ const formatter = formatters[token[0]];
3190
2797
  return formatter(originalDate, token, locale.localize, formatterOptions);
3191
2798
  })
3192
2799
  .join("");
@@ -3201,6 +2808,5 @@ function cleanEscapedString(input) {
3201
2808
 
3202
2809
  return matched[1].replace(doubleQuoteRegExp, "'");
3203
2810
  }
3204
- }(format));
3205
2811
 
3206
- export { constants as a, startOfDay$1 as b, constructFrom$1 as c, differenceInCalendarDays$1 as d, startOfISOWeek$1 as e, getTimezoneOffsetInMilliseconds$1 as f, getISOWeekYear$1 as g, startOfWeek$1 as h, isValid$1 as i, startOfYear$1 as j, defaultOptions$1 as k, defaultLocale as l, addLeadingZeros$1 as m, format as n, getWeekYear$1 as o, getWeek$1 as p, getISOWeek$1 as q, longFormatters as r, startOfISOWeekYear$1 as s, toDate$1 as t, protectedTokens as u, lightFormatters as v, startOfWeekYear$1 as w, getDayOfYear$1 as x, isDate$1 as y };
2812
+ exports.format = format;