@paperless/core 2.22.0-alpha.27 → 2.22.0-alpha.29

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 (213) hide show
  1. package/dist/build/index.esm.js +1 -1
  2. package/dist/{paperless/p-84c43a3d.entry.js → build/p-1c17ee9b.entry.js} +1 -1
  3. package/dist/build/p-25961586.entry.js +1 -0
  4. package/dist/{paperless/p-9f51b9dc.entry.js → build/p-260a97c9.entry.js} +1 -1
  5. package/dist/build/{p-44da0b12.entry.js → p-2a37b400.entry.js} +1 -1
  6. package/dist/build/{p-fff6fa7a.entry.js → p-31399606.entry.js} +1 -1
  7. package/dist/build/{p-fa519af0.js → p-5f422b65.js} +1 -1
  8. package/dist/build/p-60923e39.entry.js +1 -0
  9. package/dist/{paperless/p-d24f045f.entry.js → build/p-6aa93bf9.entry.js} +1 -1
  10. package/dist/build/{p-e51c1cd6.entry.js → p-70974f53.entry.js} +1 -1
  11. package/dist/build/p-75ba802e.entry.js +3 -0
  12. package/dist/build/{p-b781e8db.entry.js → p-8c1bf7ea.entry.js} +1 -1
  13. package/dist/{paperless/p-7d018d4d.entry.js → build/p-9e06356b.entry.js} +1 -1
  14. package/dist/build/p-B_lDCj8j.js +1 -0
  15. package/dist/build/p-CeBIrPPx.js +1 -0
  16. package/dist/build/{p-78b15121.entry.js → p-a6369294.entry.js} +1 -1
  17. package/dist/build/p-a9c0aab3.entry.js +1 -0
  18. package/dist/build/p-b85ee4b7.entry.js +1 -0
  19. package/dist/build/{p-76f83633.entry.js → p-ba7ccf80.entry.js} +1 -1
  20. package/dist/build/{p-524eb1cb.entry.js → p-c16870f5.entry.js} +1 -1
  21. package/dist/build/{p-17e598ac.entry.js → p-cf436a7d.entry.js} +1 -1
  22. package/dist/build/{p-0d6f3aa3.entry.js → p-cfbd02e6.entry.js} +1 -1
  23. package/dist/build/{p-cbeb58ba.entry.js → p-e907c9d3.entry.js} +1 -1
  24. package/dist/build/{p-d9b3ace4.entry.js → p-ee7858e4.entry.js} +1 -1
  25. package/dist/build/{p-23cc6b6b.entry.js → p-f1c6f25b.entry.js} +1 -1
  26. package/dist/{paperless/p-5abcc8d2.entry.js → build/p-f5be155f.entry.js} +1 -1
  27. package/dist/build/p-xs4N_Y-0.js +1 -0
  28. package/dist/build/paperless.esm.js +1 -1
  29. package/dist/cjs/{cn-BGmLaIp8.js → cn-Cd68UVBT.js} +30 -274
  30. package/dist/cjs/{floating-ui.dom-33QlkSyu.js → floating-ui.dom-DEq7yeQK.js} +91 -50
  31. package/dist/cjs/index.cjs.js +1 -1
  32. package/dist/cjs/locale-BIZDGOk_.js +75117 -0
  33. package/dist/cjs/p-accordion.cjs.entry.js +1 -1
  34. package/dist/cjs/p-attachment.cjs.entry.js +1 -1
  35. package/dist/cjs/p-badge_3.cjs.entry.js +1 -1
  36. package/dist/cjs/p-button_3.cjs.entry.js +6 -6
  37. package/dist/cjs/p-calendar.cjs.entry.js +75 -302
  38. package/dist/cjs/p-card-container.cjs.entry.js +1 -1
  39. package/dist/cjs/p-checkbox_3.cjs.entry.js +2 -2
  40. package/dist/cjs/p-content-slider.cjs.entry.js +1 -1
  41. package/dist/cjs/p-cropper.cjs.entry.js +88 -32
  42. package/dist/cjs/p-datepicker.cjs.entry.js +41 -2891
  43. package/dist/cjs/p-divider.cjs.entry.js +1 -1
  44. package/dist/cjs/p-dropdown-menu-item_2.cjs.entry.js +1 -1
  45. package/dist/cjs/p-empty-state_8.cjs.entry.js +12 -18
  46. package/dist/cjs/p-field_3.cjs.entry.js +1 -1
  47. package/dist/cjs/p-illustration.cjs.entry.js +1 -1
  48. package/dist/cjs/p-label.cjs.entry.js +1 -1
  49. package/dist/cjs/p-listing.cjs.entry.js +1 -1
  50. package/dist/cjs/p-navigation-item.cjs.entry.js +1 -1
  51. package/dist/cjs/p-pagination_3.cjs.entry.js +2 -2
  52. package/dist/cjs/p-select.cjs.entry.js +1 -1
  53. package/dist/cjs/p-table.cjs.entry.js +1 -1
  54. package/dist/cjs/p-tooltip.cjs.entry.js +1 -1
  55. package/dist/collection/components/atoms/loader/loader.component.js +1 -1
  56. package/dist/collection/components/molecules/button/button.component.js +8 -7
  57. package/dist/collection/components/molecules/calendar/calendar.component.js +1 -2
  58. package/dist/collection/components/molecules/datepicker/datepicker.component.js +2 -2
  59. package/dist/collection/components/molecules/pagination/pages/pagination-pages.component.js +1 -1
  60. package/dist/components/index.js +1 -1
  61. package/dist/components/{p-BtuWYjfq.js → p--JDhF4GL.js} +1 -1
  62. package/dist/components/{p-DW-MndqD.js → p-0y7dmBHx.js} +1 -1
  63. package/dist/components/{p-DxmwiGc9.js → p-B4tCVctO.js} +1 -1
  64. package/dist/components/{p-LfH4pSix.js → p-BA1QFuzs.js} +1 -1
  65. package/dist/components/{p-Bno5n2sV.js → p-BBmuctek.js} +1 -1
  66. package/dist/components/p-BE2DRulM.js +1 -0
  67. package/dist/components/{p-Dbt4VuQm.js → p-BPP8ZYwN.js} +1 -1
  68. package/dist/components/{p-BeiMfpUZ.js → p-BV-h5ALt.js} +1 -1
  69. package/dist/components/{p-C_dax2wr.js → p-BX8yg_1a.js} +1 -1
  70. package/dist/components/{p-CjI4hMLv.js → p-BaXKEl7X.js} +1 -1
  71. package/dist/components/{p-BfJQbKrn.js → p-CCvROjOe.js} +1 -1
  72. package/dist/components/p-CHydrUrt.js +1 -0
  73. package/dist/components/{p-Bi6PK1YV.js → p-CccN0jY7.js} +1 -1
  74. package/dist/components/p-CeBIrPPx.js +1 -0
  75. package/dist/components/{p-BMb-TnTI.js → p-Coxruux_.js} +1 -1
  76. package/dist/components/{p-B9n8mzrj.js → p-DAuzJ_qL.js} +1 -1
  77. package/dist/components/{p-BAIZ48ms.js → p-DZjr9R4d.js} +1 -1
  78. package/dist/components/{p-BBNOzE00.js → p-Djf2rBRX.js} +1 -1
  79. package/dist/components/p-Dl4hxOHI.js +1 -0
  80. package/dist/components/{p-BIQLsxW1.js → p-DuYGcgJi.js} +1 -1
  81. package/dist/components/{p-CFu8cH3m.js → p-DxNTB_Qq.js} +1 -1
  82. package/dist/components/{p-CgOKCXab.js → p-JhZXmipA.js} +1 -1
  83. package/dist/components/{p-ChfXIxTQ.js → p-KuL1SNit.js} +1 -1
  84. package/dist/components/p-accordion.js +1 -1
  85. package/dist/components/p-attachment.js +1 -1
  86. package/dist/components/p-button.js +1 -1
  87. package/dist/components/p-calendar.js +1 -1
  88. package/dist/components/p-card-container.js +1 -1
  89. package/dist/components/p-card-header.js +1 -1
  90. package/dist/components/p-content-slider.js +1 -1
  91. package/dist/components/p-cropper.js +2 -2
  92. package/dist/components/p-datepicker.js +1 -1
  93. package/dist/components/p-divider.js +1 -1
  94. package/dist/components/p-drawer-header.js +1 -1
  95. package/dist/components/p-drawer.js +1 -1
  96. package/dist/components/p-dropdown-menu-item.js +1 -1
  97. package/dist/components/p-dropdown.js +1 -1
  98. package/dist/components/p-empty-state.js +1 -1
  99. package/dist/components/p-field-container.js +1 -1
  100. package/dist/components/p-field.js +1 -1
  101. package/dist/components/p-floating-menu-container.js +1 -1
  102. package/dist/components/p-helper.js +1 -1
  103. package/dist/components/p-illustration.js +1 -1
  104. package/dist/components/p-label.js +1 -1
  105. package/dist/components/p-listing.js +1 -1
  106. package/dist/components/p-modal-footer.js +1 -1
  107. package/dist/components/p-modal-header.js +1 -1
  108. package/dist/components/p-modal.js +1 -1
  109. package/dist/components/p-navbar.js +1 -1
  110. package/dist/components/p-navigation-item.js +1 -1
  111. package/dist/components/p-pagination-pages.js +1 -1
  112. package/dist/components/p-pagination-size.js +1 -1
  113. package/dist/components/p-pagination.js +1 -1
  114. package/dist/components/{p-PFAC3Kay.js → p-prb4IQlb.js} +1 -1
  115. package/dist/components/p-profile.js +1 -1
  116. package/dist/components/p-segment-item.js +1 -1
  117. package/dist/components/p-select.js +1 -1
  118. package/dist/components/{p-CCOwunss.js → p-swqKzLDH.js} +1 -1
  119. package/dist/components/p-tab-container.js +1 -1
  120. package/dist/components/p-table-cell.js +1 -1
  121. package/dist/components/p-table-footer.js +1 -1
  122. package/dist/components/p-table-header.js +1 -1
  123. package/dist/components/p-table-row-actions-container.js +1 -1
  124. package/dist/components/p-table-row.js +1 -1
  125. package/dist/components/p-table.js +1 -1
  126. package/dist/components/p-tooltip.js +1 -1
  127. package/dist/components/p-xs4N_Y-0.js +1 -0
  128. package/dist/esm/{cn-BniKgfyU.js → cn-CsNqHcjL.js} +30 -274
  129. package/dist/esm/{floating-ui.dom-DGLCmOXW.js → floating-ui.dom-CeBIrPPx.js} +91 -50
  130. package/dist/esm/index.js +1 -1
  131. package/dist/esm/locale-B_lDCj8j.js +75114 -0
  132. package/dist/esm/p-accordion.entry.js +1 -1
  133. package/dist/esm/p-attachment.entry.js +1 -1
  134. package/dist/esm/p-badge_3.entry.js +1 -1
  135. package/dist/esm/p-button_3.entry.js +6 -6
  136. package/dist/esm/p-calendar.entry.js +63 -290
  137. package/dist/esm/p-card-container.entry.js +1 -1
  138. package/dist/esm/p-checkbox_3.entry.js +2 -2
  139. package/dist/esm/p-content-slider.entry.js +1 -1
  140. package/dist/esm/p-cropper.entry.js +88 -32
  141. package/dist/esm/p-datepicker.entry.js +37 -2887
  142. package/dist/esm/p-divider.entry.js +1 -1
  143. package/dist/esm/p-dropdown-menu-item_2.entry.js +1 -1
  144. package/dist/esm/p-empty-state_8.entry.js +12 -18
  145. package/dist/esm/p-field_3.entry.js +1 -1
  146. package/dist/esm/p-illustration.entry.js +1 -1
  147. package/dist/esm/p-label.entry.js +1 -1
  148. package/dist/esm/p-listing.entry.js +1 -1
  149. package/dist/esm/p-navigation-item.entry.js +1 -1
  150. package/dist/esm/p-pagination_3.entry.js +2 -2
  151. package/dist/esm/p-select.entry.js +1 -1
  152. package/dist/esm/p-table.entry.js +1 -1
  153. package/dist/esm/p-tooltip.entry.js +1 -1
  154. package/dist/index.html +1 -1
  155. package/dist/paperless/index.esm.js +1 -1
  156. package/dist/{build/p-84c43a3d.entry.js → paperless/p-1c17ee9b.entry.js} +1 -1
  157. package/dist/paperless/p-25961586.entry.js +1 -0
  158. package/dist/{build/p-9f51b9dc.entry.js → paperless/p-260a97c9.entry.js} +1 -1
  159. package/dist/paperless/{p-44da0b12.entry.js → p-2a37b400.entry.js} +1 -1
  160. package/dist/paperless/{p-fff6fa7a.entry.js → p-31399606.entry.js} +1 -1
  161. package/dist/paperless/p-60923e39.entry.js +1 -0
  162. package/dist/{build/p-d24f045f.entry.js → paperless/p-6aa93bf9.entry.js} +1 -1
  163. package/dist/paperless/{p-e51c1cd6.entry.js → p-70974f53.entry.js} +1 -1
  164. package/dist/paperless/p-75ba802e.entry.js +3 -0
  165. package/dist/paperless/{p-b781e8db.entry.js → p-8c1bf7ea.entry.js} +1 -1
  166. package/dist/{build/p-7d018d4d.entry.js → paperless/p-9e06356b.entry.js} +1 -1
  167. package/dist/paperless/p-B_lDCj8j.js +1 -0
  168. package/dist/paperless/p-CeBIrPPx.js +1 -0
  169. package/dist/paperless/{p-78b15121.entry.js → p-a6369294.entry.js} +1 -1
  170. package/dist/paperless/p-a9c0aab3.entry.js +1 -0
  171. package/dist/paperless/p-b85ee4b7.entry.js +1 -0
  172. package/dist/paperless/{p-76f83633.entry.js → p-ba7ccf80.entry.js} +1 -1
  173. package/dist/paperless/{p-524eb1cb.entry.js → p-c16870f5.entry.js} +1 -1
  174. package/dist/paperless/{p-17e598ac.entry.js → p-cf436a7d.entry.js} +1 -1
  175. package/dist/paperless/{p-0d6f3aa3.entry.js → p-cfbd02e6.entry.js} +1 -1
  176. package/dist/paperless/{p-cbeb58ba.entry.js → p-e907c9d3.entry.js} +1 -1
  177. package/dist/paperless/{p-d9b3ace4.entry.js → p-ee7858e4.entry.js} +1 -1
  178. package/dist/paperless/{p-23cc6b6b.entry.js → p-f1c6f25b.entry.js} +1 -1
  179. package/dist/{build/p-5abcc8d2.entry.js → paperless/p-f5be155f.entry.js} +1 -1
  180. package/dist/paperless/p-xs4N_Y-0.js +1 -0
  181. package/dist/paperless/paperless.esm.js +1 -1
  182. package/dist/sw.js +1 -1
  183. package/dist/sw.js.map +1 -1
  184. package/dist/types/components/molecules/button/button.component.d.ts +1 -1
  185. package/dist/types/components.d.ts +3 -1
  186. package/dist/workbox-d13932f0.js +1 -1
  187. package/dist/workbox-d13932f0.js.map +1 -1
  188. package/hydrate/index.js +75313 -6268
  189. package/hydrate/index.mjs +75313 -6268
  190. package/package.json +10 -11
  191. package/dist/build/p-1f7ab568.entry.js +0 -1
  192. package/dist/build/p-20077155.entry.js +0 -1
  193. package/dist/build/p-3452b2f5.entry.js +0 -3
  194. package/dist/build/p-CT54OXR2.js +0 -1
  195. package/dist/build/p-DGLCmOXW.js +0 -1
  196. package/dist/build/p-KEbntKvf.js +0 -1
  197. package/dist/build/p-b090e928.entry.js +0 -1
  198. package/dist/build/p-bafe9297.entry.js +0 -1
  199. package/dist/cjs/index-DG6V15XP.js +0 -2871
  200. package/dist/components/p-CPpl-J0y.js +0 -1
  201. package/dist/components/p-CT54OXR2.js +0 -1
  202. package/dist/components/p-D4bALv5t.js +0 -1
  203. package/dist/components/p-DGLCmOXW.js +0 -1
  204. package/dist/components/p-DeSgaQxj.js +0 -1
  205. package/dist/esm/index-KEbntKvf.js +0 -2839
  206. package/dist/paperless/p-1f7ab568.entry.js +0 -1
  207. package/dist/paperless/p-20077155.entry.js +0 -1
  208. package/dist/paperless/p-3452b2f5.entry.js +0 -3
  209. package/dist/paperless/p-CT54OXR2.js +0 -1
  210. package/dist/paperless/p-DGLCmOXW.js +0 -1
  211. package/dist/paperless/p-KEbntKvf.js +0 -1
  212. package/dist/paperless/p-b090e928.entry.js +0 -1
  213. package/dist/paperless/p-bafe9297.entry.js +0 -1
@@ -1,2859 +1,9 @@
1
1
  import { r as registerInstance, a as createEvent, d as getElement, h } from './index-BDccsg1s.js';
2
+ import { d as dateFnsExports, l as localeExports } from './locale-B_lDCj8j.js';
2
3
  import { s as state } from './state-xB9Jw2TG.js';
3
4
  import { c as childOf } from './child-of-TyZ7uPES.js';
