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