@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
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
- import { V as VerificationStatusEnum } from './types.esm-4ec5392e.js';
2
+ import { r as requiredArgs, t as toDate, a as toInteger, _ as _typeof, g as getUTCWeekYear, b as getUTCISOWeekYear, c as getUTCWeek, d as getUTCISOWeek, e as getDefaultOptions } from './index-705f3821.js';
3
+ import { V as VerificationStatusEnum } from './types.esm-3a1994d5.js';
3
4
  import { a as LCCategoryEnum } from './index-28917993.js';
4
5
  import { P as PuzzlePiece } from './PuzzlePiece-1fb12c2e.js';
5
6
  import { U as User, B as Briefcase, G as Graduation } from './User-161c7f37.js';
@@ -136,78 +137,6 @@ const SocialBadgesIcon = ({
136
137
  }));
137
138
  };
138
139
 
139
- function toInteger(dirtyNumber) {
140
- if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
141
- return NaN;
142
- }
143
-
144
- var number = Number(dirtyNumber);
145
-
146
- if (isNaN(number)) {
147
- return number;
148
- }
149
-
150
- return number < 0 ? Math.ceil(number) : Math.floor(number);
151
- }
152
-
153
- function requiredArgs(required, args) {
154
- if (args.length < required) {
155
- throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
156
- }
157
- }
158
-
159
- /**
160
- * @name toDate
161
- * @category Common Helpers
162
- * @summary Convert the given argument to an instance of Date.
163
- *
164
- * @description
165
- * Convert the given argument to an instance of Date.
166
- *
167
- * If the argument is an instance of Date, the function returns its clone.
168
- *
169
- * If the argument is a number, it is treated as a timestamp.
170
- *
171
- * If the argument is none of the above, the function returns Invalid Date.
172
- *
173
- * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
174
- *
175
- * @param {Date|Number} argument - the value to convert
176
- * @returns {Date} the parsed date in the local time zone
177
- * @throws {TypeError} 1 argument required
178
- *
179
- * @example
180
- * // Clone the date:
181
- * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
182
- * //=> Tue Feb 11 2014 11:30:30
183
- *
184
- * @example
185
- * // Convert the timestamp to date:
186
- * const result = toDate(1392098430000)
187
- * //=> Tue Feb 11 2014 11:30:30
188
- */
189
-
190
- function toDate(argument) {
191
- requiredArgs(1, arguments);
192
- var argStr = Object.prototype.toString.call(argument); // Clone the date
193
-
194
- if (argument instanceof Date || typeof argument === 'object' && argStr === '[object Date]') {
195
- // Prevent the date to lose the milliseconds when passed to new Date() in IE10
196
- return new Date(argument.getTime());
197
- } else if (typeof argument === 'number' || argStr === '[object Number]') {
198
- return new Date(argument);
199
- } else {
200
- if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
201
- // eslint-disable-next-line no-console
202
- 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://git.io/fjule"); // eslint-disable-next-line no-console
203
-
204
- console.warn(new Error().stack);
205
- }
206
-
207
- return new Date(NaN);
208
- }
209
- }
210
-
211
140
  /**
212
141
  * @name addMilliseconds
213
142
  * @category Millisecond Helpers
@@ -216,10 +145,6 @@ function toDate(argument) {
216
145
  * @description
217
146
  * Add the specified number of milliseconds to the given date.
218
147
  *
219
- * ### v2.0.0 breaking changes:
220
- *
221
- * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
222
- *
223
148
  * @param {Date|Number} date - the date to be changed
224
149
  * @param {Number} amount - the amount of milliseconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
225
150
  * @returns {Date} the new date with the milliseconds added
@@ -230,7 +155,6 @@ function toDate(argument) {
230
155
  * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
231
156
  * //=> Thu Jul 10 2014 12:45:30.750
232
157
  */
