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