4
5
  import { i as isMobileBrowser } from './is-mobile-browser-DPc49L2n.js';
5
6
  import { a as asBoolean } from './as-boolean-C5CTp9IA.js';
6
- import { r as requiredArgs, t as toDate, _ as _typeof, g as getUTCWeekYear, s as startOfUTCWeek, a as startOfUTCISOWeek, b as getUTCWeek, c as toInteger, d as getUTCISOWeek, e as getDefaultOptions, l as locale, f as longFormatters, h as subMilliseconds, i as getTimezoneOffsetInMilliseconds, j as isProtectedWeekYearToken, k as throwProtectedError, m as isProtectedDayOfYearToken, n as getYear, o as subYears, p as isValid, q as isBefore, u as isAfter, v as format, w as locale$1, x as startOfDay, y as startOfMonth, z as isSameDay, A as isWeekend, B as addYears, C as setYear } from './index-KEbntKvf.js';
7
-
8
- /**
9
- * Days in 1 week.
10
- *
11
- * @name daysInWeek
12
- * @constant
13
- * @type {number}
14
- * @default
15
- */
16
-
17
- /**
18
- * Milliseconds in 1 minute
19
- *
20
- * @name millisecondsInMinute
21
- * @constant
22
- * @type {number}
23
- * @default
24
- */
25
- var millisecondsInMinute = 60000;
26
-
27
- /**
28
- * Milliseconds in 1 hour
29
- *
30
- * @name millisecondsInHour
31
- * @constant
32
- * @type {number}
33
- * @default
34
- */
35
- var millisecondsInHour = 3600000;
36
-
37
- /**
38
- * Milliseconds in 1 second
39
- *
40
- * @name millisecondsInSecond
41
- * @constant
42
- * @type {number}
43
- * @default
44
- */
45
- var millisecondsInSecond = 1000;
46
-
47
- /**
48
- * @name startOfYear
49
- * @category Year Helpers
50
- * @summary Return the start of a year for the given date.
51
- *
52
- * @description
53
- * Return the start of a year for the given date.
54
- * The result will be in the local timezone.
55
- *
56
- * @param {Date|Number} date - the original date
57
- * @returns {Date} the start of a year
58
- * @throws {TypeError} 1 argument required
59
- *
60
- * @example
61
- * // The start of a year for 2 September 2014 11:55:00:
62
- * const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00))
63
- * //=> Wed Jan 01 2014 00:00:00
64
- */
65
- function startOfYear(dirtyDate) {
66
- requiredArgs(1, arguments);
67
- var cleanDate = toDate(dirtyDate);
68
- var date = new Date(0);
69
- date.setFullYear(cleanDate.getFullYear(), 0, 1);
70
- date.setHours(0, 0, 0, 0);
71
- return date;
72
- }
73
-
74
- function assign(target, object) {
75
- if (target == null) {
76
- throw new TypeError('assign requires that input parameter not be null or undefined');
77
- }
78
- for (var property in object) {
79
- if (Object.prototype.hasOwnProperty.call(object, property)) {
80
- target[property] = object[property];
81
- }
82
- }
83
- return target;
84
- }
85
-
86
- function _arrayLikeToArray(r, a) {
87
- (null == a || a > r.length) && (a = r.length);
88
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
89
- return n;
90
- }
91
-
92
- function _unsupportedIterableToArray(r, a) {
93
- if (r) {
94
- if ("string" == typeof r) return _arrayLikeToArray(r, a);
95
- var t = {}.toString.call(r).slice(8, -1);
96
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
97
- }
98
- }
99
-
100
- function _createForOfIteratorHelper(r, e) {
101
- var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
102
- if (!t) {
103
- if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
104
- t && (r = t);
105
- var _n = 0,
106
- F = function F() {};
107
- return {
108
- s: F,
109
- n: function n() {
110
- return _n >= r.length ? {
111
- done: true
112
- } : {
113
- done: false,
114
- value: r[_n++]
115
- };
116
- },
117
- e: function e(r) {
118
- throw r;
119
- },
120
- f: F
121
- };
122
- }
123
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
124
- }
125
- var o,
126
- a = true,
127
- u = false;
128
- return {
129
- s: function s() {
130
- t = t.call(r);
131
- },
132
- n: function n() {
133
- var r = t.next();
134
- return a = r.done, r;
135
- },
136
- e: function e(r) {
137
- u = true, o = r;
138
- },
139
- f: function f() {
140
- try {
141
- a || null == t["return"] || t["return"]();
142
- } finally {
143
- if (u) throw o;
144
- }
145
- }
146
- };
147
- }
148
-
149
- function _assertThisInitialized(e) {
150
- if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
151
- return e;
152
- }
153
-
154
- function _setPrototypeOf(t, e) {
155
- return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
156
- return t.__proto__ = e, t;
157
- }, _setPrototypeOf(t, e);
158
- }
159
-
160
- function _inherits(t, e) {
161
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
162
- t.prototype = Object.create(e && e.prototype, {
163
- constructor: {
164
- value: t,
165
- writable: true,
166
- configurable: true
167
- }
168
- }), Object.defineProperty(t, "prototype", {
169
- writable: false
170
- }), e && _setPrototypeOf(t, e);
171
- }
172
-
173
- function _getPrototypeOf(t) {
174
- return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
175
- return t.__proto__ || Object.getPrototypeOf(t);
176
- }, _getPrototypeOf(t);
177
- }
178
-
179
- function _isNativeReflectConstruct() {
180
- try {
181
- var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
182
- } catch (t) {}
183
- return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
184
- return !!t;
185
- })();
186
- }
187
-
188
- function _possibleConstructorReturn(t, e) {
189
- if (e && ("object" == _typeof(e) || "function" == typeof e)) return e;
190
- if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
191
- return _assertThisInitialized(t);
192
- }
193
-
194
- function _createSuper(t) {
195
- var r = _isNativeReflectConstruct();
196
- return function () {
197
- var e,
198
- o = _getPrototypeOf(t);
199
- if (r) {
200
- var s = _getPrototypeOf(this).constructor;
201
- e = Reflect.construct(o, arguments, s);
202
- } else e = o.apply(this, arguments);
203
- return _possibleConstructorReturn(this, e);
204
- };
205
- }
206
-
207
- function _classCallCheck(a, n) {
208
- if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
209
- }
210
-
211
- function toPrimitive(t, r) {
212
- if ("object" != _typeof(t) || !t) return t;
213
- var e = t[Symbol.toPrimitive];
214
- if (void 0 !== e) {
215
- var i = e.call(t, r);
216
- if ("object" != _typeof(i)) return i;
217
- throw new TypeError("@@toPrimitive must return a primitive value.");
218
- }
219
- return (String )(t);
220
- }
221
-
222
- function toPropertyKey(t) {
223
- var i = toPrimitive(t, "string");
224
- return "symbol" == _typeof(i) ? i : i + "";
225
- }
226
-
227
- function _defineProperties(e, r) {
228
- for (var t = 0; t < r.length; t++) {
229
- var o = r[t];
230
- o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, toPropertyKey(o.key), o);
231
- }
232
- }
233
- function _createClass(e, r, t) {
234
- return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
235
- writable: false
236
- }), e;
237
- }
238
-
239
- function _defineProperty(e, r, t) {
240
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
241
- value: t,
242
- enumerable: true,
243
- configurable: true,
244
- writable: true
245
- }) : e[r] = t, e;
246
- }
247
-
248
- var TIMEZONE_UNIT_PRIORITY = 10;
249
- var Setter = /*#__PURE__*/function () {
250
- function Setter() {
251
- _classCallCheck(this, Setter);
252
- _defineProperty(this, "priority", void 0);
253
- _defineProperty(this, "subPriority", 0);
254
- }
255
- _createClass(Setter, [{
256
- key: "validate",
257
- value: function validate(_utcDate, _options) {
258
- return true;
259
- }
260
- }]);
261
- return Setter;
262
- }();
263
- var ValueSetter = /*#__PURE__*/function (_Setter) {
264
- _inherits(ValueSetter, _Setter);
265
- var _super = _createSuper(ValueSetter);
266
- function ValueSetter(value, validateValue, setValue, priority, subPriority) {
267
- var _this;
268
- _classCallCheck(this, ValueSetter);
269
- _this = _super.call(this);
270
- _this.value = value;
271
- _this.validateValue = validateValue;
272
- _this.setValue = setValue;
273
- _this.priority = priority;
274
- if (subPriority) {
275
- _this.subPriority = subPriority;
276
- }
277
- return _this;
278
- }
279
- _createClass(ValueSetter, [{
280
- key: "validate",
281
- value: function validate(utcDate, options) {
282
- return this.validateValue(utcDate, this.value, options);
283
- }
284
- }, {
285
- key: "set",
286
- value: function set(utcDate, flags, options) {
287
- return this.setValue(utcDate, flags, this.value, options);
288
- }
289
- }]);
290
- return ValueSetter;
291
- }(Setter);
292
- var DateToSystemTimezoneSetter = /*#__PURE__*/function (_Setter2) {
293
- _inherits(DateToSystemTimezoneSetter, _Setter2);
294
- var _super2 = _createSuper(DateToSystemTimezoneSetter);
295
- function DateToSystemTimezoneSetter() {
296
- var _this2;
297
- _classCallCheck(this, DateToSystemTimezoneSetter);
298
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
299
- args[_key] = arguments[_key];
300
- }
301
- _this2 = _super2.call.apply(_super2, [this].concat(args));
302
- _defineProperty(_assertThisInitialized(_this2), "priority", TIMEZONE_UNIT_PRIORITY);
303
- _defineProperty(_assertThisInitialized(_this2), "subPriority", -1);
304
- return _this2;
305
- }
306
- _createClass(DateToSystemTimezoneSetter, [{
307
- key: "set",
308
- value: function set(date, flags) {
309
- if (flags.timestampIsSet) {
310
- return date;
311
- }
312
- var convertedDate = new Date(0);
313
- convertedDate.setFullYear(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
314
- convertedDate.setHours(date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds());
315
- return convertedDate;
316
- }
317
- }]);
318
- return DateToSystemTimezoneSetter;
319
- }(Setter);
320
-
321
- var Parser = /*#__PURE__*/function () {
322
- function Parser() {
323
- _classCallCheck(this, Parser);
324
- _defineProperty(this, "incompatibleTokens", void 0);
325
- _defineProperty(this, "priority", void 0);
326
- _defineProperty(this, "subPriority", void 0);
327
- }
328
- _createClass(Parser, [{
329
- key: "run",
330
- value: function run(dateString, token, match, options) {
331
- var result = this.parse(dateString, token, match, options);
332
- if (!result) {
333
- return null;
334
- }
335
- return {
336
- setter: new ValueSetter(result.value, this.validate, this.set, this.priority, this.subPriority),
337
- rest: result.rest
338
- };
339
- }
340
- }, {
341
- key: "validate",
342
- value: function validate(_utcDate, _value, _options) {
343
- return true;
344
- }
345
- }]);
346
- return Parser;
347
- }();
348
-
349
- var EraParser = /*#__PURE__*/function (_Parser) {
350
- _inherits(EraParser, _Parser);
351
- var _super = _createSuper(EraParser);
352
- function EraParser() {
353
- var _this;
354
- _classCallCheck(this, EraParser);
355
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
356
- args[_key] = arguments[_key];
357
- }
358
- _this = _super.call.apply(_super, [this].concat(args));
359
- _defineProperty(_assertThisInitialized(_this), "priority", 140);
360
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['R', 'u', 't', 'T']);
361
- return _this;
362
- }
363
- _createClass(EraParser, [{
364
- key: "parse",
365
- value: function parse(dateString, token, match) {
366
- switch (token) {
367
- // AD, BC
368
- case 'G':
369
- case 'GG':
370
- case 'GGG':
371
- return match.era(dateString, {
372
- width: 'abbreviated'
373
- }) || match.era(dateString, {
374
- width: 'narrow'
375
- });
376
- // A, B
377
- case 'GGGGG':
378
- return match.era(dateString, {
379
- width: 'narrow'
380
- });
381
- // Anno Domini, Before Christ
382
- case 'GGGG':
383
- default:
384
- return match.era(dateString, {
385
- width: 'wide'
386
- }) || match.era(dateString, {
387
- width: 'abbreviated'
388
- }) || match.era(dateString, {
389
- width: 'narrow'
390
- });
391
- }
392
- }
393
- }, {
394
- key: "set",
395
- value: function set(date, flags, value) {
396
- flags.era = value;
397
- date.setUTCFullYear(value, 0, 1);
398
- date.setUTCHours(0, 0, 0, 0);
399
- return date;
400
- }
401
- }]);
402
- return EraParser;
403
- }(Parser);
404
-
405
- var numericPatterns = {
406
- month: /^(1[0-2]|0?\d)/,
407
- // 0 to 12
408
- date: /^(3[0-1]|[0-2]?\d)/,
409
- // 0 to 31
410
- dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,
411
- // 0 to 366
412
- week: /^(5[0-3]|[0-4]?\d)/,
413
- // 0 to 53
414
- hour23h: /^(2[0-3]|[0-1]?\d)/,
415
- // 0 to 23
416
- hour24h: /^(2[0-4]|[0-1]?\d)/,
417
- // 0 to 24
418
- hour11h: /^(1[0-1]|0?\d)/,
419
- // 0 to 11
420
- hour12h: /^(1[0-2]|0?\d)/,
421
- // 0 to 12
422
- minute: /^[0-5]?\d/,
423
- // 0 to 59
424
- second: /^[0-5]?\d/,
425
- // 0 to 59
426
-
427
- singleDigit: /^\d/,
428
- // 0 to 9
429
- twoDigits: /^\d{1,2}/,
430
- // 0 to 99
431
- threeDigits: /^\d{1,3}/,
432
- // 0 to 999
433
- fourDigits: /^\d{1,4}/,
434
- // 0 to 9999
435
-
436
- anyDigitsSigned: /^-?\d+/,
437
- singleDigitSigned: /^-?\d/,
438
- // 0 to 9, -0 to -9
439
- twoDigitsSigned: /^-?\d{1,2}/,
440
- // 0 to 99, -0 to -99
441
- threeDigitsSigned: /^-?\d{1,3}/,
442
- // 0 to 999, -0 to -999
443
- fourDigitsSigned: /^-?\d{1,4}/ // 0 to 9999, -0 to -9999
444
- };
445
-
446
- var timezonePatterns = {
447
- basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/,
448
- basic: /^([+-])(\d{2})(\d{2})|Z/,
449
- basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,
450
- extended: /^([+-])(\d{2}):(\d{2})|Z/,
451
- extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/
452
- };
453
-
454
- function mapValue(parseFnResult, mapFn) {
455
- if (!parseFnResult) {
456
- return parseFnResult;
457
- }
458
- return {
459
- value: mapFn(parseFnResult.value),
460
- rest: parseFnResult.rest
461
- };
462
- }
463
- function parseNumericPattern(pattern, dateString) {
464
- var matchResult = dateString.match(pattern);
465
- if (!matchResult) {
466
- return null;
467
- }
468
- return {
469
- value: parseInt(matchResult[0], 10),
470
- rest: dateString.slice(matchResult[0].length)
471
- };
472
- }
473
- function parseTimezonePattern(pattern, dateString) {
474
- var matchResult = dateString.match(pattern);
475
- if (!matchResult) {
476
- return null;
477
- }
478
-
479
- // Input is 'Z'
480
- if (matchResult[0] === 'Z') {
481
- return {
482
- value: 0,
483
- rest: dateString.slice(1)
484
- };
485
- }
486
- var sign = matchResult[1] === '+' ? 1 : -1;
487
- var hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;
488
- var minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;
489
- var seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;
490
- return {
491
- value: sign * (hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * millisecondsInSecond),
492
- rest: dateString.slice(matchResult[0].length)
493
- };
494
- }
495
- function parseAnyDigitsSigned(dateString) {
496
- return parseNumericPattern(numericPatterns.anyDigitsSigned, dateString);
497
- }
498
- function parseNDigits(n, dateString) {
499
- switch (n) {
500
- case 1:
501
- return parseNumericPattern(numericPatterns.singleDigit, dateString);
502
- case 2:
503
- return parseNumericPattern(numericPatterns.twoDigits, dateString);
504
- case 3:
505
- return parseNumericPattern(numericPatterns.threeDigits, dateString);
506
- case 4:
507
- return parseNumericPattern(numericPatterns.fourDigits, dateString);
508
- default:
509
- return parseNumericPattern(new RegExp('^\\d{1,' + n + '}'), dateString);
510
- }
511
- }
512
- function parseNDigitsSigned(n, dateString) {
513
- switch (n) {
514
- case 1:
515
- return parseNumericPattern(numericPatterns.singleDigitSigned, dateString);
516
- case 2:
517
- return parseNumericPattern(numericPatterns.twoDigitsSigned, dateString);
518
- case 3:
519
- return parseNumericPattern(numericPatterns.threeDigitsSigned, dateString);
520
- case 4:
521
- return parseNumericPattern(numericPatterns.fourDigitsSigned, dateString);
522
- default:
523
- return parseNumericPattern(new RegExp('^-?\\d{1,' + n + '}'), dateString);
524
- }
525
- }
526
- function dayPeriodEnumToHours(dayPeriod) {
527
- switch (dayPeriod) {
528
- case 'morning':
529
- return 4;
530
- case 'evening':
531
- return 17;
532
- case 'pm':
533
- case 'noon':
534
- case 'afternoon':
535
- return 12;
536
- case 'am':
537
- case 'midnight':
538
- case 'night':
539
- default:
540
- return 0;
541
- }
542
- }
543
- function normalizeTwoDigitYear(twoDigitYear, currentYear) {
544
- var isCommonEra = currentYear > 0;
545
- // Absolute number of the current year:
546
- // 1 -> 1 AC
547
- // 0 -> 1 BC
548
- // -1 -> 2 BC
549
- var absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;
550
- var result;
551
- if (absCurrentYear <= 50) {
552
- result = twoDigitYear || 100;
553
- } else {
554
- var rangeEnd = absCurrentYear + 50;
555
- var rangeEndCentury = Math.floor(rangeEnd / 100) * 100;
556
- var isPreviousCentury = twoDigitYear >= rangeEnd % 100;
557
- result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);
558
- }
559
- return isCommonEra ? result : 1 - result;
560
- }
561
- function isLeapYearIndex(year) {
562
- return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
563
- }
564
-
565
- // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_Patterns
566
- // | Year | y | yy | yyy | yyyy | yyyyy |
567
- // |----------|-------|----|-------|-------|-------|
568
- // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
569
- // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
570
- // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
571
- // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
572
- // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
573
- var YearParser = /*#__PURE__*/function (_Parser) {
574
- _inherits(YearParser, _Parser);
575
- var _super = _createSuper(YearParser);
576
- function YearParser() {
577
- var _this;
578
- _classCallCheck(this, YearParser);
579
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
580
- args[_key] = arguments[_key];
581
- }
582
- _this = _super.call.apply(_super, [this].concat(args));
583
- _defineProperty(_assertThisInitialized(_this), "priority", 130);
584
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['Y', 'R', 'u', 'w', 'I', 'i', 'e', 'c', 't', 'T']);
585
- return _this;
586
- }
587
- _createClass(YearParser, [{
588
- key: "parse",
589
- value: function parse(dateString, token, match) {
590
- var valueCallback = function valueCallback(year) {
591
- return {
592
- year: year,
593
- isTwoDigitYear: token === 'yy'
594
- };
595
- };
596
- switch (token) {
597
- case 'y':
598
- return mapValue(parseNDigits(4, dateString), valueCallback);
599
- case 'yo':
600
- return mapValue(match.ordinalNumber(dateString, {
601
- unit: 'year'
602
- }), valueCallback);
603
- default:
604
- return mapValue(parseNDigits(token.length, dateString), valueCallback);
605
- }
606
- }
607
- }, {
608
- key: "validate",
609
- value: function validate(_date, value) {
610
- return value.isTwoDigitYear || value.year > 0;
611
- }
612
- }, {
613
- key: "set",
614
- value: function set(date, flags, value) {
615
- var currentYear = date.getUTCFullYear();
616
- if (value.isTwoDigitYear) {
617
- var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);
618
- date.setUTCFullYear(normalizedTwoDigitYear, 0, 1);
619
- date.setUTCHours(0, 0, 0, 0);
620
- return date;
621
- }
622
- var year = !('era' in flags) || flags.era === 1 ? value.year : 1 - value.year;
623
- date.setUTCFullYear(year, 0, 1);
624
- date.setUTCHours(0, 0, 0, 0);
625
- return date;
626
- }
627
- }]);
628
- return YearParser;
629
- }(Parser);
630
-
631
- // Local week-numbering year
632
- var LocalWeekYearParser = /*#__PURE__*/function (_Parser) {
633
- _inherits(LocalWeekYearParser, _Parser);
634
- var _super = _createSuper(LocalWeekYearParser);
635
- function LocalWeekYearParser() {
636
- var _this;
637
- _classCallCheck(this, LocalWeekYearParser);
638
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
639
- args[_key] = arguments[_key];
640
- }
641
- _this = _super.call.apply(_super, [this].concat(args));
642
- _defineProperty(_assertThisInitialized(_this), "priority", 130);
643
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['y', 'R', 'u', 'Q', 'q', 'M', 'L', 'I', 'd', 'D', 'i', 't', 'T']);
644
- return _this;
645
- }
646
- _createClass(LocalWeekYearParser, [{
647
- key: "parse",
648
- value: function parse(dateString, token, match) {
649
- var valueCallback = function valueCallback(year) {
650
- return {
651
- year: year,
652
- isTwoDigitYear: token === 'YY'
653
- };
654
- };
655
- switch (token) {
656
- case 'Y':
657
- return mapValue(parseNDigits(4, dateString), valueCallback);
658
- case 'Yo':
659
- return mapValue(match.ordinalNumber(dateString, {
660
- unit: 'year'
661
- }), valueCallback);
662
- default:
663
- return mapValue(parseNDigits(token.length, dateString), valueCallback);
664
- }
665
- }
666
- }, {
667
- key: "validate",
668
- value: function validate(_date, value) {
669
- return value.isTwoDigitYear || value.year > 0;
670
- }
671
- }, {
672
- key: "set",
673
- value: function set(date, flags, value, options) {
674
- var currentYear = getUTCWeekYear(date, options);
675
- if (value.isTwoDigitYear) {
676
- var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);
677
- date.setUTCFullYear(normalizedTwoDigitYear, 0, options.firstWeekContainsDate);
678
- date.setUTCHours(0, 0, 0, 0);
679
- return startOfUTCWeek(date, options);
680
- }
681
- var year = !('era' in flags) || flags.era === 1 ? value.year : 1 - value.year;
682
- date.setUTCFullYear(year, 0, options.firstWeekContainsDate);
683
- date.setUTCHours(0, 0, 0, 0);
684
- return startOfUTCWeek(date, options);
685
- }
686
- }]);
687
- return LocalWeekYearParser;
688
- }(Parser);
689
-
690
- var ISOWeekYearParser = /*#__PURE__*/function (_Parser) {
691
- _inherits(ISOWeekYearParser, _Parser);
692
- var _super = _createSuper(ISOWeekYearParser);
693
- function ISOWeekYearParser() {
694
- var _this;
695
- _classCallCheck(this, ISOWeekYearParser);
696
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
697
- args[_key] = arguments[_key];
698
- }
699
- _this = _super.call.apply(_super, [this].concat(args));
700
- _defineProperty(_assertThisInitialized(_this), "priority", 130);
701
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['G', 'y', 'Y', 'u', 'Q', 'q', 'M', 'L', 'w', 'd', 'D', 'e', 'c', 't', 'T']);
702
- return _this;
703
- }
704
- _createClass(ISOWeekYearParser, [{
705
- key: "parse",
706
- value: function parse(dateString, token) {
707
- if (token === 'R') {
708
- return parseNDigitsSigned(4, dateString);
709
- }
710
- return parseNDigitsSigned(token.length, dateString);
711
- }
712
- }, {
713
- key: "set",
714
- value: function set(_date, _flags, value) {
715
- var firstWeekOfYear = new Date(0);
716
- firstWeekOfYear.setUTCFullYear(value, 0, 4);
717
- firstWeekOfYear.setUTCHours(0, 0, 0, 0);
718
- return startOfUTCISOWeek(firstWeekOfYear);
719
- }
720
- }]);
721
- return ISOWeekYearParser;
722
- }(Parser);
723
-
724
- var ExtendedYearParser = /*#__PURE__*/function (_Parser) {
725
- _inherits(ExtendedYearParser, _Parser);
726
- var _super = _createSuper(ExtendedYearParser);
727
- function ExtendedYearParser() {
728
- var _this;
729
- _classCallCheck(this, ExtendedYearParser);
730
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
731
- args[_key] = arguments[_key];
732
- }
733
- _this = _super.call.apply(_super, [this].concat(args));
734
- _defineProperty(_assertThisInitialized(_this), "priority", 130);
735
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['G', 'y', 'Y', 'R', 'w', 'I', 'i', 'e', 'c', 't', 'T']);
736
- return _this;
737
- }
738
- _createClass(ExtendedYearParser, [{
739
- key: "parse",
740
- value: function parse(dateString, token) {
741
- if (token === 'u') {
742
- return parseNDigitsSigned(4, dateString);
743
- }
744
- return parseNDigitsSigned(token.length, dateString);
745
- }
746
- }, {
747
- key: "set",
748
- value: function set(date, _flags, value) {
749
- date.setUTCFullYear(value, 0, 1);
750
- date.setUTCHours(0, 0, 0, 0);
751
- return date;
752
- }
753
- }]);
754
- return ExtendedYearParser;
755
- }(Parser);
756
-
757
- var QuarterParser = /*#__PURE__*/function (_Parser) {
758
- _inherits(QuarterParser, _Parser);
759
- var _super = _createSuper(QuarterParser);
760
- function QuarterParser() {
761
- var _this;
762
- _classCallCheck(this, QuarterParser);
763
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
764
- args[_key] = arguments[_key];
765
- }
766
- _this = _super.call.apply(_super, [this].concat(args));
767
- _defineProperty(_assertThisInitialized(_this), "priority", 120);
768
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['Y', 'R', 'q', 'M', 'L', 'w', 'I', 'd', 'D', 'i', 'e', 'c', 't', 'T']);
769
- return _this;
770
- }
771
- _createClass(QuarterParser, [{
772
- key: "parse",
773
- value: function parse(dateString, token, match) {
774
- switch (token) {
775
- // 1, 2, 3, 4
776
- case 'Q':
777
- case 'QQ':
778
- // 01, 02, 03, 04
779
- return parseNDigits(token.length, dateString);
780
- // 1st, 2nd, 3rd, 4th
781
- case 'Qo':
782
- return match.ordinalNumber(dateString, {
783
- unit: 'quarter'
784
- });
785
- // Q1, Q2, Q3, Q4
786
- case 'QQQ':
787
- return match.quarter(dateString, {
788
- width: 'abbreviated',
789
- context: 'formatting'
790
- }) || match.quarter(dateString, {
791
- width: 'narrow',
792
- context: 'formatting'
793
- });
794
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
795
- case 'QQQQQ':
796
- return match.quarter(dateString, {
797
- width: 'narrow',
798
- context: 'formatting'
799
- });
800
- // 1st quarter, 2nd quarter, ...
801
- case 'QQQQ':
802
- default:
803
- return match.quarter(dateString, {
804
- width: 'wide',
805
- context: 'formatting'
806
- }) || match.quarter(dateString, {
807
- width: 'abbreviated',
808
- context: 'formatting'
809
- }) || match.quarter(dateString, {
810
- width: 'narrow',
811
- context: 'formatting'
812
- });
813
- }
814
- }
815
- }, {
816
- key: "validate",
817
- value: function validate(_date, value) {
818
- return value >= 1 && value <= 4;
819
- }
820
- }, {
821
- key: "set",
822
- value: function set(date, _flags, value) {
823
- date.setUTCMonth((value - 1) * 3, 1);
824
- date.setUTCHours(0, 0, 0, 0);
825
- return date;
826
- }
827
- }]);
828
- return QuarterParser;
829
- }(Parser);
830
-
831
- var StandAloneQuarterParser = /*#__PURE__*/function (_Parser) {
832
- _inherits(StandAloneQuarterParser, _Parser);
833
- var _super = _createSuper(StandAloneQuarterParser);
834
- function StandAloneQuarterParser() {
835
- var _this;
836
- _classCallCheck(this, StandAloneQuarterParser);
837
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
838
- args[_key] = arguments[_key];
839
- }
840
- _this = _super.call.apply(_super, [this].concat(args));
841
- _defineProperty(_assertThisInitialized(_this), "priority", 120);
842
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['Y', 'R', 'Q', 'M', 'L', 'w', 'I', 'd', 'D', 'i', 'e', 'c', 't', 'T']);
843
- return _this;
844
- }
845
- _createClass(StandAloneQuarterParser, [{
846
- key: "parse",
847
- value: function parse(dateString, token, match) {
848
- switch (token) {
849
- // 1, 2, 3, 4
850
- case 'q':
851
- case 'qq':
852
- // 01, 02, 03, 04
853
- return parseNDigits(token.length, dateString);
854
- // 1st, 2nd, 3rd, 4th
855
- case 'qo':
856
- return match.ordinalNumber(dateString, {
857
- unit: 'quarter'
858
- });
859
- // Q1, Q2, Q3, Q4
860
- case 'qqq':
861
- return match.quarter(dateString, {
862
- width: 'abbreviated',
863
- context: 'standalone'
864
- }) || match.quarter(dateString, {
865
- width: 'narrow',
866
- context: 'standalone'
867
- });
868
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
869
- case 'qqqqq':
870
- return match.quarter(dateString, {
871
- width: 'narrow',
872
- context: 'standalone'
873
- });
874
- // 1st quarter, 2nd quarter, ...
875
- case 'qqqq':
876
- default:
877
- return match.quarter(dateString, {
878
- width: 'wide',
879
- context: 'standalone'
880
- }) || match.quarter(dateString, {
881
- width: 'abbreviated',
882
- context: 'standalone'
883
- }) || match.quarter(dateString, {
884
- width: 'narrow',
885
- context: 'standalone'
886
- });
887
- }
888
- }
889
- }, {
890
- key: "validate",
891
- value: function validate(_date, value) {
892
- return value >= 1 && value <= 4;
893
- }
894
- }, {
895
- key: "set",
896
- value: function set(date, _flags, value) {
897
- date.setUTCMonth((value - 1) * 3, 1);
898
- date.setUTCHours(0, 0, 0, 0);
899
- return date;
900
- }
901
- }]);
902
- return StandAloneQuarterParser;
903
- }(Parser);
904
-
905
- var MonthParser = /*#__PURE__*/function (_Parser) {
906
- _inherits(MonthParser, _Parser);
907
- var _super = _createSuper(MonthParser);
908
- function MonthParser() {
909
- var _this;
910
- _classCallCheck(this, MonthParser);
911
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
912
- args[_key] = arguments[_key];
913
- }
914
- _this = _super.call.apply(_super, [this].concat(args));
915
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['Y', 'R', 'q', 'Q', 'L', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']);
916
- _defineProperty(_assertThisInitialized(_this), "priority", 110);
917
- return _this;
918
- }
919
- _createClass(MonthParser, [{
920
- key: "parse",
921
- value: function parse(dateString, token, match) {
922
- var valueCallback = function valueCallback(value) {
923
- return value - 1;
924
- };
925
- switch (token) {
926
- // 1, 2, ..., 12
927
- case 'M':
928
- return mapValue(parseNumericPattern(numericPatterns.month, dateString), valueCallback);
929
- // 01, 02, ..., 12
930
- case 'MM':
931
- return mapValue(parseNDigits(2, dateString), valueCallback);
932
- // 1st, 2nd, ..., 12th
933
- case 'Mo':
934
- return mapValue(match.ordinalNumber(dateString, {
935
- unit: 'month'
936
- }), valueCallback);
937
- // Jan, Feb, ..., Dec
938
- case 'MMM':
939
- return match.month(dateString, {
940
- width: 'abbreviated',
941
- context: 'formatting'
942
- }) || match.month(dateString, {
943
- width: 'narrow',
944
- context: 'formatting'
945
- });
946
- // J, F, ..., D
947
- case 'MMMMM':
948
- return match.month(dateString, {
949
- width: 'narrow',
950
- context: 'formatting'
951
- });
952
- // January, February, ..., December
953
- case 'MMMM':
954
- default:
955
- return match.month(dateString, {
956
- width: 'wide',
957
- context: 'formatting'
958
- }) || match.month(dateString, {
959
- width: 'abbreviated',
960
- context: 'formatting'
961
- }) || match.month(dateString, {
962
- width: 'narrow',
963
- context: 'formatting'
964
- });
965
- }
966
- }
967
- }, {
968
- key: "validate",
969
- value: function validate(_date, value) {
970
- return value >= 0 && value <= 11;
971
- }
972
- }, {
973
- key: "set",
974
- value: function set(date, _flags, value) {
975
- date.setUTCMonth(value, 1);
976
- date.setUTCHours(0, 0, 0, 0);
977
- return date;
978
- }
979
- }]);
980
- return MonthParser;
981
- }(Parser);
982
-
983
- var StandAloneMonthParser = /*#__PURE__*/function (_Parser) {
984
- _inherits(StandAloneMonthParser, _Parser);
985
- var _super = _createSuper(StandAloneMonthParser);
986
- function StandAloneMonthParser() {
987
- var _this;
988
- _classCallCheck(this, StandAloneMonthParser);
989
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
990
- args[_key] = arguments[_key];
991
- }
992
- _this = _super.call.apply(_super, [this].concat(args));
993
- _defineProperty(_assertThisInitialized(_this), "priority", 110);
994
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['Y', 'R', 'q', 'Q', 'M', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']);
995
- return _this;
996
- }
997
- _createClass(StandAloneMonthParser, [{
998
- key: "parse",
999
- value: function parse(dateString, token, match) {
1000
- var valueCallback = function valueCallback(value) {
1001
- return value - 1;
1002
- };
1003
- switch (token) {
1004
- // 1, 2, ..., 12
1005
- case 'L':
1006
- return mapValue(parseNumericPattern(numericPatterns.month, dateString), valueCallback);
1007
- // 01, 02, ..., 12
1008
- case 'LL':
1009
- return mapValue(parseNDigits(2, dateString), valueCallback);
1010
- // 1st, 2nd, ..., 12th
1011
- case 'Lo':
1012
- return mapValue(match.ordinalNumber(dateString, {
1013
- unit: 'month'
1014
- }), valueCallback);
1015
- // Jan, Feb, ..., Dec
1016
- case 'LLL':
1017
- return match.month(dateString, {
1018
- width: 'abbreviated',
1019
- context: 'standalone'
1020
- }) || match.month(dateString, {
1021
- width: 'narrow',
1022
- context: 'standalone'
1023
- });
1024
- // J, F, ..., D
1025
- case 'LLLLL':
1026
- return match.month(dateString, {
1027
- width: 'narrow',
1028
- context: 'standalone'
1029
- });
1030
- // January, February, ..., December
1031
- case 'LLLL':
1032
- default:
1033
- return match.month(dateString, {
1034
- width: 'wide',
1035
- context: 'standalone'
1036
- }) || match.month(dateString, {
1037
- width: 'abbreviated',
1038
- context: 'standalone'
1039
- }) || match.month(dateString, {
1040
- width: 'narrow',
1041
- context: 'standalone'
1042
- });
1043
- }
1044
- }
1045
- }, {
1046
- key: "validate",
1047
- value: function validate(_date, value) {
1048
- return value >= 0 && value <= 11;
1049
- }
1050
- }, {
1051
- key: "set",
1052
- value: function set(date, _flags, value) {
1053
- date.setUTCMonth(value, 1);
1054
- date.setUTCHours(0, 0, 0, 0);
1055
- return date;
1056
- }
1057
- }]);
1058
- return StandAloneMonthParser;
1059
- }(Parser);
1060
-
1061
- function setUTCWeek(dirtyDate, dirtyWeek, options) {
1062
- requiredArgs(2, arguments);
1063
- var date = toDate(dirtyDate);
1064
- var week = toInteger(dirtyWeek);
1065
- var diff = getUTCWeek(date, options) - week;
1066
- date.setUTCDate(date.getUTCDate() - diff * 7);
1067
- return date;
1068
- }
1069
-
1070
- var LocalWeekParser = /*#__PURE__*/function (_Parser) {
1071
- _inherits(LocalWeekParser, _Parser);
1072
- var _super = _createSuper(LocalWeekParser);
1073
- function LocalWeekParser() {
1074
- var _this;
1075
- _classCallCheck(this, LocalWeekParser);
1076
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1077
- args[_key] = arguments[_key];
1078
- }
1079
- _this = _super.call.apply(_super, [this].concat(args));
1080
- _defineProperty(_assertThisInitialized(_this), "priority", 100);
1081
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'i', 't', 'T']);
1082
- return _this;
1083
- }
1084
- _createClass(LocalWeekParser, [{
1085
- key: "parse",
1086
- value: function parse(dateString, token, match) {
1087
- switch (token) {
1088
- case 'w':
1089
- return parseNumericPattern(numericPatterns.week, dateString);
1090
- case 'wo':
1091
- return match.ordinalNumber(dateString, {
1092
- unit: 'week'
1093
- });
1094
- default:
1095
- return parseNDigits(token.length, dateString);
1096
- }
1097
- }
1098
- }, {
1099
- key: "validate",
1100
- value: function validate(_date, value) {
1101
- return value >= 1 && value <= 53;
1102
- }
1103
- }, {
1104
- key: "set",
1105
- value: function set(date, _flags, value, options) {
1106
- return startOfUTCWeek(setUTCWeek(date, value, options), options);
1107
- }
1108
- }]);
1109
- return LocalWeekParser;
1110
- }(Parser);
1111
-
1112
- function setUTCISOWeek(dirtyDate, dirtyISOWeek) {
1113
- requiredArgs(2, arguments);
1114
- var date = toDate(dirtyDate);
1115
- var isoWeek = toInteger(dirtyISOWeek);
1116
- var diff = getUTCISOWeek(date) - isoWeek;
1117
- date.setUTCDate(date.getUTCDate() - diff * 7);
1118
- return date;
1119
- }
1120
-
1121
- var ISOWeekParser = /*#__PURE__*/function (_Parser) {
1122
- _inherits(ISOWeekParser, _Parser);
1123
- var _super = _createSuper(ISOWeekParser);
1124
- function ISOWeekParser() {
1125
- var _this;
1126
- _classCallCheck(this, ISOWeekParser);
1127
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1128
- args[_key] = arguments[_key];
1129
- }
1130
- _this = _super.call.apply(_super, [this].concat(args));
1131
- _defineProperty(_assertThisInitialized(_this), "priority", 100);
1132
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['y', 'Y', 'u', 'q', 'Q', 'M', 'L', 'w', 'd', 'D', 'e', 'c', 't', 'T']);
1133
- return _this;
1134
- }
1135
- _createClass(ISOWeekParser, [{
1136
- key: "parse",
1137
- value: function parse(dateString, token, match) {
1138
- switch (token) {
1139
- case 'I':
1140
- return parseNumericPattern(numericPatterns.week, dateString);
1141
- case 'Io':
1142
- return match.ordinalNumber(dateString, {
1143
- unit: 'week'
1144
- });
1145
- default:
1146
- return parseNDigits(token.length, dateString);
1147
- }
1148
- }
1149
- }, {
1150
- key: "validate",
1151
- value: function validate(_date, value) {
1152
- return value >= 1 && value <= 53;
1153
- }
1154
- }, {
1155
- key: "set",
1156
- value: function set(date, _flags, value) {
1157
- return startOfUTCISOWeek(setUTCISOWeek(date, value));
1158
- }
1159
- }]);
1160
- return ISOWeekParser;
1161
- }(Parser);
1162
-
1163
- var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
1164
- var DAYS_IN_MONTH_LEAP_YEAR = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
1165
-
1166
- // Day of the month
1167
- var DateParser = /*#__PURE__*/function (_Parser) {
1168
- _inherits(DateParser, _Parser);
1169
- var _super = _createSuper(DateParser);
1170
- function DateParser() {
1171
- var _this;
1172
- _classCallCheck(this, DateParser);
1173
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1174
- args[_key] = arguments[_key];
1175
- }
1176
- _this = _super.call.apply(_super, [this].concat(args));
1177
- _defineProperty(_assertThisInitialized(_this), "priority", 90);
1178
- _defineProperty(_assertThisInitialized(_this), "subPriority", 1);
1179
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['Y', 'R', 'q', 'Q', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']);
1180
- return _this;
1181
- }
1182
- _createClass(DateParser, [{
1183
- key: "parse",
1184
- value: function parse(dateString, token, match) {
1185
- switch (token) {
1186
- case 'd':
1187
- return parseNumericPattern(numericPatterns.date, dateString);
1188
- case 'do':
1189
- return match.ordinalNumber(dateString, {
1190
- unit: 'date'
1191
- });
1192
- default:
1193
- return parseNDigits(token.length, dateString);
1194
- }
1195
- }
1196
- }, {
1197
- key: "validate",
1198
- value: function validate(date, value) {
1199
- var year = date.getUTCFullYear();
1200
- var isLeapYear = isLeapYearIndex(year);
1201
- var month = date.getUTCMonth();
1202
- if (isLeapYear) {
1203
- return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];
1204
- } else {
1205
- return value >= 1 && value <= DAYS_IN_MONTH[month];
1206
- }
1207
- }
1208
- }, {
1209
- key: "set",
1210
- value: function set(date, _flags, value) {
1211
- date.setUTCDate(value);
1212
- date.setUTCHours(0, 0, 0, 0);
1213
- return date;
1214
- }
1215
- }]);
1216
- return DateParser;
1217
- }(Parser);
1218
-
1219
- var DayOfYearParser = /*#__PURE__*/function (_Parser) {
1220
- _inherits(DayOfYearParser, _Parser);
1221
- var _super = _createSuper(DayOfYearParser);
1222
- function DayOfYearParser() {
1223
- var _this;
1224
- _classCallCheck(this, DayOfYearParser);
1225
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1226
- args[_key] = arguments[_key];
1227
- }
1228
- _this = _super.call.apply(_super, [this].concat(args));
1229
- _defineProperty(_assertThisInitialized(_this), "priority", 90);
1230
- _defineProperty(_assertThisInitialized(_this), "subpriority", 1);
1231
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['Y', 'R', 'q', 'Q', 'M', 'L', 'w', 'I', 'd', 'E', 'i', 'e', 'c', 't', 'T']);
1232
- return _this;
1233
- }
1234
- _createClass(DayOfYearParser, [{
1235
- key: "parse",
1236
- value: function parse(dateString, token, match) {
1237
- switch (token) {
1238
- case 'D':
1239
- case 'DD':
1240
- return parseNumericPattern(numericPatterns.dayOfYear, dateString);
1241
- case 'Do':
1242
- return match.ordinalNumber(dateString, {
1243
- unit: 'date'
1244
- });
1245
- default:
1246
- return parseNDigits(token.length, dateString);
1247
- }
1248
- }
1249
- }, {
1250
- key: "validate",
1251
- value: function validate(date, value) {
1252
- var year = date.getUTCFullYear();
1253
- var isLeapYear = isLeapYearIndex(year);
1254
- if (isLeapYear) {
1255
- return value >= 1 && value <= 366;
1256
- } else {
1257
- return value >= 1 && value <= 365;
1258
- }
1259
- }
1260
- }, {
1261
- key: "set",
1262
- value: function set(date, _flags, value) {
1263
- date.setUTCMonth(0, value);
1264
- date.setUTCHours(0, 0, 0, 0);
1265
- return date;
1266
- }
1267
- }]);
1268
- return DayOfYearParser;
1269
- }(Parser);
1270
-
1271
- function setUTCDay(dirtyDate, dirtyDay, options) {
1272
- var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
1273
- requiredArgs(2, arguments);
1274
- var defaultOptions = getDefaultOptions();
1275
- var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);
1276
-
1277
- // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
1278
- if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
1279
- throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
1280
- }
1281
- var date = toDate(dirtyDate);
1282
- var day = toInteger(dirtyDay);
1283
- var currentDay = date.getUTCDay();
1284
- var remainder = day % 7;
1285
- var dayIndex = (remainder + 7) % 7;
1286
- var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;
1287
- date.setUTCDate(date.getUTCDate() + diff);
1288
- return date;
1289
- }
1290
-
1291
- var DayParser = /*#__PURE__*/function (_Parser) {
1292
- _inherits(DayParser, _Parser);
1293
- var _super = _createSuper(DayParser);
1294
- function DayParser() {
1295
- var _this;
1296
- _classCallCheck(this, DayParser);
1297
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1298
- args[_key] = arguments[_key];
1299
- }
1300
- _this = _super.call.apply(_super, [this].concat(args));
1301
- _defineProperty(_assertThisInitialized(_this), "priority", 90);
1302
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['D', 'i', 'e', 'c', 't', 'T']);
1303
- return _this;
1304
- }
1305
- _createClass(DayParser, [{
1306
- key: "parse",
1307
- value: function parse(dateString, token, match) {
1308
- switch (token) {
1309
- // Tue
1310
- case 'E':
1311
- case 'EE':
1312
- case 'EEE':
1313
- return match.day(dateString, {
1314
- width: 'abbreviated',
1315
- context: 'formatting'
1316
- }) || match.day(dateString, {
1317
- width: 'short',
1318
- context: 'formatting'
1319
- }) || match.day(dateString, {
1320
- width: 'narrow',
1321
- context: 'formatting'
1322
- });
1323
- // T
1324
- case 'EEEEE':
1325
- return match.day(dateString, {
1326
- width: 'narrow',
1327
- context: 'formatting'
1328
- });
1329
- // Tu
1330
- case 'EEEEEE':
1331
- return match.day(dateString, {
1332
- width: 'short',
1333
- context: 'formatting'
1334
- }) || match.day(dateString, {
1335
- width: 'narrow',
1336
- context: 'formatting'
1337
- });
1338
- // Tuesday
1339
- case 'EEEE':
1340
- default:
1341
- return match.day(dateString, {
1342
- width: 'wide',
1343
- context: 'formatting'
1344
- }) || match.day(dateString, {
1345
- width: 'abbreviated',
1346
- context: 'formatting'
1347
- }) || match.day(dateString, {
1348
- width: 'short',
1349
- context: 'formatting'
1350
- }) || match.day(dateString, {
1351
- width: 'narrow',
1352
- context: 'formatting'
1353
- });
1354
- }
1355
- }
1356
- }, {
1357
- key: "validate",
1358
- value: function validate(_date, value) {
1359
- return value >= 0 && value <= 6;
1360
- }
1361
- }, {
1362
- key: "set",
1363
- value: function set(date, _flags, value, options) {
1364
- date = setUTCDay(date, value, options);
1365
- date.setUTCHours(0, 0, 0, 0);
1366
- return date;
1367
- }
1368
- }]);
1369
- return DayParser;
1370
- }(Parser);
1371
-
1372
- var LocalDayParser = /*#__PURE__*/function (_Parser) {
1373
- _inherits(LocalDayParser, _Parser);
1374
- var _super = _createSuper(LocalDayParser);
1375
- function LocalDayParser() {
1376
- var _this;
1377
- _classCallCheck(this, LocalDayParser);
1378
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1379
- args[_key] = arguments[_key];
1380
- }
1381
- _this = _super.call.apply(_super, [this].concat(args));
1382
- _defineProperty(_assertThisInitialized(_this), "priority", 90);
1383
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'E', 'i', 'c', 't', 'T']);
1384
- return _this;
1385
- }
1386
- _createClass(LocalDayParser, [{
1387
- key: "parse",
1388
- value: function parse(dateString, token, match, options) {
1389
- var valueCallback = function valueCallback(value) {
1390
- var wholeWeekDays = Math.floor((value - 1) / 7) * 7;
1391
- return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
1392
- };
1393
- switch (token) {
1394
- // 3
1395
- case 'e':
1396
- case 'ee':
1397
- // 03
1398
- return mapValue(parseNDigits(token.length, dateString), valueCallback);
1399
- // 3rd
1400
- case 'eo':
1401
- return mapValue(match.ordinalNumber(dateString, {
1402
- unit: 'day'
1403
- }), valueCallback);
1404
- // Tue
1405
- case 'eee':
1406
- return match.day(dateString, {
1407
- width: 'abbreviated',
1408
- context: 'formatting'
1409
- }) || match.day(dateString, {
1410
- width: 'short',
1411
- context: 'formatting'
1412
- }) || match.day(dateString, {
1413
- width: 'narrow',
1414
- context: 'formatting'
1415
- });
1416
- // T
1417
- case 'eeeee':
1418
- return match.day(dateString, {
1419
- width: 'narrow',
1420
- context: 'formatting'
1421
- });
1422
- // Tu
1423
- case 'eeeeee':
1424
- return match.day(dateString, {
1425
- width: 'short',
1426
- context: 'formatting'
1427
- }) || match.day(dateString, {
1428
- width: 'narrow',
1429
- context: 'formatting'
1430
- });
1431
- // Tuesday
1432
- case 'eeee':
1433
- default:
1434
- return match.day(dateString, {
1435
- width: 'wide',
1436
- context: 'formatting'
1437
- }) || match.day(dateString, {
1438
- width: 'abbreviated',
1439
- context: 'formatting'
1440
- }) || match.day(dateString, {
1441
- width: 'short',
1442
- context: 'formatting'
1443
- }) || match.day(dateString, {
1444
- width: 'narrow',
1445
- context: 'formatting'
1446
- });
1447
- }
1448
- }
1449
- }, {
1450
- key: "validate",
1451
- value: function validate(_date, value) {
1452
- return value >= 0 && value <= 6;
1453
- }
1454
- }, {
1455
- key: "set",
1456
- value: function set(date, _flags, value, options) {
1457
- date = setUTCDay(date, value, options);
1458
- date.setUTCHours(0, 0, 0, 0);
1459
- return date;
1460
- }
1461
- }]);
1462
- return LocalDayParser;
1463
- }(Parser);
1464
-
1465
- var StandAloneLocalDayParser = /*#__PURE__*/function (_Parser) {
1466
- _inherits(StandAloneLocalDayParser, _Parser);
1467
- var _super = _createSuper(StandAloneLocalDayParser);
1468
- function StandAloneLocalDayParser() {
1469
- var _this;
1470
- _classCallCheck(this, StandAloneLocalDayParser);
1471
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1472
- args[_key] = arguments[_key];
1473
- }
1474
- _this = _super.call.apply(_super, [this].concat(args));
1475
- _defineProperty(_assertThisInitialized(_this), "priority", 90);
1476
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'E', 'i', 'e', 't', 'T']);
1477
- return _this;
1478
- }
1479
- _createClass(StandAloneLocalDayParser, [{
1480
- key: "parse",
1481
- value: function parse(dateString, token, match, options) {
1482
- var valueCallback = function valueCallback(value) {
1483
- var wholeWeekDays = Math.floor((value - 1) / 7) * 7;
1484
- return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
1485
- };
1486
- switch (token) {
1487
- // 3
1488
- case 'c':
1489
- case 'cc':
1490
- // 03
1491
- return mapValue(parseNDigits(token.length, dateString), valueCallback);
1492
- // 3rd
1493
- case 'co':
1494
- return mapValue(match.ordinalNumber(dateString, {
1495
- unit: 'day'
1496
- }), valueCallback);
1497
- // Tue
1498
- case 'ccc':
1499
- return match.day(dateString, {
1500
- width: 'abbreviated',
1501
- context: 'standalone'
1502
- }) || match.day(dateString, {
1503
- width: 'short',
1504
- context: 'standalone'
1505
- }) || match.day(dateString, {
1506
- width: 'narrow',
1507
- context: 'standalone'
1508
- });
1509
- // T
1510
- case 'ccccc':
1511
- return match.day(dateString, {
1512
- width: 'narrow',
1513
- context: 'standalone'
1514
- });
1515
- // Tu
1516
- case 'cccccc':
1517
- return match.day(dateString, {
1518
- width: 'short',
1519
- context: 'standalone'
1520
- }) || match.day(dateString, {
1521
- width: 'narrow',
1522
- context: 'standalone'
1523
- });
1524
- // Tuesday
1525
- case 'cccc':
1526
- default:
1527
- return match.day(dateString, {
1528
- width: 'wide',
1529
- context: 'standalone'
1530
- }) || match.day(dateString, {
1531
- width: 'abbreviated',
1532
- context: 'standalone'
1533
- }) || match.day(dateString, {
1534
- width: 'short',
1535
- context: 'standalone'
1536
- }) || match.day(dateString, {
1537
- width: 'narrow',
1538
- context: 'standalone'
1539
- });
1540
- }
1541
- }
1542
- }, {
1543
- key: "validate",
1544
- value: function validate(_date, value) {
1545
- return value >= 0 && value <= 6;
1546
- }
1547
- }, {
1548
- key: "set",
1549
- value: function set(date, _flags, value, options) {
1550
- date = setUTCDay(date, value, options);
1551
- date.setUTCHours(0, 0, 0, 0);
1552
- return date;
1553
- }
1554
- }]);
1555
- return StandAloneLocalDayParser;
1556
- }(Parser);
1557
-
1558
- function setUTCISODay(dirtyDate, dirtyDay) {
1559
- requiredArgs(2, arguments);
1560
- var day = toInteger(dirtyDay);
1561
- if (day % 7 === 0) {
1562
- day = day - 7;
1563
- }
1564
- var weekStartsOn = 1;
1565
- var date = toDate(dirtyDate);
1566
- var currentDay = date.getUTCDay();
1567
- var remainder = day % 7;
1568
- var dayIndex = (remainder + 7) % 7;
1569
- var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;
1570
- date.setUTCDate(date.getUTCDate() + diff);
1571
- return date;
1572
- }
1573
-
1574
- var ISODayParser = /*#__PURE__*/function (_Parser) {
1575
- _inherits(ISODayParser, _Parser);
1576
- var _super = _createSuper(ISODayParser);
1577
- function ISODayParser() {
1578
- var _this;
1579
- _classCallCheck(this, ISODayParser);
1580
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1581
- args[_key] = arguments[_key];
1582
- }
1583
- _this = _super.call.apply(_super, [this].concat(args));
1584
- _defineProperty(_assertThisInitialized(_this), "priority", 90);
1585
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['y', 'Y', 'u', 'q', 'Q', 'M', 'L', 'w', 'd', 'D', 'E', 'e', 'c', 't', 'T']);
1586
- return _this;
1587
- }
1588
- _createClass(ISODayParser, [{
1589
- key: "parse",
1590
- value: function parse(dateString, token, match) {
1591
- var valueCallback = function valueCallback(value) {
1592
- if (value === 0) {
1593
- return 7;
1594
- }
1595
- return value;
1596
- };
1597
- switch (token) {
1598
- // 2
1599
- case 'i':
1600
- case 'ii':
1601
- // 02
1602
- return parseNDigits(token.length, dateString);
1603
- // 2nd
1604
- case 'io':
1605
- return match.ordinalNumber(dateString, {
1606
- unit: 'day'
1607
- });
1608
- // Tue
1609
- case 'iii':
1610
- return mapValue(match.day(dateString, {
1611
- width: 'abbreviated',
1612
- context: 'formatting'
1613
- }) || match.day(dateString, {
1614
- width: 'short',
1615
- context: 'formatting'
1616
- }) || match.day(dateString, {
1617
- width: 'narrow',
1618
- context: 'formatting'
1619
- }), valueCallback);
1620
- // T
1621
- case 'iiiii':
1622
- return mapValue(match.day(dateString, {
1623
- width: 'narrow',
1624
- context: 'formatting'
1625
- }), valueCallback);
1626
- // Tu
1627
- case 'iiiiii':
1628
- return mapValue(match.day(dateString, {
1629
- width: 'short',
1630
- context: 'formatting'
1631
- }) || match.day(dateString, {
1632
- width: 'narrow',
1633
- context: 'formatting'
1634
- }), valueCallback);
1635
- // Tuesday
1636
- case 'iiii':
1637
- default:
1638
- return mapValue(match.day(dateString, {
1639
- width: 'wide',
1640
- context: 'formatting'
1641
- }) || match.day(dateString, {
1642
- width: 'abbreviated',
1643
- context: 'formatting'
1644
- }) || match.day(dateString, {
1645
- width: 'short',
1646
- context: 'formatting'
1647
- }) || match.day(dateString, {
1648
- width: 'narrow',
1649
- context: 'formatting'
1650
- }), valueCallback);
1651
- }
1652
- }
1653
- }, {
1654
- key: "validate",
1655
- value: function validate(_date, value) {
1656
- return value >= 1 && value <= 7;
1657
- }
1658
- }, {
1659
- key: "set",
1660
- value: function set(date, _flags, value) {
1661
- date = setUTCISODay(date, value);
1662
- date.setUTCHours(0, 0, 0, 0);
1663
- return date;
1664
- }
1665
- }]);
1666
- return ISODayParser;
1667
- }(Parser);
1668
-
1669
- var AMPMParser = /*#__PURE__*/function (_Parser) {
1670
- _inherits(AMPMParser, _Parser);
1671
- var _super = _createSuper(AMPMParser);
1672
- function AMPMParser() {
1673
- var _this;
1674
- _classCallCheck(this, AMPMParser);
1675
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1676
- args[_key] = arguments[_key];
1677
- }
1678
- _this = _super.call.apply(_super, [this].concat(args));
1679
- _defineProperty(_assertThisInitialized(_this), "priority", 80);
1680
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['b', 'B', 'H', 'k', 't', 'T']);
1681
- return _this;
1682
- }
1683
- _createClass(AMPMParser, [{
1684
- key: "parse",
1685
- value: function parse(dateString, token, match) {
1686
- switch (token) {
1687
- case 'a':
1688
- case 'aa':
1689
- case 'aaa':
1690
- return match.dayPeriod(dateString, {
1691
- width: 'abbreviated',
1692
- context: 'formatting'
1693
- }) || match.dayPeriod(dateString, {
1694
- width: 'narrow',
1695
- context: 'formatting'
1696
- });
1697
- case 'aaaaa':
1698
- return match.dayPeriod(dateString, {
1699
- width: 'narrow',
1700
- context: 'formatting'
1701
- });
1702
- case 'aaaa':
1703
- default:
1704
- return match.dayPeriod(dateString, {
1705
- width: 'wide',
1706
- context: 'formatting'
1707
- }) || match.dayPeriod(dateString, {
1708
- width: 'abbreviated',
1709
- context: 'formatting'
1710
- }) || match.dayPeriod(dateString, {
1711
- width: 'narrow',
1712
- context: 'formatting'
1713
- });
1714
- }
1715
- }
1716
- }, {
1717
- key: "set",
1718
- value: function set(date, _flags, value) {
1719
- date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);
1720
- return date;
1721
- }
1722
- }]);
1723
- return AMPMParser;
1724
- }(Parser);
1725
-
1726
- var AMPMMidnightParser = /*#__PURE__*/function (_Parser) {
1727
- _inherits(AMPMMidnightParser, _Parser);
1728
- var _super = _createSuper(AMPMMidnightParser);
1729
- function AMPMMidnightParser() {
1730
- var _this;
1731
- _classCallCheck(this, AMPMMidnightParser);
1732
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1733
- args[_key] = arguments[_key];
1734
- }
1735
- _this = _super.call.apply(_super, [this].concat(args));
1736
- _defineProperty(_assertThisInitialized(_this), "priority", 80);
1737
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['a', 'B', 'H', 'k', 't', 'T']);
1738
- return _this;
1739
- }
1740
- _createClass(AMPMMidnightParser, [{
1741
- key: "parse",
1742
- value: function parse(dateString, token, match) {
1743
- switch (token) {
1744
- case 'b':
1745
- case 'bb':
1746
- case 'bbb':
1747
- return match.dayPeriod(dateString, {
1748
- width: 'abbreviated',
1749
- context: 'formatting'
1750
- }) || match.dayPeriod(dateString, {
1751
- width: 'narrow',
1752
- context: 'formatting'
1753
- });
1754
- case 'bbbbb':
1755
- return match.dayPeriod(dateString, {
1756
- width: 'narrow',
1757
- context: 'formatting'
1758
- });
1759
- case 'bbbb':
1760
- default:
1761
- return match.dayPeriod(dateString, {
1762
- width: 'wide',
1763
- context: 'formatting'
1764
- }) || match.dayPeriod(dateString, {
1765
- width: 'abbreviated',
1766
- context: 'formatting'
1767
- }) || match.dayPeriod(dateString, {
1768
- width: 'narrow',
1769
- context: 'formatting'
1770
- });
1771
- }
1772
- }
1773
- }, {
1774
- key: "set",
1775
- value: function set(date, _flags, value) {
1776
- date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);
1777
- return date;
1778
- }
1779
- }]);
1780
- return AMPMMidnightParser;
1781
- }(Parser);
1782
-
1783
- var DayPeriodParser = /*#__PURE__*/function (_Parser) {
1784
- _inherits(DayPeriodParser, _Parser);
1785
- var _super = _createSuper(DayPeriodParser);
1786
- function DayPeriodParser() {
1787
- var _this;
1788
- _classCallCheck(this, DayPeriodParser);
1789
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1790
- args[_key] = arguments[_key];
1791
- }
1792
- _this = _super.call.apply(_super, [this].concat(args));
1793
- _defineProperty(_assertThisInitialized(_this), "priority", 80);
1794
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['a', 'b', 't', 'T']);
1795
- return _this;
1796
- }
1797
- _createClass(DayPeriodParser, [{
1798
- key: "parse",
1799
- value: function parse(dateString, token, match) {
1800
- switch (token) {
1801
- case 'B':
1802
- case 'BB':
1803
- case 'BBB':
1804
- return match.dayPeriod(dateString, {
1805
- width: 'abbreviated',
1806
- context: 'formatting'
1807
- }) || match.dayPeriod(dateString, {
1808
- width: 'narrow',
1809
- context: 'formatting'
1810
- });
1811
- case 'BBBBB':
1812
- return match.dayPeriod(dateString, {
1813
- width: 'narrow',
1814
- context: 'formatting'
1815
- });
1816
- case 'BBBB':
1817
- default:
1818
- return match.dayPeriod(dateString, {
1819
- width: 'wide',
1820
- context: 'formatting'
1821
- }) || match.dayPeriod(dateString, {
1822
- width: 'abbreviated',
1823
- context: 'formatting'
1824
- }) || match.dayPeriod(dateString, {
1825
- width: 'narrow',
1826
- context: 'formatting'
1827
- });
1828
- }
1829
- }
1830
- }, {
1831
- key: "set",
1832
- value: function set(date, _flags, value) {
1833
- date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);
1834
- return date;
1835
- }
1836
- }]);
1837
- return DayPeriodParser;
1838
- }(Parser);
1839
-
1840
- var Hour1to12Parser = /*#__PURE__*/function (_Parser) {
1841
- _inherits(Hour1to12Parser, _Parser);
1842
- var _super = _createSuper(Hour1to12Parser);
1843
- function Hour1to12Parser() {
1844
- var _this;
1845
- _classCallCheck(this, Hour1to12Parser);
1846
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1847
- args[_key] = arguments[_key];
1848
- }
1849
- _this = _super.call.apply(_super, [this].concat(args));
1850
- _defineProperty(_assertThisInitialized(_this), "priority", 70);
1851
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['H', 'K', 'k', 't', 'T']);
1852
- return _this;
1853
- }
1854
- _createClass(Hour1to12Parser, [{
1855
- key: "parse",
1856
- value: function parse(dateString, token, match) {
1857
- switch (token) {
1858
- case 'h':
1859
- return parseNumericPattern(numericPatterns.hour12h, dateString);
1860
- case 'ho':
1861
- return match.ordinalNumber(dateString, {
1862
- unit: 'hour'
1863
- });
1864
- default:
1865
- return parseNDigits(token.length, dateString);
1866
- }
1867
- }
1868
- }, {
1869
- key: "validate",
1870
- value: function validate(_date, value) {
1871
- return value >= 1 && value <= 12;
1872
- }
1873
- }, {
1874
- key: "set",
1875
- value: function set(date, _flags, value) {
1876
- var isPM = date.getUTCHours() >= 12;
1877
- if (isPM && value < 12) {
1878
- date.setUTCHours(value + 12, 0, 0, 0);
1879
- } else if (!isPM && value === 12) {
1880
- date.setUTCHours(0, 0, 0, 0);
1881
- } else {
1882
- date.setUTCHours(value, 0, 0, 0);
1883
- }
1884
- return date;
1885
- }
1886
- }]);
1887
- return Hour1to12Parser;
1888
- }(Parser);
1889
-
1890
- var Hour0to23Parser = /*#__PURE__*/function (_Parser) {
1891
- _inherits(Hour0to23Parser, _Parser);
1892
- var _super = _createSuper(Hour0to23Parser);
1893
- function Hour0to23Parser() {
1894
- var _this;
1895
- _classCallCheck(this, Hour0to23Parser);
1896
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1897
- args[_key] = arguments[_key];
1898
- }
1899
- _this = _super.call.apply(_super, [this].concat(args));
1900
- _defineProperty(_assertThisInitialized(_this), "priority", 70);
1901
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['a', 'b', 'h', 'K', 'k', 't', 'T']);
1902
- return _this;
1903
- }
1904
- _createClass(Hour0to23Parser, [{
1905
- key: "parse",
1906
- value: function parse(dateString, token, match) {
1907
- switch (token) {
1908
- case 'H':
1909
- return parseNumericPattern(numericPatterns.hour23h, dateString);
1910
- case 'Ho':
1911
- return match.ordinalNumber(dateString, {
1912
- unit: 'hour'
1913
- });
1914
- default:
1915
- return parseNDigits(token.length, dateString);
1916
- }
1917
- }
1918
- }, {
1919
- key: "validate",
1920
- value: function validate(_date, value) {
1921
- return value >= 0 && value <= 23;
1922
- }
1923
- }, {
1924
- key: "set",
1925
- value: function set(date, _flags, value) {
1926
- date.setUTCHours(value, 0, 0, 0);
1927
- return date;
1928
- }
1929
- }]);
1930
- return Hour0to23Parser;
1931
- }(Parser);
1932
-
1933
- var Hour0To11Parser = /*#__PURE__*/function (_Parser) {
1934
- _inherits(Hour0To11Parser, _Parser);
1935
- var _super = _createSuper(Hour0To11Parser);
1936
- function Hour0To11Parser() {
1937
- var _this;
1938
- _classCallCheck(this, Hour0To11Parser);
1939
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1940
- args[_key] = arguments[_key];
1941
- }
1942
- _this = _super.call.apply(_super, [this].concat(args));
1943
- _defineProperty(_assertThisInitialized(_this), "priority", 70);
1944
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['h', 'H', 'k', 't', 'T']);
1945
- return _this;
1946
- }
1947
- _createClass(Hour0To11Parser, [{
1948
- key: "parse",
1949
- value: function parse(dateString, token, match) {
1950
- switch (token) {
1951
- case 'K':
1952
- return parseNumericPattern(numericPatterns.hour11h, dateString);
1953
- case 'Ko':
1954
- return match.ordinalNumber(dateString, {
1955
- unit: 'hour'
1956
- });
1957
- default:
1958
- return parseNDigits(token.length, dateString);
1959
- }
1960
- }
1961
- }, {
1962
- key: "validate",
1963
- value: function validate(_date, value) {
1964
- return value >= 0 && value <= 11;
1965
- }
1966
- }, {
1967
- key: "set",
1968
- value: function set(date, _flags, value) {
1969
- var isPM = date.getUTCHours() >= 12;
1970
- if (isPM && value < 12) {
1971
- date.setUTCHours(value + 12, 0, 0, 0);
1972
- } else {
1973
- date.setUTCHours(value, 0, 0, 0);
1974
- }
1975
- return date;
1976
- }
1977
- }]);
1978
- return Hour0To11Parser;
1979
- }(Parser);
1980
-
1981
- var Hour1To24Parser = /*#__PURE__*/function (_Parser) {
1982
- _inherits(Hour1To24Parser, _Parser);
1983
- var _super = _createSuper(Hour1To24Parser);
1984
- function Hour1To24Parser() {
1985
- var _this;
1986
- _classCallCheck(this, Hour1To24Parser);
1987
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1988
- args[_key] = arguments[_key];
1989
- }
1990
- _this = _super.call.apply(_super, [this].concat(args));
1991
- _defineProperty(_assertThisInitialized(_this), "priority", 70);
1992
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['a', 'b', 'h', 'H', 'K', 't', 'T']);
1993
- return _this;
1994
- }
1995
- _createClass(Hour1To24Parser, [{
1996
- key: "parse",
1997
- value: function parse(dateString, token, match) {
1998
- switch (token) {
1999
- case 'k':
2000
- return parseNumericPattern(numericPatterns.hour24h, dateString);
2001
- case 'ko':
2002
- return match.ordinalNumber(dateString, {
2003
- unit: 'hour'
2004
- });
2005
- default:
2006
- return parseNDigits(token.length, dateString);
2007
- }
2008
- }
2009
- }, {
2010
- key: "validate",
2011
- value: function validate(_date, value) {
2012
- return value >= 1 && value <= 24;
2013
- }
2014
- }, {
2015
- key: "set",
2016
- value: function set(date, _flags, value) {
2017
- var hours = value <= 24 ? value % 24 : value;
2018
- date.setUTCHours(hours, 0, 0, 0);
2019
- return date;
2020
- }
2021
- }]);
2022
- return Hour1To24Parser;
2023
- }(Parser);
2024
-
2025
- var MinuteParser = /*#__PURE__*/function (_Parser) {
2026
- _inherits(MinuteParser, _Parser);
2027
- var _super = _createSuper(MinuteParser);
2028
- function MinuteParser() {
2029
- var _this;
2030
- _classCallCheck(this, MinuteParser);
2031
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2032
- args[_key] = arguments[_key];
2033
- }
2034
- _this = _super.call.apply(_super, [this].concat(args));
2035
- _defineProperty(_assertThisInitialized(_this), "priority", 60);
2036
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['t', 'T']);
2037
- return _this;
2038
- }
2039
- _createClass(MinuteParser, [{
2040
- key: "parse",
2041
- value: function parse(dateString, token, match) {
2042
- switch (token) {
2043
- case 'm':
2044
- return parseNumericPattern(numericPatterns.minute, dateString);
2045
- case 'mo':
2046
- return match.ordinalNumber(dateString, {
2047
- unit: 'minute'
2048
- });
2049
- default:
2050
- return parseNDigits(token.length, dateString);
2051
- }
2052
- }
2053
- }, {
2054
- key: "validate",
2055
- value: function validate(_date, value) {
2056
- return value >= 0 && value <= 59;
2057
- }
2058
- }, {
2059
- key: "set",
2060
- value: function set(date, _flags, value) {
2061
- date.setUTCMinutes(value, 0, 0);
2062
- return date;
2063
- }
2064
- }]);
2065
- return MinuteParser;
2066
- }(Parser);
2067
-
2068
- var SecondParser = /*#__PURE__*/function (_Parser) {
2069
- _inherits(SecondParser, _Parser);
2070
- var _super = _createSuper(SecondParser);
2071
- function SecondParser() {
2072
- var _this;
2073
- _classCallCheck(this, SecondParser);
2074
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2075
- args[_key] = arguments[_key];
2076
- }
2077
- _this = _super.call.apply(_super, [this].concat(args));
2078
- _defineProperty(_assertThisInitialized(_this), "priority", 50);
2079
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['t', 'T']);
2080
- return _this;
2081
- }
2082
- _createClass(SecondParser, [{
2083
- key: "parse",
2084
- value: function parse(dateString, token, match) {
2085
- switch (token) {
2086
- case 's':
2087
- return parseNumericPattern(numericPatterns.second, dateString);
2088
- case 'so':
2089
- return match.ordinalNumber(dateString, {
2090
- unit: 'second'
2091
- });
2092
- default:
2093
- return parseNDigits(token.length, dateString);
2094
- }
2095
- }
2096
- }, {
2097
- key: "validate",
2098
- value: function validate(_date, value) {
2099
- return value >= 0 && value <= 59;
2100
- }
2101
- }, {
2102
- key: "set",
2103
- value: function set(date, _flags, value) {
2104
- date.setUTCSeconds(value, 0);
2105
- return date;
2106
- }
2107
- }]);
2108
- return SecondParser;
2109
- }(Parser);
2110
-
2111
- var FractionOfSecondParser = /*#__PURE__*/function (_Parser) {
2112
- _inherits(FractionOfSecondParser, _Parser);
2113
- var _super = _createSuper(FractionOfSecondParser);
2114
- function FractionOfSecondParser() {
2115
- var _this;
2116
- _classCallCheck(this, FractionOfSecondParser);
2117
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2118
- args[_key] = arguments[_key];
2119
- }
2120
- _this = _super.call.apply(_super, [this].concat(args));
2121
- _defineProperty(_assertThisInitialized(_this), "priority", 30);
2122
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['t', 'T']);
2123
- return _this;
2124
- }
2125
- _createClass(FractionOfSecondParser, [{
2126
- key: "parse",
2127
- value: function parse(dateString, token) {
2128
- var valueCallback = function valueCallback(value) {
2129
- return Math.floor(value * Math.pow(10, -token.length + 3));
2130
- };
2131
- return mapValue(parseNDigits(token.length, dateString), valueCallback);
2132
- }
2133
- }, {
2134
- key: "set",
2135
- value: function set(date, _flags, value) {
2136
- date.setUTCMilliseconds(value);
2137
- return date;
2138
- }
2139
- }]);
2140
- return FractionOfSecondParser;
2141
- }(Parser);
2142
-
2143
- var ISOTimezoneWithZParser = /*#__PURE__*/function (_Parser) {
2144
- _inherits(ISOTimezoneWithZParser, _Parser);
2145
- var _super = _createSuper(ISOTimezoneWithZParser);
2146
- function ISOTimezoneWithZParser() {
2147
- var _this;
2148
- _classCallCheck(this, ISOTimezoneWithZParser);
2149
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2150
- args[_key] = arguments[_key];
2151
- }
2152
- _this = _super.call.apply(_super, [this].concat(args));
2153
- _defineProperty(_assertThisInitialized(_this), "priority", 10);
2154
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['t', 'T', 'x']);
2155
- return _this;
2156
- }
2157
- _createClass(ISOTimezoneWithZParser, [{
2158
- key: "parse",
2159
- value: function parse(dateString, token) {
2160
- switch (token) {
2161
- case 'X':
2162
- return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, dateString);
2163
- case 'XX':
2164
- return parseTimezonePattern(timezonePatterns.basic, dateString);
2165
- case 'XXXX':
2166
- return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, dateString);
2167
- case 'XXXXX':
2168
- return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, dateString);
2169
- case 'XXX':
2170
- default:
2171
- return parseTimezonePattern(timezonePatterns.extended, dateString);
2172
- }
2173
- }
2174
- }, {
2175
- key: "set",
2176
- value: function set(date, flags, value) {
2177
- if (flags.timestampIsSet) {
2178
- return date;
2179
- }
2180
- return new Date(date.getTime() - value);
2181
- }
2182
- }]);
2183
- return ISOTimezoneWithZParser;
2184
- }(Parser);
2185
-
2186
- var ISOTimezoneParser = /*#__PURE__*/function (_Parser) {
2187
- _inherits(ISOTimezoneParser, _Parser);
2188
- var _super = _createSuper(ISOTimezoneParser);
2189
- function ISOTimezoneParser() {
2190
- var _this;
2191
- _classCallCheck(this, ISOTimezoneParser);
2192
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2193
- args[_key] = arguments[_key];
2194
- }
2195
- _this = _super.call.apply(_super, [this].concat(args));
2196
- _defineProperty(_assertThisInitialized(_this), "priority", 10);
2197
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['t', 'T', 'X']);
2198
- return _this;
2199
- }
2200
- _createClass(ISOTimezoneParser, [{
2201
- key: "parse",
2202
- value: function parse(dateString, token) {
2203
- switch (token) {
2204
- case 'x':
2205
- return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, dateString);
2206
- case 'xx':
2207
- return parseTimezonePattern(timezonePatterns.basic, dateString);
2208
- case 'xxxx':
2209
- return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, dateString);
2210
- case 'xxxxx':
2211
- return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, dateString);
2212
- case 'xxx':
2213
- default:
2214
- return parseTimezonePattern(timezonePatterns.extended, dateString);
2215
- }
2216
- }
2217
- }, {
2218
- key: "set",
2219
- value: function set(date, flags, value) {
2220
- if (flags.timestampIsSet) {
2221
- return date;
2222
- }
2223
- return new Date(date.getTime() - value);
2224
- }
2225
- }]);
2226
- return ISOTimezoneParser;
2227
- }(Parser);
2228
-
2229
- var TimestampSecondsParser = /*#__PURE__*/function (_Parser) {
2230
- _inherits(TimestampSecondsParser, _Parser);
2231
- var _super = _createSuper(TimestampSecondsParser);
2232
- function TimestampSecondsParser() {
2233
- var _this;
2234
- _classCallCheck(this, TimestampSecondsParser);
2235
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2236
- args[_key] = arguments[_key];
2237
- }
2238
- _this = _super.call.apply(_super, [this].concat(args));
2239
- _defineProperty(_assertThisInitialized(_this), "priority", 40);
2240
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", '*');
2241
- return _this;
2242
- }
2243
- _createClass(TimestampSecondsParser, [{
2244
- key: "parse",
2245
- value: function parse(dateString) {
2246
- return parseAnyDigitsSigned(dateString);
2247
- }
2248
- }, {
2249
- key: "set",
2250
- value: function set(_date, _flags, value) {
2251
- return [new Date(value * 1000), {
2252
- timestampIsSet: true
2253
- }];
2254
- }
2255
- }]);
2256
- return TimestampSecondsParser;
2257
- }(Parser);
2258
-
2259
- var TimestampMillisecondsParser = /*#__PURE__*/function (_Parser) {
2260
- _inherits(TimestampMillisecondsParser, _Parser);
2261
- var _super = _createSuper(TimestampMillisecondsParser);
2262
- function TimestampMillisecondsParser() {
2263
- var _this;
2264
- _classCallCheck(this, TimestampMillisecondsParser);
2265
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2266
- args[_key] = arguments[_key];
2267
- }
2268
- _this = _super.call.apply(_super, [this].concat(args));
2269
- _defineProperty(_assertThisInitialized(_this), "priority", 20);
2270
- _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", '*');
2271
- return _this;
2272
- }
2273
- _createClass(TimestampMillisecondsParser, [{
2274
- key: "parse",
2275
- value: function parse(dateString) {
2276
- return parseAnyDigitsSigned(dateString);
2277
- }
2278
- }, {
2279
- key: "set",
2280
- value: function set(_date, _flags, value) {
2281
- return [new Date(value), {
2282
- timestampIsSet: true
2283
- }];
2284
- }
2285
- }]);
2286
- return TimestampMillisecondsParser;
2287
- }(Parser);
2288
-
2289
- /*
2290
- * | | Unit | | Unit |
2291
- * |-----|--------------------------------|-----|--------------------------------|
2292
- * | a | AM, PM | A* | Milliseconds in day |
2293
- * | b | AM, PM, noon, midnight | B | Flexible day period |
2294
- * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
2295
- * | d | Day of month | D | Day of year |
2296
- * | e | Local day of week | E | Day of week |
2297
- * | f | | F* | Day of week in month |
2298
- * | g* | Modified Julian day | G | Era |
2299
- * | h | Hour [1-12] | H | Hour [0-23] |
2300
- * | i! | ISO day of week | I! | ISO week of year |
2301
- * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
2302
- * | k | Hour [1-24] | K | Hour [0-11] |
2303
- * | l* | (deprecated) | L | Stand-alone month |
2304
- * | m | Minute | M | Month |
2305
- * | n | | N | |
2306
- * | o! | Ordinal number modifier | O* | Timezone (GMT) |
2307
- * | p | | P | |
2308
- * | q | Stand-alone quarter | Q | Quarter |
2309
- * | r* | Related Gregorian year | R! | ISO week-numbering year |
2310
- * | s | Second | S | Fraction of second |
2311
- * | t! | Seconds timestamp | T! | Milliseconds timestamp |
2312
- * | u | Extended year | U* | Cyclic year |
2313
- * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
2314
- * | w | Local week of year | W* | Week of month |
2315
- * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
2316
- * | y | Year (abs) | Y | Local week-numbering year |
2317
- * | z* | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
2318
- *
2319
- * Letters marked by * are not implemented but reserved by Unicode standard.
2320
- *
2321
- * Letters marked by ! are non-standard, but implemented by date-fns:
2322
- * - `o` modifies the previous token to turn it into an ordinal (see `parse` docs)
2323
- * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
2324
- * i.e. 7 for Sunday, 1 for Monday, etc.
2325
- * - `I` is ISO week of year, as opposed to `w` which is local week of year.
2326
- * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
2327
- * `R` is supposed to be used in conjunction with `I` and `i`
2328
- * for universal ISO week-numbering date, whereas
2329
- * `Y` is supposed to be used in conjunction with `w` and `e`
2330
- * for week-numbering date specific to the locale.
2331
- */
2332
- var parsers = {
2333
- G: new EraParser(),
2334
- y: new YearParser(),
2335
- Y: new LocalWeekYearParser(),
2336
- R: new ISOWeekYearParser(),
2337
- u: new ExtendedYearParser(),
2338
- Q: new QuarterParser(),
2339
- q: new StandAloneQuarterParser(),
2340
- M: new MonthParser(),
2341
- L: new StandAloneMonthParser(),
2342
- w: new LocalWeekParser(),
2343
- I: new ISOWeekParser(),
2344
- d: new DateParser(),
2345
- D: new DayOfYearParser(),
2346
- E: new DayParser(),
2347
- e: new LocalDayParser(),
2348
- c: new StandAloneLocalDayParser(),
2349
- i: new ISODayParser(),
2350
- a: new AMPMParser(),
2351
- b: new AMPMMidnightParser(),
2352
- B: new DayPeriodParser(),
2353
- h: new Hour1to12Parser(),
2354
- H: new Hour0to23Parser(),
2355
- K: new Hour0To11Parser(),
2356
- k: new Hour1To24Parser(),
2357
- m: new MinuteParser(),
2358
- s: new SecondParser(),
2359
- S: new FractionOfSecondParser(),
2360
- X: new ISOTimezoneWithZParser(),
2361
- x: new ISOTimezoneParser(),
2362
- t: new TimestampSecondsParser(),
2363
- T: new TimestampMillisecondsParser()
2364
- };
2365
-
2366
- // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
2367
- // (one of the certain letters followed by `o`)
2368
- // - (\w)\1* matches any sequences of the same letter
2369
- // - '' matches two quote characters in a row
2370
- // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
2371
- // except a single quote symbol, which ends the sequence.
2372
- // Two quote characters do not end the sequence.
2373
- // If there is no matching single quote
2374
- // then the sequence will continue until the end of the string.
2375
- // - . matches any single character unmatched by previous parts of the RegExps
2376
- var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
2377
-
2378
- // This RegExp catches symbols escaped by quotes, and also
2379
- // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
2380
- var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
2381
- var escapedStringRegExp = /^'([^]*?)'?$/;
2382
- var doubleQuoteRegExp = /''/g;
2383
- var notWhitespaceRegExp = /\S/;
2384
- var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
2385
-
2386
- /**
2387
- * @name parse
2388
- * @category Common Helpers
2389
- * @summary Parse the date.
2390
- *
2391
- * @description
2392
- * Return the date parsed from string using the given format string.
2393
- *
2394
- * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
2395
- * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2396
- *
2397
- * The characters in the format string wrapped between two single quotes characters (') are escaped.
2398
- * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
2399
- *
2400
- * Format of the format string is based on Unicode Technical Standard #35:
2401
- * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
2402
- * with a few additions (see note 5 below the table).
2403
- *
2404
- * Not all tokens are compatible. Combinations that don't make sense or could lead to bugs are prohibited
2405
- * and will throw `RangeError`. For example usage of 24-hour format token with AM/PM token will throw an exception:
2406
- *
2407
- * ```javascript
2408
- * parse('23 AM', 'HH a', new Date())
2409
- * //=> RangeError: The format string mustn't contain `HH` and `a` at the same time
2410
- * ```
2411
- *
2412
- * See the compatibility table: https://docs.google.com/spreadsheets/d/e/2PACX-1vQOPU3xUhplll6dyoMmVUXHKl_8CRDs6_ueLmex3SoqwhuolkuN3O05l4rqx5h1dKX8eb46Ul-CCSrq/pubhtml?gid=0&single=true
2413
- *
2414
- * Accepted format string patterns:
2415
- * | Unit |Prior| Pattern | Result examples | Notes |
2416
- * |---------------------------------|-----|---------|-----------------------------------|-------|
2417
- * | Era | 140 | G..GGG | AD, BC | |
2418
- * | | | GGGG | Anno Domini, Before Christ | 2 |
2419
- * | | | GGGGG | A, B | |
2420
- * | Calendar year | 130 | y | 44, 1, 1900, 2017, 9999 | 4 |
2421
- * | | | yo | 44th, 1st, 1900th, 9999999th | 4,5 |
2422
- * | | | yy | 44, 01, 00, 17 | 4 |
2423
- * | | | yyy | 044, 001, 123, 999 | 4 |
2424
- * | | | yyyy | 0044, 0001, 1900, 2017 | 4 |
2425
- * | | | yyyyy | ... | 2,4 |
2426
- * | Local week-numbering year | 130 | Y | 44, 1, 1900, 2017, 9000 | 4 |
2427
- * | | | Yo | 44th, 1st, 1900th, 9999999th | 4,5 |
2428
- * | | | YY | 44, 01, 00, 17 | 4,6 |
2429
- * | | | YYY | 044, 001, 123, 999 | 4 |
2430
- * | | | YYYY | 0044, 0001, 1900, 2017 | 4,6 |
2431
- * | | | YYYYY | ... | 2,4 |
2432
- * | ISO week-numbering year | 130 | R | -43, 1, 1900, 2017, 9999, -9999 | 4,5 |
2433
- * | | | RR | -43, 01, 00, 17 | 4,5 |
2434
- * | | | RRR | -043, 001, 123, 999, -999 | 4,5 |
2435
- * | | | RRRR | -0043, 0001, 2017, 9999, -9999 | 4,5 |
2436
- * | | | RRRRR | ... | 2,4,5 |
2437
- * | Extended year | 130 | u | -43, 1, 1900, 2017, 9999, -999 | 4 |
2438
- * | | | uu | -43, 01, 99, -99 | 4 |
2439
- * | | | uuu | -043, 001, 123, 999, -999 | 4 |
2440
- * | | | uuuu | -0043, 0001, 2017, 9999, -9999 | 4 |
2441
- * | | | uuuuu | ... | 2,4 |
2442
- * | Quarter (formatting) | 120 | Q | 1, 2, 3, 4 | |
2443
- * | | | Qo | 1st, 2nd, 3rd, 4th | 5 |
2444
- * | | | QQ | 01, 02, 03, 04 | |
2445
- * | | | QQQ | Q1, Q2, Q3, Q4 | |
2446
- * | | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
2447
- * | | | QQQQQ | 1, 2, 3, 4 | 4 |
2448
- * | Quarter (stand-alone) | 120 | q | 1, 2, 3, 4 | |
2449
- * | | | qo | 1st, 2nd, 3rd, 4th | 5 |
2450
- * | | | qq | 01, 02, 03, 04 | |
2451
- * | | | qqq | Q1, Q2, Q3, Q4 | |
2452
- * | | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
2453
- * | | | qqqqq | 1, 2, 3, 4 | 3 |
2454
- * | Month (formatting) | 110 | M | 1, 2, ..., 12 | |
2455
- * | | | Mo | 1st, 2nd, ..., 12th | 5 |
2456
- * | | | MM | 01, 02, ..., 12 | |
2457
- * | | | MMM | Jan, Feb, ..., Dec | |
2458
- * | | | MMMM | January, February, ..., December | 2 |
2459
- * | | | MMMMM | J, F, ..., D | |
2460
- * | Month (stand-alone) | 110 | L | 1, 2, ..., 12 | |
2461
- * | | | Lo | 1st, 2nd, ..., 12th | 5 |
2462
- * | | | LL | 01, 02, ..., 12 | |
2463
- * | | | LLL | Jan, Feb, ..., Dec | |
2464
- * | | | LLLL | January, February, ..., December | 2 |
2465
- * | | | LLLLL | J, F, ..., D | |
2466
- * | Local week of year | 100 | w | 1, 2, ..., 53 | |
2467
- * | | | wo | 1st, 2nd, ..., 53th | 5 |
2468
- * | | | ww | 01, 02, ..., 53 | |
2469
- * | ISO week of year | 100 | I | 1, 2, ..., 53 | 5 |
2470
- * | | | Io | 1st, 2nd, ..., 53th | 5 |
2471
- * | | | II | 01, 02, ..., 53 | 5 |
2472
- * | Day of month | 90 | d | 1, 2, ..., 31 | |
2473
- * | | | do | 1st, 2nd, ..., 31st | 5 |
2474
- * | | | dd | 01, 02, ..., 31 | |
2475
- * | Day of year | 90 | D | 1, 2, ..., 365, 366 | 7 |
2476
- * | | | Do | 1st, 2nd, ..., 365th, 366th | 5 |
2477
- * | | | DD | 01, 02, ..., 365, 366 | 7 |
2478
- * | | | DDD | 001, 002, ..., 365, 366 | |
2479
- * | | | DDDD | ... | 2 |
2480
- * | Day of week (formatting) | 90 | E..EEE | Mon, Tue, Wed, ..., Sun | |
2481
- * | | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
2482
- * | | | EEEEE | M, T, W, T, F, S, S | |
2483
- * | | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
2484
- * | ISO day of week (formatting) | 90 | i | 1, 2, 3, ..., 7 | 5 |
2485
- * | | | io | 1st, 2nd, ..., 7th | 5 |
2486
- * | | | ii | 01, 02, ..., 07 | 5 |
2487
- * | | | iii | Mon, Tue, Wed, ..., Sun | 5 |
2488
- * | | | iiii | Monday, Tuesday, ..., Sunday | 2,5 |
2489
- * | | | iiiii | M, T, W, T, F, S, S | 5 |
2490
- * | | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 5 |
2491
- * | Local day of week (formatting) | 90 | e | 2, 3, 4, ..., 1 | |
2492
- * | | | eo | 2nd, 3rd, ..., 1st | 5 |
2493
- * | | | ee | 02, 03, ..., 01 | |
2494
- * | | | eee | Mon, Tue, Wed, ..., Sun | |
2495
- * | | | eeee | Monday, Tuesday, ..., Sunday | 2 |
2496
- * | | | eeeee | M, T, W, T, F, S, S | |
2497
- * | | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
2498
- * | Local day of week (stand-alone) | 90 | c | 2, 3, 4, ..., 1 | |
2499
- * | | | co | 2nd, 3rd, ..., 1st | 5 |
2500
- * | | | cc | 02, 03, ..., 01 | |
2501
- * | | | ccc | Mon, Tue, Wed, ..., Sun | |
2502
- * | | | cccc | Monday, Tuesday, ..., Sunday | 2 |
2503
- * | | | ccccc | M, T, W, T, F, S, S | |
2504
- * | | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
2505
- * | AM, PM | 80 | a..aaa | AM, PM | |
2506
- * | | | aaaa | a.m., p.m. | 2 |
2507
- * | | | aaaaa | a, p | |
2508
- * | AM, PM, noon, midnight | 80 | b..bbb | AM, PM, noon, midnight | |
2509
- * | | | bbbb | a.m., p.m., noon, midnight | 2 |
2510
- * | | | bbbbb | a, p, n, mi | |
2511
- * | Flexible day period | 80 | B..BBB | at night, in the morning, ... | |
2512
- * | | | BBBB | at night, in the morning, ... | 2 |
2513
- * | | | BBBBB | at night, in the morning, ... | |
2514
- * | Hour [1-12] | 70 | h | 1, 2, ..., 11, 12 | |
2515
- * | | | ho | 1st, 2nd, ..., 11th, 12th | 5 |
2516
- * | | | hh | 01, 02, ..., 11, 12 | |
2517
- * | Hour [0-23] | 70 | H | 0, 1, 2, ..., 23 | |
2518
- * | | | Ho | 0th, 1st, 2nd, ..., 23rd | 5 |
2519
- * | | | HH | 00, 01, 02, ..., 23 | |
2520
- * | Hour [0-11] | 70 | K | 1, 2, ..., 11, 0 | |
2521
- * | | | Ko | 1st, 2nd, ..., 11th, 0th | 5 |
2522
- * | | | KK | 01, 02, ..., 11, 00 | |
2523
- * | Hour [1-24] | 70 | k | 24, 1, 2, ..., 23 | |
2524
- * | | | ko | 24th, 1st, 2nd, ..., 23rd | 5 |
2525
- * | | | kk | 24, 01, 02, ..., 23 | |
2526
- * | Minute | 60 | m | 0, 1, ..., 59 | |
2527
- * | | | mo | 0th, 1st, ..., 59th | 5 |
2528
- * | | | mm | 00, 01, ..., 59 | |
2529
- * | Second | 50 | s | 0, 1, ..., 59 | |
2530
- * | | | so | 0th, 1st, ..., 59th | 5 |
2531
- * | | | ss | 00, 01, ..., 59 | |
2532
- * | Seconds timestamp | 40 | t | 512969520 | |
2533
- * | | | tt | ... | 2 |
2534
- * | Fraction of second | 30 | S | 0, 1, ..., 9 | |
2535
- * | | | SS | 00, 01, ..., 99 | |
2536
- * | | | SSS | 000, 001, ..., 999 | |
2537
- * | | | SSSS | ... | 2 |
2538
- * | Milliseconds timestamp | 20 | T | 512969520900 | |
2539
- * | | | TT | ... | 2 |
2540
- * | Timezone (ISO-8601 w/ Z) | 10 | X | -08, +0530, Z | |
2541
- * | | | XX | -0800, +0530, Z | |
2542
- * | | | XXX | -08:00, +05:30, Z | |
2543
- * | | | XXXX | -0800, +0530, Z, +123456 | 2 |
2544
- * | | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
2545
- * | Timezone (ISO-8601 w/o Z) | 10 | x | -08, +0530, +00 | |
2546
- * | | | xx | -0800, +0530, +0000 | |
2547
- * | | | xxx | -08:00, +05:30, +00:00 | 2 |
2548
- * | | | xxxx | -0800, +0530, +0000, +123456 | |
2549
- * | | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
2550
- * | Long localized date | NA | P | 05/29/1453 | 5,8 |
2551
- * | | | PP | May 29, 1453 | |
2552
- * | | | PPP | May 29th, 1453 | |
2553
- * | | | PPPP | Sunday, May 29th, 1453 | 2,5,8 |
2554
- * | Long localized time | NA | p | 12:00 AM | 5,8 |
2555
- * | | | pp | 12:00:00 AM | |
2556
- * | Combination of date and time | NA | Pp | 05/29/1453, 12:00 AM | |
2557
- * | | | PPpp | May 29, 1453, 12:00:00 AM | |
2558
- * | | | PPPpp | May 29th, 1453 at ... | |
2559
- * | | | PPPPpp | Sunday, May 29th, 1453 at ... | 2,5,8 |
2560
- * Notes:
2561
- * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
2562
- * are the same as "stand-alone" units, but are different in some languages.
2563
- * "Formatting" units are declined according to the rules of the language
2564
- * in the context of a date. "Stand-alone" units are always nominative singular.
2565
- * In `format` function, they will produce different result:
2566
- *
2567
- * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
2568
- *
2569
- * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
2570
- *
2571
- * `parse` will try to match both formatting and stand-alone units interchangably.
2572
- *
2573
- * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
2574
- * the single quote characters (see below).
2575
- * If the sequence is longer than listed in table:
2576
- * - for numerical units (`yyyyyyyy`) `parse` will try to match a number
2577
- * as wide as the sequence
2578
- * - for text units (`MMMMMMMM`) `parse` will try to match the widest variation of the unit.
2579
- * These variations are marked with "2" in the last column of the table.
2580
- *
2581
- * 3. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
2582
- * These tokens represent the shortest form of the quarter.
2583
- *
2584
- * 4. The main difference between `y` and `u` patterns are B.C. years:
2585
- *
2586
- * | Year | `y` | `u` |
2587
- * |------|-----|-----|
2588
- * | AC 1 | 1 | 1 |
2589
- * | BC 1 | 1 | 0 |
2590
- * | BC 2 | 2 | -1 |
2591
- *
2592
- * Also `yy` will try to guess the century of two digit year by proximity with `referenceDate`:
2593
- *
2594
- * `parse('50', 'yy', new Date(2018, 0, 1)) //=> Sat Jan 01 2050 00:00:00`
2595
- *
2596
- * `parse('75', 'yy', new Date(2018, 0, 1)) //=> Wed Jan 01 1975 00:00:00`
2597
- *
2598
- * while `uu` will just assign the year as is:
2599
- *
2600
- * `parse('50', 'uu', new Date(2018, 0, 1)) //=> Sat Jan 01 0050 00:00:00`
2601
- *
2602
- * `parse('75', 'uu', new Date(2018, 0, 1)) //=> Tue Jan 01 0075 00:00:00`
2603
- *
2604
- * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
2605
- * except local week-numbering years are dependent on `options.weekStartsOn`
2606
- * and `options.firstWeekContainsDate` (compare [setISOWeekYear]{@link https://date-fns.org/docs/setISOWeekYear}
2607
- * and [setWeekYear]{@link https://date-fns.org/docs/setWeekYear}).
2608
- *
2609
- * 5. These patterns are not in the Unicode Technical Standard #35:
2610
- * - `i`: ISO day of week
2611
- * - `I`: ISO week of year
2612
- * - `R`: ISO week-numbering year
2613
- * - `o`: ordinal number modifier
2614
- * - `P`: long localized date
2615
- * - `p`: long localized time
2616
- *
2617
- * 6. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
2618
- * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2619
- *
2620
- * 7. `D` and `DD` tokens represent days of the year but they are ofthen confused with days of the month.
2621
- * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2622
- *
2623
- * 8. `P+` tokens do not have a defined priority since they are merely aliases to other tokens based
2624
- * on the given locale.
2625
- *
2626
- * using `en-US` locale: `P` => `MM/dd/yyyy`
2627
- * using `en-US` locale: `p` => `hh:mm a`
2628
- * using `pt-BR` locale: `P` => `dd/MM/yyyy`
2629
- * using `pt-BR` locale: `p` => `HH:mm`
2630
- *
2631
- * Values will be assigned to the date in the descending order of its unit's priority.
2632
- * Units of an equal priority overwrite each other in the order of appearance.
2633
- *
2634
- * If no values of higher priority are parsed (e.g. when parsing string 'January 1st' without a year),
2635
- * the values will be taken from 3rd argument `referenceDate` which works as a context of parsing.
2636
- *
2637
- * `referenceDate` must be passed for correct work of the function.
2638
- * If you're not sure which `referenceDate` to supply, create a new instance of Date:
2639
- * `parse('02/11/2014', 'MM/dd/yyyy', new Date())`
2640
- * In this case parsing will be done in the context of the current date.
2641
- * If `referenceDate` is `Invalid Date` or a value not convertible to valid `Date`,
2642
- * then `Invalid Date` will be returned.
2643
- *
2644
- * The result may vary by locale.
2645
- *
2646
- * If `formatString` matches with `dateString` but does not provides tokens, `referenceDate` will be returned.
2647
- *
2648
- * If parsing failed, `Invalid Date` will be returned.
2649
- * Invalid Date is a Date, whose time value is NaN.
2650
- * Time value of Date: http://es5.github.io/#x15.9.1.1
2651
- *
2652
- * @param {String} dateString - the string to parse
2653
- * @param {String} formatString - the string of tokens
2654
- * @param {Date|Number} referenceDate - defines values missing from the parsed dateString
2655
- * @param {Object} [options] - an object with options.
2656
- * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
2657
- * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
2658
- * @param {1|2|3|4|5|6|7} [options.firstWeekContainsDate=1] - the day of January, which is always in the first week of the year
2659
- * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
2660
- * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2661
- * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
2662
- * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2663
- * @returns {Date} the parsed date
2664
- * @throws {TypeError} 3 arguments required
2665
- * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
2666
- * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
2667
- * @throws {RangeError} `options.locale` must contain `match` property
2668
- * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2669
- * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2670
- * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2671
- * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2672
- * @throws {RangeError} format string contains an unescaped latin alphabet character
2673
- *
2674
- * @example
2675
- * // Parse 11 February 2014 from middle-endian format:
2676
- * var result = parse('02/11/2014', 'MM/dd/yyyy', new Date())
2677
- * //=> Tue Feb 11 2014 00:00:00
2678
- *
2679
- * @example
2680
- * // Parse 28th of February in Esperanto locale in the context of 2010 year:
2681
- * import eo from 'date-fns/locale/eo'
2682
- * var result = parse('28-a de februaro', "do 'de' MMMM", new Date(2010, 0, 1), {
2683
- * locale: eo
2684
- * })
2685
- * //=> Sun Feb 28 2010 00:00:00
2686
- */
2687
- function parse(dirtyDateString, dirtyFormatString, dirtyReferenceDate, options) {
2688
- var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _defaultOptions$local3, _defaultOptions$local4;
2689
- requiredArgs(3, arguments);
2690
- var dateString = String(dirtyDateString);
2691
- var formatString = String(dirtyFormatString);
2692
- var defaultOptions = getDefaultOptions();
2693
- var locale$1 = (_ref = (_options$locale = void 0 ) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : locale;
2694
- if (!locale$1.match) {
2695
- throw new RangeError('locale must contain match property');
2696
- }
2697
- var firstWeekContainsDate = toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = void 0 ) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : void 0 ) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1);
2698
-
2699
- // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
2700
- if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
2701
- throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
2702
- }
2703
- var weekStartsOn = toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = void 0 ) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : void 0 ) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0);
2704
-
2705
- // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
2706
- if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
2707
- throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
2708
- }
2709
- if (formatString === '') {
2710
- if (dateString === '') {
2711
- return toDate(dirtyReferenceDate);
2712
- } else {
2713
- return new Date(NaN);
2714
- }
2715
- }
2716
- var subFnOptions = {
2717
- firstWeekContainsDate: firstWeekContainsDate,
2718
- weekStartsOn: weekStartsOn,
2719
- locale: locale$1
2720
- };
2721
-
2722
- // If timezone isn't specified, it will be set to the system timezone
2723
- var setters = [new DateToSystemTimezoneSetter()];
2724
- var tokens = formatString.match(longFormattingTokensRegExp).map(function (substring) {
2725
- var firstCharacter = substring[0];
2726
- if (firstCharacter in longFormatters) {
2727
- var longFormatter = longFormatters[firstCharacter];
2728
- return longFormatter(substring, locale$1.formatLong);
2729
- }
2730
- return substring;
2731
- }).join('').match(formattingTokensRegExp);
2732
- var usedTokens = [];
2733
- var _iterator = _createForOfIteratorHelper(tokens),
2734
- _step;
2735
- try {
2736
- var _loop = function _loop() {
2737
- var token = _step.value;
2738
- if (isProtectedWeekYearToken(token)) {
2739
- throwProtectedError(token, formatString, dirtyDateString);
2740
- }
2741
- if (isProtectedDayOfYearToken(token)) {
2742
- throwProtectedError(token, formatString, dirtyDateString);
2743
- }
2744
- var firstCharacter = token[0];
2745
- var parser = parsers[firstCharacter];
2746
- if (parser) {
2747
- var incompatibleTokens = parser.incompatibleTokens;
2748
- if (Array.isArray(incompatibleTokens)) {
2749
- var incompatibleToken = usedTokens.find(function (usedToken) {
2750
- return incompatibleTokens.includes(usedToken.token) || usedToken.token === firstCharacter;
2751
- });
2752
- if (incompatibleToken) {
2753
- throw new RangeError("The format string mustn't contain `".concat(incompatibleToken.fullToken, "` and `").concat(token, "` at the same time"));
2754
- }
2755
- } else if (parser.incompatibleTokens === '*' && usedTokens.length > 0) {
2756
- throw new RangeError("The format string mustn't contain `".concat(token, "` and any other token at the same time"));
2757
- }
2758
- usedTokens.push({
2759
- token: firstCharacter,
2760
- fullToken: token
2761
- });
2762
- var parseResult = parser.run(dateString, token, locale$1.match, subFnOptions);
2763
- if (!parseResult) {
2764
- return {
2765
- v: new Date(NaN)
2766
- };
2767
- }
2768
- setters.push(parseResult.setter);
2769
- dateString = parseResult.rest;
2770
- } else {
2771
- if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
2772
- throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
2773
- }
2774
-
2775
- // Replace two single quote characters with one single quote character
2776
- if (token === "''") {
2777
- token = "'";
2778
- } else if (firstCharacter === "'") {
2779
- token = cleanEscapedString(token);
2780
- }
2781
-
2782
- // Cut token from string, or, if string doesn't match the token, return Invalid Date
2783
- if (dateString.indexOf(token) === 0) {
2784
- dateString = dateString.slice(token.length);
2785
- } else {
2786
- return {
2787
- v: new Date(NaN)
2788
- };
2789
- }
2790
- }
2791
- };
2792
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
2793
- var _ret = _loop();
2794
- if (_typeof(_ret) === "object") return _ret.v;
2795
- }
2796
-
2797
- // Check if the remaining input contains something other than whitespace
2798
- } catch (err) {
2799
- _iterator.e(err);
2800
- } finally {
2801
- _iterator.f();
2802
- }
2803
- if (dateString.length > 0 && notWhitespaceRegExp.test(dateString)) {
2804
- return new Date(NaN);
2805
- }
2806
- var uniquePrioritySetters = setters.map(function (setter) {
2807
- return setter.priority;
2808
- }).sort(function (a, b) {
2809
- return b - a;
2810
- }).filter(function (priority, index, array) {
2811
- return array.indexOf(priority) === index;
2812
- }).map(function (priority) {
2813
- return setters.filter(function (setter) {
2814
- return setter.priority === priority;
2815
- }).sort(function (a, b) {
2816
- return b.subPriority - a.subPriority;
2817
- });
2818
- }).map(function (setterArray) {
2819
- return setterArray[0];
2820
- });
2821
- var date = toDate(dirtyReferenceDate);
2822
- if (isNaN(date.getTime())) {
2823
- return new Date(NaN);
2824
- }
2825
-
2826
- // Convert the date in system timezone to the same date in UTC+00:00 timezone.
2827
- var utcDate = subMilliseconds(date, getTimezoneOffsetInMilliseconds(date));
2828
- var flags = {};
2829
- var _iterator2 = _createForOfIteratorHelper(uniquePrioritySetters),
2830
- _step2;
2831
- try {
2832
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
2833
- var setter = _step2.value;
2834
- if (!setter.validate(utcDate, subFnOptions)) {
2835
- return new Date(NaN);
2836
- }
2837
- var result = setter.set(utcDate, flags, subFnOptions);
2838
- // Result is tuple (date, flags)
2839
- if (Array.isArray(result)) {
2840
- utcDate = result[0];
2841
- assign(flags, result[1]);
2842
- // Result is date
2843
- } else {
2844
- utcDate = result;
2845
- }
2846
- }
2847
- } catch (err) {
2848
- _iterator2.e(err);
2849
- } finally {
2850
- _iterator2.f();
2851
- }
2852
- return utcDate;
2853
- }
2854
- function cleanEscapedString(input) {
2855
- return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
2856
- }
2857
7
 
