@learncard/react 2.7.20 → 2.7.22

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 (245) hide show
  1. package/dist/base.css +1 -1
  2. package/dist/base.js +1 -1
  3. package/dist/cjs/{AchievementCard-2ad4cb64.js → AchievementCard-496e93b5.js} +4 -4
  4. package/dist/cjs/{AchievementCard-2ad4cb64.js.map → AchievementCard-496e93b5.js.map} +1 -1
  5. package/dist/cjs/{BoostGenericCard-e540e459.js → BoostGenericCard-1bfe4385.js} +8 -8
  6. package/dist/cjs/BoostGenericCard-1bfe4385.js.map +1 -0
  7. package/dist/cjs/{BoostSmallCard-9dc75a95.js → BoostSmallCard-bba7c0c9.js} +5 -5
  8. package/dist/cjs/BoostSmallCard-bba7c0c9.js.map +1 -0
  9. package/dist/cjs/Button-a7af702b.js.map +1 -1
  10. package/dist/cjs/{CertificateDisplayCard-11ebf814.js → CertificateDisplayCard-c5583200.js} +31 -19
  11. package/dist/{esm/CertificateDisplayCard-b69fd06f.js.map → cjs/CertificateDisplayCard-c5583200.js.map} +1 -1
  12. package/dist/cjs/Checkmark-f611aa4d.js.map +1 -1
  13. package/dist/cjs/CircleCheckButton-82d47ee2.js.map +1 -1
  14. package/dist/cjs/CircleIcon-617c38fa.js.map +1 -1
  15. package/dist/cjs/CircleSpinner-093cce04.js.map +1 -1
  16. package/dist/cjs/Coins-acd63f46.js.map +1 -1
  17. package/dist/cjs/CourseCard-338a32ee.js.map +1 -1
  18. package/dist/cjs/{CourseVerticalCard-5a73ab74.js → CourseVerticalCard-841960b1.js} +3 -3
  19. package/dist/cjs/{CourseVerticalCard-5a73ab74.js.map → CourseVerticalCard-841960b1.js.map} +1 -1
  20. package/dist/cjs/FlippyCard-209549c5.js.map +1 -1
  21. package/dist/cjs/GenericArrow-8dfb261d.js.map +1 -1
  22. package/dist/cjs/{GenericCard-46248807.js → GenericCard-5659339e.js} +7 -8
  23. package/dist/cjs/GenericCard-5659339e.js.map +1 -0
  24. package/dist/cjs/JobHistoryCard-05a3f98b.js.map +1 -1
  25. package/dist/cjs/JobListCard-458c8585.js.map +1 -1
  26. package/dist/cjs/LearnCardCreditCardBackFace-87cc8b9f.js.map +1 -1
  27. package/dist/cjs/{LearnCardCreditCardFrontFace-94be6a62.js → LearnCardCreditCardFrontFace-39eeb89a.js} +2 -2
  28. package/dist/cjs/{LearnCardCreditCardFrontFace-94be6a62.js.map → LearnCardCreditCardFrontFace-39eeb89a.js.map} +1 -1
  29. package/dist/cjs/LearnPill-21b47475.js.map +1 -1
  30. package/dist/cjs/{Lightbox-f19e13d2.js → Lightbox-880f4672.js} +22 -19
  31. package/dist/cjs/{Lightbox-f19e13d2.js.map → Lightbox-880f4672.js.map} +1 -1
  32. package/dist/cjs/Lightbulb-19c89d3c.js.map +1 -1
  33. package/dist/cjs/{MeritBadgeDisplayCard-70930ef2.js → MeritBadgeDisplayCard-306c0f77.js} +23 -17
  34. package/dist/{esm/MeritBadgeDisplayCard-575a61ed.js.map → cjs/MeritBadgeDisplayCard-306c0f77.js.map} +1 -1
  35. package/dist/cjs/{MeritBadgeSkillsCount-41a273ae.js → MeritBadgeSkillsCount-e48b2202.js} +10 -4
  36. package/dist/cjs/{MeritBadgeSkillsCount-41a273ae.js.map → MeritBadgeSkillsCount-e48b2202.js.map} +1 -1
  37. package/dist/cjs/MiniVCThumbnail-a78e44f2.js.map +1 -1
  38. package/dist/cjs/Notification-d212fa7b.js.map +1 -1
  39. package/dist/cjs/NotificationBoostCard-70dfa17e.js.map +1 -1
  40. package/dist/cjs/NotificationUserAcceptedBoostCard-423b9320.js.map +1 -1
  41. package/dist/cjs/NotificationUserCard-d4dab06c.js.map +1 -1
  42. package/dist/cjs/PuzzlePiece-937c216a.js.map +1 -1
  43. package/dist/cjs/{QRCodeCard-2a818136.js → QRCodeCard-b56c11cc.js} +2 -2
  44. package/dist/cjs/{QRCodeCard-2a818136.js.map → QRCodeCard-b56c11cc.js.map} +1 -1
  45. package/dist/cjs/QRCodeIcon-81c6e96b.js.map +1 -1
  46. package/dist/cjs/RoundedPill-bda7c067.js.map +1 -1
  47. package/dist/cjs/{SchoolIDCard-c7b4153a.js → SchoolIDCard-5a0b8568.js} +1206 -10
  48. package/dist/cjs/SchoolIDCard-5a0b8568.js.map +1 -0
  49. package/dist/cjs/{SkillTabCard-d8f3f5d4.js → SkillTabCard-66677f3c.js} +2 -2
  50. package/dist/cjs/{SkillTabCard-d8f3f5d4.js.map → SkillTabCard-66677f3c.js.map} +1 -1
  51. package/dist/cjs/SkillVerticalCard-3eb3a8e9.js.map +1 -1
  52. package/dist/cjs/SkillsCard-4b6dbb4f.js.map +1 -1
  53. package/dist/cjs/SkillsStatsCard-97a35a88.js.map +1 -1
  54. package/dist/cjs/SmallAchievementCard-a1fa862b.js.map +1 -1
  55. package/dist/cjs/Trophy-3d323be3.js.map +1 -1
  56. package/dist/cjs/User-301088ac.js.map +1 -1
  57. package/dist/cjs/{VCCard-cf3590eb.js → VCCard-4dbd6d24.js} +4 -18
  58. package/dist/{esm/VCCard-6c8c3ff1.js.map → cjs/VCCard-4dbd6d24.js.map} +1 -1
  59. package/dist/cjs/{VCDisplayBackFace-9c064eef.js → VCDisplayBackFace-0473d345.js} +3 -3
  60. package/dist/cjs/{VCDisplayBackFace-9c064eef.js.map → VCDisplayBackFace-0473d345.js.map} +1 -1
  61. package/dist/cjs/{VCDisplayCard-929fe8b9.js → VCDisplayCard-4edf82c6.js} +3 -3
  62. package/dist/cjs/{VCDisplayCard-929fe8b9.js.map → VCDisplayCard-4edf82c6.js.map} +1 -1
  63. package/dist/cjs/{VCDisplayCard2-19613b61.js → VCDisplayCard2-1720f1f1.js} +67 -48
  64. package/dist/{esm/VCDisplayCard2-06c93532.js.map → cjs/VCDisplayCard2-1720f1f1.js.map} +1 -1
  65. package/dist/cjs/VCThumbnail-6bf86bb2.js.map +1 -1
  66. package/dist/cjs/VCVerificationCheck-46fa75d3.js.map +1 -1
  67. package/dist/cjs/{VCVerificationPill-09953688.js → VCVerificationPill-b8d9a33d.js} +2 -2
  68. package/dist/cjs/{VCVerificationPill-09953688.js.map → VCVerificationPill-b8d9a33d.js.map} +1 -1
  69. package/dist/cjs/{VerifierStateBadgeAndText-fd0bd814.js → VerifierStateBadgeAndText-855df7d5.js} +14 -7
  70. package/dist/cjs/VerifierStateBadgeAndText-855df7d5.js.map +1 -0
  71. package/dist/cjs/{constants-737d10f6.js → constants-5bc954cb.js} +10 -10
  72. package/dist/cjs/{constants-737d10f6.js.map → constants-5bc954cb.js.map} +1 -1
  73. package/dist/cjs/{credential.helpers-afb94f02.js → credential.helpers-04044bbd.js} +855 -1285
  74. package/dist/cjs/credential.helpers-04044bbd.js.map +1 -0
  75. package/dist/cjs/icons-0404f605.js.map +1 -1
  76. package/dist/cjs/index-5488badc.js.map +1 -1
  77. package/dist/cjs/index-7cd11826.js.map +1 -1
  78. package/dist/cjs/index-c831a2f6.js +2448 -0
  79. package/dist/cjs/index-c831a2f6.js.map +1 -0
  80. package/dist/cjs/{index-8082a131.js → index-ec1d26f1.js} +17 -21
  81. package/dist/cjs/index-ec1d26f1.js.map +1 -0
  82. package/dist/cjs/index.js +52 -52
  83. package/dist/cjs/index10.js +6 -6
  84. package/dist/cjs/index12.js +1 -1
  85. package/dist/cjs/index13.js +52 -52
  86. package/dist/cjs/index17.js +2 -2
  87. package/dist/cjs/index19.js +1 -1
  88. package/dist/cjs/index2.js +21 -21
  89. package/dist/cjs/index21.js +8 -7
  90. package/dist/cjs/index21.js.map +1 -1
  91. package/dist/cjs/index27.js +2 -2
  92. package/dist/cjs/index29.js +1 -1
  93. package/dist/cjs/index3.js +2 -2
  94. package/dist/cjs/index30.js +1 -2
  95. package/dist/cjs/index30.js.map +1 -1
  96. package/dist/cjs/index33.js +3 -3
  97. package/dist/cjs/index37.js +13 -13
  98. package/dist/cjs/index38.js +5 -4
  99. package/dist/cjs/index38.js.map +1 -1
  100. package/dist/cjs/index39.js +6 -5
  101. package/dist/cjs/index39.js.map +1 -1
  102. package/dist/cjs/index4.js +19 -19
  103. package/dist/cjs/index40.js +9 -9
  104. package/dist/cjs/index41.js +2 -1
  105. package/dist/cjs/index41.js.map +1 -1
  106. package/dist/cjs/index44.js +2 -2
  107. package/dist/cjs/index6.js +7 -6
  108. package/dist/cjs/index6.js.map +1 -1
  109. package/dist/cjs/notifications-56c6fc94.js.map +1 -1
  110. package/dist/cjs/types-8eab1382.js.map +1 -1
  111. package/dist/cjs/types-e4d9a257.js.map +1 -1
  112. package/dist/cjs/{types.esm-c33cbec2.js → types.esm-41aaa0d4.js} +50 -40
  113. package/dist/cjs/types.esm-41aaa0d4.js.map +1 -0
  114. package/dist/esm/{AchievementCard-1d5d1b61.js → AchievementCard-017092a3.js} +4 -4
  115. package/dist/esm/{AchievementCard-1d5d1b61.js.map → AchievementCard-017092a3.js.map} +1 -1
  116. package/dist/esm/{BoostGenericCard-de8e2a84.js → BoostGenericCard-f5200b85.js} +4 -4
  117. package/dist/esm/BoostGenericCard-f5200b85.js.map +1 -0
  118. package/dist/esm/{BoostSmallCard-902844fc.js → BoostSmallCard-7180158e.js} +6 -6
  119. package/dist/esm/BoostSmallCard-7180158e.js.map +1 -0
  120. package/dist/esm/Button-5f805204.js.map +1 -1
  121. package/dist/esm/{CertificateDisplayCard-b69fd06f.js → CertificateDisplayCard-6b7a31bc.js} +31 -19
  122. package/dist/{cjs/CertificateDisplayCard-11ebf814.js.map → esm/CertificateDisplayCard-6b7a31bc.js.map} +1 -1
  123. package/dist/esm/Checkmark-d8b8f43d.js.map +1 -1
  124. package/dist/esm/CircleCheckButton-5a97f071.js.map +1 -1
  125. package/dist/esm/CircleIcon-4200733b.js.map +1 -1
  126. package/dist/esm/CircleSpinner-9b8b1a6b.js.map +1 -1
  127. package/dist/esm/Coins-ed119ec6.js.map +1 -1
  128. package/dist/esm/CourseCard-663ff174.js.map +1 -1
  129. package/dist/esm/{CourseVerticalCard-6b11b2a1.js → CourseVerticalCard-130b0d91.js} +3 -3
  130. package/dist/esm/{CourseVerticalCard-6b11b2a1.js.map → CourseVerticalCard-130b0d91.js.map} +1 -1
  131. package/dist/esm/FlippyCard-a2de5cf1.js.map +1 -1
  132. package/dist/esm/GenericArrow-0dba1707.js.map +1 -1
  133. package/dist/esm/{GenericCard-7b21d3e2.js → GenericCard-fe56887c.js} +4 -5
  134. package/dist/esm/GenericCard-fe56887c.js.map +1 -0
  135. package/dist/esm/JobHistoryCard-80d4ef27.js.map +1 -1
  136. package/dist/esm/JobListCard-1299ff04.js.map +1 -1
  137. package/dist/esm/LearnCardCreditCardBackFace-9baa9e6b.js.map +1 -1
  138. package/dist/esm/{LearnCardCreditCardFrontFace-f61b789c.js → LearnCardCreditCardFrontFace-d50efb25.js} +2 -2
  139. package/dist/esm/{LearnCardCreditCardFrontFace-f61b789c.js.map → LearnCardCreditCardFrontFace-d50efb25.js.map} +1 -1
  140. package/dist/esm/LearnPill-b8885ed1.js.map +1 -1
  141. package/dist/esm/{Lightbox-a1aab9ea.js → Lightbox-883afe8f.js} +22 -19
  142. package/dist/esm/{Lightbox-a1aab9ea.js.map → Lightbox-883afe8f.js.map} +1 -1
  143. package/dist/esm/Lightbulb-b6eca510.js.map +1 -1
  144. package/dist/esm/{MeritBadgeDisplayCard-575a61ed.js → MeritBadgeDisplayCard-0fd4c3c7.js} +23 -17
  145. package/dist/{cjs/MeritBadgeDisplayCard-70930ef2.js.map → esm/MeritBadgeDisplayCard-0fd4c3c7.js.map} +1 -1
  146. package/dist/esm/{MeritBadgeSkillsCount-8f371ab1.js → MeritBadgeSkillsCount-d0c9dd6e.js} +10 -4
  147. package/dist/esm/{MeritBadgeSkillsCount-8f371ab1.js.map → MeritBadgeSkillsCount-d0c9dd6e.js.map} +1 -1
  148. package/dist/esm/MiniVCThumbnail-6a07e810.js.map +1 -1
  149. package/dist/esm/Notification-95d159d2.js.map +1 -1
  150. package/dist/esm/NotificationBoostCard-e614c341.js.map +1 -1
  151. package/dist/esm/NotificationUserAcceptedBoostCard-8c13bd3f.js.map +1 -1
  152. package/dist/esm/NotificationUserCard-dbcc80f9.js.map +1 -1
  153. package/dist/esm/PuzzlePiece-1fb12c2e.js.map +1 -1
  154. package/dist/esm/{QRCodeCard-79d4d253.js → QRCodeCard-aa2b9967.js} +2 -2
  155. package/dist/esm/{QRCodeCard-79d4d253.js.map → QRCodeCard-aa2b9967.js.map} +1 -1
  156. package/dist/esm/QRCodeIcon-e9569804.js.map +1 -1
  157. package/dist/esm/RoundedPill-6a6e8aaf.js.map +1 -1
  158. package/dist/esm/{SchoolIDCard-01422d53.js → SchoolIDCard-5abd1bd9.js} +1205 -9
  159. package/dist/esm/SchoolIDCard-5abd1bd9.js.map +1 -0
  160. package/dist/esm/{SkillTabCard-8177895b.js → SkillTabCard-cfe117a2.js} +2 -2
  161. package/dist/esm/{SkillTabCard-8177895b.js.map → SkillTabCard-cfe117a2.js.map} +1 -1
  162. package/dist/esm/SkillVerticalCard-108f49bb.js.map +1 -1
  163. package/dist/esm/SkillsCard-92a51db2.js.map +1 -1
  164. package/dist/esm/SkillsStatsCard-1628fe9c.js.map +1 -1
  165. package/dist/esm/SmallAchievementCard-d0220751.js.map +1 -1
  166. package/dist/esm/Trophy-ad67f46a.js.map +1 -1
  167. package/dist/esm/User-161c7f37.js.map +1 -1
  168. package/dist/esm/{VCCard-6c8c3ff1.js → VCCard-aa590ccb.js} +4 -18
  169. package/dist/{cjs/VCCard-cf3590eb.js.map → esm/VCCard-aa590ccb.js.map} +1 -1
  170. package/dist/esm/{VCDisplayBackFace-c618851f.js → VCDisplayBackFace-ac7bbe0b.js} +3 -3
  171. package/dist/esm/{VCDisplayBackFace-c618851f.js.map → VCDisplayBackFace-ac7bbe0b.js.map} +1 -1
  172. package/dist/esm/{VCDisplayCard-fb298063.js → VCDisplayCard-b7dc3160.js} +3 -3
  173. package/dist/esm/{VCDisplayCard-fb298063.js.map → VCDisplayCard-b7dc3160.js.map} +1 -1
  174. package/dist/esm/{VCDisplayCard2-06c93532.js → VCDisplayCard2-b8e77e57.js} +67 -48
  175. package/dist/{cjs/VCDisplayCard2-19613b61.js.map → esm/VCDisplayCard2-b8e77e57.js.map} +1 -1
  176. package/dist/esm/VCThumbnail-3c254bda.js.map +1 -1
  177. package/dist/esm/VCVerificationCheck-80249524.js.map +1 -1
  178. package/dist/esm/{VCVerificationPill-dc9dda81.js → VCVerificationPill-43167fd5.js} +2 -2
  179. package/dist/esm/{VCVerificationPill-dc9dda81.js.map → VCVerificationPill-43167fd5.js.map} +1 -1
  180. package/dist/esm/{VerifierStateBadgeAndText-86214479.js → VerifierStateBadgeAndText-26578052.js} +14 -7
  181. package/dist/esm/VerifierStateBadgeAndText-26578052.js.map +1 -0
  182. package/dist/esm/constants-a7601fa8.js.map +1 -1
  183. package/dist/esm/{credential.helpers-cdc2f4a3.js → credential.helpers-93170224.js} +801 -1231
  184. package/dist/esm/credential.helpers-93170224.js.map +1 -0
  185. package/dist/esm/icons-03afd795.js.map +1 -1
  186. package/dist/esm/index-28917993.js.map +1 -1
  187. package/dist/esm/{index-dff96076.js → index-2ef835bd.js} +17 -21
  188. package/dist/esm/index-2ef835bd.js.map +1 -0
  189. package/dist/esm/index-5d5219f7.js.map +1 -1
  190. package/dist/esm/index-705f3821.js +2438 -0
  191. package/dist/esm/index-705f3821.js.map +1 -0
  192. package/dist/esm/index.js +42 -42
  193. package/dist/esm/index10.js +6 -6
  194. package/dist/esm/index12.js +1 -1
  195. package/dist/esm/index13.js +42 -42
  196. package/dist/esm/index17.js +2 -2
  197. package/dist/esm/index19.js +1 -1
  198. package/dist/esm/index2.js +21 -21
  199. package/dist/esm/index21.js +8 -7
  200. package/dist/esm/index21.js.map +1 -1
  201. package/dist/esm/index27.js +2 -2
  202. package/dist/esm/index3.js +2 -2
  203. package/dist/esm/index30.js +1 -2
  204. package/dist/esm/index30.js.map +1 -1
  205. package/dist/esm/index33.js +3 -3
  206. package/dist/esm/index37.js +13 -13
  207. package/dist/esm/index38.js +5 -4
  208. package/dist/esm/index38.js.map +1 -1
  209. package/dist/esm/index39.js +6 -5
  210. package/dist/esm/index39.js.map +1 -1
  211. package/dist/esm/index4.js +19 -19
  212. package/dist/esm/index40.js +9 -9
  213. package/dist/esm/index41.js +2 -1
  214. package/dist/esm/index41.js.map +1 -1
  215. package/dist/esm/index44.js +2 -2
  216. package/dist/esm/index6.js +7 -6
  217. package/dist/esm/index6.js.map +1 -1
  218. package/dist/esm/notifications-009bbd80.js.map +1 -1
  219. package/dist/esm/types-b32d28d5.js.map +1 -1
  220. package/dist/esm/types-cfde3c2b.js.map +1 -1
  221. package/dist/esm/{types.esm-4ec5392e.js → types.esm-3a1994d5.js} +50 -40
  222. package/dist/esm/types.esm-3a1994d5.js.map +1 -0
  223. package/dist/main.css +1 -1
  224. package/dist/main.js +1 -1
  225. package/package.json +3 -3
  226. package/dist/cjs/BoostGenericCard-e540e459.js.map +0 -1
  227. package/dist/cjs/BoostSmallCard-9dc75a95.js.map +0 -1
  228. package/dist/cjs/GenericCard-46248807.js.map +0 -1
  229. package/dist/cjs/SchoolIDCard-c7b4153a.js.map +0 -1
  230. package/dist/cjs/VerifierStateBadgeAndText-fd0bd814.js.map +0 -1
  231. package/dist/cjs/credential.helpers-afb94f02.js.map +0 -1
  232. package/dist/cjs/index-8082a131.js.map +0 -1
  233. package/dist/cjs/index-838fa72c.js +0 -1186
  234. package/dist/cjs/index-838fa72c.js.map +0 -1
  235. package/dist/cjs/types.esm-c33cbec2.js.map +0 -1
  236. package/dist/esm/BoostGenericCard-de8e2a84.js.map +0 -1
  237. package/dist/esm/BoostSmallCard-902844fc.js.map +0 -1
  238. package/dist/esm/GenericCard-7b21d3e2.js.map +0 -1
  239. package/dist/esm/SchoolIDCard-01422d53.js.map +0 -1
  240. package/dist/esm/VerifierStateBadgeAndText-86214479.js.map +0 -1
  241. package/dist/esm/credential.helpers-cdc2f4a3.js.map +0 -1
  242. package/dist/esm/index-4fa491c1.js +0 -1184
  243. package/dist/esm/index-4fa491c1.js.map +0 -1
  244. package/dist/esm/index-dff96076.js.map +0 -1
  245. package/dist/esm/types.esm-4ec5392e.js.map +0 -1