233
-
234
158
  function addMilliseconds(dirtyDate, dirtyAmount) {
235
159
  requiredArgs(2, arguments);
236
160
  var timestamp = toDate(dirtyDate).getTime();
@@ -263,10 +187,6 @@ function getTimezoneOffsetInMilliseconds(date) {
263
187
  * @description
264
188
  * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
265
189
  *
266
- * ### v2.0.0 breaking changes:
267
- *
268
- * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
269
- *
270
190
  * @param {*} value - the value to check
271
191
  * @returns {boolean} true if the given value is a date
272
192
  * @throws {TypeError} 1 arguments required
@@ -291,10 +211,9 @@ function getTimezoneOffsetInMilliseconds(date) {
291
211
  * const result = isDate({})
292
212
  * //=> false
293
213
  */
294
-
295
214
  function isDate(value) {
296
215
  requiredArgs(1, arguments);
297
- return value instanceof Date || typeof value === 'object' && Object.prototype.toString.call(value) === '[object Date]';
216
+ return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
298
217
  }
299
218
 
300
219
  /**
@@ -309,32 +228,6 @@ function isDate(value) {
309
228
  *
310
229
  * Time value of Date: http://es5.github.io/#x15.9.1.1
311
230
  *
312
- * ### v2.0.0 breaking changes:
313
- *
314
- * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
315
- *
316
- * - Now `isValid` doesn't throw an exception
317
- * if the first argument is not an instance of Date.
318
- * Instead, argument is converted beforehand using `toDate`.
319
- *
320
- * Examples:
321
- *
322
- * | `isValid` argument | Before v2.0.0 | v2.0.0 onward |
323
- * |---------------------------|---------------|---------------|
324
- * | `new Date()` | `true` | `true` |
325
- * | `new Date('2016-01-01')` | `true` | `true` |
326
- * | `new Date('')` | `false` | `false` |
327
- * | `new Date(1488370835081)` | `true` | `true` |
328
- * | `new Date(NaN)` | `false` | `false` |
329
- * | `'2016-01-01'` | `TypeError` | `false` |
330
- * | `''` | `TypeError` | `false` |
331
- * | `1488370835081` | `TypeError` | `true` |
332
- * | `NaN` | `TypeError` | `false` |
333
- *
334
- * We introduce this change to make *date-fns* consistent with ECMAScript behavior
335
- * that try to coerce arguments to the expected type
336
- * (which is also the case with other *date-fns* functions).
337
- *
338
231
  * @param {*} date - the date to check
339
232
  * @returns {Boolean} the date is valid
340
233
  * @throws {TypeError} 1 argument required
@@ -354,811 +247,148 @@ function isDate(value) {
354
247
  * const result = isValid(new Date(''))
355
248
  * //=> false
356
249
  */
357
-
358
250
  function isValid(dirtyDate) {
359
251
  requiredArgs(1, arguments);
360
-
361
252
  if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
362
253
  return false;
363
254
  }
364
-
365
255
  var date = toDate(dirtyDate);
366
256
  return !isNaN(Number(date));
367
257
  }
368
258
 
369
- var formatDistanceLocale = {
370
- lessThanXSeconds: {
371
- one: 'less than a second',
372
- other: 'less than {{count}} seconds'
373
- },
374
- xSeconds: {
375
- one: '1 second',
376
- other: '{{count}} seconds'
377
- },
378
- halfAMinute: 'half a minute',
379
- lessThanXMinutes: {
380
- one: 'less than a minute',
381
- other: 'less than {{count}} minutes'
382
- },
383
- xMinutes: {
384
- one: '1 minute',
385
- other: '{{count}} minutes'
386
- },
387
- aboutXHours: {
388
- one: 'about 1 hour',
389
- other: 'about {{count}} hours'
390
- },
391
- xHours: {
392
- one: '1 hour',
393
- other: '{{count}} hours'
394
- },
395
- xDays: {
396
- one: '1 day',
397
- other: '{{count}} days'
259
+ /**
260
+ * @name subMilliseconds
261
+ * @category Millisecond Helpers
262
+ * @summary Subtract the specified number of milliseconds from the given date.
263
+ *
264
+ * @description
265
+ * Subtract the specified number of milliseconds from the given date.
266
+ *
267
+ * @param {Date|Number} date - the date to be changed
268
+ * @param {Number} amount - the amount of milliseconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
269
+ * @returns {Date} the new date with the milliseconds subtracted
270
+ * @throws {TypeError} 2 arguments required
271
+ *
272
+ * @example
273
+ * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
274
+ * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
275
+ * //=> Thu Jul 10 2014 12:45:29.250
276
+ */
277
+ function subMilliseconds(dirtyDate, dirtyAmount) {
278
+ requiredArgs(2, arguments);
279
+ var amount = toInteger(dirtyAmount);
280
+ return addMilliseconds(dirtyDate, -amount);
281
+ }
282
+
283
+ var MILLISECONDS_IN_DAY = 86400000;
284
+ function getUTCDayOfYear(dirtyDate) {
285
+ requiredArgs(1, arguments);
286
+ var date = toDate(dirtyDate);
287
+ var timestamp = date.getTime();
288
+ date.setUTCMonth(0, 1);
289
+ date.setUTCHours(0, 0, 0, 0);
290
+ var startOfYearTimestamp = date.getTime();
291
+ var difference = timestamp - startOfYearTimestamp;
292
+ return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
293
+ }
294
+
295
+ function addLeadingZeros(number, targetLength) {
296
+ var sign = number < 0 ? '-' : '';
297
+ var output = Math.abs(number).toString();
298
+ while (output.length < targetLength) {
299
+ output = '0' + output;
300
+ }
301
+ return sign + output;
302
+ }
303
+
304
+ /*
305
+ * | | Unit | | Unit |
306
+ * |-----|--------------------------------|-----|--------------------------------|
307
+ * | a | AM, PM | A* | |
308
+ * | d | Day of month | D | |
309
+ * | h | Hour [1-12] | H | Hour [0-23] |
310
+ * | m | Minute | M | Month |
311
+ * | s | Second | S | Fraction of second |
312
+ * | y | Year (abs) | Y | |
313
+ *
314
+ * Letters marked by * are not implemented but reserved by Unicode standard.
315
+ */
316
+ var formatters$1 = {
317
+ // Year
318
+ y: function y(date, token) {
319
+ // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
320
+ // | Year | y | yy | yyy | yyyy | yyyyy |
321
+ // |----------|-------|----|-------|-------|-------|
322
+ // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
323
+ // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
324
+ // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
325
+ // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
326
+ // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
327
+
328
+ var signedYear = date.getUTCFullYear();
329
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
330
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
331
+ return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
398
332
  },
399
- aboutXWeeks: {
400
- one: 'about 1 week',
401
- other: 'about {{count}} weeks'
333
+ // Month
334
+ M: function M(date, token) {
335
+ var month = date.getUTCMonth();
336
+ return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
402
337
  },
403
- xWeeks: {
404
- one: '1 week',
405
- other: '{{count}} weeks'
338
+ // Day of the month
339
+ d: function d(date, token) {
340
+ return addLeadingZeros(date.getUTCDate(), token.length);
406
341
  },
407
- aboutXMonths: {
408
- one: 'about 1 month',
409
- other: 'about {{count}} months'
342
+ // AM or PM
343
+ a: function a(date, token) {
344
+ var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
345
+ switch (token) {
346
+ case 'a':
347
+ case 'aa':
348
+ return dayPeriodEnumValue.toUpperCase();
349
+ case 'aaa':
350
+ return dayPeriodEnumValue;
351
+ case 'aaaaa':
352
+ return dayPeriodEnumValue[0];
353
+ case 'aaaa':
354
+ default:
355
+ return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
356
+ }
410
357
  },
411
- xMonths: {
412
- one: '1 month',
413
- other: '{{count}} months'
358
+ // Hour [1-12]
359
+ h: function h(date, token) {
360
+ return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
414
361
  },
415
- aboutXYears: {
416
- one: 'about 1 year',
417
- other: 'about {{count}} years'
362
+ // Hour [0-23]
363
+ H: function H(date, token) {
364
+ return addLeadingZeros(date.getUTCHours(), token.length);
418
365
  },
419
- xYears: {
420
- one: '1 year',
421
- other: '{{count}} years'
366
+ // Minute
367
+ m: function m(date, token) {
368
+ return addLeadingZeros(date.getUTCMinutes(), token.length);
422
369
  },
423
- overXYears: {
424
- one: 'over 1 year',
425
- other: 'over {{count}} years'
370
+ // Second
371
+ s: function s(date, token) {
372
+ return addLeadingZeros(date.getUTCSeconds(), token.length);
426
373
  },
427
- almostXYears: {
428
- one: 'almost 1 year',
429
- other: 'almost {{count}} years'
430
- }
431
- };
432
-
433
- var formatDistance = function (token, count, options) {
434
- var result;
435
- var tokenValue = formatDistanceLocale[token];
436
-
437
- if (typeof tokenValue === 'string') {
438
- result = tokenValue;
439
- } else if (count === 1) {
440
- result = tokenValue.one;
441
- } else {
442
- result = tokenValue.other.replace('{{count}}', count.toString());
443
- }
444
-
445
- if (options !== null && options !== void 0 && options.addSuffix) {
446
- if (options.comparison && options.comparison > 0) {
447
- return 'in ' + result;
448
- } else {
449
- return result + ' ago';
450
- }
374
+ // Fraction of second
375
+ S: function S(date, token) {
376
+ var numberOfDigits = token.length;
377
+ var milliseconds = date.getUTCMilliseconds();
378
+ var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
379
+ return addLeadingZeros(fractionalSeconds, token.length);
451
380
  }
452
-
453
- return result;
454
381
  };
455
382
 
456
- function buildFormatLongFn(args) {
457
- return function () {
458
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
459
- // TODO: Remove String()
460
- var width = options.width ? String(options.width) : args.defaultWidth;
461
- var format = args.formats[width] || args.formats[args.defaultWidth];
462
- return format;
463
- };
464
- }
465
-
466
- var dateFormats = {
467
- full: 'EEEE, MMMM do, y',
468
- long: 'MMMM do, y',
469
- medium: 'MMM d, y',
470
- short: 'MM/dd/yyyy'
471
- };
472
- var timeFormats = {
473
- full: 'h:mm:ss a zzzz',
474
- long: 'h:mm:ss a z',
475
- medium: 'h:mm:ss a',
476
- short: 'h:mm a'
477
- };
478
- var dateTimeFormats = {
479
- full: "{{date}} 'at' {{time}}",
480
- long: "{{date}} 'at' {{time}}",
481
- medium: '{{date}}, {{time}}',
482
- short: '{{date}}, {{time}}'
483
- };
484
- var formatLong = {
485
- date: buildFormatLongFn({
486
- formats: dateFormats,
487
- defaultWidth: 'full'
488
- }),
489
- time: buildFormatLongFn({
490
- formats: timeFormats,
491
- defaultWidth: 'full'
492
- }),
493
- dateTime: buildFormatLongFn({
494
- formats: dateTimeFormats,
495
- defaultWidth: 'full'
496
- })
497
- };
498
-
499
- var formatRelativeLocale = {
500
- lastWeek: "'last' eeee 'at' p",
501
- yesterday: "'yesterday at' p",
502
- today: "'today at' p",
503
- tomorrow: "'tomorrow at' p",
504
- nextWeek: "eeee 'at' p",
505
- other: 'P'
506
- };
507
-
508
- var formatRelative = function (token, _date, _baseDate, _options) {
509
- return formatRelativeLocale[token];
510
- };
511
-
512
- function buildLocalizeFn(args) {
513
- return function (dirtyIndex, dirtyOptions) {
514
- var options = dirtyOptions || {};
515
- var context = options.context ? String(options.context) : 'standalone';
516
- var valuesArray;
517
-
518
- if (context === 'formatting' && args.formattingValues) {
519
- var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
520
- var width = options.width ? String(options.width) : defaultWidth;
521
- valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
522
- } else {
523
- var _defaultWidth = args.defaultWidth;
524
-
525
- var _width = options.width ? String(options.width) : args.defaultWidth;
526
-
527
- valuesArray = args.values[_width] || args.values[_defaultWidth];
528
- }
529
-
530
- var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; // @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
531
-
532
- return valuesArray[index];
533
- };
534
- }
535
-
536
- var eraValues = {
537
- narrow: ['B', 'A'],
538
- abbreviated: ['BC', 'AD'],
539
- wide: ['Before Christ', 'Anno Domini']
540
- };
541
- var quarterValues = {
542
- narrow: ['1', '2', '3', '4'],
543
- abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
544
- wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
545
- }; // Note: in English, the names of days of the week and months are capitalized.
546
- // If you are making a new locale based on this one, check if the same is true for the language you're working on.
547
- // Generally, formatted dates should look like they are in the middle of a sentence,
548
- // e.g. in Spanish language the weekdays and months should be in the lowercase.
549
-
550
- var monthValues = {
551
- narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
552
- abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
553
- wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
554
- };
555
- var dayValues = {
556
- narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
557
- short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
558
- abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
559
- wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
560
- };
561
- var dayPeriodValues = {
562
- narrow: {
563
- am: 'a',
564
- pm: 'p',
565
- midnight: 'mi',
566
- noon: 'n',
567
- morning: 'morning',
568
- afternoon: 'afternoon',
569
- evening: 'evening',
570
- night: 'night'
571
- },
572
- abbreviated: {
573
- am: 'AM',
574
- pm: 'PM',
575
- midnight: 'midnight',
576
- noon: 'noon',
577
- morning: 'morning',
578
- afternoon: 'afternoon',
579
- evening: 'evening',
580
- night: 'night'
581
- },
582
- wide: {
583
- am: 'a.m.',
584
- pm: 'p.m.',
585
- midnight: 'midnight',
586
- noon: 'noon',
587
- morning: 'morning',
588
- afternoon: 'afternoon',
589
- evening: 'evening',
590
- night: 'night'
591
- }
592
- };
593
- var formattingDayPeriodValues = {
594
- narrow: {
595
- am: 'a',
596
- pm: 'p',
597
- midnight: 'mi',
598
- noon: 'n',
599
- morning: 'in the morning',
600
- afternoon: 'in the afternoon',
601
- evening: 'in the evening',
602
- night: 'at night'
603
- },
604
- abbreviated: {
605
- am: 'AM',
606
- pm: 'PM',
607
- midnight: 'midnight',
608
- noon: 'noon',
609
- morning: 'in the morning',
610
- afternoon: 'in the afternoon',
611
- evening: 'in the evening',
612
- night: 'at night'
613
- },
614
- wide: {
615
- am: 'a.m.',
616
- pm: 'p.m.',
617
- midnight: 'midnight',
618
- noon: 'noon',
619
- morning: 'in the morning',
620
- afternoon: 'in the afternoon',
621
- evening: 'in the evening',
622
- night: 'at night'
623
- }
624
- };
625
-
626
- var ordinalNumber = function (dirtyNumber, _options) {
627
- var number = Number(dirtyNumber); // If ordinal numbers depend on context, for example,
628
- // if they are different for different grammatical genders,
629
- // use `options.unit`.
630
- //
631
- // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
632
- // 'day', 'hour', 'minute', 'second'.
633
-
634
- var rem100 = number % 100;
635
-
636
- if (rem100 > 20 || rem100 < 10) {
637
- switch (rem100 % 10) {
638
- case 1:
639
- return number + 'st';
640
-
641
- case 2:
642
- return number + 'nd';
643
-
644
- case 3:
645
- return number + 'rd';
646
- }
647
- }
648
-
649
- return number + 'th';
650
- };
651
-
652
- var localize = {
653
- ordinalNumber: ordinalNumber,
654
- era: buildLocalizeFn({
655
- values: eraValues,
656
- defaultWidth: 'wide'
657
- }),
658
- quarter: buildLocalizeFn({
659
- values: quarterValues,
660
- defaultWidth: 'wide',
661
- argumentCallback: function (quarter) {
662
- return quarter - 1;
663
- }
664
- }),
665
- month: buildLocalizeFn({
666
- values: monthValues,
667
- defaultWidth: 'wide'
668
- }),
669
- day: buildLocalizeFn({
670
- values: dayValues,
671
- defaultWidth: 'wide'
672
- }),
673
- dayPeriod: buildLocalizeFn({
674
- values: dayPeriodValues,
675
- defaultWidth: 'wide',
676
- formattingValues: formattingDayPeriodValues,
677
- defaultFormattingWidth: 'wide'
678
- })
679
- };
680
-
681
- function buildMatchFn(args) {
682
- return function (string) {
683
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
684
- var width = options.width;
685
- var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
686
- var matchResult = string.match(matchPattern);
687
-
688
- if (!matchResult) {
689
- return null;
690
- }
691
-
692
- var matchedString = matchResult[0];
693
- var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
694
- var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
695
- return pattern.test(matchedString);
696
- }) : findKey(parsePatterns, function (pattern) {
697
- return pattern.test(matchedString);
698
- });
699
- var value;
700
- value = args.valueCallback ? args.valueCallback(key) : key;
701
- value = options.valueCallback ? options.valueCallback(value) : value;
702
- var rest = string.slice(matchedString.length);
703
- return {
704
- value: value,
705
- rest: rest
706
- };
707
- };
708
- }
709
-
710
- function findKey(object, predicate) {
711
- for (var key in object) {
712
- if (object.hasOwnProperty(key) && predicate(object[key])) {
713
- return key;
714
- }
715
- }
716
-
717
- return undefined;
718
- }
719
-
720
- function findIndex(array, predicate) {
721
- for (var key = 0; key < array.length; key++) {
722
- if (predicate(array[key])) {
723
- return key;
724
- }
725
- }
726
-
727
- return undefined;
728
- }
729
-
730
- function buildMatchPatternFn(args) {
731
- return function (string) {
732
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
733
- var matchResult = string.match(args.matchPattern);
734
- if (!matchResult) return null;
735
- var matchedString = matchResult[0];
736
- var parseResult = string.match(args.parsePattern);
737
- if (!parseResult) return null;
738
- var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
739
- value = options.valueCallback ? options.valueCallback(value) : value;
740
- var rest = string.slice(matchedString.length);
741
- return {
742
- value: value,
743
- rest: rest
744
- };
745
- };
746
- }
747
-
748
- var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
749
- var parseOrdinalNumberPattern = /\d+/i;
750
- var matchEraPatterns = {
751
- narrow: /^(b|a)/i,
752
- abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
753
- wide: /^(before christ|before common era|anno domini|common era)/i
754
- };
755
- var parseEraPatterns = {
756
- any: [/^b/i, /^(a|c)/i]
757
- };
758
- var matchQuarterPatterns = {
759
- narrow: /^[1234]/i,
760
- abbreviated: /^q[1234]/i,
761
- wide: /^[1234](th|st|nd|rd)? quarter/i
762
- };
763
- var parseQuarterPatterns = {
764
- any: [/1/i, /2/i, /3/i, /4/i]
765
- };
766
- var matchMonthPatterns = {
767
- narrow: /^[jfmasond]/i,
768
- abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
769
- wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
770
- };
771
- var parseMonthPatterns = {
772
- narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
773
- any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
774
- };
775
- var matchDayPatterns = {
776
- narrow: /^[smtwf]/i,
777
- short: /^(su|mo|tu|we|th|fr|sa)/i,
778
- abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
779
- wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
780
- };
781
- var parseDayPatterns = {
782
- narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
783
- any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
784
- };
785
- var matchDayPeriodPatterns = {
786
- narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
787
- any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
788
- };
789
- var parseDayPeriodPatterns = {
790
- any: {
791
- am: /^a/i,
792
- pm: /^p/i,
793
- midnight: /^mi/i,
794
- noon: /^no/i,
795
- morning: /morning/i,
796
- afternoon: /afternoon/i,
797
- evening: /evening/i,
798
- night: /night/i
799
- }
800
- };
801
- var match = {
802
- ordinalNumber: buildMatchPatternFn({
803
- matchPattern: matchOrdinalNumberPattern,
804
- parsePattern: parseOrdinalNumberPattern,
805
- valueCallback: function (value) {
806
- return parseInt(value, 10);
807
- }
808
- }),
809
- era: buildMatchFn({
810
- matchPatterns: matchEraPatterns,
811
- defaultMatchWidth: 'wide',
812
- parsePatterns: parseEraPatterns,
813
- defaultParseWidth: 'any'
814
- }),
815
- quarter: buildMatchFn({
816
- matchPatterns: matchQuarterPatterns,
817
- defaultMatchWidth: 'wide',
818
- parsePatterns: parseQuarterPatterns,
819
- defaultParseWidth: 'any',
820
- valueCallback: function (index) {
821
- return index + 1;
822
- }
823
- }),
824
- month: buildMatchFn({
825
- matchPatterns: matchMonthPatterns,
826
- defaultMatchWidth: 'wide',
827
- parsePatterns: parseMonthPatterns,
828
- defaultParseWidth: 'any'
829
- }),
830
- day: buildMatchFn({
831
- matchPatterns: matchDayPatterns,
832
- defaultMatchWidth: 'wide',
833
- parsePatterns: parseDayPatterns,
834
- defaultParseWidth: 'any'
835
- }),
836
- dayPeriod: buildMatchFn({
837
- matchPatterns: matchDayPeriodPatterns,
838
- defaultMatchWidth: 'any',
839
- parsePatterns: parseDayPeriodPatterns,
840
- defaultParseWidth: 'any'
841
- })
842
- };
843
-
844
- /**
845
- * @type {Locale}
846
- * @category Locales
847
- * @summary English locale (United States).
848
- * @language English
849
- * @iso-639-2 eng
850
- * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
851
- * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
852
- */
853
- var locale = {
854
- code: 'en-US',
855
- formatDistance: formatDistance,
856
- formatLong: formatLong,
857
- formatRelative: formatRelative,
858
- localize: localize,
859
- match: match,
860
- options: {
861
- weekStartsOn: 0
862
- /* Sunday */
863
- ,
864
- firstWeekContainsDate: 1
865
- }
866
- };
867
-
868
- /**
869
- * @name subMilliseconds
870
- * @category Millisecond Helpers
871
- * @summary Subtract the specified number of milliseconds from the given date.
872
- *
873
- * @description
874
- * Subtract the specified number of milliseconds from the given date.
875
- *
876
- * ### v2.0.0 breaking changes:
877
- *
878
- * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
879
- *
880
- * @param {Date|Number} date - the date to be changed
881
- * @param {Number} amount - the amount of milliseconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
882
- * @returns {Date} the new date with the milliseconds subtracted
883
- * @throws {TypeError} 2 arguments required
884
- *
885
- * @example
886
- * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
887
- * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
888
- * //=> Thu Jul 10 2014 12:45:29.250
889
- */
890
-
891
- function subMilliseconds(dirtyDate, dirtyAmount) {
892
- requiredArgs(2, arguments);
893
- var amount = toInteger(dirtyAmount);
894
- return addMilliseconds(dirtyDate, -amount);
895
- }
896
-
897
- var MILLISECONDS_IN_DAY = 86400000; // This function will be a part of public API when UTC function will be implemented.
898
- // See issue: https://github.com/date-fns/date-fns/issues/376
899
-
900
- function getUTCDayOfYear(dirtyDate) {
901
- requiredArgs(1, arguments);
902
- var date = toDate(dirtyDate);
903
- var timestamp = date.getTime();
904
- date.setUTCMonth(0, 1);
905
- date.setUTCHours(0, 0, 0, 0);
906
- var startOfYearTimestamp = date.getTime();
907
- var difference = timestamp - startOfYearTimestamp;
908
- return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
909
- }
910
-
911
- // See issue: https://github.com/date-fns/date-fns/issues/376
912
-
913
- function startOfUTCISOWeek(dirtyDate) {
914
- requiredArgs(1, arguments);
915
- var weekStartsOn = 1;
916
- var date = toDate(dirtyDate);
917
- var day = date.getUTCDay();
918
- var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
919
- date.setUTCDate(date.getUTCDate() - diff);
920
- date.setUTCHours(0, 0, 0, 0);
921
- return date;
922
- }
923
-
924
- // See issue: https://github.com/date-fns/date-fns/issues/376
925
-
926
- function getUTCISOWeekYear(dirtyDate) {
927
- requiredArgs(1, arguments);
928
- var date = toDate(dirtyDate);
929
- var year = date.getUTCFullYear();
930
- var fourthOfJanuaryOfNextYear = new Date(0);
931
- fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
932
- fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
933
- var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
934
- var fourthOfJanuaryOfThisYear = new Date(0);
935
- fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
936
- fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
937
- var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
938
-
939
- if (date.getTime() >= startOfNextYear.getTime()) {
940
- return year + 1;
941
- } else if (date.getTime() >= startOfThisYear.getTime()) {
942
- return year;
943
- } else {
944
- return year - 1;
945
- }
946
- }
947
-
948
- // See issue: https://github.com/date-fns/date-fns/issues/376
949
-
950
- function startOfUTCISOWeekYear(dirtyDate) {
951
- requiredArgs(1, arguments);
952
- var year = getUTCISOWeekYear(dirtyDate);
953
- var fourthOfJanuary = new Date(0);
954
- fourthOfJanuary.setUTCFullYear(year, 0, 4);
955
- fourthOfJanuary.setUTCHours(0, 0, 0, 0);
956
- var date = startOfUTCISOWeek(fourthOfJanuary);
957
- return date;
958
- }
959
-
960
- var MILLISECONDS_IN_WEEK$1 = 604800000; // This function will be a part of public API when UTC function will be implemented.
961
- // See issue: https://github.com/date-fns/date-fns/issues/376
962
-
963
- function getUTCISOWeek(dirtyDate) {
964
- requiredArgs(1, arguments);
965
- var date = toDate(dirtyDate);
966
- var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime(); // Round the number of days to the nearest integer
967
- // because the number of milliseconds in a week is not constant
968
- // (e.g. it's different in the week of the daylight saving time clock shift)
969
-
970
- return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
971
- }
972
-
973
- // See issue: https://github.com/date-fns/date-fns/issues/376
974
-
975
- function startOfUTCWeek(dirtyDate, dirtyOptions) {
976
- requiredArgs(1, arguments);
977
- var options = dirtyOptions || {};
978
- var locale = options.locale;
979
- var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn;
980
- var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
981
- var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
982
-
983
- if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
984
- throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
985
- }
986
-
987
- var date = toDate(dirtyDate);
988
- var day = date.getUTCDay();
989
- var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
990
- date.setUTCDate(date.getUTCDate() - diff);
991
- date.setUTCHours(0, 0, 0, 0);
992
- return date;
993
- }
994
-
995
- // See issue: https://github.com/date-fns/date-fns/issues/376
996
-
997
- function getUTCWeekYear(dirtyDate, dirtyOptions) {
998
- requiredArgs(1, arguments);
999
- var date = toDate(dirtyDate);
1000
- var year = date.getUTCFullYear();
1001
- var options = dirtyOptions || {};
1002
- var locale = options.locale;
1003
- var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
1004
- var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
1005
- var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
1006
-
1007
- if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
1008
- throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
1009
- }
1010
-
1011
- var firstWeekOfNextYear = new Date(0);
1012
- firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
1013
- firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
1014
- var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, dirtyOptions);
1015
- var firstWeekOfThisYear = new Date(0);
1016
- firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
1017
- firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
1018
- var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, dirtyOptions);
1019
-
1020
- if (date.getTime() >= startOfNextYear.getTime()) {
1021
- return year + 1;
1022
- } else if (date.getTime() >= startOfThisYear.getTime()) {
1023
- return year;
1024
- } else {
1025
- return year - 1;
1026
- }
1027
- }
1028
-
1029
- // See issue: https://github.com/date-fns/date-fns/issues/376
1030
-
1031
- function startOfUTCWeekYear(dirtyDate, dirtyOptions) {
1032
- requiredArgs(1, arguments);
1033
- var options = dirtyOptions || {};
1034
- var locale = options.locale;
1035
- var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
1036
- var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
1037
- var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);
1038
- var year = getUTCWeekYear(dirtyDate, dirtyOptions);
1039
- var firstWeek = new Date(0);
1040
- firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
1041
- firstWeek.setUTCHours(0, 0, 0, 0);
1042
- var date = startOfUTCWeek(firstWeek, dirtyOptions);
1043
- return date;
1044
- }
1045
-
1046
- var MILLISECONDS_IN_WEEK = 604800000; // This function will be a part of public API when UTC function will be implemented.
1047
- // See issue: https://github.com/date-fns/date-fns/issues/376
1048
-
1049
- function getUTCWeek(dirtyDate, options) {
1050
- requiredArgs(1, arguments);
1051
- var date = toDate(dirtyDate);
1052
- var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime(); // Round the number of days to the nearest integer
1053
- // because the number of milliseconds in a week is not constant
1054
- // (e.g. it's different in the week of the daylight saving time clock shift)
1055
-
1056
- return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
1057
- }
1058
-
1059
- function addLeadingZeros(number, targetLength) {
1060
- var sign = number < 0 ? '-' : '';
1061
- var output = Math.abs(number).toString();
1062
-
1063
- while (output.length < targetLength) {
1064
- output = '0' + output;
1065
- }
1066
-
1067
- return sign + output;
1068
- }
1069
-
1070
- /*
1071
- * | | Unit | | Unit |
1072
- * |-----|--------------------------------|-----|--------------------------------|
1073
- * | a | AM, PM | A* | |
1074
- * | d | Day of month | D | |
1075
- * | h | Hour [1-12] | H | Hour [0-23] |
1076
- * | m | Minute | M | Month |
1077
- * | s | Second | S | Fraction of second |
1078
- * | y | Year (abs) | Y | |
1079
- *
1080
- * Letters marked by * are not implemented but reserved by Unicode standard.
1081
- */
1082
-
1083
- var formatters$1 = {
1084
- // Year
1085
- y: function (date, token) {
1086
- // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
1087
- // | Year | y | yy | yyy | yyyy | yyyyy |
1088
- // |----------|-------|----|-------|-------|-------|
1089
- // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
1090
- // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
1091
- // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
1092
- // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
1093
- // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
1094
- var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
1095
-
1096
- var year = signedYear > 0 ? signedYear : 1 - signedYear;
1097
- return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
1098
- },
1099
- // Month
1100
- M: function (date, token) {
1101
- var month = date.getUTCMonth();
1102
- return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
1103
- },
1104
- // Day of the month
1105
- d: function (date, token) {
1106
- return addLeadingZeros(date.getUTCDate(), token.length);
1107
- },
1108
- // AM or PM
1109
- a: function (date, token) {
1110
- var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
1111
-
1112
- switch (token) {
1113
- case 'a':
1114
- case 'aa':
1115
- return dayPeriodEnumValue.toUpperCase();
1116
-
1117
- case 'aaa':
1118
- return dayPeriodEnumValue;
1119
-
1120
- case 'aaaaa':
1121
- return dayPeriodEnumValue[0];
1122
-
1123
- case 'aaaa':
1124
- default:
1125
- return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
1126
- }
1127
- },
1128
- // Hour [1-12]
1129
- h: function (date, token) {
1130
- return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
1131
- },
1132
- // Hour [0-23]
1133
- H: function (date, token) {
1134
- return addLeadingZeros(date.getUTCHours(), token.length);
1135
- },
1136
- // Minute
1137
- m: function (date, token) {
1138
- return addLeadingZeros(date.getUTCMinutes(), token.length);
1139
- },
1140
- // Second
1141
- s: function (date, token) {
1142
- return addLeadingZeros(date.getUTCSeconds(), token.length);
1143
- },
1144
- // Fraction of second
1145
- S: function (date, token) {
1146
- var numberOfDigits = token.length;
1147
- var milliseconds = date.getUTCMilliseconds();
1148
- var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
1149
- return addLeadingZeros(fractionalSeconds, token.length);
1150
- }
1151
- };
1152
-
1153
- var dayPeriodEnum = {
1154
- am: 'am',
1155
- pm: 'pm',
1156
- midnight: 'midnight',
1157
- noon: 'noon',
1158
- morning: 'morning',
1159
- afternoon: 'afternoon',
1160
- evening: 'evening',
1161
- night: 'night'
383
+ var dayPeriodEnum = {
384
+ am: 'am',
385
+ pm: 'pm',
386
+ midnight: 'midnight',
387
+ noon: 'noon',
388
+ morning: 'morning',
389
+ afternoon: 'afternoon',
390
+ evening: 'evening',
391
+ night: 'night'
1162
392
  };
1163
393
  /*
1164
394
  * | | Unit | | Unit |
@@ -1208,9 +438,8 @@ var dayPeriodEnum = {
1208
438
 
1209
439
  var formatters = {
1210
440
  // Era
1211
- G: function (date, token, localize) {
441
+ G: function G(date, token, localize) {
1212
442
  var era = date.getUTCFullYear() > 0 ? 1 : 0;
1213
-
1214
443
  switch (token) {
1215
444
  // AD, BC
1216
445
  case 'G':
@@ -1220,13 +449,11 @@ var formatters = {
1220
449
  width: 'abbreviated'
1221
450
  });
1222
451
  // A, B
1223
-
1224
452
  case 'GGGGG':
1225
453
  return localize.era(era, {
1226
454
  width: 'narrow'
1227
455
  });
1228
456
  // Anno Domini, Before Christ
1229
-
1230
457
  case 'GGGG':
1231
458
  default:
1232
459
  return localize.era(era, {
@@ -1235,44 +462,45 @@ var formatters = {
1235
462
  }
1236
463
  },
1237
464
  // Year
1238
- y: function (date, token, localize) {
465
+ y: function y(date, token, localize) {
1239
466
  // Ordinal number
1240
467
  if (token === 'yo') {
1241
- var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
1242
-
468
+ var signedYear = date.getUTCFullYear();
469
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
1243
470
  var year = signedYear > 0 ? signedYear : 1 - signedYear;
1244
471
  return localize.ordinalNumber(year, {
1245
472
  unit: 'year'
1246
473
  });
1247
474
  }
1248
-
1249
475
  return formatters$1.y(date, token);
1250
476
  },
1251
477
  // Local week-numbering year
1252
- Y: function (date, token, localize, options) {
1253
- var signedWeekYear = getUTCWeekYear(date, options); // Returns 1 for 1 BC (which is year 0 in JavaScript)
1254
-
1255
- var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; // Two digit year
478
+ Y: function Y(date, token, localize, options) {
479
+ var signedWeekYear = getUTCWeekYear(date, options);
480
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
481
+ var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
1256
482
 
483
+ // Two digit year
1257
484
  if (token === 'YY') {
1258
485
  var twoDigitYear = weekYear % 100;
1259
486
  return addLeadingZeros(twoDigitYear, 2);
1260
- } // Ordinal number
1261
-
487
+ }
1262
488
 
489
+ // Ordinal number
1263
490
  if (token === 'Yo') {
1264
491
  return localize.ordinalNumber(weekYear, {
1265
492
  unit: 'year'
1266
493
  });
1267
- } // Padding
1268
-
494
+ }
1269
495
 
496
+ // Padding
1270
497
  return addLeadingZeros(weekYear, token.length);
1271
498
  },
1272
499
  // ISO week-numbering year
1273
- R: function (date, token) {
1274
- var isoWeekYear = getUTCISOWeekYear(date); // Padding
500
+ R: function R(date, token) {
501
+ var isoWeekYear = getUTCISOWeekYear(date);
1275
502
 
503
+ // Padding
1276
504
  return addLeadingZeros(isoWeekYear, token.length);
1277
505
  },
1278
506
  // Extended year. This is a single number designating the year of this calendar system.
@@ -1284,44 +512,38 @@ var formatters = {
1284
512
  // | BC 2 | 2 | -1 |
1285
513
  // Also `yy` always returns the last two digits of a year,
1286
514
  // while `uu` pads single digit years to 2 characters and returns other years unchanged.
1287
- u: function (date, token) {
515
+ u: function u(date, token) {
1288
516
  var year = date.getUTCFullYear();
1289
517
  return addLeadingZeros(year, token.length);
1290
518
  },
1291
519
  // Quarter
1292
- Q: function (date, token, localize) {
520
+ Q: function Q(date, token, localize) {
1293
521
  var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
1294
-
1295
522
  switch (token) {
1296
523
  // 1, 2, 3, 4
1297
524
  case 'Q':
1298
525
  return String(quarter);
1299
526
  // 01, 02, 03, 04
1300
-
1301
527
  case 'QQ':
1302
528
  return addLeadingZeros(quarter, 2);
1303
529
  // 1st, 2nd, 3rd, 4th
1304
-
1305
530
  case 'Qo':
1306
531
  return localize.ordinalNumber(quarter, {
1307
532
  unit: 'quarter'
1308
533
  });
1309
534
  // Q1, Q2, Q3, Q4
1310
-
1311
535
  case 'QQQ':
1312
536
  return localize.quarter(quarter, {
1313
537
  width: 'abbreviated',
1314
538
  context: 'formatting'
1315
539
  });
1316
540
  // 1, 2, 3, 4 (narrow quarter; could be not numerical)
1317
-
1318
541
  case 'QQQQQ':
1319
542
  return localize.quarter(quarter, {
1320
543
  width: 'narrow',
1321
544
  context: 'formatting'
1322
545
  });
1323
546
  // 1st quarter, 2nd quarter, ...
1324
-
1325
547
  case 'QQQQ':
1326
548
  default:
1327
549
  return localize.quarter(quarter, {
@@ -1331,39 +553,33 @@ var formatters = {
1331
553
  }
1332
554
  },
1333
555
  // Stand-alone quarter
1334
- q: function (date, token, localize) {
556
+ q: function q(date, token, localize) {
1335
557
  var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
1336
-
1337
558
  switch (token) {
1338
559
  // 1, 2, 3, 4
1339
560
  case 'q':
1340
561
  return String(quarter);
1341
562
  // 01, 02, 03, 04
1342
-
1343
563
  case 'qq':
1344
564
  return addLeadingZeros(quarter, 2);
1345
565
  // 1st, 2nd, 3rd, 4th
1346
-
1347
566
  case 'qo':
1348
567
  return localize.ordinalNumber(quarter, {
1349
568
  unit: 'quarter'
1350
569
  });
1351
570
  // Q1, Q2, Q3, Q4
1352
-
1353
571
  case 'qqq':
1354
572
  return localize.quarter(quarter, {
1355
573
  width: 'abbreviated',
1356
574
  context: 'standalone'
1357
575
  });
1358
576
  // 1, 2, 3, 4 (narrow quarter; could be not numerical)
1359
-
1360
577
  case 'qqqqq':
1361
578
  return localize.quarter(quarter, {
1362
579
  width: 'narrow',
1363
580
  context: 'standalone'
1364
581
  });
1365
582
  // 1st quarter, 2nd quarter, ...
1366
-
1367
583
  case 'qqqq':
1368
584
  default:
1369
585
  return localize.quarter(quarter, {
@@ -1373,35 +589,30 @@ var formatters = {
1373
589
  }
1374
590
  },
1375
591
  // Month
1376
- M: function (date, token, localize) {
592
+ M: function M(date, token, localize) {
1377
593
  var month = date.getUTCMonth();
1378
-
1379
594
  switch (token) {
1380
595
  case 'M':
1381
596
  case 'MM':
1382
597
  return formatters$1.M(date, token);
1383
598
  // 1st, 2nd, ..., 12th
1384
-
1385
599
  case 'Mo':
1386
600
  return localize.ordinalNumber(month + 1, {
1387
601
  unit: 'month'
1388
602
  });
1389
603
  // Jan, Feb, ..., Dec
1390
-
1391
604
  case 'MMM':
1392
605
  return localize.month(month, {
1393
606
  width: 'abbreviated',
1394
607
  context: 'formatting'
1395
608
  });
1396
609
  // J, F, ..., D
1397
-
1398
610
  case 'MMMMM':
1399
611
  return localize.month(month, {
1400
612
  width: 'narrow',
1401
613
  context: 'formatting'
1402
614
  });
1403
615
  // January, February, ..., December
1404
-
1405
616
  case 'MMMM':
1406
617
  default:
1407
618
  return localize.month(month, {
@@ -1411,39 +622,33 @@ var formatters = {
1411
622
  }
1412
623
  },
1413
624
  // Stand-alone month
1414
- L: function (date, token, localize) {
625
+ L: function L(date, token, localize) {
1415
626
  var month = date.getUTCMonth();
1416
-
1417
627
  switch (token) {
1418
628
  // 1, 2, ..., 12
1419
629
  case 'L':
1420
630
  return String(month + 1);
1421
631
  // 01, 02, ..., 12
1422
-
1423
632
  case 'LL':
1424
633
  return addLeadingZeros(month + 1, 2);
1425
634
  // 1st, 2nd, ..., 12th
1426
-
1427
635
  case 'Lo':
1428
636
  return localize.ordinalNumber(month + 1, {
1429
637
  unit: 'month'
1430
638
  });
1431
639
  // Jan, Feb, ..., Dec
1432
-
1433
640
  case 'LLL':
1434
641
  return localize.month(month, {
1435
642
  width: 'abbreviated',
1436
643
  context: 'standalone'
1437
644
  });
1438
645
  // J, F, ..., D
1439
-
1440
646
  case 'LLLLL':
1441
647
  return localize.month(month, {
1442
648
  width: 'narrow',
1443
649
  context: 'standalone'
1444
650
  });
1445
651
  // January, February, ..., December
1446
-
1447
652
  case 'LLLL':
1448
653
  default:
1449
654
  return localize.month(month, {
@@ -1453,55 +658,47 @@ var formatters = {
1453
658
  }
1454
659
  },
1455
660
  // Local week of year
1456
- w: function (date, token, localize, options) {
661
+ w: function w(date, token, localize, options) {
1457
662
  var week = getUTCWeek(date, options);
1458
-
1459
663
  if (token === 'wo') {
1460
664
  return localize.ordinalNumber(week, {
1461
665
  unit: 'week'
1462
666
  });
1463
667
  }
1464
-
1465
668
  return addLeadingZeros(week, token.length);
1466
669
  },
1467
670
  // ISO week of year
1468
- I: function (date, token, localize) {
671
+ I: function I(date, token, localize) {
1469
672
  var isoWeek = getUTCISOWeek(date);
1470
-
1471
673
  if (token === 'Io') {
1472
674
  return localize.ordinalNumber(isoWeek, {
1473
675
  unit: 'week'
1474
676
  });
1475
677
  }
1476
-
1477
678
  return addLeadingZeros(isoWeek, token.length);
1478
679
  },
1479
680
  // Day of the month
1480
- d: function (date, token, localize) {
681
+ d: function d(date, token, localize) {
1481
682
  if (token === 'do') {
1482
683
  return localize.ordinalNumber(date.getUTCDate(), {
1483
684
  unit: 'date'
1484
685
  });
1485
686
  }
1486
-
1487
687
  return formatters$1.d(date, token);
1488
688
  },
1489
689
  // Day of year
1490
- D: function (date, token, localize) {
690
+ D: function D(date, token, localize) {
1491
691
  var dayOfYear = getUTCDayOfYear(date);
1492
-
1493
692
  if (token === 'Do') {
1494
693
  return localize.ordinalNumber(dayOfYear, {
1495
694
  unit: 'dayOfYear'
1496
695
  });
1497
696
  }
1498
-
1499
697
  return addLeadingZeros(dayOfYear, token.length);
1500
698
  },
1501
699
  // Day of week
1502
- E: function (date, token, localize) {
700
+ E: function E(date, token, localize) {
1503
701
  var dayOfWeek = date.getUTCDay();
1504
-
1505
702
  switch (token) {
1506
703
  // Tue
1507
704
  case 'E':
@@ -1512,21 +709,18 @@ var formatters = {
1512
709
  context: 'formatting'
1513
710
  });
1514
711
  // T
1515
-
1516
712
  case 'EEEEE':
1517
713
  return localize.day(dayOfWeek, {
1518
714
  width: 'narrow',
1519
715
  context: 'formatting'
1520
716
  });
1521
717
  // Tu
1522
-
1523
718
  case 'EEEEEE':
1524
719
  return localize.day(dayOfWeek, {
1525
720
  width: 'short',
1526
721
  context: 'formatting'
1527
722
  });
1528
723
  // Tuesday
1529
-
1530
724
  case 'EEEE':
1531
725
  default:
1532
726
  return localize.day(dayOfWeek, {
@@ -1536,46 +730,39 @@ var formatters = {
1536
730
  }
1537
731
  },
1538
732
  // Local day of week
1539
- e: function (date, token, localize, options) {
733
+ e: function e(date, token, localize, options) {
1540
734
  var dayOfWeek = date.getUTCDay();
1541
735
  var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
1542
-
1543
736
  switch (token) {
1544
737
  // Numerical value (Nth day of week with current locale or weekStartsOn)
1545
738
  case 'e':
1546
739
  return String(localDayOfWeek);
1547
740
  // Padded numerical value
1548
-
1549
741
  case 'ee':
1550
742
  return addLeadingZeros(localDayOfWeek, 2);
1551
743
  // 1st, 2nd, ..., 7th
1552
-
1553
744
  case 'eo':
1554
745
  return localize.ordinalNumber(localDayOfWeek, {
1555
746
  unit: 'day'
1556
747
  });
1557
-
1558
748
  case 'eee':
1559
749
  return localize.day(dayOfWeek, {
1560
750
  width: 'abbreviated',
1561
751
  context: 'formatting'
1562
752
  });
1563
753
  // T
1564
-
1565
754
  case 'eeeee':
1566
755
  return localize.day(dayOfWeek, {
1567
756
  width: 'narrow',
1568
757
  context: 'formatting'
1569
758
  });
1570
759
  // Tu
1571
-
1572
760
  case 'eeeeee':
1573
761
  return localize.day(dayOfWeek, {
1574
762
  width: 'short',
1575
763
  context: 'formatting'
1576
764
  });
1577
765
  // Tuesday
1578
-
1579
766
  case 'eeee':
1580
767
  default:
1581
768
  return localize.day(dayOfWeek, {
@@ -1585,46 +772,39 @@ var formatters = {
1585
772
  }
1586
773
  },
1587
774
  // Stand-alone local day of week
1588
- c: function (date, token, localize, options) {
775
+ c: function c(date, token, localize, options) {
1589
776
  var dayOfWeek = date.getUTCDay();
1590
777
  var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
1591
-
1592
778
  switch (token) {
1593
779
  // Numerical value (same as in `e`)
1594
780
  case 'c':
1595
781
  return String(localDayOfWeek);
1596
782
  // Padded numerical value
1597
-
1598
783
  case 'cc':
1599
784
  return addLeadingZeros(localDayOfWeek, token.length);
1600
785
  // 1st, 2nd, ..., 7th
1601
-
1602
786
  case 'co':
1603
787
  return localize.ordinalNumber(localDayOfWeek, {
1604
788
  unit: 'day'
1605
789
  });
1606
-
1607
790
  case 'ccc':
1608
791
  return localize.day(dayOfWeek, {
1609
792
  width: 'abbreviated',
1610
793
  context: 'standalone'
1611
794
  });
1612
795
  // T
1613
-
1614
796
  case 'ccccc':
1615
797
  return localize.day(dayOfWeek, {
1616
798
  width: 'narrow',
1617
799
  context: 'standalone'
1618
800
  });
1619
801
  // Tu
1620
-
1621
802
  case 'cccccc':
1622
803
  return localize.day(dayOfWeek, {
1623
804
  width: 'short',
1624
805
  context: 'standalone'
1625
806
  });
1626
807
  // Tuesday
1627
-
1628
808
  case 'cccc':
1629
809
  default:
1630
810
  return localize.day(dayOfWeek, {
@@ -1634,47 +814,40 @@ var formatters = {
1634
814
  }
1635
815
  },
1636
816
  // ISO day of week
1637
- i: function (date, token, localize) {
817
+ i: function i(date, token, localize) {
1638
818
  var dayOfWeek = date.getUTCDay();
1639
819
  var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
1640
-
1641
820
  switch (token) {
1642
821
  // 2
1643
822
  case 'i':
1644
823
  return String(isoDayOfWeek);
1645
824
  // 02
1646
-
1647
825
  case 'ii':
1648
826
  return addLeadingZeros(isoDayOfWeek, token.length);
1649
827
  // 2nd
1650
-
1651
828
  case 'io':
1652
829
  return localize.ordinalNumber(isoDayOfWeek, {
1653
830
  unit: 'day'
1654
831
  });
1655
832
  // Tue
1656
-
1657
833
  case 'iii':
1658
834
  return localize.day(dayOfWeek, {
1659
835
  width: 'abbreviated',
1660
836
  context: 'formatting'
1661
837
  });
1662
838
  // T
1663
-
1664
839
  case 'iiiii':
1665
840
  return localize.day(dayOfWeek, {
1666
841
  width: 'narrow',
1667
842
  context: 'formatting'
1668
843
  });
1669
844
  // Tu
1670
-
1671
845
  case 'iiiiii':
1672
846
  return localize.day(dayOfWeek, {
1673
847
  width: 'short',
1674
848
  context: 'formatting'
1675
849
  });
1676
850
  // Tuesday
1677
-
1678
851
  case 'iiii':
1679
852
  default:
1680
853
  return localize.day(dayOfWeek, {
@@ -1684,10 +857,9 @@ var formatters = {
1684
857
  }
1685
858
  },
1686
859
  // AM or PM
1687
- a: function (date, token, localize) {
860
+ a: function a(date, token, localize) {
1688
861
  var hours = date.getUTCHours();
1689
862
  var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
1690
-
1691
863
  switch (token) {
1692
864
  case 'a':
1693
865
  case 'aa':
@@ -1695,19 +867,16 @@ var formatters = {
1695
867
  width: 'abbreviated',
1696
868
  context: 'formatting'
1697
869
  });
1698
-
1699
870
  case 'aaa':
1700
871
  return localize.dayPeriod(dayPeriodEnumValue, {
1701
872
  width: 'abbreviated',
1702
873
  context: 'formatting'
1703
874
  }).toLowerCase();
1704
-
1705
875
  case 'aaaaa':
1706
876
  return localize.dayPeriod(dayPeriodEnumValue, {
1707
877
  width: 'narrow',
1708
878
  context: 'formatting'
1709
879
  });
1710
-
1711
880
  case 'aaaa':
1712
881
  default:
1713
882
  return localize.dayPeriod(dayPeriodEnumValue, {
@@ -1717,10 +886,9 @@ var formatters = {
1717
886
  }
1718
887
  },
1719
888
  // AM, PM, midnight, noon
1720
- b: function (date, token, localize) {
889
+ b: function b(date, token, localize) {
1721
890
  var hours = date.getUTCHours();
1722
891
  var dayPeriodEnumValue;
1723
-
1724
892
  if (hours === 12) {
1725
893
  dayPeriodEnumValue = dayPeriodEnum.noon;
1726
894
  } else if (hours === 0) {
@@ -1728,7 +896,6 @@ var formatters = {
1728
896
  } else {
1729
897
  dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
1730
898
  }
1731
-
1732
899
  switch (token) {
1733
900
  case 'b':
1734
901
  case 'bb':
@@ -1736,19 +903,16 @@ var formatters = {
1736
903
  width: 'abbreviated',
1737
904
  context: 'formatting'
1738
905
  });
1739
-
1740
906
  case 'bbb':
1741
907
  return localize.dayPeriod(dayPeriodEnumValue, {
1742
908
  width: 'abbreviated',
1743
909
  context: 'formatting'
1744
910
  }).toLowerCase();
1745
-
1746
911
  case 'bbbbb':
1747
912
  return localize.dayPeriod(dayPeriodEnumValue, {
1748
913
  width: 'narrow',
1749
914
  context: 'formatting'
1750
915
  });
1751
-
1752
916
  case 'bbbb':
1753
917
  default:
1754
918
  return localize.dayPeriod(dayPeriodEnumValue, {
@@ -1758,10 +922,9 @@ var formatters = {
1758
922
  }
1759
923
  },
1760
924
  // in the morning, in the afternoon, in the evening, at night
1761
- B: function (date, token, localize) {
925
+ B: function B(date, token, localize) {
1762
926
  var hours = date.getUTCHours();
1763
927
  var dayPeriodEnumValue;
1764
-
1765
928
  if (hours >= 17) {
1766
929
  dayPeriodEnumValue = dayPeriodEnum.evening;
1767
930
  } else if (hours >= 12) {
@@ -1771,7 +934,6 @@ var formatters = {
1771
934
  } else {
1772
935
  dayPeriodEnumValue = dayPeriodEnum.night;
1773
936
  }
1774
-
1775
937
  switch (token) {
1776
938
  case 'B':
1777
939
  case 'BB':
@@ -1780,13 +942,11 @@ var formatters = {
1780
942
  width: 'abbreviated',
1781
943
  context: 'formatting'
1782
944
  });
1783
-
1784
945
  case 'BBBBB':
1785
946
  return localize.dayPeriod(dayPeriodEnumValue, {
1786
947
  width: 'narrow',
1787
948
  context: 'formatting'
1788
949
  });
1789
-
1790
950
  case 'BBBB':
1791
951
  default:
1792
952
  return localize.dayPeriod(dayPeriodEnumValue, {
@@ -1796,7 +956,7 @@ var formatters = {
1796
956
  }
1797
957
  },
1798
958
  // Hour [1-12]
1799
- h: function (date, token, localize) {
959
+ h: function h(date, token, localize) {
1800
960
  if (token === 'ho') {
1801
961
  var hours = date.getUTCHours() % 12;
1802
962
  if (hours === 0) hours = 12;
@@ -1804,133 +964,119 @@ var formatters = {
1804
964
  unit: 'hour'
1805
965
  });
1806
966
  }
1807
-
1808
967
  return formatters$1.h(date, token);
1809
968
  },
1810
969
  // Hour [0-23]
1811
- H: function (date, token, localize) {
970
+ H: function H(date, token, localize) {
1812
971
  if (token === 'Ho') {
1813
972
  return localize.ordinalNumber(date.getUTCHours(), {
1814
973
  unit: 'hour'
1815
974
  });
1816
975
  }
1817
-
1818
976
  return formatters$1.H(date, token);
1819
977
  },
1820
978
  // Hour [0-11]
1821
- K: function (date, token, localize) {
979
+ K: function K(date, token, localize) {
1822
980
  var hours = date.getUTCHours() % 12;
1823
-
1824
981
  if (token === 'Ko') {
1825
982
  return localize.ordinalNumber(hours, {
1826
983
  unit: 'hour'
1827
984
  });
1828
985
  }
1829
-
1830
986
  return addLeadingZeros(hours, token.length);
1831
987
  },
1832
988
  // Hour [1-24]
1833
- k: function (date, token, localize) {
989
+ k: function k(date, token, localize) {
1834
990
  var hours = date.getUTCHours();
1835
991
  if (hours === 0) hours = 24;
1836
-
1837
992
  if (token === 'ko') {
1838
993
  return localize.ordinalNumber(hours, {
1839
994
  unit: 'hour'
1840
995
  });
1841
996
  }
1842
-
1843
997
  return addLeadingZeros(hours, token.length);
1844
998
  },
1845
999
  // Minute
1846
- m: function (date, token, localize) {
1000
+ m: function m(date, token, localize) {
1847
1001
  if (token === 'mo') {
1848
1002
  return localize.ordinalNumber(date.getUTCMinutes(), {
1849
1003
  unit: 'minute'
1850
1004
  });
1851
1005
  }
1852
-
1853
1006
  return formatters$1.m(date, token);
1854
1007
  },
1855
1008
  // Second
1856
- s: function (date, token, localize) {
1009
+ s: function s(date, token, localize) {
1857
1010
  if (token === 'so') {
1858
1011
  return localize.ordinalNumber(date.getUTCSeconds(), {
1859
1012
  unit: 'second'
1860
1013
  });
1861
1014
  }
1862
-
1863
1015
  return formatters$1.s(date, token);
1864
1016
  },
1865
1017
  // Fraction of second
1866
- S: function (date, token) {
1018
+ S: function S(date, token) {
1867
1019
  return formatters$1.S(date, token);
1868
1020
  },
1869
1021
  // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
1870
- X: function (date, token, _localize, options) {
1022
+ X: function X(date, token, _localize, options) {
1871
1023
  var originalDate = options._originalDate || date;
1872
1024
  var timezoneOffset = originalDate.getTimezoneOffset();
1873
-
1874
1025
  if (timezoneOffset === 0) {
1875
1026
  return 'Z';
1876
1027
  }
1877
-
1878
1028
  switch (token) {
1879
1029
  // Hours and optional minutes
1880
1030
  case 'X':
1881
1031
  return formatTimezoneWithOptionalMinutes(timezoneOffset);
1032
+
1882
1033
  // Hours, minutes and optional seconds without `:` delimiter
1883
1034
  // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1884
1035
  // so this token always has the same output as `XX`
1885
-
1886
1036
  case 'XXXX':
1887
1037
  case 'XX':
1888
1038
  // Hours and minutes without `:` delimiter
1889
1039
  return formatTimezone(timezoneOffset);
1040
+
1890
1041
  // Hours, minutes and optional seconds with `:` delimiter
1891
1042
  // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1892
1043
  // so this token always has the same output as `XXX`
1893
-
1894
1044
  case 'XXXXX':
1895
1045
  case 'XXX': // Hours and minutes with `:` delimiter
1896
-
1897
1046
  default:
1898
1047
  return formatTimezone(timezoneOffset, ':');
1899
1048
  }
1900
1049
  },
1901
1050
  // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
1902
- x: function (date, token, _localize, options) {
1051
+ x: function x(date, token, _localize, options) {
1903
1052
  var originalDate = options._originalDate || date;
1904
1053
  var timezoneOffset = originalDate.getTimezoneOffset();
1905
-
1906
1054
  switch (token) {
1907
1055
  // Hours and optional minutes
1908
1056
  case 'x':
1909
1057
  return formatTimezoneWithOptionalMinutes(timezoneOffset);
1058
+
1910
1059
  // Hours, minutes and optional seconds without `:` delimiter
1911
1060
  // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1912
1061
  // so this token always has the same output as `xx`
1913
-
1914
1062
  case 'xxxx':
1915
1063
  case 'xx':
1916
1064
  // Hours and minutes without `:` delimiter
1917
1065
  return formatTimezone(timezoneOffset);
1066
+
1918
1067
  // Hours, minutes and optional seconds with `:` delimiter
1919
1068
  // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1920
1069
  // so this token always has the same output as `xxx`
1921
-
1922
1070
  case 'xxxxx':
1923
1071
  case 'xxx': // Hours and minutes with `:` delimiter
1924
-
1925
1072
  default:
1926
1073
  return formatTimezone(timezoneOffset, ':');
1927
1074
  }
1928
1075
  },
1929
1076
  // Timezone (GMT)
1930
- O: function (date, token, _localize, options) {
1077
+ O: function O(date, token, _localize, options) {
1931
1078
  var originalDate = options._originalDate || date;
1932
1079
  var timezoneOffset = originalDate.getTimezoneOffset();
1933
-
1934
1080
  switch (token) {
1935
1081
  // Short
1936
1082
  case 'O':
@@ -1938,17 +1084,15 @@ var formatters = {
1938
1084
  case 'OOO':
1939
1085
  return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1940
1086
  // Long
1941
-
1942
1087
  case 'OOOO':
1943
1088
  default:
1944
1089
  return 'GMT' + formatTimezone(timezoneOffset, ':');
1945
1090
  }
1946
1091
  },
1947
1092
  // Timezone (specific non-location)
1948
- z: function (date, token, _localize, options) {
1093
+ z: function z(date, token, _localize, options) {
1949
1094
  var originalDate = options._originalDate || date;
1950
1095
  var timezoneOffset = originalDate.getTimezoneOffset();
1951
-
1952
1096
  switch (token) {
1953
1097
  // Short
1954
1098
  case 'z':
@@ -1956,173 +1100,628 @@ var formatters = {
1956
1100
  case 'zzz':
1957
1101
  return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1958
1102
  // Long
1959
-
1960
1103
  case 'zzzz':
1961
1104
  default:
1962
1105
  return 'GMT' + formatTimezone(timezoneOffset, ':');
1963
1106
  }
1964
1107
  },
1965
1108
  // Seconds timestamp
1966
- t: function (date, token, _localize, options) {
1109
+ t: function t(date, token, _localize, options) {
1967
1110
  var originalDate = options._originalDate || date;
1968
1111
  var timestamp = Math.floor(originalDate.getTime() / 1000);
1969
1112
  return addLeadingZeros(timestamp, token.length);
1970
1113
  },
1971
1114
  // Milliseconds timestamp
1972
- T: function (date, token, _localize, options) {
1115
+ T: function T(date, token, _localize, options) {
1973
1116
  var originalDate = options._originalDate || date;
1974
1117
  var timestamp = originalDate.getTime();
1975
1118
  return addLeadingZeros(timestamp, token.length);
1976
1119
  }
1977
1120
  };
1121
+ function formatTimezoneShort(offset, dirtyDelimiter) {
1122
+ var sign = offset > 0 ? '-' : '+';
1123
+ var absOffset = Math.abs(offset);
1124
+ var hours = Math.floor(absOffset / 60);
1125
+ var minutes = absOffset % 60;
1126
+ if (minutes === 0) {
1127
+ return sign + String(hours);
1128
+ }
1129
+ var delimiter = dirtyDelimiter || '';
1130
+ return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
1131
+ }
1132
+ function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
1133
+ if (offset % 60 === 0) {
1134
+ var sign = offset > 0 ? '-' : '+';
1135
+ return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
1136
+ }
1137
+ return formatTimezone(offset, dirtyDelimiter);
1138
+ }
1139
+ function formatTimezone(offset, dirtyDelimiter) {
1140
+ var delimiter = dirtyDelimiter || '';
1141
+ var sign = offset > 0 ? '-' : '+';
1142
+ var absOffset = Math.abs(offset);
1143
+ var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
1144
+ var minutes = addLeadingZeros(absOffset % 60, 2);
1145
+ return sign + hours + delimiter + minutes;
1146
+ }
1147
+
1148
+ var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
1149
+ switch (pattern) {
1150
+ case 'P':
1151
+ return formatLong.date({
1152
+ width: 'short'
1153
+ });
1154
+ case 'PP':
1155
+ return formatLong.date({
1156
+ width: 'medium'
1157
+ });
1158
+ case 'PPP':
1159
+ return formatLong.date({
1160
+ width: 'long'
1161
+ });
1162
+ case 'PPPP':
1163
+ default:
1164
+ return formatLong.date({
1165
+ width: 'full'
1166
+ });
1167
+ }
1168
+ };
1169
+ var timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
1170
+ switch (pattern) {
1171
+ case 'p':
1172
+ return formatLong.time({
1173
+ width: 'short'
1174
+ });
1175
+ case 'pp':
1176
+ return formatLong.time({
1177
+ width: 'medium'
1178
+ });
1179
+ case 'ppp':
1180
+ return formatLong.time({
1181
+ width: 'long'
1182
+ });
1183
+ case 'pppp':
1184
+ default:
1185
+ return formatLong.time({
1186
+ width: 'full'
1187
+ });
1188
+ }
1189
+ };
1190
+ var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
1191
+ var matchResult = pattern.match(/(P+)(p+)?/) || [];
1192
+ var datePattern = matchResult[1];
1193
+ var timePattern = matchResult[2];
1194
+ if (!timePattern) {
1195
+ return dateLongFormatter(pattern, formatLong);
1196
+ }
1197
+ var dateTimeFormat;
1198
+ switch (datePattern) {
1199
+ case 'P':
1200
+ dateTimeFormat = formatLong.dateTime({
1201
+ width: 'short'
1202
+ });
1203
+ break;
1204
+ case 'PP':
1205
+ dateTimeFormat = formatLong.dateTime({
1206
+ width: 'medium'
1207
+ });
1208
+ break;
1209
+ case 'PPP':
1210
+ dateTimeFormat = formatLong.dateTime({
1211
+ width: 'long'
1212
+ });
1213
+ break;
1214
+ case 'PPPP':
1215
+ default:
1216
+ dateTimeFormat = formatLong.dateTime({
1217
+ width: 'full'
1218
+ });
1219
+ break;
1220
+ }
1221
+ return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
1222
+ };
1223
+ var longFormatters = {
1224
+ p: timeLongFormatter,
1225
+ P: dateTimeLongFormatter
1226
+ };
1227
+
1228
+ var protectedDayOfYearTokens = ['D', 'DD'];
1229
+ var protectedWeekYearTokens = ['YY', 'YYYY'];
1230
+ function isProtectedDayOfYearToken(token) {
1231
+ return protectedDayOfYearTokens.indexOf(token) !== -1;
1232
+ }
1233
+ function isProtectedWeekYearToken(token) {
1234
+ return protectedWeekYearTokens.indexOf(token) !== -1;
1235
+ }
1236
+ function throwProtectedError(token, format, input) {
1237
+ if (token === 'YYYY') {
1238
+ throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
1239
+ } else if (token === 'YY') {
1240
+ throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
1241
+ } else if (token === 'D') {
1242
+ throw new RangeError("Use `d` instead of `D` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
1243
+ } else if (token === 'DD') {
1244
+ throw new RangeError("Use `dd` instead of `DD` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
1245
+ }
1246
+ }
1247
+
1248
+ var formatDistanceLocale = {
1249
+ lessThanXSeconds: {
1250
+ one: 'less than a second',
1251
+ other: 'less than {{count}} seconds'
1252
+ },
1253
+ xSeconds: {
1254
+ one: '1 second',
1255
+ other: '{{count}} seconds'
1256
+ },
1257
+ halfAMinute: 'half a minute',
1258
+ lessThanXMinutes: {
1259
+ one: 'less than a minute',
1260
+ other: 'less than {{count}} minutes'
1261
+ },
1262
+ xMinutes: {
1263
+ one: '1 minute',
1264
+ other: '{{count}} minutes'
1265
+ },
1266
+ aboutXHours: {
1267
+ one: 'about 1 hour',
1268
+ other: 'about {{count}} hours'
1269
+ },
1270
+ xHours: {
1271
+ one: '1 hour',
1272
+ other: '{{count}} hours'
1273
+ },
1274
+ xDays: {
1275
+ one: '1 day',
1276
+ other: '{{count}} days'
1277
+ },
1278
+ aboutXWeeks: {
1279
+ one: 'about 1 week',
1280
+ other: 'about {{count}} weeks'
1281
+ },
1282
+ xWeeks: {
1283
+ one: '1 week',
1284
+ other: '{{count}} weeks'
1285
+ },
1286
+ aboutXMonths: {
1287
+ one: 'about 1 month',
1288
+ other: 'about {{count}} months'
1289
+ },
1290
+ xMonths: {
1291
+ one: '1 month',
1292
+ other: '{{count}} months'
1293
+ },
1294
+ aboutXYears: {
1295
+ one: 'about 1 year',
1296
+ other: 'about {{count}} years'
1297
+ },
1298
+ xYears: {
1299
+ one: '1 year',
1300
+ other: '{{count}} years'
1301
+ },
1302
+ overXYears: {
1303
+ one: 'over 1 year',
1304
+ other: 'over {{count}} years'
1305
+ },
1306
+ almostXYears: {
1307
+ one: 'almost 1 year',
1308
+ other: 'almost {{count}} years'
1309
+ }
1310
+ };
1311
+ var formatDistance = function formatDistance(token, count, options) {
1312
+ var result;
1313
+ var tokenValue = formatDistanceLocale[token];
1314
+ if (typeof tokenValue === 'string') {
1315
+ result = tokenValue;
1316
+ } else if (count === 1) {
1317
+ result = tokenValue.one;
1318
+ } else {
1319
+ result = tokenValue.other.replace('{{count}}', count.toString());
1320
+ }
1321
+ if (options !== null && options !== void 0 && options.addSuffix) {
1322
+ if (options.comparison && options.comparison > 0) {
1323
+ return 'in ' + result;
1324
+ } else {
1325
+ return result + ' ago';
1326
+ }
1327
+ }
1328
+ return result;
1329
+ };
1978
1330
 
1979
- function formatTimezoneShort(offset, dirtyDelimiter) {
1980
- var sign = offset > 0 ? '-' : '+';
1981
- var absOffset = Math.abs(offset);
1982
- var hours = Math.floor(absOffset / 60);
1983
- var minutes = absOffset % 60;
1984
-
1985
- if (minutes === 0) {
1986
- return sign + String(hours);
1987
- }
1988
-
1989
- var delimiter = dirtyDelimiter || '';
1990
- return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
1331
+ function buildFormatLongFn(args) {
1332
+ return function () {
1333
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1334
+ // TODO: Remove String()
1335
+ var width = options.width ? String(options.width) : args.defaultWidth;
1336
+ var format = args.formats[width] || args.formats[args.defaultWidth];
1337
+ return format;
1338
+ };
1991
1339
  }
1992
1340
 
1993
- function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
1994
- if (offset % 60 === 0) {
1995
- var sign = offset > 0 ? '-' : '+';
1996
- return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
1997
- }
1341
+ var dateFormats = {
1342
+ full: 'EEEE, MMMM do, y',
1343
+ long: 'MMMM do, y',
1344
+ medium: 'MMM d, y',
1345
+ short: 'MM/dd/yyyy'
1346
+ };
1347
+ var timeFormats = {
1348
+ full: 'h:mm:ss a zzzz',
1349
+ long: 'h:mm:ss a z',
1350
+ medium: 'h:mm:ss a',
1351
+ short: 'h:mm a'
1352
+ };
1353
+ var dateTimeFormats = {
1354
+ full: "{{date}} 'at' {{time}}",
1355
+ long: "{{date}} 'at' {{time}}",
1356
+ medium: '{{date}}, {{time}}',
1357
+ short: '{{date}}, {{time}}'
1358
+ };
1359
+ var formatLong = {
1360
+ date: buildFormatLongFn({
1361
+ formats: dateFormats,
1362
+ defaultWidth: 'full'
1363
+ }),
1364
+ time: buildFormatLongFn({
1365
+ formats: timeFormats,
1366
+ defaultWidth: 'full'
1367
+ }),
1368
+ dateTime: buildFormatLongFn({
1369
+ formats: dateTimeFormats,
1370
+ defaultWidth: 'full'
1371
+ })
1372
+ };
1998
1373
 
1999
- return formatTimezone(offset, dirtyDelimiter);
2000
- }
1374
+ var formatRelativeLocale = {
1375
+ lastWeek: "'last' eeee 'at' p",
1376
+ yesterday: "'yesterday at' p",
1377
+ today: "'today at' p",
1378
+ tomorrow: "'tomorrow at' p",
1379
+ nextWeek: "eeee 'at' p",
1380
+ other: 'P'
1381
+ };
1382
+ var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
1383
+ return formatRelativeLocale[token];
1384
+ };
2001
1385
 
2002
- function formatTimezone(offset, dirtyDelimiter) {
2003
- var delimiter = dirtyDelimiter || '';
2004
- var sign = offset > 0 ? '-' : '+';
2005
- var absOffset = Math.abs(offset);
2006
- var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
2007
- var minutes = addLeadingZeros(absOffset % 60, 2);
2008
- return sign + hours + delimiter + minutes;
1386
+ function buildLocalizeFn(args) {
1387
+ return function (dirtyIndex, options) {
1388
+ var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
1389
+ var valuesArray;
1390
+ if (context === 'formatting' && args.formattingValues) {
1391
+ var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
1392
+ var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
1393
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
1394
+ } else {
1395
+ var _defaultWidth = args.defaultWidth;
1396
+ var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
1397
+ valuesArray = args.values[_width] || args.values[_defaultWidth];
1398
+ }
1399
+ var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
1400
+ // @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
1401
+ return valuesArray[index];
1402
+ };
2009
1403
  }
2010
1404
 
2011
- function dateLongFormatter(pattern, formatLong) {
2012
- switch (pattern) {
2013
- case 'P':
2014
- return formatLong.date({
2015
- width: 'short'
2016
- });
2017
-
2018
- case 'PP':
2019
- return formatLong.date({
2020
- width: 'medium'
2021
- });
2022
-
2023
- case 'PPP':
2024
- return formatLong.date({
2025
- width: 'long'
2026
- });
1405
+ var eraValues = {
1406
+ narrow: ['B', 'A'],
1407
+ abbreviated: ['BC', 'AD'],
1408
+ wide: ['Before Christ', 'Anno Domini']
1409
+ };
1410
+ var quarterValues = {
1411
+ narrow: ['1', '2', '3', '4'],
1412
+ abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
1413
+ wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
1414
+ };
2027
1415
 
2028
- case 'PPPP':
2029
- default:
2030
- return formatLong.date({
2031
- width: 'full'
2032
- });
1416
+ // Note: in English, the names of days of the week and months are capitalized.
1417
+ // If you are making a new locale based on this one, check if the same is true for the language you're working on.
1418
+ // Generally, formatted dates should look like they are in the middle of a sentence,
1419
+ // e.g. in Spanish language the weekdays and months should be in the lowercase.
1420
+ var monthValues = {
1421
+ narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
1422
+ abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
1423
+ wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
1424
+ };
1425
+ var dayValues = {
1426
+ narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
1427
+ short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
1428
+ abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
1429
+ wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
1430
+ };
1431
+ var dayPeriodValues = {
1432
+ narrow: {
1433
+ am: 'a',
1434
+ pm: 'p',
1435
+ midnight: 'mi',
1436
+ noon: 'n',
1437
+ morning: 'morning',
1438
+ afternoon: 'afternoon',
1439
+ evening: 'evening',
1440
+ night: 'night'
1441
+ },
1442
+ abbreviated: {
1443
+ am: 'AM',
1444
+ pm: 'PM',
1445
+ midnight: 'midnight',
1446
+ noon: 'noon',
1447
+ morning: 'morning',
1448
+ afternoon: 'afternoon',
1449
+ evening: 'evening',
1450
+ night: 'night'
1451
+ },
1452
+ wide: {
1453
+ am: 'a.m.',
1454
+ pm: 'p.m.',
1455
+ midnight: 'midnight',
1456
+ noon: 'noon',
1457
+ morning: 'morning',
1458
+ afternoon: 'afternoon',
1459
+ evening: 'evening',
1460
+ night: 'night'
2033
1461
  }
2034
- }
2035
-
2036
- function timeLongFormatter(pattern, formatLong) {
2037
- switch (pattern) {
2038
- case 'p':
2039
- return formatLong.time({
2040
- width: 'short'
2041
- });
1462
+ };
1463
+ var formattingDayPeriodValues = {
1464
+ narrow: {
1465
+ am: 'a',
1466
+ pm: 'p',
1467
+ midnight: 'mi',
1468
+ noon: 'n',
1469
+ morning: 'in the morning',
1470
+ afternoon: 'in the afternoon',
1471
+ evening: 'in the evening',
1472
+ night: 'at night'
1473
+ },
1474
+ abbreviated: {
1475
+ am: 'AM',
1476
+ pm: 'PM',
1477
+ midnight: 'midnight',
1478
+ noon: 'noon',
1479
+ morning: 'in the morning',
1480
+ afternoon: 'in the afternoon',
1481
+ evening: 'in the evening',
1482
+ night: 'at night'
1483
+ },
1484
+ wide: {
1485
+ am: 'a.m.',
1486
+ pm: 'p.m.',
1487
+ midnight: 'midnight',
1488
+ noon: 'noon',
1489
+ morning: 'in the morning',
1490
+ afternoon: 'in the afternoon',
1491
+ evening: 'in the evening',
1492
+ night: 'at night'
1493
+ }
1494
+ };
1495
+ var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
1496
+ var number = Number(dirtyNumber);
2042
1497
 
2043
- case 'pp':
2044
- return formatLong.time({
2045
- width: 'medium'
2046
- });
1498
+ // If ordinal numbers depend on context, for example,
1499
+ // if they are different for different grammatical genders,
1500
+ // use `options.unit`.
1501
+ //
1502
+ // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
1503
+ // 'day', 'hour', 'minute', 'second'.
2047
1504
 
2048
- case 'ppp':
2049
- return formatLong.time({
2050
- width: 'long'
2051
- });
1505
+ var rem100 = number % 100;
1506
+ if (rem100 > 20 || rem100 < 10) {
1507
+ switch (rem100 % 10) {
1508
+ case 1:
1509
+ return number + 'st';
1510
+ case 2:
1511
+ return number + 'nd';
1512
+ case 3:
1513
+ return number + 'rd';
1514
+ }
1515
+ }
1516
+ return number + 'th';
1517
+ };
1518
+ var localize = {
1519
+ ordinalNumber: ordinalNumber,
1520
+ era: buildLocalizeFn({
1521
+ values: eraValues,
1522
+ defaultWidth: 'wide'
1523
+ }),
1524
+ quarter: buildLocalizeFn({
1525
+ values: quarterValues,
1526
+ defaultWidth: 'wide',
1527
+ argumentCallback: function argumentCallback(quarter) {
1528
+ return quarter - 1;
1529
+ }
1530
+ }),
1531
+ month: buildLocalizeFn({
1532
+ values: monthValues,
1533
+ defaultWidth: 'wide'
1534
+ }),
1535
+ day: buildLocalizeFn({
1536
+ values: dayValues,
1537
+ defaultWidth: 'wide'
1538
+ }),
1539
+ dayPeriod: buildLocalizeFn({
1540
+ values: dayPeriodValues,
1541
+ defaultWidth: 'wide',
1542
+ formattingValues: formattingDayPeriodValues,
1543
+ defaultFormattingWidth: 'wide'
1544
+ })
1545
+ };
2052
1546
 
2053
- case 'pppp':
2054
- default:
2055
- return formatLong.time({
2056
- width: 'full'
2057
- });
2058
- }
1547
+ function buildMatchFn(args) {
1548
+ return function (string) {
1549
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1550
+ var width = options.width;
1551
+ var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
1552
+ var matchResult = string.match(matchPattern);
1553
+ if (!matchResult) {
1554
+ return null;
1555
+ }
1556
+ var matchedString = matchResult[0];
1557
+ var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
1558
+ var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
1559
+ return pattern.test(matchedString);
1560
+ }) : findKey(parsePatterns, function (pattern) {
1561
+ return pattern.test(matchedString);
1562
+ });
1563
+ var value;
1564
+ value = args.valueCallback ? args.valueCallback(key) : key;
1565
+ value = options.valueCallback ? options.valueCallback(value) : value;
1566
+ var rest = string.slice(matchedString.length);
1567
+ return {
1568
+ value: value,
1569
+ rest: rest
1570
+ };
1571
+ };
2059
1572
  }
2060
-
2061
- function dateTimeLongFormatter(pattern, formatLong) {
2062
- var matchResult = pattern.match(/(P+)(p+)?/) || [];
2063
- var datePattern = matchResult[1];
2064
- var timePattern = matchResult[2];
2065
-
2066
- if (!timePattern) {
2067
- return dateLongFormatter(pattern, formatLong);
1573
+ function findKey(object, predicate) {
1574
+ for (var key in object) {
1575
+ if (object.hasOwnProperty(key) && predicate(object[key])) {
1576
+ return key;
1577
+ }
2068
1578
  }
2069
-
2070
- var dateTimeFormat;
2071
-
2072
- switch (datePattern) {
2073
- case 'P':
2074
- dateTimeFormat = formatLong.dateTime({
2075
- width: 'short'
2076
- });
2077
- break;
2078
-
2079
- case 'PP':
2080
- dateTimeFormat = formatLong.dateTime({
2081
- width: 'medium'
2082
- });
2083
- break;
2084
-
2085
- case 'PPP':
2086
- dateTimeFormat = formatLong.dateTime({
2087
- width: 'long'
2088
- });
2089
- break;
2090
-
2091
- case 'PPPP':
2092
- default:
2093
- dateTimeFormat = formatLong.dateTime({
2094
- width: 'full'
2095
- });
2096
- break;
1579
+ return undefined;
1580
+ }
1581
+ function findIndex(array, predicate) {
1582
+ for (var key = 0; key < array.length; key++) {
1583
+ if (predicate(array[key])) {
1584
+ return key;
1585
+ }
2097
1586
  }
1587
+ return undefined;
1588
+ }
2098
1589
 
2099
- return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
1590
+ function buildMatchPatternFn(args) {
1591
+ return function (string) {
1592
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1593
+ var matchResult = string.match(args.matchPattern);
1594
+ if (!matchResult) return null;
1595
+ var matchedString = matchResult[0];
1596
+ var parseResult = string.match(args.parsePattern);
1597
+ if (!parseResult) return null;
1598
+ var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
1599
+ value = options.valueCallback ? options.valueCallback(value) : value;
1600
+ var rest = string.slice(matchedString.length);
1601
+ return {
1602
+ value: value,
1603
+ rest: rest
1604
+ };
1605
+ };
2100
1606
  }
2101
1607
 
2102
- var longFormatters = {
2103
- p: timeLongFormatter,
2104
- P: dateTimeLongFormatter
1608
+ var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
1609
+ var parseOrdinalNumberPattern = /\d+/i;
1610
+ var matchEraPatterns = {
1611
+ narrow: /^(b|a)/i,
1612
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
1613
+ wide: /^(before christ|before common era|anno domini|common era)/i
1614
+ };
1615
+ var parseEraPatterns = {
1616
+ any: [/^b/i, /^(a|c)/i]
1617
+ };
1618
+ var matchQuarterPatterns = {
1619
+ narrow: /^[1234]/i,
1620
+ abbreviated: /^q[1234]/i,
1621
+ wide: /^[1234](th|st|nd|rd)? quarter/i
1622
+ };
1623
+ var parseQuarterPatterns = {
1624
+ any: [/1/i, /2/i, /3/i, /4/i]
1625
+ };
1626
+ var matchMonthPatterns = {
1627
+ narrow: /^[jfmasond]/i,
1628
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
1629
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
1630
+ };
1631
+ var parseMonthPatterns = {
1632
+ narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
1633
+ any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
1634
+ };
1635
+ var matchDayPatterns = {
1636
+ narrow: /^[smtwf]/i,
1637
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
1638
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
1639
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
1640
+ };
1641
+ var parseDayPatterns = {
1642
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
1643
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
1644
+ };
1645
+ var matchDayPeriodPatterns = {
1646
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
1647
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
1648
+ };
1649
+ var parseDayPeriodPatterns = {
1650
+ any: {
1651
+ am: /^a/i,
1652
+ pm: /^p/i,
1653
+ midnight: /^mi/i,
1654
+ noon: /^no/i,
1655
+ morning: /morning/i,
1656
+ afternoon: /afternoon/i,
1657
+ evening: /evening/i,
1658
+ night: /night/i
1659
+ }
1660
+ };
1661
+ var match = {
1662
+ ordinalNumber: buildMatchPatternFn({
1663
+ matchPattern: matchOrdinalNumberPattern,
1664
+ parsePattern: parseOrdinalNumberPattern,
1665
+ valueCallback: function valueCallback(value) {
1666
+ return parseInt(value, 10);
1667
+ }
1668
+ }),
1669
+ era: buildMatchFn({
1670
+ matchPatterns: matchEraPatterns,
1671
+ defaultMatchWidth: 'wide',
1672
+ parsePatterns: parseEraPatterns,
1673
+ defaultParseWidth: 'any'
1674
+ }),
1675
+ quarter: buildMatchFn({
1676
+ matchPatterns: matchQuarterPatterns,
1677
+ defaultMatchWidth: 'wide',
1678
+ parsePatterns: parseQuarterPatterns,
1679
+ defaultParseWidth: 'any',
1680
+ valueCallback: function valueCallback(index) {
1681
+ return index + 1;
1682
+ }
1683
+ }),
1684
+ month: buildMatchFn({
1685
+ matchPatterns: matchMonthPatterns,
1686
+ defaultMatchWidth: 'wide',
1687
+ parsePatterns: parseMonthPatterns,
1688
+ defaultParseWidth: 'any'
1689
+ }),
1690
+ day: buildMatchFn({
1691
+ matchPatterns: matchDayPatterns,
1692
+ defaultMatchWidth: 'wide',
1693
+ parsePatterns: parseDayPatterns,
1694
+ defaultParseWidth: 'any'
1695
+ }),
1696
+ dayPeriod: buildMatchFn({
1697
+ matchPatterns: matchDayPeriodPatterns,
1698
+ defaultMatchWidth: 'any',
1699
+ parsePatterns: parseDayPeriodPatterns,
1700
+ defaultParseWidth: 'any'
1701
+ })
2105
1702
  };
2106
1703
 
2107
- var protectedDayOfYearTokens = ['D', 'DD'];
2108
- var protectedWeekYearTokens = ['YY', 'YYYY'];
2109
- function isProtectedDayOfYearToken(token) {
2110
- return protectedDayOfYearTokens.indexOf(token) !== -1;
2111
- }
2112
- function isProtectedWeekYearToken(token) {
2113
- return protectedWeekYearTokens.indexOf(token) !== -1;
2114
- }
2115
- function throwProtectedError(token, format, input) {
2116
- if (token === 'YYYY') {
2117
- throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
2118
- } else if (token === 'YY') {
2119
- throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
2120
- } else if (token === 'D') {
2121
- throw new RangeError("Use `d` instead of `D` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://git.io/fxCyr"));
2122
- } else if (token === 'DD') {
2123
- throw new RangeError("Use `dd` instead of `DD` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://git.io/fxCyr"));
1704
+ /**
1705
+ * @type {Locale}
1706
+ * @category Locales
1707
+ * @summary English locale (United States).
1708
+ * @language English
1709
+ * @iso-639-2 eng
1710
+ * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
1711
+ * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
1712
+ */
1713
+ var locale = {
1714
+ code: 'en-US',
1715
+ formatDistance: formatDistance,
1716
+ formatLong: formatLong,
1717
+ formatRelative: formatRelative,
1718
+ localize: localize,
1719
+ match: match,
1720
+ options: {
1721
+ weekStartsOn: 0 /* Sunday */,
1722
+ firstWeekContainsDate: 1
2124
1723
  }
2125
- }
1724
+ };
2126
1725
 
2127
1726
  // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
2128
1727
  // (one of the certain letters followed by `o`)
@@ -2134,14 +1733,15 @@ function throwProtectedError(token, format, input) {
2134
1733
  // If there is no matching single quote
2135
1734
  // then the sequence will continue until the end of the string.
2136
1735
  // - . matches any single character unmatched by previous parts of the RegExps
1736
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
2137
1737
 
2138
- var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also
1738
+ // This RegExp catches symbols escaped by quotes, and also
2139
1739
  // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
2140
-
2141
1740
  var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
2142
1741
  var escapedStringRegExp = /^'([^]*?)'?$/;
2143
1742
  var doubleQuoteRegExp = /''/g;
2144
1743
  var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
1744
+
2145
1745
  /**
2146
1746
  * @name format
2147
1747
  * @category Common Helpers
@@ -2151,7 +1751,7 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
2151
1751
  * Return the formatted date string in the given format. The result may vary by locale.
2152
1752
  *
2153
1753
  * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
2154
- * > See: https://git.io/fxCyr
1754
+ * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2155
1755
  *
2156
1756
  * The characters wrapped between two single quotes characters (') are escaped.
2157
1757
  * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
@@ -2387,30 +1987,10 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
2387
1987
  * - `p`: long localized time
2388
1988
  *
2389
1989
  * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
2390
- * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://git.io/fxCyr
1990
+ * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2391
1991
  *
2392
1992
  * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
2393
- * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://git.io/fxCyr
2394
- *
2395
- * ### v2.0.0 breaking changes:
2396
- *
2397
- * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
2398
- *
2399
- * - The second argument is now required for the sake of explicitness.
2400
- *
2401
- * ```javascript
2402
- * // Before v2.0.0
2403
- * format(new Date(2016, 0, 1))
2404
- *
2405
- * // v2.0.0 onward
2406
- * format(new Date(2016, 0, 1), "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")
2407
- * ```
2408
- *
2409
- * - New format string API for `format` function
2410
- * which is based on [Unicode Technical Standard #35](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table).
2411
- * See [this post](https://blog.date-fns.org/post/unicode-tokens-in-date-fns-v2-sreatyki91jg) for more details.
2412
- *
2413
- * - Characters are now escaped using single quote symbols (`'`) instead of square brackets.
1993
+ * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2414
1994
  *
2415
1995
  * @param {Date|Number} date - the original date
2416
1996
  * @param {String} format - the string of tokens
@@ -2419,9 +1999,9 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
2419
1999
  * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
2420
2000
  * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
2421
2001
  * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
2422
- * see: https://git.io/fxCyr
2002
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2423
2003
  * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
2424
- * see: https://git.io/fxCyr
2004
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2425
2005
  * @returns {String} the formatted date string
2426
2006
  * @throws {TypeError} 2 arguments required
2427
2007
  * @throws {RangeError} `date` must not be Invalid Date
@@ -2429,69 +2009,63 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
2429
2009
  * @throws {RangeError} `options.locale` must contain `formatLong` property
2430
2010
  * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
2431
2011
  * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
2432
- * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
2433
- * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
2434
- * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://git.io/fxCyr
2435
- * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://git.io/fxCyr
2012
+ * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2013
+ * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2014
+ * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2015
+ * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2436
2016
  * @throws {RangeError} format string contains an unescaped latin alphabet character
2437
2017
  *
2438
2018
  * @example
2439
2019
  * // Represent 11 February 2014 in middle-endian format:
2440
- * var result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
2020
+ * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
2441
2021
  * //=> '02/11/2014'
2442
2022
  *
2443
2023
  * @example
2444
2024
  * // Represent 2 July 2014 in Esperanto:
2445
2025
  * import { eoLocale } from 'date-fns/locale/eo'
2446
- * var result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
2026
+ * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
2447
2027
  * locale: eoLocale
2448
2028
  * })
2449
2029
  * //=> '2-a de julio 2014'
2450
2030
  *
2451
2031
  * @example
2452
2032
  * // Escape string by single quote characters:
2453
- * var result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
2033
+ * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
2454
2034
  * //=> "3 o'clock"
2455
2035
  */
2456
2036
 
2457
- function format(dirtyDate, dirtyFormatStr, dirtyOptions) {
2037
+ function format(dirtyDate, dirtyFormatStr, options) {
2038
+ var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;
2458
2039
  requiredArgs(2, arguments);
2459
2040
  var formatStr = String(dirtyFormatStr);
2460
- var options = dirtyOptions || {};
2461
- var locale$1 = options.locale || locale;
2462
- var localeFirstWeekContainsDate = locale$1.options && locale$1.options.firstWeekContainsDate;
2463
- var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
2464
- var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
2041
+ var defaultOptions = getDefaultOptions();
2042
+ var locale$1 = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : locale;
2043
+ var firstWeekContainsDate = toInteger((_ref2 = (_ref3 = (_ref4 = (_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$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1);
2465
2044
 
2045
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
2466
2046
  if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
2467
2047
  throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
2468
2048
  }
2049
+ var weekStartsOn = toInteger((_ref5 = (_ref6 = (_ref7 = (_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$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0);
2469
2050
 
2470
- var localeWeekStartsOn = locale$1.options && locale$1.options.weekStartsOn;
2471
- var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
2472
- var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
2473
-
2051
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
2474
2052
  if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
2475
2053
  throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
2476
2054
  }
2477
-
2478
2055
  if (!locale$1.localize) {
2479
2056
  throw new RangeError('locale must contain localize property');
2480
2057
  }
2481
-
2482
2058
  if (!locale$1.formatLong) {
2483
2059
  throw new RangeError('locale must contain formatLong property');
2484
2060
  }
2485
-
2486
2061
  var originalDate = toDate(dirtyDate);
2487
-
2488
2062
  if (!isValid(originalDate)) {
2489
2063
  throw new RangeError('Invalid time value');
2490
- } // Convert the date in system timezone to the same date in UTC+00:00 timezone.
2064
+ }
2065
+
2066
+ // Convert the date in system timezone to the same date in UTC+00:00 timezone.
2491
2067
  // This ensures that when UTC functions will be implemented, locales will be compatible with them.
2492
2068
  // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
2493
-
2494
-
2495
2069
  var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
2496
2070
  var utcDate = subMilliseconds(originalDate, timezoneOffset);
2497
2071
  var formatterOptions = {
@@ -2502,50 +2076,43 @@ function format(dirtyDate, dirtyFormatStr, dirtyOptions) {
2502
2076
  };
2503
2077
  var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
2504
2078
  var firstCharacter = substring[0];
2505
-
2506
2079
  if (firstCharacter === 'p' || firstCharacter === 'P') {
2507
2080
  var longFormatter = longFormatters[firstCharacter];
2508
- return longFormatter(substring, locale$1.formatLong, formatterOptions);
2081
+ return longFormatter(substring, locale$1.formatLong);
2509
2082
  }
2510
-
2511
2083
  return substring;
2512
2084
  }).join('').match(formattingTokensRegExp).map(function (substring) {
2513
2085
  // Replace two single quote characters with one single quote character
2514
2086
  if (substring === "''") {
2515
2087
  return "'";
2516
2088
  }
2517
-
2518
2089
  var firstCharacter = substring[0];
2519
-
2520
2090
  if (firstCharacter === "'") {
2521
2091
  return cleanEscapedString(substring);
2522
2092
  }
2523
-
2524
2093
  var formatter = formatters[firstCharacter];
2525
-
2526
2094
  if (formatter) {
2527
- if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken(substring)) {
2528
- throwProtectedError(substring, dirtyFormatStr, dirtyDate);
2095
+ if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
2096
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2529
2097
  }
2530
-
2531
- if (!options.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(substring)) {
2532
- throwProtectedError(substring, dirtyFormatStr, dirtyDate);
2098
+ if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
2099
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2533
2100
  }
2534
-
2535
2101
  return formatter(utcDate, substring, locale$1.localize, formatterOptions);
2536
2102
  }
2537
-
2538
2103
  if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
2539
2104
  throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
2540
2105
  }
2541
-
2542
2106
  return substring;
2543
2107
  }).join('');
2544
2108
  return result;
2545
2109
  }
2546
-
2547
2110
  function cleanEscapedString(input) {
2548
- return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
2111
+ var matched = input.match(escapedStringRegExp);
2112
+ if (!matched) {
2113
+ return input;
2114
+ }
2115
+ return matched[1].replace(doubleQuoteRegExp, "'");
2549
2116
  }
2550
2117
 
2551
2118
  const getImageFromImage = (image) => {
@@ -2721,10 +2288,13 @@ const categorizeSkills = (skills) => {
2721
2288
  acc[obj.category].push(obj);
2722
2289
  acc[obj.category].totalSkills++;
2723
2290
  }
2724
- let totalSubskillsCount = acc[obj.category].reduce((total, skill) => {
2725
- var _a2, _b;
2726
- return total + ((_b = (_a2 = skill == null ? void 0 : skill.subskills) == null ? void 0 : _a2.length) != null ? _b : 0);
2727
- }, 0);
2291
+ let totalSubskillsCount = acc[obj.category].reduce(
2292
+ (total, skill) => {
2293
+ var _a2, _b;
2294
+ return total + ((_b = (_a2 = skill == null ? void 0 : skill.subskills) == null ? void 0 : _a2.length) != null ? _b : 0);
2295
+ },
2296
+ 0
2297
+ );
2728
2298
  acc[obj.category].totalSubskillsCount = totalSubskillsCount;
2729
2299
  return acc;
2730
2300
  }, {});
@@ -2744,4 +2314,4 @@ const getTotalCountOfSkills = (skills) => {
2744
2314
  };
2745
2315
 
2746
2316
  export { getColorForVerificationStatus as a, getInfoFromCredential as b, categorizeSkills as c, getCategoryDarkColor as d, getCategoryLightColor as e, getCategoryIcon as f, getTotalCountOfSkills as g, getNameFromProfile as h, getImageFromProfile as i, format as j, getCategoryColor as k };
2747
- //# sourceMappingURL=credential.helpers-cdc2f4a3.js.map
2317
+ //# sourceMappingURL=credential.helpers-93170224.js.map