2858
8
  const datepickerComponentCss = () => `*{box-sizing:border-box}.pointer-events-none{pointer-events:none}.static{position:static}.absolute{position:absolute}.left-0{left:0}.top-0{top:0}.z-\\[-10\\]{z-index:-10}.overflow-hidden{overflow:hidden}.opacity-0{opacity:0}.blur{--tw-blur:blur(8px)}.blur,.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}`;
2859
9
 
@@ -2997,17 +147,17 @@ const Datepicker = class {
2997
147
  }
2998
148
  parseMinDate(minDate) {
2999
149
  if (minDate === null || minDate === '') {
3000
- this.minDate = new Date(getYear(subYears(new Date(), 100)), 0, 1);
150
+ this.minDate = new Date(dateFnsExports.getYear(dateFnsExports.subYears(new Date(), 100)), 0, 1);
3001
151
  return;
3002
152
  }
3003
153
  if (typeof minDate === 'string') {
3004
154
  minDate = new Date(minDate);
3005
155
  }
3006
- if (!isValid(minDate)) {
156
+ if (!dateFnsExports.isValid(minDate)) {
3007
157
  return;
3008
158
  }
3009
159
  this._minDate = minDate;
3010
- if (isBefore(this._value, this._minDate)) {
160
+ if (dateFnsExports.isBefore(this._value, this._minDate)) {
3011
161
  this._setValue(null);
3012
162
  }
3013
163
  }
@@ -3019,11 +169,11 @@ const Datepicker = class {
3019
169
  if (typeof maxDate === 'string') {
3020
170
  maxDate = new Date(maxDate);
3021
171
  }
3022
- if (!isValid(maxDate)) {
172
+ if (!dateFnsExports.isValid(maxDate)) {
3023
173
  return;
3024
174
  }
3025
175
  this._maxDate = maxDate;
3026
- if (isAfter(this._value, this._maxDate)) {
176
+ if (dateFnsExports.isAfter(this._value, this._maxDate)) {
3027
177
  this._setValue(null);
3028
178
  }
3029
179
  }
@@ -3042,7 +192,7 @@ const Datepicker = class {
3042
192
  }
3043
193
  return date;
3044
194
  })
3045
- .filter(date => isValid(date));
195
+ .filter(date => dateFnsExports.isValid(date));
3046
196
  if (this._isDisabledDay(this._value)) {
3047
197
  this._setValue(null);
3048
198
  }
@@ -3069,16 +219,16 @@ const Datepicker = class {
3069
219
  this.parseValue(this.value);
3070
220
  }
3071
221
  render() {
3072
- return (h("p-dropdown", { key: 'a01a3bf86a26c0b909a777941c002f8db1963210', allowOverflow: true, strategy: this.strategy, placement: this.placement, disableTriggerClick: true, applyMaxWidth: false, applyFullWidth: false, insideClick: true, show: this._showDropdown, isDatepicker: true }, h("p-field", { key: '66141e393236efcc4ce8deb36ea3083eb8f1cbe8', slot: 'trigger', icon: this.hideIconWhenFilled && !!this._value ? null : 'calendar-multi', iconPosition: 'start', size: this.size, prefix: this.prefix, label: this.label, loading: this.loading, helper: this.helper, required: asBoolean(this.required), showOptional: asBoolean(this.showOptional), error: this.error, forceShowTooltip: !!this.error?.length && !this._showDropdown, autoShowError: false, disabled: asBoolean(this.disabled), focused: this._showDropdown, value: this._getFormattedDate(), placeholder: this.placeholder, onFocus: () => this._onFocus(), onBlur: (ev) => this._onBlur(ev), onValueChange: ev => this._onValueChange(ev.detail), onInputRefChange: ev => (this._inputRef = ev.detail) }), this.enableNativePicker && this._isMobileBrowser && (h("input", { key: '6c7d01a5c298b42d089ae18d06c6acb2659031cb', slot: 'trigger', type: this.mode === 'day' ? 'date' : 'month', class: 'pointer-events-none absolute left-0 top-0 z-[-10] overflow-hidden opacity-0', onInput: ev => this._onNativeInput(ev), ref: ref => (this._dateInputRef = ref), value: this._value &&
3073
- format(this._value, 'yyyy-MM-dd', {
3074
- locale: state.locale === 'nl' ? locale$1 : locale,
222
+ return (h("p-dropdown", { key: 'c65daeff45afabeefa654b8d033a40d9fda5b4e2', allowOverflow: true, strategy: this.strategy, placement: this.placement, disableTriggerClick: true, applyMaxWidth: false, applyFullWidth: false, insideClick: true, show: this._showDropdown, isDatepicker: true }, h("p-field", { key: '09aaa8a320e9a1852171aa59054a9b269667addb', slot: 'trigger', icon: this.hideIconWhenFilled && !!this._value ? null : 'calendar-multi', iconPosition: 'start', size: this.size, prefix: this.prefix, label: this.label, loading: this.loading, helper: this.helper, required: asBoolean(this.required), showOptional: asBoolean(this.showOptional), error: this.error, forceShowTooltip: !!this.error?.length && !this._showDropdown, autoShowError: false, disabled: asBoolean(this.disabled), focused: this._showDropdown, value: this._getFormattedDate(), placeholder: this.placeholder, onFocus: () => this._onFocus(), onBlur: (ev) => this._onBlur(ev), onValueChange: ev => this._onValueChange(ev.detail), onInputRefChange: ev => (this._inputRef = ev.detail) }), this.enableNativePicker && this._isMobileBrowser && (h("input", { key: 'f63ca80f15e52a5824a51e997f7b45664104a196', slot: 'trigger', type: this.mode === 'day' ? 'date' : 'month', class: 'pointer-events-none absolute left-0 top-0 z-[-10] overflow-hidden opacity-0', onInput: ev => this._onNativeInput(ev), ref: ref => (this._dateInputRef = ref), value: this._value &&
223
+ dateFnsExports.format(this._value, 'yyyy-MM-dd', {
224
+ locale: state.locale === 'nl' ? localeExports.nl : localeExports.enUS,
3075
225
  }), min: this._minDate &&
3076
- format(new Date(this._minDate), 'yyyy-MM-dd', {
3077
- locale: state.locale === 'nl' ? locale$1 : locale,
226
+ dateFnsExports.format(new Date(this._minDate), 'yyyy-MM-dd', {
227
+ locale: state.locale === 'nl' ? localeExports.nl : localeExports.enUS,
3078
228
  }), max: this.maxDate &&
3079
- format(new Date(this.maxDate), 'yyyy-MM-dd', {
3080
- locale: state.locale === 'nl' ? locale$1 : locale,
3081
- }) })), h("div", { key: 'd5a32388cee9bb272905deb090816da8217e9a41', tabIndex: -1, slot: 'items' }, h("p-calendar", { key: 'dce8bdd282632e2c38ebf13b3b07db561b27dffb', variant: 'embedded', value: this._value, onValueChange: ({ detail }) => (this.value = detail), preselectToday: this.preselectToday, disabledDates: this.disabledDates, minDate: this.minDate, maxDate: this.maxDate, disableWeekends: this.disableWeekends, enableToday: this.enableToday, todayText: this.todayText, mode: this.mode }))));
229
+ dateFnsExports.format(new Date(this.maxDate), 'yyyy-MM-dd', {
230
+ locale: state.locale === 'nl' ? localeExports.nl : localeExports.enUS,
231
+ }) })), h("div", { key: 'f57a7045507cc0bf0bb2ae070258c0d4ed1af81f', tabIndex: -1, slot: 'items' }, h("p-calendar", { key: '469d4b2a4c2972a0bfb621d85a67fb3d8c3c3e83', variant: 'embedded', value: this._value, onValueChange: ({ detail }) => (this.value = detail), preselectToday: this.preselectToday, disabledDates: this.disabledDates, minDate: this.minDate, maxDate: this.maxDate, disableWeekends: this.disableWeekends, enableToday: this.enableToday, todayText: this.todayText, mode: this.mode }))));
3082
232
  }
3083
233
  documentClickHandler({ target }) {
3084
234
  if (!this._showDropdown || childOf(target, this._el)) {
@@ -3106,11 +256,11 @@ const Datepicker = class {
3106
256
  if (target.value === null) {
3107
257
  return;
3108
258
  }
3109
- const value = parse(target.value, parseFormat, new Date());
259
+ const value = dateFnsExports.parse(target.value, parseFormat, new Date());
3110
260
  if (value === this._value) {
3111
261
  return;
3112
262
  }
3113
- const valid = isValid(value);
263
+ const valid = dateFnsExports.isValid(value);
3114
264
  if (!valid && parseFormat === this.format && this.mode === 'day') {
3115
265
  return this._onBlur(ev, this._defaultFormats['dayNoDashes']);
3116
266
  }
@@ -3133,10 +283,10 @@ const Datepicker = class {
3133
283
  this._setValue(null);
3134
284
  return;
3135
285
  }
3136
- const parsedValue = parse(value, parseFormat, new Date());
3137
- if (!isValid(parsedValue) ||
3138
- format(parsedValue, parseFormat, {
3139
- locale: state.locale === 'nl' ? locale$1 : locale,
286
+ const parsedValue = dateFnsExports.parse(value, parseFormat, new Date());
287
+ if (!dateFnsExports.isValid(parsedValue) ||
288
+ dateFnsExports.format(parsedValue, parseFormat, {
289
+ locale: state.locale === 'nl' ? localeExports.nl : localeExports.enUS,
3140
290
  }) !== value) {
3141
291
  if (this.mode === 'day') {
3142
292
  this._onValueChange(value, this._defaultFormats['dayNoDashes']);
@@ -3164,14 +314,14 @@ const Datepicker = class {
3164
314
  this.valueChange.emit(null);
3165
315
  return;
3166
316
  }
3167
- if (!isValid(value)) {
317
+ if (!dateFnsExports.isValid(value)) {
3168
318
  return;
3169
319
  }
3170
320
  if (this._isDisabledDay(value)) {
3171
321
  if (this._dateInputRef?.value) {
3172
322
  this._dateInputRef.value = this._value
3173
- ? format(this._value, 'yyyy-MM-dd', {
3174
- locale: state.locale === 'nl' ? locale$1 : locale,
323
+ ? dateFnsExports.format(this._value, 'yyyy-MM-dd', {
324
+ locale: state.locale === 'nl' ? localeExports.nl : localeExports.enUS,
3175
325
  })
3176
326
  : null;
3177
327
  }
@@ -3179,11 +329,11 @@ const Datepicker = class {
3179
329
  }
3180
330
  value =
3181
331
  this.mode === 'day'
3182
- ? startOfDay(value)
332
+ ? dateFnsExports.startOfDay(value)
3183
333
  : this.mode === 'month'
3184
- ? startOfMonth(value)
3185
- : startOfYear(value);
3186
- const isSameValue = isSameDay(value, this._value);
334
+ ? dateFnsExports.startOfMonth(value)
335
+ : dateFnsExports.startOfYear(value);
336
+ const isSameValue = dateFnsExports.isSameDay(value, this._value);
3187
337
  if (isSameValue) {
3188
338
  return;
3189
339
  }
@@ -3194,24 +344,24 @@ const Datepicker = class {
3194
344
  this.valueChange.emit(value);
3195
345
  }
3196
346
  _isDisabledDay(day) {
3197
- return ((this.disableWeekends && isWeekend(day)) ||
3198
- (isBefore(day, this._minDate) && !isSameDay(day, this._minDate)) ||
3199
- (isAfter(day, this._maxDate) && !isSameDay(day, this._maxDate)) ||
3200
- this._disabledDates.some(date => isSameDay(date, day)));
347
+ return ((this.disableWeekends && dateFnsExports.isWeekend(day)) ||
348
+ (dateFnsExports.isBefore(day, this._minDate) && !dateFnsExports.isSameDay(day, this._minDate)) ||
349
+ (dateFnsExports.isAfter(day, this._maxDate) && !dateFnsExports.isSameDay(day, this._maxDate)) ||
350
+ this._disabledDates.some(date => dateFnsExports.isSameDay(date, day)));
3201
351
  }
3202
352
  _getFormattedDate() {
3203
353
  if (!this._value) {
3204
354
  return '';
3205
355
  }
3206
- return format(this._value, this.format, {
3207
- locale: state.locale === 'nl' ? locale$1 : locale,
356
+ return dateFnsExports.format(this._value, this.format, {
357
+ locale: state.locale === 'nl' ? localeExports.nl : localeExports.enUS,
3208
358
  });
3209
359
  }
3210
360
  _getAutomaticMax() {
3211
- const date = addYears(new Date(), 50);
3212
- let year = getYear(date);
361
+ const date = dateFnsExports.addYears(new Date(), 50);
362
+ let year = dateFnsExports.getYear(date);
3213
363
  year = Math.ceil(year / 10) * 10;
3214
- return setYear(date, year);
364
+ return dateFnsExports.setYear(date, year);
3215
365
  }
3216
366
  static get formAssociated() { return true; }
3217
367
  static get watchers() { return {