@@ -0,0 +1,2448 @@
1
+ 'use strict';
2
+
3
+ function _typeof(o) {
4
+ "@babel/helpers - typeof";
5
+
6
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
7
+ return typeof o;
8
+ } : function (o) {
9
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
10
+ }, _typeof(o);
11
+ }
12
+
13
+ function toInteger(dirtyNumber) {
14
+ if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
15
+ return NaN;
16
+ }
17
+ var number = Number(dirtyNumber);
18
+ if (isNaN(number)) {
19
+ return number;
20
+ }
21
+ return number < 0 ? Math.ceil(number) : Math.floor(number);
22
+ }
23
+
24
+ function requiredArgs(required, args) {
25
+ if (args.length < required) {
26
+ throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
27
+ }
28
+ }
29
+
30
+ /**
31
+ * @name toDate
32
+ * @category Common Helpers
33
+ * @summary Convert the given argument to an instance of Date.
34
+ *
35
+ * @description
36
+ * Convert the given argument to an instance of Date.
37
+ *
38
+ * If the argument is an instance of Date, the function returns its clone.
39
+ *
40
+ * If the argument is a number, it is treated as a timestamp.
41
+ *
42
+ * If the argument is none of the above, the function returns Invalid Date.
43
+ *
44
+ * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
45
+ *
46
+ * @param {Date|Number} argument - the value to convert
47
+ * @returns {Date} the parsed date in the local time zone
48
+ * @throws {TypeError} 1 argument required
49
+ *
50
+ * @example
51
+ * // Clone the date:
52
+ * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
53
+ * //=> Tue Feb 11 2014 11:30:30
54
+ *
55
+ * @example
56
+ * // Convert the timestamp to date:
57
+ * const result = toDate(1392098430000)
58
+ * //=> Tue Feb 11 2014 11:30:30
59
+ */
60
+ function toDate(argument) {
61
+ requiredArgs(1, arguments);
62
+ var argStr = Object.prototype.toString.call(argument);
63
+
64
+ // Clone the date
65
+ if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
66
+ // Prevent the date to lose the milliseconds when passed to new Date() in IE10
67
+ return new Date(argument.getTime());
68
+ } else if (typeof argument === 'number' || argStr === '[object Number]') {
69
+ return new Date(argument);
70
+ } else {
71
+ if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
72
+ // eslint-disable-next-line no-console
73
+ console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
74
+ // eslint-disable-next-line no-console
75
+ console.warn(new Error().stack);
76
+ }
77
+ return new Date(NaN);
78
+ }
79
+ }
80
+
81
+ var defaultOptions = {};
82
+ function getDefaultOptions() {
83
+ return defaultOptions;
84
+ }
85
+
86
+ /**
87
+ * Days in 1 week.
88
+ *
89
+ * @name daysInWeek
90
+ * @constant
91
+ * @type {number}
92
+ * @default
93
+ */
94
+
95
+ /**
96
+ * Milliseconds in 1 minute
97
+ *
98
+ * @name millisecondsInMinute
99
+ * @constant
100
+ * @type {number}
101
+ * @default
102
+ */
103
+ var millisecondsInMinute = 60000;
104
+
105
+ /**
106
+ * Milliseconds in 1 hour
107
+ *
108
+ * @name millisecondsInHour
109
+ * @constant
110
+ * @type {number}
111
+ * @default
112
+ */
113
+ var millisecondsInHour = 3600000;
114
+
115
+ /**
116
+ * Milliseconds in 1 second
117
+ *
118
+ * @name millisecondsInSecond
119
+ * @constant
120
+ * @type {number}
121
+ * @default
122
+ */
123
+ var millisecondsInSecond = 1000;
124
+
125
+ function startOfUTCISOWeek(dirtyDate) {
126
+ requiredArgs(1, arguments);
127
+ var weekStartsOn = 1;
128
+ var date = toDate(dirtyDate);
129
+ var day = date.getUTCDay();
130
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
131
+ date.setUTCDate(date.getUTCDate() - diff);
132
+ date.setUTCHours(0, 0, 0, 0);
133
+ return date;
134
+ }
135
+
136
+ function getUTCISOWeekYear(dirtyDate) {
137
+ requiredArgs(1, arguments);
138
+ var date = toDate(dirtyDate);
139
+ var year = date.getUTCFullYear();
140
+ var fourthOfJanuaryOfNextYear = new Date(0);
141
+ fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
142
+ fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
143
+ var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
144
+ var fourthOfJanuaryOfThisYear = new Date(0);
145
+ fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
146
+ fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
147
+ var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
148
+ if (date.getTime() >= startOfNextYear.getTime()) {
149
+ return year + 1;
150
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
151
+ return year;
152
+ } else {
153
+ return year - 1;
154
+ }
155
+ }
156
+
157
+ function startOfUTCISOWeekYear(dirtyDate) {
158
+ requiredArgs(1, arguments);
159
+ var year = getUTCISOWeekYear(dirtyDate);
160
+ var fourthOfJanuary = new Date(0);
161
+ fourthOfJanuary.setUTCFullYear(year, 0, 4);
162
+ fourthOfJanuary.setUTCHours(0, 0, 0, 0);
163
+ var date = startOfUTCISOWeek(fourthOfJanuary);
164
+ return date;
165
+ }
166
+
167
+ var MILLISECONDS_IN_WEEK$1 = 604800000;
168
+ function getUTCISOWeek(dirtyDate) {
169
+ requiredArgs(1, arguments);
170
+ var date = toDate(dirtyDate);
171
+ var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
172
+
173
+ // Round the number of days to the nearest integer
174
+ // because the number of milliseconds in a week is not constant
175
+ // (e.g. it's different in the week of the daylight saving time clock shift)
176
+ return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
177
+ }
178
+
179
+ function startOfUTCWeek(dirtyDate, options) {
180
+ var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
181
+ requiredArgs(1, arguments);
182
+ var defaultOptions = getDefaultOptions();
183
+ var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);
184
+
185
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
186
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
187
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
188
+ }
189
+ var date = toDate(dirtyDate);
190
+ var day = date.getUTCDay();
191
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
192
+ date.setUTCDate(date.getUTCDate() - diff);
193
+ date.setUTCHours(0, 0, 0, 0);
194
+ return date;
195
+ }
196
+
197
+ function getUTCWeekYear(dirtyDate, options) {
198
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
199
+ requiredArgs(1, arguments);
200
+ var date = toDate(dirtyDate);
201
+ var year = date.getUTCFullYear();
202
+ var defaultOptions = getDefaultOptions();
203
+ var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : 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.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== 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.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
204
+
205
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
206
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
207
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
208
+ }
209
+ var firstWeekOfNextYear = new Date(0);
210
+ firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
211
+ firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
212
+ var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
213
+ var firstWeekOfThisYear = new Date(0);
214
+ firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
215
+ firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
216
+ var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
217
+ if (date.getTime() >= startOfNextYear.getTime()) {
218
+ return year + 1;
219
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
220
+ return year;
221
+ } else {
222
+ return year - 1;
223
+ }
224
+ }
225
+
226
+ function startOfUTCWeekYear(dirtyDate, options) {
227
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
228
+ requiredArgs(1, arguments);
229
+ var defaultOptions = getDefaultOptions();
230
+ var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : 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.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== 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.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
231
+ var year = getUTCWeekYear(dirtyDate, options);
232
+ var firstWeek = new Date(0);
233
+ firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
234
+ firstWeek.setUTCHours(0, 0, 0, 0);
235
+ var date = startOfUTCWeek(firstWeek, options);
236
+ return date;
237
+ }
238
+
239
+ var MILLISECONDS_IN_WEEK = 604800000;
240
+ function getUTCWeek(dirtyDate, options) {
241
+ requiredArgs(1, arguments);
242
+ var date = toDate(dirtyDate);
243
+ var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
244
+
245
+ // Round the number of days to the nearest integer
246
+ // because the number of milliseconds in a week is not constant
247
+ // (e.g. it's different in the week of the daylight saving time clock shift)
248
+ return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
249
+ }
250
+
251
+ function _assertThisInitialized(e) {
252
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
253
+ return e;
254
+ }
255
+
256
+ function _setPrototypeOf(t, e) {
257
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
258
+ return t.__proto__ = e, t;
259
+ }, _setPrototypeOf(t, e);
260
+ }
261
+
262
+ function _inherits(t, e) {
263
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
264
+ t.prototype = Object.create(e && e.prototype, {
265
+ constructor: {
266
+ value: t,
267
+ writable: !0,
268
+ configurable: !0
269
+ }
270
+ }), Object.defineProperty(t, "prototype", {
271
+ writable: !1
272
+ }), e && _setPrototypeOf(t, e);
273
+ }
274
+
275
+ function _getPrototypeOf(t) {
276
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
277
+ return t.__proto__ || Object.getPrototypeOf(t);
278
+ }, _getPrototypeOf(t);
279
+ }
280
+
281
+ function _isNativeReflectConstruct() {
282
+ try {
283
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
284
+ } catch (t) {}
285
+ return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
286
+ return !!t;
287
+ })();
288
+ }
289
+
290
+ function _possibleConstructorReturn(t, e) {
291
+ if (e && ("object" == _typeof(e) || "function" == typeof e)) return e;
292
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
293
+ return _assertThisInitialized(t);
294
+ }
295
+
296
+ function _createSuper(t) {
297
+ var r = _isNativeReflectConstruct();
298
+ return function () {
299
+ var e,
300
+ o = _getPrototypeOf(t);
301
+ if (r) {
302
+ var s = _getPrototypeOf(this).constructor;
303
+ e = Reflect.construct(o, arguments, s);
304
+ } else e = o.apply(this, arguments);
305
+ return _possibleConstructorReturn(this, e);
306
+ };
307
+ }
308
+
309
+ function _classCallCheck(a, n) {
310
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
311
+ }
312
+
313
+ function toPrimitive(t, r) {
314
+ if ("object" != _typeof(t) || !t) return t;
315
+ var e = t[Symbol.toPrimitive];
316
+ if (void 0 !== e) {
317
+ var i = e.call(t, r || "default");
318
+ if ("object" != _typeof(i)) return i;
319
+ throw new TypeError("@@toPrimitive must return a primitive value.");
320
+ }
321
+ return ("string" === r ? String : Number)(t);
322
+ }
323
+
324
+ function toPropertyKey(t) {
325
+ var i = toPrimitive(t, "string");
326
+ return "symbol" == _typeof(i) ? i : i + "";
327
+ }
328
+
329
+ function _defineProperties(e, r) {
330
+ for (var t = 0; t < r.length; t++) {
331
+ var o = r[t];
332
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
333
+ }
334
+ }
335
+ function _createClass(e, r, t) {
336
+ return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
337
+ writable: !1
338
+ }), e;
339
+ }
340
+
341
+ function _defineProperty(e, r, t) {
342
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
343
+ value: t,
344
+ enumerable: !0,
345
+ configurable: !0,
346
+ writable: !0
347
+ }) : e[r] = t, e;
348
+ }
349
+
350
+ var Setter = /*#__PURE__*/function () {
351
+ function Setter() {
352
+ _classCallCheck(this, Setter);
353
+ _defineProperty(this, "priority", void 0);
354
+ _defineProperty(this, "subPriority", 0);
355
+ }
356
+ _createClass(Setter, [{
357
+ key: "validate",
358
+ value: function validate(_utcDate, _options) {
359
+ return true;
360
+ }
361
+ }]);
362
+ return Setter;
363
+ }();
364
+ var ValueSetter = /*#__PURE__*/function (_Setter) {
365
+ _inherits(ValueSetter, _Setter);
366
+ var _super = _createSuper(ValueSetter);
367
+ function ValueSetter(value, validateValue, setValue, priority, subPriority) {
368
+ var _this;
369
+ _classCallCheck(this, ValueSetter);
370
+ _this = _super.call(this);
371
+ _this.value = value;
372
+ _this.validateValue = validateValue;
373
+ _this.setValue = setValue;
374
+ _this.priority = priority;
375
+ if (subPriority) {
376
+ _this.subPriority = subPriority;
377
+ }
378
+ return _this;
379
+ }
380
+ _createClass(ValueSetter, [{
381
+ key: "validate",
382
+ value: function validate(utcDate, options) {
383
+ return this.validateValue(utcDate, this.value, options);
384
+ }
385
+ }, {
386
+ key: "set",
387
+ value: function set(utcDate, flags, options) {
388
+ return this.setValue(utcDate, flags, this.value, options);
389
+ }
390
+ }]);
391
+ return ValueSetter;
392
+ }(Setter);
393
+
394
+ var Parser = /*#__PURE__*/function () {
395
+ function Parser() {
396
+ _classCallCheck(this, Parser);
397
+ _defineProperty(this, "incompatibleTokens", void 0);
398
+ _defineProperty(this, "priority", void 0);
399
+ _defineProperty(this, "subPriority", void 0);
400
+ }
401
+ _createClass(Parser, [{
402
+ key: "run",
403
+ value: function run(dateString, token, match, options) {
404
+ var result = this.parse(dateString, token, match, options);
405
+ if (!result) {
406
+ return null;
407
+ }
408
+ return {
409
+ setter: new ValueSetter(result.value, this.validate, this.set, this.priority, this.subPriority),
410
+ rest: result.rest
411
+ };
412
+ }
413
+ }, {
414
+ key: "validate",
415
+ value: function validate(_utcDate, _value, _options) {
416
+ return true;
417
+ }
418
+ }]);
419
+ return Parser;
420
+ }();
421
+
422
+ var EraParser = /*#__PURE__*/function (_Parser) {
423
+ _inherits(EraParser, _Parser);
424
+ var _super = _createSuper(EraParser);
425
+ function EraParser() {
426
+ var _this;
427
+ _classCallCheck(this, EraParser);
428
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
429
+ args[_key] = arguments[_key];
430
+ }
431
+ _this = _super.call.apply(_super, [this].concat(args));
432
+ _defineProperty(_assertThisInitialized(_this), "priority", 140);
433
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['R', 'u', 't', 'T']);
434
+ return _this;
435
+ }
436
+ _createClass(EraParser, [{
437
+ key: "parse",
438
+ value: function parse(dateString, token, match) {
439
+ switch (token) {
440
+ // AD, BC
441
+ case 'G':
442
+ case 'GG':
443
+ case 'GGG':
444
+ return match.era(dateString, {
445
+ width: 'abbreviated'
446
+ }) || match.era(dateString, {
447
+ width: 'narrow'
448
+ });
449
+ // A, B
450
+ case 'GGGGG':
451
+ return match.era(dateString, {
452
+ width: 'narrow'
453
+ });
454
+ // Anno Domini, Before Christ
455
+ case 'GGGG':
456
+ default:
457
+ return match.era(dateString, {
458
+ width: 'wide'
459
+ }) || match.era(dateString, {
460
+ width: 'abbreviated'
461
+ }) || match.era(dateString, {
462
+ width: 'narrow'
463
+ });
464
+ }
465
+ }
466
+ }, {
467
+ key: "set",
468
+ value: function set(date, flags, value) {
469
+ flags.era = value;
470
+ date.setUTCFullYear(value, 0, 1);
471
+ date.setUTCHours(0, 0, 0, 0);
472
+ return date;
473
+ }
474
+ }]);
475
+ return EraParser;
476
+ }(Parser);
477
+
478
+ var numericPatterns = {
479
+ month: /^(1[0-2]|0?\d)/,
480
+ // 0 to 12
481
+ date: /^(3[0-1]|[0-2]?\d)/,
482
+ // 0 to 31
483
+ dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,
484
+ // 0 to 366
485
+ week: /^(5[0-3]|[0-4]?\d)/,
486
+ // 0 to 53
487
+ hour23h: /^(2[0-3]|[0-1]?\d)/,
488
+ // 0 to 23
489
+ hour24h: /^(2[0-4]|[0-1]?\d)/,
490
+ // 0 to 24
491
+ hour11h: /^(1[0-1]|0?\d)/,
492
+ // 0 to 11
493
+ hour12h: /^(1[0-2]|0?\d)/,
494
+ // 0 to 12
495
+ minute: /^[0-5]?\d/,
496
+ // 0 to 59
497
+ second: /^[0-5]?\d/,
498
+ // 0 to 59
499
+
500
+ singleDigit: /^\d/,
501
+ // 0 to 9
502
+ twoDigits: /^\d{1,2}/,
503
+ // 0 to 99
504
+ threeDigits: /^\d{1,3}/,
505
+ // 0 to 999
506
+ fourDigits: /^\d{1,4}/,
507
+ // 0 to 9999
508
+
509
+ anyDigitsSigned: /^-?\d+/,
510
+ singleDigitSigned: /^-?\d/,
511
+ // 0 to 9, -0 to -9
512
+ twoDigitsSigned: /^-?\d{1,2}/,
513
+ // 0 to 99, -0 to -99
514
+ threeDigitsSigned: /^-?\d{1,3}/,
515
+ // 0 to 999, -0 to -999
516
+ fourDigitsSigned: /^-?\d{1,4}/ // 0 to 9999, -0 to -9999
517
+ };
518
+
519
+ var timezonePatterns = {
520
+ basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/,
521
+ basic: /^([+-])(\d{2})(\d{2})|Z/,
522
+ basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,
523
+ extended: /^([+-])(\d{2}):(\d{2})|Z/,
524
+ extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/
525
+ };
526
+
527
+ function mapValue(parseFnResult, mapFn) {
528
+ if (!parseFnResult) {
529
+ return parseFnResult;
530
+ }
531
+ return {
532
+ value: mapFn(parseFnResult.value),
533
+ rest: parseFnResult.rest
534
+ };
535
+ }
536
+ function parseNumericPattern(pattern, dateString) {
537
+ var matchResult = dateString.match(pattern);
538
+ if (!matchResult) {
539
+ return null;
540
+ }
541
+ return {
542
+ value: parseInt(matchResult[0], 10),
543
+ rest: dateString.slice(matchResult[0].length)
544
+ };
545
+ }
546
+ function parseTimezonePattern(pattern, dateString) {
547
+ var matchResult = dateString.match(pattern);
548
+ if (!matchResult) {
549
+ return null;
550
+ }
551
+
552
+ // Input is 'Z'
553
+ if (matchResult[0] === 'Z') {
554
+ return {
555
+ value: 0,
556
+ rest: dateString.slice(1)
557
+ };
558
+ }
559
+ var sign = matchResult[1] === '+' ? 1 : -1;
560
+ var hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;
561
+ var minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;
562
+ var seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;
563
+ return {
564
+ value: sign * (hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * millisecondsInSecond),
565
+ rest: dateString.slice(matchResult[0].length)
566
+ };
567
+ }
568
+ function parseAnyDigitsSigned(dateString) {
569
+ return parseNumericPattern(numericPatterns.anyDigitsSigned, dateString);
570
+ }
571
+ function parseNDigits(n, dateString) {
572
+ switch (n) {
573
+ case 1:
574
+ return parseNumericPattern(numericPatterns.singleDigit, dateString);
575
+ case 2:
576
+ return parseNumericPattern(numericPatterns.twoDigits, dateString);
577
+ case 3:
578
+ return parseNumericPattern(numericPatterns.threeDigits, dateString);
579
+ case 4:
580
+ return parseNumericPattern(numericPatterns.fourDigits, dateString);
581
+ default:
582
+ return parseNumericPattern(new RegExp('^\\d{1,' + n + '}'), dateString);
583
+ }
584
+ }
585
+ function parseNDigitsSigned(n, dateString) {
586
+ switch (n) {
587
+ case 1:
588
+ return parseNumericPattern(numericPatterns.singleDigitSigned, dateString);
589
+ case 2:
590
+ return parseNumericPattern(numericPatterns.twoDigitsSigned, dateString);
591
+ case 3:
592
+ return parseNumericPattern(numericPatterns.threeDigitsSigned, dateString);
593
+ case 4:
594
+ return parseNumericPattern(numericPatterns.fourDigitsSigned, dateString);
595
+ default:
596
+ return parseNumericPattern(new RegExp('^-?\\d{1,' + n + '}'), dateString);
597
+ }
598
+ }
599
+ function dayPeriodEnumToHours(dayPeriod) {
600
+ switch (dayPeriod) {
601
+ case 'morning':
602
+ return 4;
603
+ case 'evening':
604
+ return 17;
605
+ case 'pm':
606
+ case 'noon':
607
+ case 'afternoon':
608
+ return 12;
609
+ case 'am':
610
+ case 'midnight':
611
+ case 'night':
612
+ default:
613
+ return 0;
614
+ }
615
+ }
616
+ function normalizeTwoDigitYear(twoDigitYear, currentYear) {
617
+ var isCommonEra = currentYear > 0;
618
+ // Absolute number of the current year:
619
+ // 1 -> 1 AC
620
+ // 0 -> 1 BC
621
+ // -1 -> 2 BC
622
+ var absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;
623
+ var result;
624
+ if (absCurrentYear <= 50) {
625
+ result = twoDigitYear || 100;
626
+ } else {
627
+ var rangeEnd = absCurrentYear + 50;
628
+ var rangeEndCentury = Math.floor(rangeEnd / 100) * 100;
629
+ var isPreviousCentury = twoDigitYear >= rangeEnd % 100;
630
+ result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);
631
+ }
632
+ return isCommonEra ? result : 1 - result;
633
+ }
634
+ function isLeapYearIndex(year) {
635
+ return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
636
+ }
637
+
638
+ // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_Patterns
639
+ // | Year | y | yy | yyy | yyyy | yyyyy |
640
+ // |----------|-------|----|-------|-------|-------|
641
+ // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
642
+ // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
643
+ // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
644
+ // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
645
+ // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
646
+ var YearParser = /*#__PURE__*/function (_Parser) {
647
+ _inherits(YearParser, _Parser);
648
+ var _super = _createSuper(YearParser);
649
+ function YearParser() {
650
+ var _this;
651
+ _classCallCheck(this, YearParser);
652
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
653
+ args[_key] = arguments[_key];
654
+ }
655
+ _this = _super.call.apply(_super, [this].concat(args));
656
+ _defineProperty(_assertThisInitialized(_this), "priority", 130);
657
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['Y', 'R', 'u', 'w', 'I', 'i', 'e', 'c', 't', 'T']);
658
+ return _this;
659
+ }
660
+ _createClass(YearParser, [{
661
+ key: "parse",
662
+ value: function parse(dateString, token, match) {
663
+ var valueCallback = function valueCallback(year) {
664
+ return {
665
+ year: year,
666
+ isTwoDigitYear: token === 'yy'
667
+ };
668
+ };
669
+ switch (token) {
670
+ case 'y':
671
+ return mapValue(parseNDigits(4, dateString), valueCallback);
672
+ case 'yo':
673
+ return mapValue(match.ordinalNumber(dateString, {
674
+ unit: 'year'
675
+ }), valueCallback);
676
+ default:
677
+ return mapValue(parseNDigits(token.length, dateString), valueCallback);
678
+ }
679
+ }
680
+ }, {
681
+ key: "validate",
682
+ value: function validate(_date, value) {
683
+ return value.isTwoDigitYear || value.year > 0;
684
+ }
685
+ }, {
686
+ key: "set",
687
+ value: function set(date, flags, value) {
688
+ var currentYear = date.getUTCFullYear();
689
+ if (value.isTwoDigitYear) {
690
+ var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);
691
+ date.setUTCFullYear(normalizedTwoDigitYear, 0, 1);
692
+ date.setUTCHours(0, 0, 0, 0);
693
+ return date;
694
+ }
695
+ var year = !('era' in flags) || flags.era === 1 ? value.year : 1 - value.year;
696
+ date.setUTCFullYear(year, 0, 1);
697
+ date.setUTCHours(0, 0, 0, 0);
698
+ return date;
699
+ }
700
+ }]);
701
+ return YearParser;
702
+ }(Parser);
703
+
704
+ // Local week-numbering year
705
+ var LocalWeekYearParser = /*#__PURE__*/function (_Parser) {
706
+ _inherits(LocalWeekYearParser, _Parser);
707
+ var _super = _createSuper(LocalWeekYearParser);
708
+ function LocalWeekYearParser() {
709
+ var _this;
710
+ _classCallCheck(this, LocalWeekYearParser);
711
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
712
+ args[_key] = arguments[_key];
713
+ }
714
+ _this = _super.call.apply(_super, [this].concat(args));
715
+ _defineProperty(_assertThisInitialized(_this), "priority", 130);
716
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['y', 'R', 'u', 'Q', 'q', 'M', 'L', 'I', 'd', 'D', 'i', 't', 'T']);
717
+ return _this;
718
+ }
719
+ _createClass(LocalWeekYearParser, [{
720
+ key: "parse",
721
+ value: function parse(dateString, token, match) {
722
+ var valueCallback = function valueCallback(year) {
723
+ return {
724
+ year: year,
725
+ isTwoDigitYear: token === 'YY'
726
+ };
727
+ };
728
+ switch (token) {
729
+ case 'Y':
730
+ return mapValue(parseNDigits(4, dateString), valueCallback);
731
+ case 'Yo':
732
+ return mapValue(match.ordinalNumber(dateString, {
733
+ unit: 'year'
734
+ }), valueCallback);
735
+ default:
736
+ return mapValue(parseNDigits(token.length, dateString), valueCallback);
737
+ }
738
+ }
739
+ }, {
740
+ key: "validate",
741
+ value: function validate(_date, value) {
742
+ return value.isTwoDigitYear || value.year > 0;
743
+ }
744
+ }, {
745
+ key: "set",
746
+ value: function set(date, flags, value, options) {
747
+ var currentYear = getUTCWeekYear(date, options);
748
+ if (value.isTwoDigitYear) {
749
+ var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);
750
+ date.setUTCFullYear(normalizedTwoDigitYear, 0, options.firstWeekContainsDate);
751
+ date.setUTCHours(0, 0, 0, 0);
752
+ return startOfUTCWeek(date, options);
753
+ }
754
+ var year = !('era' in flags) || flags.era === 1 ? value.year : 1 - value.year;
755
+ date.setUTCFullYear(year, 0, options.firstWeekContainsDate);
756
+ date.setUTCHours(0, 0, 0, 0);
757
+ return startOfUTCWeek(date, options);
758
+ }
759
+ }]);
760
+ return LocalWeekYearParser;
761
+ }(Parser);
762
+
763
+ var ISOWeekYearParser = /*#__PURE__*/function (_Parser) {
764
+ _inherits(ISOWeekYearParser, _Parser);
765
+ var _super = _createSuper(ISOWeekYearParser);
766
+ function ISOWeekYearParser() {
767
+ var _this;
768
+ _classCallCheck(this, ISOWeekYearParser);
769
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
770
+ args[_key] = arguments[_key];
771
+ }
772
+ _this = _super.call.apply(_super, [this].concat(args));
773
+ _defineProperty(_assertThisInitialized(_this), "priority", 130);
774
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['G', 'y', 'Y', 'u', 'Q', 'q', 'M', 'L', 'w', 'd', 'D', 'e', 'c', 't', 'T']);
775
+ return _this;
776
+ }
777
+ _createClass(ISOWeekYearParser, [{
778
+ key: "parse",
779
+ value: function parse(dateString, token) {
780
+ if (token === 'R') {
781
+ return parseNDigitsSigned(4, dateString);
782
+ }
783
+ return parseNDigitsSigned(token.length, dateString);
784
+ }
785
+ }, {
786
+ key: "set",
787
+ value: function set(_date, _flags, value) {
788
+ var firstWeekOfYear = new Date(0);
789
+ firstWeekOfYear.setUTCFullYear(value, 0, 4);
790
+ firstWeekOfYear.setUTCHours(0, 0, 0, 0);
791
+ return startOfUTCISOWeek(firstWeekOfYear);
792
+ }
793
+ }]);
794
+ return ISOWeekYearParser;
795
+ }(Parser);
796
+
797
+ var ExtendedYearParser = /*#__PURE__*/function (_Parser) {
798
+ _inherits(ExtendedYearParser, _Parser);
799
+ var _super = _createSuper(ExtendedYearParser);
800
+ function ExtendedYearParser() {
801
+ var _this;
802
+ _classCallCheck(this, ExtendedYearParser);
803
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
804
+ args[_key] = arguments[_key];
805
+ }
806
+ _this = _super.call.apply(_super, [this].concat(args));
807
+ _defineProperty(_assertThisInitialized(_this), "priority", 130);
808
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['G', 'y', 'Y', 'R', 'w', 'I', 'i', 'e', 'c', 't', 'T']);
809
+ return _this;
810
+ }
811
+ _createClass(ExtendedYearParser, [{
812
+ key: "parse",
813
+ value: function parse(dateString, token) {
814
+ if (token === 'u') {
815
+ return parseNDigitsSigned(4, dateString);
816
+ }
817
+ return parseNDigitsSigned(token.length, dateString);
818
+ }
819
+ }, {
820
+ key: "set",
821
+ value: function set(date, _flags, value) {
822
+ date.setUTCFullYear(value, 0, 1);
823
+ date.setUTCHours(0, 0, 0, 0);
824
+ return date;
825
+ }
826
+ }]);
827
+ return ExtendedYearParser;
828
+ }(Parser);
829
+
830
+ var QuarterParser = /*#__PURE__*/function (_Parser) {
831
+ _inherits(QuarterParser, _Parser);
832
+ var _super = _createSuper(QuarterParser);
833
+ function QuarterParser() {
834
+ var _this;
835
+ _classCallCheck(this, QuarterParser);
836
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
837
+ args[_key] = arguments[_key];
838
+ }
839
+ _this = _super.call.apply(_super, [this].concat(args));
840
+ _defineProperty(_assertThisInitialized(_this), "priority", 120);
841
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['Y', 'R', 'q', 'M', 'L', 'w', 'I', 'd', 'D', 'i', 'e', 'c', 't', 'T']);
842
+ return _this;
843
+ }
844
+ _createClass(QuarterParser, [{
845
+ key: "parse",
846
+ value: function parse(dateString, token, match) {
847
+ switch (token) {
848
+ // 1, 2, 3, 4
849
+ case 'Q':
850
+ case 'QQ':
851
+ // 01, 02, 03, 04
852
+ return parseNDigits(token.length, dateString);
853
+ // 1st, 2nd, 3rd, 4th
854
+ case 'Qo':
855
+ return match.ordinalNumber(dateString, {
856
+ unit: 'quarter'
857
+ });
858
+ // Q1, Q2, Q3, Q4
859
+ case 'QQQ':
860
+ return match.quarter(dateString, {
861
+ width: 'abbreviated',
862
+ context: 'formatting'
863
+ }) || match.quarter(dateString, {
864
+ width: 'narrow',
865
+ context: 'formatting'
866
+ });
867
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
868
+ case 'QQQQQ':
869
+ return match.quarter(dateString, {
870
+ width: 'narrow',
871
+ context: 'formatting'
872
+ });
873
+ // 1st quarter, 2nd quarter, ...
874
+ case 'QQQQ':
875
+ default:
876
+ return match.quarter(dateString, {
877
+ width: 'wide',
878
+ context: 'formatting'
879
+ }) || match.quarter(dateString, {
880
+ width: 'abbreviated',
881
+ context: 'formatting'
882
+ }) || match.quarter(dateString, {
883
+ width: 'narrow',
884
+ context: 'formatting'
885
+ });
886
+ }
887
+ }
888
+ }, {
889
+ key: "validate",
890
+ value: function validate(_date, value) {
891
+ return value >= 1 && value <= 4;
892
+ }
893
+ }, {
894
+ key: "set",
895
+ value: function set(date, _flags, value) {
896
+ date.setUTCMonth((value - 1) * 3, 1);
897
+ date.setUTCHours(0, 0, 0, 0);
898
+ return date;
899
+ }
900
+ }]);
901
+ return QuarterParser;
902
+ }(Parser);
903
+
904
+ var StandAloneQuarterParser = /*#__PURE__*/function (_Parser) {
905
+ _inherits(StandAloneQuarterParser, _Parser);
906
+ var _super = _createSuper(StandAloneQuarterParser);
907
+ function StandAloneQuarterParser() {
908
+ var _this;
909
+ _classCallCheck(this, StandAloneQuarterParser);
910
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
911
+ args[_key] = arguments[_key];
912
+ }
913
+ _this = _super.call.apply(_super, [this].concat(args));
914
+ _defineProperty(_assertThisInitialized(_this), "priority", 120);
915
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['Y', 'R', 'Q', 'M', 'L', 'w', 'I', 'd', 'D', 'i', 'e', 'c', 't', 'T']);
916
+ return _this;
917
+ }
918
+ _createClass(StandAloneQuarterParser, [{
919
+ key: "parse",
920
+ value: function parse(dateString, token, match) {
921
+ switch (token) {
922
+ // 1, 2, 3, 4
923
+ case 'q':
924
+ case 'qq':
925
+ // 01, 02, 03, 04
926
+ return parseNDigits(token.length, dateString);
927
+ // 1st, 2nd, 3rd, 4th
928
+ case 'qo':
929
+ return match.ordinalNumber(dateString, {
930
+ unit: 'quarter'
931
+ });
932
+ // Q1, Q2, Q3, Q4
933
+ case 'qqq':
934
+ return match.quarter(dateString, {
935
+ width: 'abbreviated',
936
+ context: 'standalone'
937
+ }) || match.quarter(dateString, {
938
+ width: 'narrow',
939
+ context: 'standalone'
940
+ });
941
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
942
+ case 'qqqqq':
943
+ return match.quarter(dateString, {
944
+ width: 'narrow',
945
+ context: 'standalone'
946
+ });
947
+ // 1st quarter, 2nd quarter, ...
948
+ case 'qqqq':
949
+ default:
950
+ return match.quarter(dateString, {
951
+ width: 'wide',
952
+ context: 'standalone'
953
+ }) || match.quarter(dateString, {
954
+ width: 'abbreviated',
955
+ context: 'standalone'
956
+ }) || match.quarter(dateString, {
957
+ width: 'narrow',
958
+ context: 'standalone'
959
+ });
960
+ }
961
+ }
962
+ }, {
963
+ key: "validate",
964
+ value: function validate(_date, value) {
965
+ return value >= 1 && value <= 4;
966
+ }
967
+ }, {
968
+ key: "set",
969
+ value: function set(date, _flags, value) {
970
+ date.setUTCMonth((value - 1) * 3, 1);
971
+ date.setUTCHours(0, 0, 0, 0);
972
+ return date;
973
+ }
974
+ }]);
975
+ return StandAloneQuarterParser;
976
+ }(Parser);
977
+
978
+ var MonthParser = /*#__PURE__*/function (_Parser) {
979
+ _inherits(MonthParser, _Parser);
980
+ var _super = _createSuper(MonthParser);
981
+ function MonthParser() {
982
+ var _this;
983
+ _classCallCheck(this, MonthParser);
984
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
985
+ args[_key] = arguments[_key];
986
+ }
987
+ _this = _super.call.apply(_super, [this].concat(args));
988
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['Y', 'R', 'q', 'Q', 'L', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']);
989
+ _defineProperty(_assertThisInitialized(_this), "priority", 110);
990
+ return _this;
991
+ }
992
+ _createClass(MonthParser, [{
993
+ key: "parse",
994
+ value: function parse(dateString, token, match) {
995
+ var valueCallback = function valueCallback(value) {
996
+ return value - 1;
997
+ };
998
+ switch (token) {
999
+ // 1, 2, ..., 12
1000
+ case 'M':
1001
+ return mapValue(parseNumericPattern(numericPatterns.month, dateString), valueCallback);
1002
+ // 01, 02, ..., 12
1003
+ case 'MM':
1004
+ return mapValue(parseNDigits(2, dateString), valueCallback);
1005
+ // 1st, 2nd, ..., 12th
1006
+ case 'Mo':
1007
+ return mapValue(match.ordinalNumber(dateString, {
1008
+ unit: 'month'
1009
+ }), valueCallback);
1010
+ // Jan, Feb, ..., Dec
1011
+ case 'MMM':
1012
+ return match.month(dateString, {
1013
+ width: 'abbreviated',
1014
+ context: 'formatting'
1015
+ }) || match.month(dateString, {
1016
+ width: 'narrow',
1017
+ context: 'formatting'
1018
+ });
1019
+ // J, F, ..., D
1020
+ case 'MMMMM':
1021
+ return match.month(dateString, {
1022
+ width: 'narrow',
1023
+ context: 'formatting'
1024
+ });
1025
+ // January, February, ..., December
1026
+ case 'MMMM':
1027
+ default:
1028
+ return match.month(dateString, {
1029
+ width: 'wide',
1030
+ context: 'formatting'
1031
+ }) || match.month(dateString, {
1032
+ width: 'abbreviated',
1033
+ context: 'formatting'
1034
+ }) || match.month(dateString, {
1035
+ width: 'narrow',
1036
+ context: 'formatting'
1037
+ });
1038
+ }
1039
+ }
1040
+ }, {
1041
+ key: "validate",
1042
+ value: function validate(_date, value) {
1043
+ return value >= 0 && value <= 11;
1044
+ }
1045
+ }, {
1046
+ key: "set",
1047
+ value: function set(date, _flags, value) {
1048
+ date.setUTCMonth(value, 1);
1049
+ date.setUTCHours(0, 0, 0, 0);
1050
+ return date;
1051
+ }
1052
+ }]);
1053
+ return MonthParser;
1054
+ }(Parser);
1055
+
1056
+ var StandAloneMonthParser = /*#__PURE__*/function (_Parser) {
1057
+ _inherits(StandAloneMonthParser, _Parser);
1058
+ var _super = _createSuper(StandAloneMonthParser);
1059
+ function StandAloneMonthParser() {
1060
+ var _this;
1061
+ _classCallCheck(this, StandAloneMonthParser);
1062
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1063
+ args[_key] = arguments[_key];
1064
+ }
1065
+ _this = _super.call.apply(_super, [this].concat(args));
1066
+ _defineProperty(_assertThisInitialized(_this), "priority", 110);
1067
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['Y', 'R', 'q', 'Q', 'M', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']);
1068
+ return _this;
1069
+ }
1070
+ _createClass(StandAloneMonthParser, [{
1071
+ key: "parse",
1072
+ value: function parse(dateString, token, match) {
1073
+ var valueCallback = function valueCallback(value) {
1074
+ return value - 1;
1075
+ };
1076
+ switch (token) {
1077
+ // 1, 2, ..., 12
1078
+ case 'L':
1079
+ return mapValue(parseNumericPattern(numericPatterns.month, dateString), valueCallback);
1080
+ // 01, 02, ..., 12
1081
+ case 'LL':
1082
+ return mapValue(parseNDigits(2, dateString), valueCallback);
1083
+ // 1st, 2nd, ..., 12th
1084
+ case 'Lo':
1085
+ return mapValue(match.ordinalNumber(dateString, {
1086
+ unit: 'month'
1087
+ }), valueCallback);
1088
+ // Jan, Feb, ..., Dec
1089
+ case 'LLL':
1090
+ return match.month(dateString, {
1091
+ width: 'abbreviated',
1092
+ context: 'standalone'
1093
+ }) || match.month(dateString, {
1094
+ width: 'narrow',
1095
+ context: 'standalone'
1096
+ });
1097
+ // J, F, ..., D
1098
+ case 'LLLLL':
1099
+ return match.month(dateString, {
1100
+ width: 'narrow',
1101
+ context: 'standalone'
1102
+ });
1103
+ // January, February, ..., December
1104
+ case 'LLLL':
1105
+ default:
1106
+ return match.month(dateString, {
1107
+ width: 'wide',
1108
+ context: 'standalone'
1109
+ }) || match.month(dateString, {
1110
+ width: 'abbreviated',
1111
+ context: 'standalone'
1112
+ }) || match.month(dateString, {
1113
+ width: 'narrow',
1114
+ context: 'standalone'
1115
+ });
1116
+ }
1117
+ }
1118
+ }, {
1119
+ key: "validate",
1120
+ value: function validate(_date, value) {
1121
+ return value >= 0 && value <= 11;
1122
+ }
1123
+ }, {
1124
+ key: "set",
1125
+ value: function set(date, _flags, value) {
1126
+ date.setUTCMonth(value, 1);
1127
+ date.setUTCHours(0, 0, 0, 0);
1128
+ return date;
1129
+ }
1130
+ }]);
1131
+ return StandAloneMonthParser;
1132
+ }(Parser);
1133
+
1134
+ function setUTCWeek(dirtyDate, dirtyWeek, options) {
1135
+ requiredArgs(2, arguments);
1136
+ var date = toDate(dirtyDate);
1137
+ var week = toInteger(dirtyWeek);
1138
+ var diff = getUTCWeek(date, options) - week;
1139
+ date.setUTCDate(date.getUTCDate() - diff * 7);
1140
+ return date;
1141
+ }
1142
+
1143
+ var LocalWeekParser = /*#__PURE__*/function (_Parser) {
1144
+ _inherits(LocalWeekParser, _Parser);
1145
+ var _super = _createSuper(LocalWeekParser);
1146
+ function LocalWeekParser() {
1147
+ var _this;
1148
+ _classCallCheck(this, LocalWeekParser);
1149
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1150
+ args[_key] = arguments[_key];
1151
+ }
1152
+ _this = _super.call.apply(_super, [this].concat(args));
1153
+ _defineProperty(_assertThisInitialized(_this), "priority", 100);
1154
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'i', 't', 'T']);
1155
+ return _this;
1156
+ }
1157
+ _createClass(LocalWeekParser, [{
1158
+ key: "parse",
1159
+ value: function parse(dateString, token, match) {
1160
+ switch (token) {
1161
+ case 'w':
1162
+ return parseNumericPattern(numericPatterns.week, dateString);
1163
+ case 'wo':
1164
+ return match.ordinalNumber(dateString, {
1165
+ unit: 'week'
1166
+ });
1167
+ default:
1168
+ return parseNDigits(token.length, dateString);
1169
+ }
1170
+ }
1171
+ }, {
1172
+ key: "validate",
1173
+ value: function validate(_date, value) {
1174
+ return value >= 1 && value <= 53;
1175
+ }
1176
+ }, {
1177
+ key: "set",
1178
+ value: function set(date, _flags, value, options) {
1179
+ return startOfUTCWeek(setUTCWeek(date, value, options), options);
1180
+ }
1181
+ }]);
1182
+ return LocalWeekParser;
1183
+ }(Parser);
1184
+
1185
+ function setUTCISOWeek(dirtyDate, dirtyISOWeek) {
1186
+ requiredArgs(2, arguments);
1187
+ var date = toDate(dirtyDate);
1188
+ var isoWeek = toInteger(dirtyISOWeek);
1189
+ var diff = getUTCISOWeek(date) - isoWeek;
1190
+ date.setUTCDate(date.getUTCDate() - diff * 7);
1191
+ return date;
1192
+ }
1193
+
1194
+ var ISOWeekParser = /*#__PURE__*/function (_Parser) {
1195
+ _inherits(ISOWeekParser, _Parser);
1196
+ var _super = _createSuper(ISOWeekParser);
1197
+ function ISOWeekParser() {
1198
+ var _this;
1199
+ _classCallCheck(this, ISOWeekParser);
1200
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1201
+ args[_key] = arguments[_key];
1202
+ }
1203
+ _this = _super.call.apply(_super, [this].concat(args));
1204
+ _defineProperty(_assertThisInitialized(_this), "priority", 100);
1205
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['y', 'Y', 'u', 'q', 'Q', 'M', 'L', 'w', 'd', 'D', 'e', 'c', 't', 'T']);
1206
+ return _this;
1207
+ }
1208
+ _createClass(ISOWeekParser, [{
1209
+ key: "parse",
1210
+ value: function parse(dateString, token, match) {
1211
+ switch (token) {
1212
+ case 'I':
1213
+ return parseNumericPattern(numericPatterns.week, dateString);
1214
+ case 'Io':
1215
+ return match.ordinalNumber(dateString, {
1216
+ unit: 'week'
1217
+ });
1218
+ default:
1219
+ return parseNDigits(token.length, dateString);
1220
+ }
1221
+ }
1222
+ }, {
1223
+ key: "validate",
1224
+ value: function validate(_date, value) {
1225
+ return value >= 1 && value <= 53;
1226
+ }
1227
+ }, {
1228
+ key: "set",
1229
+ value: function set(date, _flags, value) {
1230
+ return startOfUTCISOWeek(setUTCISOWeek(date, value));
1231
+ }
1232
+ }]);
1233
+ return ISOWeekParser;
1234
+ }(Parser);
1235
+
1236
+ var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
1237
+ var DAYS_IN_MONTH_LEAP_YEAR = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
1238
+
1239
+ // Day of the month
1240
+ var DateParser = /*#__PURE__*/function (_Parser) {
1241
+ _inherits(DateParser, _Parser);
1242
+ var _super = _createSuper(DateParser);
1243
+ function DateParser() {
1244
+ var _this;
1245
+ _classCallCheck(this, DateParser);
1246
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1247
+ args[_key] = arguments[_key];
1248
+ }
1249
+ _this = _super.call.apply(_super, [this].concat(args));
1250
+ _defineProperty(_assertThisInitialized(_this), "priority", 90);
1251
+ _defineProperty(_assertThisInitialized(_this), "subPriority", 1);
1252
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['Y', 'R', 'q', 'Q', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']);
1253
+ return _this;
1254
+ }
1255
+ _createClass(DateParser, [{
1256
+ key: "parse",
1257
+ value: function parse(dateString, token, match) {
1258
+ switch (token) {
1259
+ case 'd':
1260
+ return parseNumericPattern(numericPatterns.date, dateString);
1261
+ case 'do':
1262
+ return match.ordinalNumber(dateString, {
1263
+ unit: 'date'
1264
+ });
1265
+ default:
1266
+ return parseNDigits(token.length, dateString);
1267
+ }
1268
+ }
1269
+ }, {
1270
+ key: "validate",
1271
+ value: function validate(date, value) {
1272
+ var year = date.getUTCFullYear();
1273
+ var isLeapYear = isLeapYearIndex(year);
1274
+ var month = date.getUTCMonth();
1275
+ if (isLeapYear) {
1276
+ return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];
1277
+ } else {
1278
+ return value >= 1 && value <= DAYS_IN_MONTH[month];
1279
+ }
1280
+ }
1281
+ }, {
1282
+ key: "set",
1283
+ value: function set(date, _flags, value) {
1284
+ date.setUTCDate(value);
1285
+ date.setUTCHours(0, 0, 0, 0);
1286
+ return date;
1287
+ }
1288
+ }]);
1289
+ return DateParser;
1290
+ }(Parser);
1291
+
1292
+ var DayOfYearParser = /*#__PURE__*/function (_Parser) {
1293
+ _inherits(DayOfYearParser, _Parser);
1294
+ var _super = _createSuper(DayOfYearParser);
1295
+ function DayOfYearParser() {
1296
+ var _this;
1297
+ _classCallCheck(this, DayOfYearParser);
1298
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1299
+ args[_key] = arguments[_key];
1300
+ }
1301
+ _this = _super.call.apply(_super, [this].concat(args));
1302
+ _defineProperty(_assertThisInitialized(_this), "priority", 90);
1303
+ _defineProperty(_assertThisInitialized(_this), "subpriority", 1);
1304
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['Y', 'R', 'q', 'Q', 'M', 'L', 'w', 'I', 'd', 'E', 'i', 'e', 'c', 't', 'T']);
1305
+ return _this;
1306
+ }
1307
+ _createClass(DayOfYearParser, [{
1308
+ key: "parse",
1309
+ value: function parse(dateString, token, match) {
1310
+ switch (token) {
1311
+ case 'D':
1312
+ case 'DD':
1313
+ return parseNumericPattern(numericPatterns.dayOfYear, dateString);
1314
+ case 'Do':
1315
+ return match.ordinalNumber(dateString, {
1316
+ unit: 'date'
1317
+ });
1318
+ default:
1319
+ return parseNDigits(token.length, dateString);
1320
+ }
1321
+ }
1322
+ }, {
1323
+ key: "validate",
1324
+ value: function validate(date, value) {
1325
+ var year = date.getUTCFullYear();
1326
+ var isLeapYear = isLeapYearIndex(year);
1327
+ if (isLeapYear) {
1328
+ return value >= 1 && value <= 366;
1329
+ } else {
1330
+ return value >= 1 && value <= 365;
1331
+ }
1332
+ }
1333
+ }, {
1334
+ key: "set",
1335
+ value: function set(date, _flags, value) {
1336
+ date.setUTCMonth(0, value);
1337
+ date.setUTCHours(0, 0, 0, 0);
1338
+ return date;
1339
+ }
1340
+ }]);
1341
+ return DayOfYearParser;
1342
+ }(Parser);
1343
+
1344
+ function setUTCDay(dirtyDate, dirtyDay, options) {
1345
+ var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
1346
+ requiredArgs(2, arguments);
1347
+ var defaultOptions = getDefaultOptions();
1348
+ var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);
1349
+
1350
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
1351
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
1352
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
1353
+ }
1354
+ var date = toDate(dirtyDate);
1355
+ var day = toInteger(dirtyDay);
1356
+ var currentDay = date.getUTCDay();
1357
+ var remainder = day % 7;
1358
+ var dayIndex = (remainder + 7) % 7;
1359
+ var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;
1360
+ date.setUTCDate(date.getUTCDate() + diff);
1361
+ return date;
1362
+ }
1363
+
1364
+ var DayParser = /*#__PURE__*/function (_Parser) {
1365
+ _inherits(DayParser, _Parser);
1366
+ var _super = _createSuper(DayParser);
1367
+ function DayParser() {
1368
+ var _this;
1369
+ _classCallCheck(this, DayParser);
1370
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1371
+ args[_key] = arguments[_key];
1372
+ }
1373
+ _this = _super.call.apply(_super, [this].concat(args));
1374
+ _defineProperty(_assertThisInitialized(_this), "priority", 90);
1375
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['D', 'i', 'e', 'c', 't', 'T']);
1376
+ return _this;
1377
+ }
1378
+ _createClass(DayParser, [{
1379
+ key: "parse",
1380
+ value: function parse(dateString, token, match) {
1381
+ switch (token) {
1382
+ // Tue
1383
+ case 'E':
1384
+ case 'EE':
1385
+ case 'EEE':
1386
+ return match.day(dateString, {
1387
+ width: 'abbreviated',
1388
+ context: 'formatting'
1389
+ }) || match.day(dateString, {
1390
+ width: 'short',
1391
+ context: 'formatting'
1392
+ }) || match.day(dateString, {
1393
+ width: 'narrow',
1394
+ context: 'formatting'
1395
+ });
1396
+ // T
1397
+ case 'EEEEE':
1398
+ return match.day(dateString, {
1399
+ width: 'narrow',
1400
+ context: 'formatting'
1401
+ });
1402
+ // Tu
1403
+ case 'EEEEEE':
1404
+ return match.day(dateString, {
1405
+ width: 'short',
1406
+ context: 'formatting'
1407
+ }) || match.day(dateString, {
1408
+ width: 'narrow',
1409
+ context: 'formatting'
1410
+ });
1411
+ // Tuesday
1412
+ case 'EEEE':
1413
+ default:
1414
+ return match.day(dateString, {
1415
+ width: 'wide',
1416
+ context: 'formatting'
1417
+ }) || match.day(dateString, {
1418
+ width: 'abbreviated',
1419
+ context: 'formatting'
1420
+ }) || match.day(dateString, {
1421
+ width: 'short',
1422
+ context: 'formatting'
1423
+ }) || match.day(dateString, {
1424
+ width: 'narrow',
1425
+ context: 'formatting'
1426
+ });
1427
+ }
1428
+ }
1429
+ }, {
1430
+ key: "validate",
1431
+ value: function validate(_date, value) {
1432
+ return value >= 0 && value <= 6;
1433
+ }
1434
+ }, {
1435
+ key: "set",
1436
+ value: function set(date, _flags, value, options) {
1437
+ date = setUTCDay(date, value, options);
1438
+ date.setUTCHours(0, 0, 0, 0);
1439
+ return date;
1440
+ }
1441
+ }]);
1442
+ return DayParser;
1443
+ }(Parser);
1444
+
1445
+ var LocalDayParser = /*#__PURE__*/function (_Parser) {
1446
+ _inherits(LocalDayParser, _Parser);
1447
+ var _super = _createSuper(LocalDayParser);
1448
+ function LocalDayParser() {
1449
+ var _this;
1450
+ _classCallCheck(this, LocalDayParser);
1451
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1452
+ args[_key] = arguments[_key];
1453
+ }
1454
+ _this = _super.call.apply(_super, [this].concat(args));
1455
+ _defineProperty(_assertThisInitialized(_this), "priority", 90);
1456
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'E', 'i', 'c', 't', 'T']);
1457
+ return _this;
1458
+ }
1459
+ _createClass(LocalDayParser, [{
1460
+ key: "parse",
1461
+ value: function parse(dateString, token, match, options) {
1462
+ var valueCallback = function valueCallback(value) {
1463
+ var wholeWeekDays = Math.floor((value - 1) / 7) * 7;
1464
+ return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
1465
+ };
1466
+ switch (token) {
1467
+ // 3
1468
+ case 'e':
1469
+ case 'ee':
1470
+ // 03
1471
+ return mapValue(parseNDigits(token.length, dateString), valueCallback);
1472
+ // 3rd
1473
+ case 'eo':
1474
+ return mapValue(match.ordinalNumber(dateString, {
1475
+ unit: 'day'
1476
+ }), valueCallback);
1477
+ // Tue
1478
+ case 'eee':
1479
+ return match.day(dateString, {
1480
+ width: 'abbreviated',
1481
+ context: 'formatting'
1482
+ }) || match.day(dateString, {
1483
+ width: 'short',
1484
+ context: 'formatting'
1485
+ }) || match.day(dateString, {
1486
+ width: 'narrow',
1487
+ context: 'formatting'
1488
+ });
1489
+ // T
1490
+ case 'eeeee':
1491
+ return match.day(dateString, {
1492
+ width: 'narrow',
1493
+ context: 'formatting'
1494
+ });
1495
+ // Tu
1496
+ case 'eeeeee':
1497
+ return match.day(dateString, {
1498
+ width: 'short',
1499
+ context: 'formatting'
1500
+ }) || match.day(dateString, {
1501
+ width: 'narrow',
1502
+ context: 'formatting'
1503
+ });
1504
+ // Tuesday
1505
+ case 'eeee':
1506
+ default:
1507
+ return match.day(dateString, {
1508
+ width: 'wide',
1509
+ context: 'formatting'
1510
+ }) || match.day(dateString, {
1511
+ width: 'abbreviated',
1512
+ context: 'formatting'
1513
+ }) || match.day(dateString, {
1514
+ width: 'short',
1515
+ context: 'formatting'
1516
+ }) || match.day(dateString, {
1517
+ width: 'narrow',
1518
+ context: 'formatting'
1519
+ });
1520
+ }
1521
+ }
1522
+ }, {
1523
+ key: "validate",
1524
+ value: function validate(_date, value) {
1525
+ return value >= 0 && value <= 6;
1526
+ }
1527
+ }, {
1528
+ key: "set",
1529
+ value: function set(date, _flags, value, options) {
1530
+ date = setUTCDay(date, value, options);
1531
+ date.setUTCHours(0, 0, 0, 0);
1532
+ return date;
1533
+ }
1534
+ }]);
1535
+ return LocalDayParser;
1536
+ }(Parser);
1537
+
1538
+ var StandAloneLocalDayParser = /*#__PURE__*/function (_Parser) {
1539
+ _inherits(StandAloneLocalDayParser, _Parser);
1540
+ var _super = _createSuper(StandAloneLocalDayParser);
1541
+ function StandAloneLocalDayParser() {
1542
+ var _this;
1543
+ _classCallCheck(this, StandAloneLocalDayParser);
1544
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1545
+ args[_key] = arguments[_key];
1546
+ }
1547
+ _this = _super.call.apply(_super, [this].concat(args));
1548
+ _defineProperty(_assertThisInitialized(_this), "priority", 90);
1549
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'E', 'i', 'e', 't', 'T']);
1550
+ return _this;
1551
+ }
1552
+ _createClass(StandAloneLocalDayParser, [{
1553
+ key: "parse",
1554
+ value: function parse(dateString, token, match, options) {
1555
+ var valueCallback = function valueCallback(value) {
1556
+ var wholeWeekDays = Math.floor((value - 1) / 7) * 7;
1557
+ return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
1558
+ };
1559
+ switch (token) {
1560
+ // 3
1561
+ case 'c':
1562
+ case 'cc':
1563
+ // 03
1564
+ return mapValue(parseNDigits(token.length, dateString), valueCallback);
1565
+ // 3rd
1566
+ case 'co':
1567
+ return mapValue(match.ordinalNumber(dateString, {
1568
+ unit: 'day'
1569
+ }), valueCallback);
1570
+ // Tue
1571
+ case 'ccc':
1572
+ return match.day(dateString, {
1573
+ width: 'abbreviated',
1574
+ context: 'standalone'
1575
+ }) || match.day(dateString, {
1576
+ width: 'short',
1577
+ context: 'standalone'
1578
+ }) || match.day(dateString, {
1579
+ width: 'narrow',
1580
+ context: 'standalone'
1581
+ });
1582
+ // T
1583
+ case 'ccccc':
1584
+ return match.day(dateString, {
1585
+ width: 'narrow',
1586
+ context: 'standalone'
1587
+ });
1588
+ // Tu
1589
+ case 'cccccc':
1590
+ return match.day(dateString, {
1591
+ width: 'short',
1592
+ context: 'standalone'
1593
+ }) || match.day(dateString, {
1594
+ width: 'narrow',
1595
+ context: 'standalone'
1596
+ });
1597
+ // Tuesday
1598
+ case 'cccc':
1599
+ default:
1600
+ return match.day(dateString, {
1601
+ width: 'wide',
1602
+ context: 'standalone'
1603
+ }) || match.day(dateString, {
1604
+ width: 'abbreviated',
1605
+ context: 'standalone'
1606
+ }) || match.day(dateString, {
1607
+ width: 'short',
1608
+ context: 'standalone'
1609
+ }) || match.day(dateString, {
1610
+ width: 'narrow',
1611
+ context: 'standalone'
1612
+ });
1613
+ }
1614
+ }
1615
+ }, {
1616
+ key: "validate",
1617
+ value: function validate(_date, value) {
1618
+ return value >= 0 && value <= 6;
1619
+ }
1620
+ }, {
1621
+ key: "set",
1622
+ value: function set(date, _flags, value, options) {
1623
+ date = setUTCDay(date, value, options);
1624
+ date.setUTCHours(0, 0, 0, 0);
1625
+ return date;
1626
+ }
1627
+ }]);
1628
+ return StandAloneLocalDayParser;
1629
+ }(Parser);
1630
+
1631
+ function setUTCISODay(dirtyDate, dirtyDay) {
1632
+ requiredArgs(2, arguments);
1633
+ var day = toInteger(dirtyDay);
1634
+ if (day % 7 === 0) {
1635
+ day = day - 7;
1636
+ }
1637
+ var weekStartsOn = 1;
1638
+ var date = toDate(dirtyDate);
1639
+ var currentDay = date.getUTCDay();
1640
+ var remainder = day % 7;
1641
+ var dayIndex = (remainder + 7) % 7;
1642
+ var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;
1643
+ date.setUTCDate(date.getUTCDate() + diff);
1644
+ return date;
1645
+ }
1646
+
1647
+ var ISODayParser = /*#__PURE__*/function (_Parser) {
1648
+ _inherits(ISODayParser, _Parser);
1649
+ var _super = _createSuper(ISODayParser);
1650
+ function ISODayParser() {
1651
+ var _this;
1652
+ _classCallCheck(this, ISODayParser);
1653
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1654
+ args[_key] = arguments[_key];
1655
+ }
1656
+ _this = _super.call.apply(_super, [this].concat(args));
1657
+ _defineProperty(_assertThisInitialized(_this), "priority", 90);
1658
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['y', 'Y', 'u', 'q', 'Q', 'M', 'L', 'w', 'd', 'D', 'E', 'e', 'c', 't', 'T']);
1659
+ return _this;
1660
+ }
1661
+ _createClass(ISODayParser, [{
1662
+ key: "parse",
1663
+ value: function parse(dateString, token, match) {
1664
+ var valueCallback = function valueCallback(value) {
1665
+ if (value === 0) {
1666
+ return 7;
1667
+ }
1668
+ return value;
1669
+ };
1670
+ switch (token) {
1671
+ // 2
1672
+ case 'i':
1673
+ case 'ii':
1674
+ // 02
1675
+ return parseNDigits(token.length, dateString);
1676
+ // 2nd
1677
+ case 'io':
1678
+ return match.ordinalNumber(dateString, {
1679
+ unit: 'day'
1680
+ });
1681
+ // Tue
1682
+ case 'iii':
1683
+ return mapValue(match.day(dateString, {
1684
+ width: 'abbreviated',
1685
+ context: 'formatting'
1686
+ }) || match.day(dateString, {
1687
+ width: 'short',
1688
+ context: 'formatting'
1689
+ }) || match.day(dateString, {
1690
+ width: 'narrow',
1691
+ context: 'formatting'
1692
+ }), valueCallback);
1693
+ // T
1694
+ case 'iiiii':
1695
+ return mapValue(match.day(dateString, {
1696
+ width: 'narrow',
1697
+ context: 'formatting'
1698
+ }), valueCallback);
1699
+ // Tu
1700
+ case 'iiiiii':
1701
+ return mapValue(match.day(dateString, {
1702
+ width: 'short',
1703
+ context: 'formatting'
1704
+ }) || match.day(dateString, {
1705
+ width: 'narrow',
1706
+ context: 'formatting'
1707
+ }), valueCallback);
1708
+ // Tuesday
1709
+ case 'iiii':
1710
+ default:
1711
+ return mapValue(match.day(dateString, {
1712
+ width: 'wide',
1713
+ context: 'formatting'
1714
+ }) || match.day(dateString, {
1715
+ width: 'abbreviated',
1716
+ context: 'formatting'
1717
+ }) || match.day(dateString, {
1718
+ width: 'short',
1719
+ context: 'formatting'
1720
+ }) || match.day(dateString, {
1721
+ width: 'narrow',
1722
+ context: 'formatting'
1723
+ }), valueCallback);
1724
+ }
1725
+ }
1726
+ }, {
1727
+ key: "validate",
1728
+ value: function validate(_date, value) {
1729
+ return value >= 1 && value <= 7;
1730
+ }
1731
+ }, {
1732
+ key: "set",
1733
+ value: function set(date, _flags, value) {
1734
+ date = setUTCISODay(date, value);
1735
+ date.setUTCHours(0, 0, 0, 0);
1736
+ return date;
1737
+ }
1738
+ }]);
1739
+ return ISODayParser;
1740
+ }(Parser);
1741
+
1742
+ var AMPMParser = /*#__PURE__*/function (_Parser) {
1743
+ _inherits(AMPMParser, _Parser);
1744
+ var _super = _createSuper(AMPMParser);
1745
+ function AMPMParser() {
1746
+ var _this;
1747
+ _classCallCheck(this, AMPMParser);
1748
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1749
+ args[_key] = arguments[_key];
1750
+ }
1751
+ _this = _super.call.apply(_super, [this].concat(args));
1752
+ _defineProperty(_assertThisInitialized(_this), "priority", 80);
1753
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['b', 'B', 'H', 'k', 't', 'T']);
1754
+ return _this;
1755
+ }
1756
+ _createClass(AMPMParser, [{
1757
+ key: "parse",
1758
+ value: function parse(dateString, token, match) {
1759
+ switch (token) {
1760
+ case 'a':
1761
+ case 'aa':
1762
+ case 'aaa':
1763
+ return match.dayPeriod(dateString, {
1764
+ width: 'abbreviated',
1765
+ context: 'formatting'
1766
+ }) || match.dayPeriod(dateString, {
1767
+ width: 'narrow',
1768
+ context: 'formatting'
1769
+ });
1770
+ case 'aaaaa':
1771
+ return match.dayPeriod(dateString, {
1772
+ width: 'narrow',
1773
+ context: 'formatting'
1774
+ });
1775
+ case 'aaaa':
1776
+ default:
1777
+ return match.dayPeriod(dateString, {
1778
+ width: 'wide',
1779
+ context: 'formatting'
1780
+ }) || match.dayPeriod(dateString, {
1781
+ width: 'abbreviated',
1782
+ context: 'formatting'
1783
+ }) || match.dayPeriod(dateString, {
1784
+ width: 'narrow',
1785
+ context: 'formatting'
1786
+ });
1787
+ }
1788
+ }
1789
+ }, {
1790
+ key: "set",
1791
+ value: function set(date, _flags, value) {
1792
+ date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);
1793
+ return date;
1794
+ }
1795
+ }]);
1796
+ return AMPMParser;
1797
+ }(Parser);
1798
+
1799
+ var AMPMMidnightParser = /*#__PURE__*/function (_Parser) {
1800
+ _inherits(AMPMMidnightParser, _Parser);
1801
+ var _super = _createSuper(AMPMMidnightParser);
1802
+ function AMPMMidnightParser() {
1803
+ var _this;
1804
+ _classCallCheck(this, AMPMMidnightParser);
1805
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1806
+ args[_key] = arguments[_key];
1807
+ }
1808
+ _this = _super.call.apply(_super, [this].concat(args));
1809
+ _defineProperty(_assertThisInitialized(_this), "priority", 80);
1810
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['a', 'B', 'H', 'k', 't', 'T']);
1811
+ return _this;
1812
+ }
1813
+ _createClass(AMPMMidnightParser, [{
1814
+ key: "parse",
1815
+ value: function parse(dateString, token, match) {
1816
+ switch (token) {
1817
+ case 'b':
1818
+ case 'bb':
1819
+ case 'bbb':
1820
+ return match.dayPeriod(dateString, {
1821
+ width: 'abbreviated',
1822
+ context: 'formatting'
1823
+ }) || match.dayPeriod(dateString, {
1824
+ width: 'narrow',
1825
+ context: 'formatting'
1826
+ });
1827
+ case 'bbbbb':
1828
+ return match.dayPeriod(dateString, {
1829
+ width: 'narrow',
1830
+ context: 'formatting'
1831
+ });
1832
+ case 'bbbb':
1833
+ default:
1834
+ return match.dayPeriod(dateString, {
1835
+ width: 'wide',
1836
+ context: 'formatting'
1837
+ }) || match.dayPeriod(dateString, {
1838
+ width: 'abbreviated',
1839
+ context: 'formatting'
1840
+ }) || match.dayPeriod(dateString, {
1841
+ width: 'narrow',
1842
+ context: 'formatting'
1843
+ });
1844
+ }
1845
+ }
1846
+ }, {
1847
+ key: "set",
1848
+ value: function set(date, _flags, value) {
1849
+ date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);
1850
+ return date;
1851
+ }
1852
+ }]);
1853
+ return AMPMMidnightParser;
1854
+ }(Parser);
1855
+
1856
+ var DayPeriodParser = /*#__PURE__*/function (_Parser) {
1857
+ _inherits(DayPeriodParser, _Parser);
1858
+ var _super = _createSuper(DayPeriodParser);
1859
+ function DayPeriodParser() {
1860
+ var _this;
1861
+ _classCallCheck(this, DayPeriodParser);
1862
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1863
+ args[_key] = arguments[_key];
1864
+ }
1865
+ _this = _super.call.apply(_super, [this].concat(args));
1866
+ _defineProperty(_assertThisInitialized(_this), "priority", 80);
1867
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['a', 'b', 't', 'T']);
1868
+ return _this;
1869
+ }
1870
+ _createClass(DayPeriodParser, [{
1871
+ key: "parse",
1872
+ value: function parse(dateString, token, match) {
1873
+ switch (token) {
1874
+ case 'B':
1875
+ case 'BB':
1876
+ case 'BBB':
1877
+ return match.dayPeriod(dateString, {
1878
+ width: 'abbreviated',
1879
+ context: 'formatting'
1880
+ }) || match.dayPeriod(dateString, {
1881
+ width: 'narrow',
1882
+ context: 'formatting'
1883
+ });
1884
+ case 'BBBBB':
1885
+ return match.dayPeriod(dateString, {
1886
+ width: 'narrow',
1887
+ context: 'formatting'
1888
+ });
1889
+ case 'BBBB':
1890
+ default:
1891
+ return match.dayPeriod(dateString, {
1892
+ width: 'wide',
1893
+ context: 'formatting'
1894
+ }) || match.dayPeriod(dateString, {
1895
+ width: 'abbreviated',
1896
+ context: 'formatting'
1897
+ }) || match.dayPeriod(dateString, {
1898
+ width: 'narrow',
1899
+ context: 'formatting'
1900
+ });
1901
+ }
1902
+ }
1903
+ }, {
1904
+ key: "set",
1905
+ value: function set(date, _flags, value) {
1906
+ date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);
1907
+ return date;
1908
+ }
1909
+ }]);
1910
+ return DayPeriodParser;
1911
+ }(Parser);
1912
+
1913
+ var Hour1to12Parser = /*#__PURE__*/function (_Parser) {
1914
+ _inherits(Hour1to12Parser, _Parser);
1915
+ var _super = _createSuper(Hour1to12Parser);
1916
+ function Hour1to12Parser() {
1917
+ var _this;
1918
+ _classCallCheck(this, Hour1to12Parser);
1919
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1920
+ args[_key] = arguments[_key];
1921
+ }
1922
+ _this = _super.call.apply(_super, [this].concat(args));
1923
+ _defineProperty(_assertThisInitialized(_this), "priority", 70);
1924
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['H', 'K', 'k', 't', 'T']);
1925
+ return _this;
1926
+ }
1927
+ _createClass(Hour1to12Parser, [{
1928
+ key: "parse",
1929
+ value: function parse(dateString, token, match) {
1930
+ switch (token) {
1931
+ case 'h':
1932
+ return parseNumericPattern(numericPatterns.hour12h, dateString);
1933
+ case 'ho':
1934
+ return match.ordinalNumber(dateString, {
1935
+ unit: 'hour'
1936
+ });
1937
+ default:
1938
+ return parseNDigits(token.length, dateString);
1939
+ }
1940
+ }
1941
+ }, {
1942
+ key: "validate",
1943
+ value: function validate(_date, value) {
1944
+ return value >= 1 && value <= 12;
1945
+ }
1946
+ }, {
1947
+ key: "set",
1948
+ value: function set(date, _flags, value) {
1949
+ var isPM = date.getUTCHours() >= 12;
1950
+ if (isPM && value < 12) {
1951
+ date.setUTCHours(value + 12, 0, 0, 0);
1952
+ } else if (!isPM && value === 12) {
1953
+ date.setUTCHours(0, 0, 0, 0);
1954
+ } else {
1955
+ date.setUTCHours(value, 0, 0, 0);
1956
+ }
1957
+ return date;
1958
+ }
1959
+ }]);
1960
+ return Hour1to12Parser;
1961
+ }(Parser);
1962
+
1963
+ var Hour0to23Parser = /*#__PURE__*/function (_Parser) {
1964
+ _inherits(Hour0to23Parser, _Parser);
1965
+ var _super = _createSuper(Hour0to23Parser);
1966
+ function Hour0to23Parser() {
1967
+ var _this;
1968
+ _classCallCheck(this, Hour0to23Parser);
1969
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1970
+ args[_key] = arguments[_key];
1971
+ }
1972
+ _this = _super.call.apply(_super, [this].concat(args));
1973
+ _defineProperty(_assertThisInitialized(_this), "priority", 70);
1974
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['a', 'b', 'h', 'K', 'k', 't', 'T']);
1975
+ return _this;
1976
+ }
1977
+ _createClass(Hour0to23Parser, [{
1978
+ key: "parse",
1979
+ value: function parse(dateString, token, match) {
1980
+ switch (token) {
1981
+ case 'H':
1982
+ return parseNumericPattern(numericPatterns.hour23h, dateString);
1983
+ case 'Ho':
1984
+ return match.ordinalNumber(dateString, {
1985
+ unit: 'hour'
1986
+ });
1987
+ default:
1988
+ return parseNDigits(token.length, dateString);
1989
+ }
1990
+ }
1991
+ }, {
1992
+ key: "validate",
1993
+ value: function validate(_date, value) {
1994
+ return value >= 0 && value <= 23;
1995
+ }
1996
+ }, {
1997
+ key: "set",
1998
+ value: function set(date, _flags, value) {
1999
+ date.setUTCHours(value, 0, 0, 0);
2000
+ return date;
2001
+ }
2002
+ }]);
2003
+ return Hour0to23Parser;
2004
+ }(Parser);
2005
+
2006
+ var Hour0To11Parser = /*#__PURE__*/function (_Parser) {
2007
+ _inherits(Hour0To11Parser, _Parser);
2008
+ var _super = _createSuper(Hour0To11Parser);
2009
+ function Hour0To11Parser() {
2010
+ var _this;
2011
+ _classCallCheck(this, Hour0To11Parser);
2012
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2013
+ args[_key] = arguments[_key];
2014
+ }
2015
+ _this = _super.call.apply(_super, [this].concat(args));
2016
+ _defineProperty(_assertThisInitialized(_this), "priority", 70);
2017
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['h', 'H', 'k', 't', 'T']);
2018
+ return _this;
2019
+ }
2020
+ _createClass(Hour0To11Parser, [{
2021
+ key: "parse",
2022
+ value: function parse(dateString, token, match) {
2023
+ switch (token) {
2024
+ case 'K':
2025
+ return parseNumericPattern(numericPatterns.hour11h, dateString);
2026
+ case 'Ko':
2027
+ return match.ordinalNumber(dateString, {
2028
+ unit: 'hour'
2029
+ });
2030
+ default:
2031
+ return parseNDigits(token.length, dateString);
2032
+ }
2033
+ }
2034
+ }, {
2035
+ key: "validate",
2036
+ value: function validate(_date, value) {
2037
+ return value >= 0 && value <= 11;
2038
+ }
2039
+ }, {
2040
+ key: "set",
2041
+ value: function set(date, _flags, value) {
2042
+ var isPM = date.getUTCHours() >= 12;
2043
+ if (isPM && value < 12) {
2044
+ date.setUTCHours(value + 12, 0, 0, 0);
2045
+ } else {
2046
+ date.setUTCHours(value, 0, 0, 0);
2047
+ }
2048
+ return date;
2049
+ }
2050
+ }]);
2051
+ return Hour0To11Parser;
2052
+ }(Parser);
2053
+
2054
+ var Hour1To24Parser = /*#__PURE__*/function (_Parser) {
2055
+ _inherits(Hour1To24Parser, _Parser);
2056
+ var _super = _createSuper(Hour1To24Parser);
2057
+ function Hour1To24Parser() {
2058
+ var _this;
2059
+ _classCallCheck(this, Hour1To24Parser);
2060
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2061
+ args[_key] = arguments[_key];
2062
+ }
2063
+ _this = _super.call.apply(_super, [this].concat(args));
2064
+ _defineProperty(_assertThisInitialized(_this), "priority", 70);
2065
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['a', 'b', 'h', 'H', 'K', 't', 'T']);
2066
+ return _this;
2067
+ }
2068
+ _createClass(Hour1To24Parser, [{
2069
+ key: "parse",
2070
+ value: function parse(dateString, token, match) {
2071
+ switch (token) {
2072
+ case 'k':
2073
+ return parseNumericPattern(numericPatterns.hour24h, dateString);
2074
+ case 'ko':
2075
+ return match.ordinalNumber(dateString, {
2076
+ unit: 'hour'
2077
+ });
2078
+ default:
2079
+ return parseNDigits(token.length, dateString);
2080
+ }
2081
+ }
2082
+ }, {
2083
+ key: "validate",
2084
+ value: function validate(_date, value) {
2085
+ return value >= 1 && value <= 24;
2086
+ }
2087
+ }, {
2088
+ key: "set",
2089
+ value: function set(date, _flags, value) {
2090
+ var hours = value <= 24 ? value % 24 : value;
2091
+ date.setUTCHours(hours, 0, 0, 0);
2092
+ return date;
2093
+ }
2094
+ }]);
2095
+ return Hour1To24Parser;
2096
+ }(Parser);
2097
+
2098
+ var MinuteParser = /*#__PURE__*/function (_Parser) {
2099
+ _inherits(MinuteParser, _Parser);
2100
+ var _super = _createSuper(MinuteParser);
2101
+ function MinuteParser() {
2102
+ var _this;
2103
+ _classCallCheck(this, MinuteParser);
2104
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2105
+ args[_key] = arguments[_key];
2106
+ }
2107
+ _this = _super.call.apply(_super, [this].concat(args));
2108
+ _defineProperty(_assertThisInitialized(_this), "priority", 60);
2109
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['t', 'T']);
2110
+ return _this;
2111
+ }
2112
+ _createClass(MinuteParser, [{
2113
+ key: "parse",
2114
+ value: function parse(dateString, token, match) {
2115
+ switch (token) {
2116
+ case 'm':
2117
+ return parseNumericPattern(numericPatterns.minute, dateString);
2118
+ case 'mo':
2119
+ return match.ordinalNumber(dateString, {
2120
+ unit: 'minute'
2121
+ });
2122
+ default:
2123
+ return parseNDigits(token.length, dateString);
2124
+ }
2125
+ }
2126
+ }, {
2127
+ key: "validate",
2128
+ value: function validate(_date, value) {
2129
+ return value >= 0 && value <= 59;
2130
+ }
2131
+ }, {
2132
+ key: "set",
2133
+ value: function set(date, _flags, value) {
2134
+ date.setUTCMinutes(value, 0, 0);
2135
+ return date;
2136
+ }
2137
+ }]);
2138
+ return MinuteParser;
2139
+ }(Parser);
2140
+
2141
+ var SecondParser = /*#__PURE__*/function (_Parser) {
2142
+ _inherits(SecondParser, _Parser);
2143
+ var _super = _createSuper(SecondParser);
2144
+ function SecondParser() {
2145
+ var _this;
2146
+ _classCallCheck(this, SecondParser);
2147
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2148
+ args[_key] = arguments[_key];
2149
+ }
2150
+ _this = _super.call.apply(_super, [this].concat(args));
2151
+ _defineProperty(_assertThisInitialized(_this), "priority", 50);
2152
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['t', 'T']);
2153
+ return _this;
2154
+ }
2155
+ _createClass(SecondParser, [{
2156
+ key: "parse",
2157
+ value: function parse(dateString, token, match) {
2158
+ switch (token) {
2159
+ case 's':
2160
+ return parseNumericPattern(numericPatterns.second, dateString);
2161
+ case 'so':
2162
+ return match.ordinalNumber(dateString, {
2163
+ unit: 'second'
2164
+ });
2165
+ default:
2166
+ return parseNDigits(token.length, dateString);
2167
+ }
2168
+ }
2169
+ }, {
2170
+ key: "validate",
2171
+ value: function validate(_date, value) {
2172
+ return value >= 0 && value <= 59;
2173
+ }
2174
+ }, {
2175
+ key: "set",
2176
+ value: function set(date, _flags, value) {
2177
+ date.setUTCSeconds(value, 0);
2178
+ return date;
2179
+ }
2180
+ }]);
2181
+ return SecondParser;
2182
+ }(Parser);
2183
+
2184
+ var FractionOfSecondParser = /*#__PURE__*/function (_Parser) {
2185
+ _inherits(FractionOfSecondParser, _Parser);
2186
+ var _super = _createSuper(FractionOfSecondParser);
2187
+ function FractionOfSecondParser() {
2188
+ var _this;
2189
+ _classCallCheck(this, FractionOfSecondParser);
2190
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2191
+ args[_key] = arguments[_key];
2192
+ }
2193
+ _this = _super.call.apply(_super, [this].concat(args));
2194
+ _defineProperty(_assertThisInitialized(_this), "priority", 30);
2195
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['t', 'T']);
2196
+ return _this;
2197
+ }
2198
+ _createClass(FractionOfSecondParser, [{
2199
+ key: "parse",
2200
+ value: function parse(dateString, token) {
2201
+ var valueCallback = function valueCallback(value) {
2202
+ return Math.floor(value * Math.pow(10, -token.length + 3));
2203
+ };
2204
+ return mapValue(parseNDigits(token.length, dateString), valueCallback);
2205
+ }
2206
+ }, {
2207
+ key: "set",
2208
+ value: function set(date, _flags, value) {
2209
+ date.setUTCMilliseconds(value);
2210
+ return date;
2211
+ }
2212
+ }]);
2213
+ return FractionOfSecondParser;
2214
+ }(Parser);
2215
+
2216
+ var ISOTimezoneWithZParser = /*#__PURE__*/function (_Parser) {
2217
+ _inherits(ISOTimezoneWithZParser, _Parser);
2218
+ var _super = _createSuper(ISOTimezoneWithZParser);
2219
+ function ISOTimezoneWithZParser() {
2220
+ var _this;
2221
+ _classCallCheck(this, ISOTimezoneWithZParser);
2222
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2223
+ args[_key] = arguments[_key];
2224
+ }
2225
+ _this = _super.call.apply(_super, [this].concat(args));
2226
+ _defineProperty(_assertThisInitialized(_this), "priority", 10);
2227
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['t', 'T', 'x']);
2228
+ return _this;
2229
+ }
2230
+ _createClass(ISOTimezoneWithZParser, [{
2231
+ key: "parse",
2232
+ value: function parse(dateString, token) {
2233
+ switch (token) {
2234
+ case 'X':
2235
+ return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, dateString);
2236
+ case 'XX':
2237
+ return parseTimezonePattern(timezonePatterns.basic, dateString);
2238
+ case 'XXXX':
2239
+ return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, dateString);
2240
+ case 'XXXXX':
2241
+ return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, dateString);
2242
+ case 'XXX':
2243
+ default:
2244
+ return parseTimezonePattern(timezonePatterns.extended, dateString);
2245
+ }
2246
+ }
2247
+ }, {
2248
+ key: "set",
2249
+ value: function set(date, flags, value) {
2250
+ if (flags.timestampIsSet) {
2251
+ return date;
2252
+ }
2253
+ return new Date(date.getTime() - value);
2254
+ }
2255
+ }]);
2256
+ return ISOTimezoneWithZParser;
2257
+ }(Parser);
2258
+
2259
+ var ISOTimezoneParser = /*#__PURE__*/function (_Parser) {
2260
+ _inherits(ISOTimezoneParser, _Parser);
2261
+ var _super = _createSuper(ISOTimezoneParser);
2262
+ function ISOTimezoneParser() {
2263
+ var _this;
2264
+ _classCallCheck(this, ISOTimezoneParser);
2265
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2266
+ args[_key] = arguments[_key];
2267
+ }
2268
+ _this = _super.call.apply(_super, [this].concat(args));
2269
+ _defineProperty(_assertThisInitialized(_this), "priority", 10);
2270
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['t', 'T', 'X']);
2271
+ return _this;
2272
+ }
2273
+ _createClass(ISOTimezoneParser, [{
2274
+ key: "parse",
2275
+ value: function parse(dateString, token) {
2276
+ switch (token) {
2277
+ case 'x':
2278
+ return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, dateString);
2279
+ case 'xx':
2280
+ return parseTimezonePattern(timezonePatterns.basic, dateString);
2281
+ case 'xxxx':
2282
+ return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, dateString);
2283
+ case 'xxxxx':
2284
+ return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, dateString);
2285
+ case 'xxx':
2286
+ default:
2287
+ return parseTimezonePattern(timezonePatterns.extended, dateString);
2288
+ }
2289
+ }
2290
+ }, {
2291
+ key: "set",
2292
+ value: function set(date, flags, value) {
2293
+ if (flags.timestampIsSet) {
2294
+ return date;
2295
+ }
2296
+ return new Date(date.getTime() - value);
2297
+ }
2298
+ }]);
2299
+ return ISOTimezoneParser;
2300
+ }(Parser);
2301
+
2302
+ var TimestampSecondsParser = /*#__PURE__*/function (_Parser) {
2303
+ _inherits(TimestampSecondsParser, _Parser);
2304
+ var _super = _createSuper(TimestampSecondsParser);
2305
+ function TimestampSecondsParser() {
2306
+ var _this;
2307
+ _classCallCheck(this, TimestampSecondsParser);
2308
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2309
+ args[_key] = arguments[_key];
2310
+ }
2311
+ _this = _super.call.apply(_super, [this].concat(args));
2312
+ _defineProperty(_assertThisInitialized(_this), "priority", 40);
2313
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", '*');
2314
+ return _this;
2315
+ }
2316
+ _createClass(TimestampSecondsParser, [{
2317
+ key: "parse",
2318
+ value: function parse(dateString) {
2319
+ return parseAnyDigitsSigned(dateString);
2320
+ }
2321
+ }, {
2322
+ key: "set",
2323
+ value: function set(_date, _flags, value) {
2324
+ return [new Date(value * 1000), {
2325
+ timestampIsSet: true
2326
+ }];
2327
+ }
2328
+ }]);
2329
+ return TimestampSecondsParser;
2330
+ }(Parser);
2331
+
2332
+ var TimestampMillisecondsParser = /*#__PURE__*/function (_Parser) {
2333
+ _inherits(TimestampMillisecondsParser, _Parser);
2334
+ var _super = _createSuper(TimestampMillisecondsParser);
2335
+ function TimestampMillisecondsParser() {
2336
+ var _this;
2337
+ _classCallCheck(this, TimestampMillisecondsParser);
2338
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2339
+ args[_key] = arguments[_key];
2340
+ }
2341
+ _this = _super.call.apply(_super, [this].concat(args));
2342
+ _defineProperty(_assertThisInitialized(_this), "priority", 20);
2343
+ _defineProperty(_assertThisInitialized(_this), "incompatibleTokens", '*');
2344
+ return _this;
2345
+ }
2346
+ _createClass(TimestampMillisecondsParser, [{
2347
+ key: "parse",
2348
+ value: function parse(dateString) {
2349
+ return parseAnyDigitsSigned(dateString);
2350
+ }
2351
+ }, {
2352
+ key: "set",
2353
+ value: function set(_date, _flags, value) {
2354
+ return [new Date(value), {
2355
+ timestampIsSet: true
2356
+ }];
2357
+ }
2358
+ }]);
2359
+ return TimestampMillisecondsParser;
2360
+ }(Parser);
2361
+
2362
+ /*
2363
+ * | | Unit | | Unit |
2364
+ * |-----|--------------------------------|-----|--------------------------------|
2365
+ * | a | AM, PM | A* | Milliseconds in day |
2366
+ * | b | AM, PM, noon, midnight | B | Flexible day period |
2367
+ * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
2368
+ * | d | Day of month | D | Day of year |
2369
+ * | e | Local day of week | E | Day of week |
2370
+ * | f | | F* | Day of week in month |
2371
+ * | g* | Modified Julian day | G | Era |
2372
+ * | h | Hour [1-12] | H | Hour [0-23] |
2373
+ * | i! | ISO day of week | I! | ISO week of year |
2374
+ * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
2375
+ * | k | Hour [1-24] | K | Hour [0-11] |
2376
+ * | l* | (deprecated) | L | Stand-alone month |
2377
+ * | m | Minute | M | Month |
2378
+ * | n | | N | |
2379
+ * | o! | Ordinal number modifier | O* | Timezone (GMT) |
2380
+ * | p | | P | |
2381
+ * | q | Stand-alone quarter | Q | Quarter |
2382
+ * | r* | Related Gregorian year | R! | ISO week-numbering year |
2383
+ * | s | Second | S | Fraction of second |
2384
+ * | t! | Seconds timestamp | T! | Milliseconds timestamp |
2385
+ * | u | Extended year | U* | Cyclic year |
2386
+ * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
2387
+ * | w | Local week of year | W* | Week of month |
2388
+ * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
2389
+ * | y | Year (abs) | Y | Local week-numbering year |
2390
+ * | z* | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
2391
+ *
2392
+ * Letters marked by * are not implemented but reserved by Unicode standard.
2393
+ *
2394
+ * Letters marked by ! are non-standard, but implemented by date-fns:
2395
+ * - `o` modifies the previous token to turn it into an ordinal (see `parse` docs)
2396
+ * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
2397
+ * i.e. 7 for Sunday, 1 for Monday, etc.
2398
+ * - `I` is ISO week of year, as opposed to `w` which is local week of year.
2399
+ * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
2400
+ * `R` is supposed to be used in conjunction with `I` and `i`
2401
+ * for universal ISO week-numbering date, whereas
2402
+ * `Y` is supposed to be used in conjunction with `w` and `e`
2403
+ * for week-numbering date specific to the locale.
2404
+ */
2405
+ ({
2406
+ G: new EraParser(),
2407
+ y: new YearParser(),
2408
+ Y: new LocalWeekYearParser(),
2409
+ R: new ISOWeekYearParser(),
2410
+ u: new ExtendedYearParser(),
2411
+ Q: new QuarterParser(),
2412
+ q: new StandAloneQuarterParser(),
2413
+ M: new MonthParser(),
2414
+ L: new StandAloneMonthParser(),
2415
+ w: new LocalWeekParser(),
2416
+ I: new ISOWeekParser(),
2417
+ d: new DateParser(),
2418
+ D: new DayOfYearParser(),
2419
+ E: new DayParser(),
2420
+ e: new LocalDayParser(),
2421
+ c: new StandAloneLocalDayParser(),
2422
+ i: new ISODayParser(),
2423
+ a: new AMPMParser(),
2424
+ b: new AMPMMidnightParser(),
2425
+ B: new DayPeriodParser(),
2426
+ h: new Hour1to12Parser(),
2427
+ H: new Hour0to23Parser(),
2428
+ K: new Hour0To11Parser(),
2429
+ k: new Hour1To24Parser(),
2430
+ m: new MinuteParser(),
2431
+ s: new SecondParser(),
2432
+ S: new FractionOfSecondParser(),
2433
+ X: new ISOTimezoneWithZParser(),
2434
+ x: new ISOTimezoneParser(),
2435
+ t: new TimestampSecondsParser(),
2436
+ T: new TimestampMillisecondsParser()
2437
+ });
2438
+
2439
+ exports._typeof = _typeof;
2440
+ exports.getDefaultOptions = getDefaultOptions;
2441
+ exports.getUTCISOWeek = getUTCISOWeek;
2442
+ exports.getUTCISOWeekYear = getUTCISOWeekYear;
2443
+ exports.getUTCWeek = getUTCWeek;
2444
+ exports.getUTCWeekYear = getUTCWeekYear;
2445
+ exports.requiredArgs = requiredArgs;
2446
+ exports.toDate = toDate;
2447
+ exports.toInteger = toInteger;
2448
+ //# sourceMappingURL=index-c831a2f6.js.map