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