bromcom-ui 2.11.1-rc.8 → 2.11.1-rc.9-1

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 (414) hide show
  1. package/dist/bromcom-ui/bromcom-ui.css +1 -1
  2. package/dist/bromcom-ui/bromcom-ui.esm.js +1 -1
  3. package/dist/bromcom-ui/{p-c7e8dcf7.js → p-0d0e3903.js} +1 -1
  4. package/dist/bromcom-ui/{p-fb529ec0.entry.js → p-1345d51b.entry.js} +1 -1
  5. package/dist/bromcom-ui/{p-e037ee2b.js → p-170cf07d.js} +1 -1
  6. package/dist/bromcom-ui/{p-4d7ea23c.entry.js → p-1b558b0f.entry.js} +1 -1
  7. package/dist/bromcom-ui/{p-5b76a893.entry.js → p-1d81a0a4.entry.js} +1 -1
  8. package/dist/bromcom-ui/p-228c74e9.entry.js +5 -0
  9. package/dist/bromcom-ui/{p-18bc4e04.entry.js → p-270e1b24.entry.js} +1 -1
  10. package/dist/bromcom-ui/p-2bdf78f5.entry.js +5 -0
  11. package/dist/bromcom-ui/{p-0999d548.js → p-2c4435e2.js} +1 -1
  12. package/dist/bromcom-ui/{p-1cac8ccc.js → p-2cd6cdee.js} +1 -1
  13. package/dist/bromcom-ui/{p-63138ee5.entry.js → p-32c55505.entry.js} +1 -1
  14. package/dist/bromcom-ui/p-376a20ed.js +5 -0
  15. package/dist/bromcom-ui/{p-78bdc41e.entry.js → p-3a290e0d.entry.js} +1 -1
  16. package/dist/bromcom-ui/{p-4438d629.entry.js → p-4393b33e.entry.js} +1 -1
  17. package/dist/bromcom-ui/{p-cb190cbb.js → p-46cc4f0c.js} +1 -1
  18. package/dist/bromcom-ui/p-4cc25225.entry.js +20 -0
  19. package/dist/bromcom-ui/{p-16e8e9ba.js → p-4d55ba21.js} +1 -1
  20. package/dist/bromcom-ui/{p-5e4f84aa.entry.js → p-54788d6e.entry.js} +1 -1
  21. package/dist/bromcom-ui/{p-6e7bb16f.entry.js → p-59f7fa84.entry.js} +1 -1
  22. package/dist/bromcom-ui/p-5b63bfc6.entry.js +5 -0
  23. package/dist/bromcom-ui/{p-77b99601.entry.js → p-5be80cce.entry.js} +1 -1
  24. package/dist/bromcom-ui/{p-468157a0.entry.js → p-5d670fd7.entry.js} +1 -1
  25. package/dist/bromcom-ui/{p-d0e56a89.entry.js → p-5f4a7e27.entry.js} +1 -1
  26. package/dist/bromcom-ui/{p-745e2913.entry.js → p-65119762.entry.js} +1 -1
  27. package/dist/bromcom-ui/{p-e45c1546.js → p-6657830f.js} +1 -1
  28. package/dist/bromcom-ui/{p-3b079331.entry.js → p-67343ad8.entry.js} +1 -1
  29. package/dist/bromcom-ui/p-6a82a1c6.entry.js +5 -0
  30. package/dist/bromcom-ui/{p-4798d827.js → p-6bea284a.js} +1 -1
  31. package/dist/bromcom-ui/p-6e5f5f36.js +1 -1
  32. package/dist/bromcom-ui/{p-197aba37.js → p-74e6d2b6.js} +1 -1
  33. package/dist/bromcom-ui/{p-1e8559ac.entry.js → p-77b1dbdd.entry.js} +1 -1
  34. package/dist/bromcom-ui/{p-95a2c489.entry.js → p-77ef609e.entry.js} +1 -1
  35. package/dist/bromcom-ui/{p-1f99c170.entry.js → p-7a590e30.entry.js} +1 -1
  36. package/dist/bromcom-ui/{p-03337609.entry.js → p-7c5763cc.entry.js} +1 -1
  37. package/dist/bromcom-ui/{p-991ffc23.entry.js → p-7d0d6073.entry.js} +1 -1
  38. package/dist/bromcom-ui/{p-5ae0a59b.js → p-7e44e6b5.js} +1 -1
  39. package/dist/bromcom-ui/{p-d2f863d9.js → p-8b6d3a37.js} +1 -1
  40. package/dist/bromcom-ui/{p-3c7a0345.js → p-8c018ae0.js} +1 -1
  41. package/dist/bromcom-ui/p-959bd503.entry.js +5 -0
  42. package/dist/bromcom-ui/{p-79572dc0.entry.js → p-9668c853.entry.js} +1 -1
  43. package/dist/bromcom-ui/{p-8e5e362a.js → p-9850cbce.js} +1 -1
  44. package/dist/bromcom-ui/p-991f374c.entry.js +5 -0
  45. package/dist/bromcom-ui/{p-0efc9196.entry.js → p-9b59c689.entry.js} +1 -1
  46. package/dist/bromcom-ui/{p-6b5ed4d8.js → p-a0d6d680.js} +1 -1
  47. package/dist/bromcom-ui/p-a0f44b56.entry.js +5 -0
  48. package/dist/bromcom-ui/{p-0e362df2.entry.js → p-a20ac74f.entry.js} +1 -1
  49. package/dist/bromcom-ui/p-a313fba6.js +1 -1
  50. package/dist/bromcom-ui/{p-f39d9d7c.entry.js → p-a32b4186.entry.js} +1 -1
  51. package/dist/bromcom-ui/{p-e32ab4da.entry.js → p-a486613b.entry.js} +1 -1
  52. package/dist/bromcom-ui/{p-7a89243a.entry.js → p-a6aa173f.entry.js} +1 -1
  53. package/dist/bromcom-ui/{p-0fc9f542.entry.js → p-a9759941.entry.js} +1 -1
  54. package/dist/bromcom-ui/p-ae57f046.entry.js +5 -0
  55. package/dist/bromcom-ui/p-aeb4be41.js +5 -0
  56. package/dist/bromcom-ui/{p-5f9b5e9a.entry.js → p-b703f03f.entry.js} +1 -1
  57. package/dist/bromcom-ui/{p-80eb3fdb.entry.js → p-b72147fd.entry.js} +1 -1
  58. package/dist/bromcom-ui/{p-fcc6f71e.js → p-beaec5b8.js} +1 -1
  59. package/dist/bromcom-ui/{p-107f11df.entry.js → p-c1a992e7.entry.js} +1 -1
  60. package/dist/bromcom-ui/{p-48f5a3c9.entry.js → p-c49b6287.entry.js} +1 -1
  61. package/dist/bromcom-ui/{p-0c8f2481.entry.js → p-c661de9e.entry.js} +1 -1
  62. package/dist/bromcom-ui/p-cb7003f0.entry.js +5 -0
  63. package/dist/bromcom-ui/{p-32a2509b.entry.js → p-cbbadc43.entry.js} +1 -1
  64. package/dist/bromcom-ui/{p-f9686cdb.entry.js → p-ce917a87.entry.js} +1 -1
  65. package/dist/bromcom-ui/{p-8290f0dc.entry.js → p-cf119021.entry.js} +1 -1
  66. package/dist/bromcom-ui/{p-a496024a.entry.js → p-d5251ffe.entry.js} +1 -1
  67. package/dist/bromcom-ui/{p-188b9079.entry.js → p-d59d9687.entry.js} +1 -1
  68. package/dist/bromcom-ui/p-de0b0192.entry.js +5 -0
  69. package/dist/bromcom-ui/p-e0ab7b38.js +11 -0
  70. package/dist/bromcom-ui/p-e72cd4e5.entry.js +5 -0
  71. package/dist/bromcom-ui/{p-181f2f4a.entry.js → p-e8eaa3bb.entry.js} +1 -1
  72. package/dist/bromcom-ui/{p-298c652a.entry.js → p-e98016f3.entry.js} +1 -1
  73. package/dist/bromcom-ui/{p-64da3643.entry.js → p-ea062405.entry.js} +1 -1
  74. package/dist/bromcom-ui/p-eca0acda.js +5 -0
  75. package/dist/bromcom-ui/{p-6bdc5130.entry.js → p-ee0bfc38.entry.js} +1 -1
  76. package/dist/bromcom-ui/p-f990f4c3.js +5 -0
  77. package/dist/bromcom-ui/{p-08159d00.entry.js → p-f9b59bcc.entry.js} +1 -1
  78. package/dist/bromcom-ui/{p-f9119bec.entry.js → p-fc787048.entry.js} +1 -1
  79. package/dist/cjs/{bcm-489c9b1a.js → bcm-1d1fcf21.js} +4 -4
  80. package/dist/cjs/bcm-accordion_45.cjs.entry.js +23947 -0
  81. package/dist/cjs/bcm-alert.cjs.entry.js +5 -5
  82. package/dist/cjs/bcm-attendance-actions-comment.cjs.entry.js +10 -10
  83. package/dist/cjs/bcm-attendance-actions-dropdown.cjs.entry.js +10 -10
  84. package/dist/cjs/bcm-breadcrumb.cjs.entry.js +3 -3
  85. package/dist/cjs/bcm-caption.cjs.entry.js +11 -11
  86. package/dist/cjs/bcm-card.cjs.entry.js +7 -7
  87. package/dist/cjs/{bcm-checkbox-lite_9.cjs.entry.js → bcm-checkbox-lite_8.cjs.entry.js} +7 -27
  88. package/dist/cjs/bcm-chip-group.cjs.entry.js +11 -11
  89. package/dist/cjs/bcm-collapse.cjs.entry.js +62 -0
  90. package/dist/cjs/bcm-date-picker.cjs.entry.js +5 -5
  91. package/dist/cjs/bcm-datetime-picker.cjs.entry.js +9 -9
  92. package/dist/cjs/bcm-default.cjs.entry.js +3 -3
  93. package/dist/cjs/bcm-error-layout.cjs.entry.js +1 -1
  94. package/dist/cjs/bcm-form-2.cjs.entry.js +6 -6
  95. package/dist/cjs/bcm-input-custom.cjs.entry.js +3 -3
  96. package/dist/cjs/bcm-input-dropdown.cjs.entry.js +12 -12
  97. package/dist/cjs/bcm-link.cjs.entry.js +3 -3
  98. package/dist/cjs/bcm-modal-2-footer.cjs.entry.js +8 -8
  99. package/dist/cjs/bcm-modal-2-header.cjs.entry.js +8 -8
  100. package/dist/cjs/bcm-modal-2.cjs.entry.js +9 -9
  101. package/dist/cjs/bcm-modal.cjs.entry.js +8 -8
  102. package/dist/cjs/bcm-number-input.cjs.entry.js +11 -11
  103. package/dist/cjs/bcm-old-input.cjs.entry.js +1 -1
  104. package/dist/cjs/bcm-overlay_2.cjs.entry.js +1 -1
  105. package/dist/cjs/bcm-popover.cjs.entry.js +11 -11
  106. package/dist/cjs/bcm-range.cjs.entry.js +7 -7
  107. package/dist/cjs/bcm-select.cjs.entry.js +2 -2
  108. package/dist/cjs/bcm-skeleton.cjs.entry.js +8 -8
  109. package/dist/cjs/bcm-table.cjs.entry.js +8 -8
  110. package/dist/cjs/bcm-tag.cjs.entry.js +16 -16
  111. package/dist/cjs/bcm-time-picker.cjs.entry.js +5 -5
  112. package/dist/cjs/bcm-toast.cjs.entry.js +12 -12
  113. package/dist/cjs/bromcom-ui.cjs.js +3 -3
  114. package/dist/cjs/{caption-template-086e9cac.js → caption-template-85a18b6d.js} +2 -2
  115. package/dist/cjs/{color-helper-c3a819ea.js → color-helper-dc98a2ca.js} +1 -1
  116. package/dist/cjs/{colors-078851ec.js → colors-250d0982.js} +13 -7
  117. package/dist/cjs/{floating-ui-21890d11.js → floating-ui-5b396838.js} +2 -2
  118. package/dist/cjs/{generate-06bf97b8.js → generate-c4e28fef.js} +2 -2
  119. package/dist/cjs/{global-74a88067.js → global-32a72f23.js} +1 -1
  120. package/dist/cjs/{label-template-94b3d775.js → label-template-e83447b5.js} +3 -3
  121. package/dist/cjs/loader.cjs.js +3 -3
  122. package/dist/cjs/{number-helper-362f0e03.js → number-helper-40bfb2fc.js} +1 -1
  123. package/dist/cjs/old-bcm-popover-box.cjs.entry.js +8 -8
  124. package/dist/cjs/old-bcm-popover.cjs.entry.js +6 -6
  125. package/dist/cjs/{package-92cfcafb.js → package-4a28cfe9.js} +1 -1
  126. package/dist/cjs/{popover-placement-e7d6eabd.js → popover-placement-02e6101b.js} +1 -1
  127. package/dist/cjs/{slot-template-c8e2816c.js → slot-template-df7b5b59.js} +1 -1
  128. package/dist/cjs/{string-helper-f9184277.js → string-helper-9cdfb273.js} +2 -2
  129. package/dist/cjs/{validators-07d7a0c9.js → validators-0f4f7438.js} +1 -1
  130. package/dist/collection/components/atoms/avatar/avatar.js +1 -1
  131. package/dist/collection/components/atoms/badge/badge.js +1 -1
  132. package/dist/collection/components/atoms/badge/badge.style.js +1 -1
  133. package/dist/collection/components/atoms/button/button.css +13 -13
  134. package/dist/collection/components/atoms/button/button.js +14 -14
  135. package/dist/collection/components/atoms/chip/chip.css +4 -4
  136. package/dist/collection/components/atoms/chip/chip.js +3 -3
  137. package/dist/collection/components/molecules/checkbox/group.css +2 -2
  138. package/dist/collection/components/molecules/checkbox/group.js +1 -1
  139. package/dist/collection/components/molecules/color-input/color-input.js +1 -1
  140. package/dist/collection/components/molecules/empty/empty.js +1 -1
  141. package/dist/collection/components/molecules/error-layout/error-layout.js +1 -1
  142. package/dist/collection/components/molecules/expansion-panel/expansion-panel.js +1 -1
  143. package/dist/collection/components/molecules/input/input.js +1 -1
  144. package/dist/collection/components/molecules/input-dropdown/input-dropdown.js +1 -1
  145. package/dist/collection/components/molecules/menu/menu.css +4 -4
  146. package/dist/collection/components/molecules/radio/radio-group.js +1 -1
  147. package/dist/collection/components/molecules/radio/radio.js +1 -1
  148. package/dist/collection/components/molecules/range/range.js +1 -1
  149. package/dist/collection/components/molecules/switch/switch.css +2 -2
  150. package/dist/collection/components/molecules/tab-group/tab-group.js +2 -2
  151. package/dist/collection/components/molecules/tab-group/tab-item-header.js +5 -5
  152. package/dist/collection/components/molecules/tooltip/tooltip.js +1 -1
  153. package/dist/collection/components/organism/list/list.js +2 -2
  154. package/dist/collection/components/other/attendance/attendance.js +1 -1
  155. package/dist/collection/stories/ui-library/components/date/argTypes_common.js +1 -0
  156. package/dist/collection/templates/button-template.js +1 -1
  157. package/dist/collection/templates/caption-template.js +2 -2
  158. package/dist/collection/templates/input-template.js +1 -1
  159. package/dist/collection/templates/label-template.js +1 -1
  160. package/dist/collection/templates/list-item-template.js +1 -1
  161. package/dist/collection/templates/list-template.js +3 -9
  162. package/dist/components/avatar.js +1 -1
  163. package/dist/components/badge.js +2 -2
  164. package/dist/components/bcm-attendance.js +1 -1
  165. package/dist/components/bcm-checkbox-group.js +2 -2
  166. package/dist/components/bcm-color-input.js +1 -1
  167. package/dist/components/bcm-error-layout.js +1 -1
  168. package/dist/components/bcm-expansion-panel.js +1 -1
  169. package/dist/components/bcm-input-dropdown.js +1 -1
  170. package/dist/components/bcm-radio-group.js +1 -1
  171. package/dist/components/bcm-range.js +1 -1
  172. package/dist/components/bcm-switch.js +1 -1
  173. package/dist/components/bcm-tab-group.js +2 -2
  174. package/dist/components/bcm-tab-item-header.js +5 -5
  175. package/dist/components/button.js +16 -16
  176. package/dist/components/caption-template.js +2 -2
  177. package/dist/components/chip.js +4 -4
  178. package/dist/components/colors2.js +13 -7
  179. package/dist/components/empty.js +1 -1
  180. package/dist/components/generate.js +1 -1
  181. package/dist/components/input-template.js +1 -1
  182. package/dist/components/input.js +1 -1
  183. package/dist/components/label.js +1 -1
  184. package/dist/components/list.js +6 -12
  185. package/dist/components/menu.js +1 -1
  186. package/dist/components/radio.js +1 -1
  187. package/dist/components/tooltip.js +1 -1
  188. package/dist/esm/{_commonjsHelpers-be0d4ec8.js → _commonjsHelpers-82aa9212.js} +1 -1
  189. package/dist/esm/bcm-a50d55ba.js +1 -1
  190. package/dist/esm/bcm-accordion_45.entry.js +23899 -0
  191. package/dist/esm/bcm-alert.entry.js +8 -8
  192. package/dist/esm/bcm-attendance-actions-comment.entry.js +12 -12
  193. package/dist/esm/bcm-attendance-actions-dropdown.entry.js +13 -13
  194. package/dist/esm/bcm-autocomplete.entry.js +3 -3
  195. package/dist/esm/bcm-box.entry.js +1 -1
  196. package/dist/esm/bcm-breadcrumb.entry.js +6 -6
  197. package/dist/esm/bcm-caption.entry.js +14 -14
  198. package/dist/esm/bcm-card.entry.js +10 -10
  199. package/dist/esm/{bcm-checkbox-lite_9.entry.js → bcm-checkbox-lite_8.entry.js} +10 -29
  200. package/dist/esm/bcm-chip-group.entry.js +15 -15
  201. package/dist/esm/bcm-collapse-group.entry.js +2 -2
  202. package/dist/esm/bcm-collapse.entry.js +58 -0
  203. package/dist/esm/bcm-colorpicker.entry.js +5 -5
  204. package/dist/esm/bcm-content.entry.js +1 -1
  205. package/dist/esm/bcm-date-picker.entry.js +9 -9
  206. package/dist/esm/bcm-datetime-picker.entry.js +13 -13
  207. package/dist/esm/bcm-default.entry.js +5 -5
  208. package/dist/esm/bcm-error-layout.entry.js +4 -4
  209. package/dist/esm/bcm-form-2.entry.js +8 -8
  210. package/dist/esm/bcm-form-group.entry.js +1 -1
  211. package/dist/esm/bcm-input-custom.entry.js +6 -6
  212. package/dist/esm/bcm-input-dropdown.entry.js +15 -15
  213. package/dist/esm/bcm-link.entry.js +4 -4
  214. package/dist/esm/bcm-message.entry.js +3 -3
  215. package/dist/esm/bcm-modal-2-footer.entry.js +12 -12
  216. package/dist/esm/bcm-modal-2-header.entry.js +11 -11
  217. package/dist/esm/bcm-modal-2.entry.js +13 -13
  218. package/dist/esm/bcm-modal.entry.js +9 -9
  219. package/dist/esm/bcm-notification.entry.js +3 -3
  220. package/dist/esm/bcm-number-input.entry.js +14 -14
  221. package/dist/esm/bcm-old-input.entry.js +5 -5
  222. package/dist/esm/bcm-old-tag_2.entry.js +4 -4
  223. package/dist/esm/bcm-overlay_2.entry.js +4 -4
  224. package/dist/esm/bcm-popover.entry.js +12 -12
  225. package/dist/esm/bcm-range.entry.js +9 -9
  226. package/dist/esm/bcm-result.entry.js +3 -3
  227. package/dist/esm/bcm-select-group.entry.js +3 -3
  228. package/dist/esm/bcm-select-option.entry.js +3 -3
  229. package/dist/esm/bcm-select.entry.js +5 -5
  230. package/dist/esm/bcm-skeleton.entry.js +11 -11
  231. package/dist/esm/bcm-tab-pane.entry.js +3 -3
  232. package/dist/esm/bcm-tab.entry.js +3 -3
  233. package/dist/esm/bcm-table.entry.js +12 -12
  234. package/dist/esm/bcm-tabs-content.entry.js +4 -4
  235. package/dist/esm/bcm-tabs.entry.js +4 -4
  236. package/dist/esm/bcm-tag.entry.js +9 -9
  237. package/dist/esm/bcm-time-picker.entry.js +9 -9
  238. package/dist/esm/bcm-timeline-item.entry.js +3 -3
  239. package/dist/esm/bcm-timeline.entry.js +3 -3
  240. package/dist/esm/bcm-toast.entry.js +9 -9
  241. package/dist/esm/bcm-treeview-group.entry.js +1 -1
  242. package/dist/esm/bromcom-ui.js +5 -5
  243. package/dist/esm/{caption-template-caa3bc94.js → caption-template-d7953d13.js} +4 -4
  244. package/dist/esm/{color-helper-c4fa9ebc.js → color-helper-74614f24.js} +2 -2
  245. package/dist/esm/{colors-e1c31f79.js → colors-dd598eea.js} +14 -8
  246. package/dist/esm/{element-dragger-7ea06c76.js → element-dragger-89bb52fd.js} +1 -1
  247. package/dist/esm/floating-ui-3f4394da.js +1 -1
  248. package/dist/esm/{generate-2696a8c2.js → generate-7f921cea.js} +2 -2
  249. package/dist/esm/{global-61bfbbb2.js → global-e270bb55.js} +2 -2
  250. package/dist/esm/{index-4614b7f0.js → index-0615c2b8.js} +1 -1
  251. package/dist/esm/{index-f38e3364.js → index-7e71bbc8.js} +1 -1
  252. package/dist/esm/{index-b84bc8c9.js → index-f549811f.js} +1 -1
  253. package/dist/esm/{is-load-decorator-b8ca22f2.js → is-load-decorator-8277e3b8.js} +1 -1
  254. package/dist/esm/{label-template-737576c4.js → label-template-a26f76c0.js} +4 -4
  255. package/dist/esm/loader.js +5 -5
  256. package/dist/esm/{lodash-0a4396a7.js → lodash-4197be99.js} +1 -1
  257. package/dist/esm/{number-helper-738f0f80.js → number-helper-48abae7a.js} +1 -1
  258. package/dist/esm/old-bcm-popover-box.entry.js +11 -11
  259. package/dist/esm/old-bcm-popover.entry.js +7 -7
  260. package/dist/esm/{package-131d6f3d.js → package-52b93905.js} +1 -1
  261. package/dist/esm/{popover-placement-2f5939ea.js → popover-placement-d12fec40.js} +1 -1
  262. package/dist/esm/{slot-template-08ed1fe4.js → slot-template-2a19b2db.js} +2 -2
  263. package/dist/esm/{string-helper-85990695.js → string-helper-3592bdc2.js} +2 -2
  264. package/dist/esm/{utils-b3338faf.js → utils-57652744.js} +1 -1
  265. package/dist/esm/{validators-0d91bd42.js → validators-2bf0eca1.js} +1 -1
  266. package/dist/types/templates/list-template.d.ts +1 -0
  267. package/package.json +1 -1
  268. package/dist/bromcom-ui/p-02209931.entry.js +0 -5
  269. package/dist/bromcom-ui/p-0267a472.entry.js +0 -5
  270. package/dist/bromcom-ui/p-034bbcdd.js +0 -5
  271. package/dist/bromcom-ui/p-04e5fdfe.entry.js +0 -5
  272. package/dist/bromcom-ui/p-0b28fa4e.entry.js +0 -5
  273. package/dist/bromcom-ui/p-1a33d7a3.entry.js +0 -5
  274. package/dist/bromcom-ui/p-2297ea95.entry.js +0 -5
  275. package/dist/bromcom-ui/p-2b3800d3.entry.js +0 -5
  276. package/dist/bromcom-ui/p-2e1a70ec.entry.js +0 -5
  277. package/dist/bromcom-ui/p-3089e9c7.js +0 -5
  278. package/dist/bromcom-ui/p-3182df7e.js +0 -10
  279. package/dist/bromcom-ui/p-339aca62.entry.js +0 -5
  280. package/dist/bromcom-ui/p-393f0e15.entry.js +0 -5
  281. package/dist/bromcom-ui/p-3f0b84a6.entry.js +0 -5
  282. package/dist/bromcom-ui/p-3f9f5a13.entry.js +0 -5
  283. package/dist/bromcom-ui/p-4213ba24.js +0 -5
  284. package/dist/bromcom-ui/p-45a9f416.entry.js +0 -5
  285. package/dist/bromcom-ui/p-4aa5350f.entry.js +0 -5
  286. package/dist/bromcom-ui/p-4ad0e51a.entry.js +0 -5
  287. package/dist/bromcom-ui/p-4d8067b9.entry.js +0 -5
  288. package/dist/bromcom-ui/p-5199f537.entry.js +0 -5
  289. package/dist/bromcom-ui/p-52722917.entry.js +0 -5
  290. package/dist/bromcom-ui/p-5362c0b3.js +0 -5
  291. package/dist/bromcom-ui/p-57bbbd50.entry.js +0 -5
  292. package/dist/bromcom-ui/p-5ea9881d.entry.js +0 -5
  293. package/dist/bromcom-ui/p-6f11eb8e.entry.js +0 -5
  294. package/dist/bromcom-ui/p-70259bf1.entry.js +0 -5
  295. package/dist/bromcom-ui/p-734c3522.entry.js +0 -5
  296. package/dist/bromcom-ui/p-7380fb38.entry.js +0 -5
  297. package/dist/bromcom-ui/p-76c877e3.entry.js +0 -5
  298. package/dist/bromcom-ui/p-76edf59f.js +0 -7
  299. package/dist/bromcom-ui/p-77035c08.entry.js +0 -5
  300. package/dist/bromcom-ui/p-7e3209a0.js +0 -14
  301. package/dist/bromcom-ui/p-7fcb7aec.entry.js +0 -5
  302. package/dist/bromcom-ui/p-88b59874.entry.js +0 -5
  303. package/dist/bromcom-ui/p-8ec1a890.js +0 -5
  304. package/dist/bromcom-ui/p-98a4c883.entry.js +0 -5
  305. package/dist/bromcom-ui/p-9da2b0d5.entry.js +0 -5
  306. package/dist/bromcom-ui/p-9e4cb37f.entry.js +0 -5
  307. package/dist/bromcom-ui/p-a387fa95.entry.js +0 -5
  308. package/dist/bromcom-ui/p-a436ed99.entry.js +0 -5
  309. package/dist/bromcom-ui/p-a9aaa5c1.entry.js +0 -5
  310. package/dist/bromcom-ui/p-bb37a2e6.entry.js +0 -5
  311. package/dist/bromcom-ui/p-be6595a2.entry.js +0 -5
  312. package/dist/bromcom-ui/p-bed627ab.js +0 -11
  313. package/dist/bromcom-ui/p-c4df05e3.entry.js +0 -5
  314. package/dist/bromcom-ui/p-d7309e81.entry.js +0 -5
  315. package/dist/bromcom-ui/p-d88a206a.entry.js +0 -5
  316. package/dist/bromcom-ui/p-dbde1ce5.entry.js +0 -5
  317. package/dist/bromcom-ui/p-dc6a4f29.entry.js +0 -5
  318. package/dist/bromcom-ui/p-e3c66141.js +0 -5
  319. package/dist/bromcom-ui/p-e55dc873.js +0 -5
  320. package/dist/bromcom-ui/p-e8075d25.entry.js +0 -5
  321. package/dist/bromcom-ui/p-e8ef1d0d.js +0 -5
  322. package/dist/bromcom-ui/p-f27a5636.entry.js +0 -5
  323. package/dist/bromcom-ui/p-f2850f20.entry.js +0 -5
  324. package/dist/bromcom-ui/p-f2d598d5.entry.js +0 -5
  325. package/dist/bromcom-ui/p-f6c83f16.entry.js +0 -5
  326. package/dist/bromcom-ui/p-fedb8902.entry.js +0 -5
  327. package/dist/cjs/bcm-accordion.cjs.entry.js +0 -74
  328. package/dist/cjs/bcm-attendance-actions.cjs.entry.js +0 -330
  329. package/dist/cjs/bcm-attendance.cjs.entry.js +0 -35
  330. package/dist/cjs/bcm-avatar_2.cjs.entry.js +0 -210
  331. package/dist/cjs/bcm-button-group.cjs.entry.js +0 -92
  332. package/dist/cjs/bcm-button_2.cjs.entry.js +0 -419
  333. package/dist/cjs/bcm-checkbox-group.cjs.entry.js +0 -415
  334. package/dist/cjs/bcm-checkbox_2.cjs.entry.js +0 -194
  335. package/dist/cjs/bcm-chip.cjs.entry.js +0 -91
  336. package/dist/cjs/bcm-color-input.cjs.entry.js +0 -77
  337. package/dist/cjs/bcm-colorful_2.cjs.entry.js +0 -251
  338. package/dist/cjs/bcm-date.cjs.entry.js +0 -182
  339. package/dist/cjs/bcm-drawer.cjs.entry.js +0 -96
  340. package/dist/cjs/bcm-dropdown.cjs.entry.js +0 -119
  341. package/dist/cjs/bcm-expansion-panel.cjs.entry.js +0 -116
  342. package/dist/cjs/bcm-form.cjs.entry.js +0 -492
  343. package/dist/cjs/bcm-icon.cjs.entry.js +0 -39
  344. package/dist/cjs/bcm-input_2.cjs.entry.js +0 -550
  345. package/dist/cjs/bcm-item.cjs.entry.js +0 -72
  346. package/dist/cjs/bcm-items.cjs.entry.js +0 -49
  347. package/dist/cjs/bcm-label_2.cjs.entry.js +0 -135
  348. package/dist/cjs/bcm-list_3.cjs.entry.js +0 -2563
  349. package/dist/cjs/bcm-menu.cjs.entry.js +0 -151
  350. package/dist/cjs/bcm-popconfirm-box.cjs.entry.js +0 -115
  351. package/dist/cjs/bcm-popconfirm.cjs.entry.js +0 -101
  352. package/dist/cjs/bcm-progress.cjs.entry.js +0 -162
  353. package/dist/cjs/bcm-radio-group.cjs.entry.js +0 -161
  354. package/dist/cjs/bcm-radio.cjs.entry.js +0 -65
  355. package/dist/cjs/bcm-rc-picker.cjs.entry.js +0 -9391
  356. package/dist/cjs/bcm-shortcut.cjs.entry.js +0 -65
  357. package/dist/cjs/bcm-step.cjs.entry.js +0 -89
  358. package/dist/cjs/bcm-stepper.cjs.entry.js +0 -240
  359. package/dist/cjs/bcm-switch.cjs.entry.js +0 -151
  360. package/dist/cjs/bcm-tab-group.cjs.entry.js +0 -210
  361. package/dist/cjs/bcm-tab-item-header.cjs.entry.js +0 -59
  362. package/dist/cjs/bcm-tab-item.cjs.entry.js +0 -91
  363. package/dist/cjs/bcm-text.cjs.entry.js +0 -49
  364. package/dist/cjs/index-3d67f613.js +0 -1610
  365. package/dist/cjs/index-e05a7c6f.js +0 -545
  366. package/dist/cjs/input-template-106fdeb9.js +0 -92
  367. package/dist/cjs/json-parse-decarator-6cbdad46.js +0 -40
  368. package/dist/cjs/moment-d06b012f.js +0 -4601
  369. package/dist/cjs/stepper-states-5c4f767b.js +0 -85
  370. package/dist/cjs/tooltip-helper-9f0c156a.js +0 -158
  371. package/dist/esm/bcm-accordion.entry.js +0 -70
  372. package/dist/esm/bcm-attendance-actions.entry.js +0 -326
  373. package/dist/esm/bcm-attendance.entry.js +0 -31
  374. package/dist/esm/bcm-avatar_2.entry.js +0 -205
  375. package/dist/esm/bcm-button-group.entry.js +0 -88
  376. package/dist/esm/bcm-button_2.entry.js +0 -414
  377. package/dist/esm/bcm-checkbox-group.entry.js +0 -411
  378. package/dist/esm/bcm-checkbox_2.entry.js +0 -189
  379. package/dist/esm/bcm-chip.entry.js +0 -87
  380. package/dist/esm/bcm-color-input.entry.js +0 -73
  381. package/dist/esm/bcm-colorful_2.entry.js +0 -246
  382. package/dist/esm/bcm-date.entry.js +0 -178
  383. package/dist/esm/bcm-drawer.entry.js +0 -92
  384. package/dist/esm/bcm-dropdown.entry.js +0 -115
  385. package/dist/esm/bcm-expansion-panel.entry.js +0 -112
  386. package/dist/esm/bcm-form.entry.js +0 -488
  387. package/dist/esm/bcm-icon.entry.js +0 -35
  388. package/dist/esm/bcm-input_2.entry.js +0 -545
  389. package/dist/esm/bcm-item.entry.js +0 -68
  390. package/dist/esm/bcm-items.entry.js +0 -45
  391. package/dist/esm/bcm-label_2.entry.js +0 -130
  392. package/dist/esm/bcm-list_3.entry.js +0 -2557
  393. package/dist/esm/bcm-menu.entry.js +0 -147
  394. package/dist/esm/bcm-popconfirm-box.entry.js +0 -111
  395. package/dist/esm/bcm-popconfirm.entry.js +0 -97
  396. package/dist/esm/bcm-progress.entry.js +0 -158
  397. package/dist/esm/bcm-radio-group.entry.js +0 -157
  398. package/dist/esm/bcm-radio.entry.js +0 -61
  399. package/dist/esm/bcm-rc-picker.entry.js +0 -9387
  400. package/dist/esm/bcm-shortcut.entry.js +0 -61
  401. package/dist/esm/bcm-step.entry.js +0 -85
  402. package/dist/esm/bcm-stepper.entry.js +0 -236
  403. package/dist/esm/bcm-switch.entry.js +0 -147
  404. package/dist/esm/bcm-tab-group.entry.js +0 -206
  405. package/dist/esm/bcm-tab-item-header.entry.js +0 -55
  406. package/dist/esm/bcm-tab-item.entry.js +0 -87
  407. package/dist/esm/bcm-text.entry.js +0 -45
  408. package/dist/esm/index-a6d9d0af.js +0 -541
  409. package/dist/esm/index-c4568336.js +0 -1594
  410. package/dist/esm/input-template-b2e1b39d.js +0 -90
  411. package/dist/esm/json-parse-decarator-44a00bc5.js +0 -38
  412. package/dist/esm/moment-15cd9198.js +0 -4598
  413. package/dist/esm/stepper-states-66f07873.js +0 -83
  414. package/dist/esm/tooltip-helper-4b501ffa.js +0 -156
@@ -1,4601 +0,0 @@
1
- /*!
2
- * Built with Stencil
3
- * Copyright (c) Bromcom.
4
- */
5
- 'use strict';
6
-
7
- var hookCallback;
8
-
9
- function hooks () {
10
- return hookCallback.apply(null, arguments);
11
- }
12
-
13
- // This is done to register the method called with moment()
14
- // without creating circular dependencies.
15
- function setHookCallback (callback) {
16
- hookCallback = callback;
17
- }
18
-
19
- function isArray(input) {
20
- return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]';
21
- }
22
-
23
- function isObject(input) {
24
- // IE8 will treat undefined and null as object if it wasn't for
25
- // input != null
26
- return input != null && Object.prototype.toString.call(input) === '[object Object]';
27
- }
28
-
29
- function isObjectEmpty(obj) {
30
- if (Object.getOwnPropertyNames) {
31
- return (Object.getOwnPropertyNames(obj).length === 0);
32
- } else {
33
- var k;
34
- for (k in obj) {
35
- if (obj.hasOwnProperty(k)) {
36
- return false;
37
- }
38
- }
39
- return true;
40
- }
41
- }
42
-
43
- function isUndefined(input) {
44
- return input === void 0;
45
- }
46
-
47
- function isNumber(input) {
48
- return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]';
49
- }
50
-
51
- function isDate(input) {
52
- return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
53
- }
54
-
55
- function map(arr, fn) {
56
- var res = [], i;
57
- for (i = 0; i < arr.length; ++i) {
58
- res.push(fn(arr[i], i));
59
- }
60
- return res;
61
- }
62
-
63
- function hasOwnProp(a, b) {
64
- return Object.prototype.hasOwnProperty.call(a, b);
65
- }
66
-
67
- function extend(a, b) {
68
- for (var i in b) {
69
- if (hasOwnProp(b, i)) {
70
- a[i] = b[i];
71
- }
72
- }
73
-
74
- if (hasOwnProp(b, 'toString')) {
75
- a.toString = b.toString;
76
- }
77
-
78
- if (hasOwnProp(b, 'valueOf')) {
79
- a.valueOf = b.valueOf;
80
- }
81
-
82
- return a;
83
- }
84
-
85
- function createUTC (input, format, locale, strict) {
86
- return createLocalOrUTC(input, format, locale, strict, true).utc();
87
- }
88
-
89
- function defaultParsingFlags() {
90
- // We need to deep clone this object.
91
- return {
92
- empty : false,
93
- unusedTokens : [],
94
- unusedInput : [],
95
- overflow : -2,
96
- charsLeftOver : 0,
97
- nullInput : false,
98
- invalidMonth : null,
99
- invalidFormat : false,
100
- userInvalidated : false,
101
- iso : false,
102
- parsedDateParts : [],
103
- meridiem : null,
104
- rfc2822 : false,
105
- weekdayMismatch : false
106
- };
107
- }
108
-
109
- function getParsingFlags(m) {
110
- if (m._pf == null) {
111
- m._pf = defaultParsingFlags();
112
- }
113
- return m._pf;
114
- }
115
-
116
- var some;
117
- if (Array.prototype.some) {
118
- some = Array.prototype.some;
119
- } else {
120
- some = function (fun) {
121
- var t = Object(this);
122
- var len = t.length >>> 0;
123
-
124
- for (var i = 0; i < len; i++) {
125
- if (i in t && fun.call(this, t[i], i, t)) {
126
- return true;
127
- }
128
- }
129
-
130
- return false;
131
- };
132
- }
133
-
134
- function isValid$2(m) {
135
- if (m._isValid == null) {
136
- var flags = getParsingFlags(m);
137
- var parsedParts = some.call(flags.parsedDateParts, function (i) {
138
- return i != null;
139
- });
140
- var isNowValid = !isNaN(m._d.getTime()) &&
141
- flags.overflow < 0 &&
142
- !flags.empty &&
143
- !flags.invalidMonth &&
144
- !flags.invalidWeekday &&
145
- !flags.weekdayMismatch &&
146
- !flags.nullInput &&
147
- !flags.invalidFormat &&
148
- !flags.userInvalidated &&
149
- (!flags.meridiem || (flags.meridiem && parsedParts));
150
-
151
- if (m._strict) {
152
- isNowValid = isNowValid &&
153
- flags.charsLeftOver === 0 &&
154
- flags.unusedTokens.length === 0 &&
155
- flags.bigHour === undefined;
156
- }
157
-
158
- if (Object.isFrozen == null || !Object.isFrozen(m)) {
159
- m._isValid = isNowValid;
160
- }
161
- else {
162
- return isNowValid;
163
- }
164
- }
165
- return m._isValid;
166
- }
167
-
168
- function createInvalid$1 (flags) {
169
- var m = createUTC(NaN);
170
- if (flags != null) {
171
- extend(getParsingFlags(m), flags);
172
- }
173
- else {
174
- getParsingFlags(m).userInvalidated = true;
175
- }
176
-
177
- return m;
178
- }
179
-
180
- // Plugins that add properties should also add the key here (null value),
181
- // so we can properly clone ourselves.
182
- var momentProperties = hooks.momentProperties = [];
183
-
184
- function copyConfig(to, from) {
185
- var i, prop, val;
186
-
187
- if (!isUndefined(from._isAMomentObject)) {
188
- to._isAMomentObject = from._isAMomentObject;
189
- }
190
- if (!isUndefined(from._i)) {
191
- to._i = from._i;
192
- }
193
- if (!isUndefined(from._f)) {
194
- to._f = from._f;
195
- }
196
- if (!isUndefined(from._l)) {
197
- to._l = from._l;
198
- }
199
- if (!isUndefined(from._strict)) {
200
- to._strict = from._strict;
201
- }
202
- if (!isUndefined(from._tzm)) {
203
- to._tzm = from._tzm;
204
- }
205
- if (!isUndefined(from._isUTC)) {
206
- to._isUTC = from._isUTC;
207
- }
208
- if (!isUndefined(from._offset)) {
209
- to._offset = from._offset;
210
- }
211
- if (!isUndefined(from._pf)) {
212
- to._pf = getParsingFlags(from);
213
- }
214
- if (!isUndefined(from._locale)) {
215
- to._locale = from._locale;
216
- }
217
-
218
- if (momentProperties.length > 0) {
219
- for (i = 0; i < momentProperties.length; i++) {
220
- prop = momentProperties[i];
221
- val = from[prop];
222
- if (!isUndefined(val)) {
223
- to[prop] = val;
224
- }
225
- }
226
- }
227
-
228
- return to;
229
- }
230
-
231
- var updateInProgress = false;
232
-
233
- // Moment prototype object
234
- function Moment(config) {
235
- copyConfig(this, config);
236
- this._d = new Date(config._d != null ? config._d.getTime() : NaN);
237
- if (!this.isValid()) {
238
- this._d = new Date(NaN);
239
- }
240
- // Prevent infinite loop in case updateOffset creates new moment
241
- // objects.
242
- if (updateInProgress === false) {
243
- updateInProgress = true;
244
- hooks.updateOffset(this);
245
- updateInProgress = false;
246
- }
247
- }
248
-
249
- function isMoment (obj) {
250
- return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
251
- }
252
-
253
- function absFloor (number) {
254
- if (number < 0) {
255
- // -0 -> 0
256
- return Math.ceil(number) || 0;
257
- } else {
258
- return Math.floor(number);
259
- }
260
- }
261
-
262
- function toInt(argumentForCoercion) {
263
- var coercedNumber = +argumentForCoercion,
264
- value = 0;
265
-
266
- if (coercedNumber !== 0 && isFinite(coercedNumber)) {
267
- value = absFloor(coercedNumber);
268
- }
269
-
270
- return value;
271
- }
272
-
273
- // compare two arrays, return the number of differences
274
- function compareArrays(array1, array2, dontConvert) {
275
- var len = Math.min(array1.length, array2.length),
276
- lengthDiff = Math.abs(array1.length - array2.length),
277
- diffs = 0,
278
- i;
279
- for (i = 0; i < len; i++) {
280
- if ((dontConvert && array1[i] !== array2[i]) ||
281
- (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
282
- diffs++;
283
- }
284
- }
285
- return diffs + lengthDiff;
286
- }
287
-
288
- function warn(msg) {
289
- if (hooks.suppressDeprecationWarnings === false &&
290
- (typeof console !== 'undefined') && console.warn) {
291
- console.warn('Deprecation warning: ' + msg);
292
- }
293
- }
294
-
295
- function deprecate(msg, fn) {
296
- var firstTime = true;
297
-
298
- return extend(function () {
299
- if (hooks.deprecationHandler != null) {
300
- hooks.deprecationHandler(null, msg);
301
- }
302
- if (firstTime) {
303
- var args = [];
304
- var arg;
305
- for (var i = 0; i < arguments.length; i++) {
306
- arg = '';
307
- if (typeof arguments[i] === 'object') {
308
- arg += '\n[' + i + '] ';
309
- for (var key in arguments[0]) {
310
- arg += key + ': ' + arguments[0][key] + ', ';
311
- }
312
- arg = arg.slice(0, -2); // Remove trailing comma and space
313
- } else {
314
- arg = arguments[i];
315
- }
316
- args.push(arg);
317
- }
318
- warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack);
319
- firstTime = false;
320
- }
321
- return fn.apply(this, arguments);
322
- }, fn);
323
- }
324
-
325
- var deprecations = {};
326
-
327
- function deprecateSimple(name, msg) {
328
- if (hooks.deprecationHandler != null) {
329
- hooks.deprecationHandler(name, msg);
330
- }
331
- if (!deprecations[name]) {
332
- warn(msg);
333
- deprecations[name] = true;
334
- }
335
- }
336
-
337
- hooks.suppressDeprecationWarnings = false;
338
- hooks.deprecationHandler = null;
339
-
340
- function isFunction(input) {
341
- return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]';
342
- }
343
-
344
- function set$1 (config) {
345
- var prop, i;
346
- for (i in config) {
347
- prop = config[i];
348
- if (isFunction(prop)) {
349
- this[i] = prop;
350
- } else {
351
- this['_' + i] = prop;
352
- }
353
- }
354
- this._config = config;
355
- // Lenient ordinal parsing accepts just a number in addition to
356
- // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
357
- // TODO: Remove "ordinalParse" fallback in next major release.
358
- this._dayOfMonthOrdinalParseLenient = new RegExp(
359
- (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
360
- '|' + (/\d{1,2}/).source);
361
- }
362
-
363
- function mergeConfigs(parentConfig, childConfig) {
364
- var res = extend({}, parentConfig), prop;
365
- for (prop in childConfig) {
366
- if (hasOwnProp(childConfig, prop)) {
367
- if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
368
- res[prop] = {};
369
- extend(res[prop], parentConfig[prop]);
370
- extend(res[prop], childConfig[prop]);
371
- } else if (childConfig[prop] != null) {
372
- res[prop] = childConfig[prop];
373
- } else {
374
- delete res[prop];
375
- }
376
- }
377
- }
378
- for (prop in parentConfig) {
379
- if (hasOwnProp(parentConfig, prop) &&
380
- !hasOwnProp(childConfig, prop) &&
381
- isObject(parentConfig[prop])) {
382
- // make sure changes to properties don't modify parent config
383
- res[prop] = extend({}, res[prop]);
384
- }
385
- }
386
- return res;
387
- }
388
-
389
- function Locale(config) {
390
- if (config != null) {
391
- this.set(config);
392
- }
393
- }
394
-
395
- var keys;
396
-
397
- if (Object.keys) {
398
- keys = Object.keys;
399
- } else {
400
- keys = function (obj) {
401
- var i, res = [];
402
- for (i in obj) {
403
- if (hasOwnProp(obj, i)) {
404
- res.push(i);
405
- }
406
- }
407
- return res;
408
- };
409
- }
410
-
411
- var defaultCalendar = {
412
- sameDay : '[Today at] LT',
413
- nextDay : '[Tomorrow at] LT',
414
- nextWeek : 'dddd [at] LT',
415
- lastDay : '[Yesterday at] LT',
416
- lastWeek : '[Last] dddd [at] LT',
417
- sameElse : 'L'
418
- };
419
-
420
- function calendar$1 (key, mom, now) {
421
- var output = this._calendar[key] || this._calendar['sameElse'];
422
- return isFunction(output) ? output.call(mom, now) : output;
423
- }
424
-
425
- var defaultLongDateFormat = {
426
- LTS : 'h:mm:ss A',
427
- LT : 'h:mm A',
428
- L : 'MM/DD/YYYY',
429
- LL : 'MMMM D, YYYY',
430
- LLL : 'MMMM D, YYYY h:mm A',
431
- LLLL : 'dddd, MMMM D, YYYY h:mm A'
432
- };
433
-
434
- function longDateFormat (key) {
435
- var format = this._longDateFormat[key],
436
- formatUpper = this._longDateFormat[key.toUpperCase()];
437
-
438
- if (format || !formatUpper) {
439
- return format;
440
- }
441
-
442
- this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
443
- return val.slice(1);
444
- });
445
-
446
- return this._longDateFormat[key];
447
- }
448
-
449
- var defaultInvalidDate = 'Invalid date';
450
-
451
- function invalidDate () {
452
- return this._invalidDate;
453
- }
454
-
455
- var defaultOrdinal = '%d';
456
- var defaultDayOfMonthOrdinalParse = /\d{1,2}/;
457
-
458
- function ordinal (number) {
459
- return this._ordinal.replace('%d', number);
460
- }
461
-
462
- var defaultRelativeTime = {
463
- future : 'in %s',
464
- past : '%s ago',
465
- s : 'a few seconds',
466
- ss : '%d seconds',
467
- m : 'a minute',
468
- mm : '%d minutes',
469
- h : 'an hour',
470
- hh : '%d hours',
471
- d : 'a day',
472
- dd : '%d days',
473
- M : 'a month',
474
- MM : '%d months',
475
- y : 'a year',
476
- yy : '%d years'
477
- };
478
-
479
- function relativeTime$1 (number, withoutSuffix, string, isFuture) {
480
- var output = this._relativeTime[string];
481
- return (isFunction(output)) ?
482
- output(number, withoutSuffix, string, isFuture) :
483
- output.replace(/%d/i, number);
484
- }
485
-
486
- function pastFuture (diff, output) {
487
- var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
488
- return isFunction(format) ? format(output) : format.replace(/%s/i, output);
489
- }
490
-
491
- var aliases = {};
492
-
493
- function addUnitAlias (unit, shorthand) {
494
- var lowerCase = unit.toLowerCase();
495
- aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
496
- }
497
-
498
- function normalizeUnits(units) {
499
- return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
500
- }
501
-
502
- function normalizeObjectUnits(inputObject) {
503
- var normalizedInput = {},
504
- normalizedProp,
505
- prop;
506
-
507
- for (prop in inputObject) {
508
- if (hasOwnProp(inputObject, prop)) {
509
- normalizedProp = normalizeUnits(prop);
510
- if (normalizedProp) {
511
- normalizedInput[normalizedProp] = inputObject[prop];
512
- }
513
- }
514
- }
515
-
516
- return normalizedInput;
517
- }
518
-
519
- var priorities = {};
520
-
521
- function addUnitPriority(unit, priority) {
522
- priorities[unit] = priority;
523
- }
524
-
525
- function getPrioritizedUnits(unitsObj) {
526
- var units = [];
527
- for (var u in unitsObj) {
528
- units.push({unit: u, priority: priorities[u]});
529
- }
530
- units.sort(function (a, b) {
531
- return a.priority - b.priority;
532
- });
533
- return units;
534
- }
535
-
536
- function zeroFill(number, targetLength, forceSign) {
537
- var absNumber = '' + Math.abs(number),
538
- zerosToFill = targetLength - absNumber.length,
539
- sign = number >= 0;
540
- return (sign ? (forceSign ? '+' : '') : '-') +
541
- Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
542
- }
543
-
544
- var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
545
-
546
- var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
547
-
548
- var formatFunctions = {};
549
-
550
- var formatTokenFunctions = {};
551
-
552
- // token: 'M'
553
- // padded: ['MM', 2]
554
- // ordinal: 'Mo'
555
- // callback: function () { this.month() + 1 }
556
- function addFormatToken (token, padded, ordinal, callback) {
557
- var func = callback;
558
- if (typeof callback === 'string') {
559
- func = function () {
560
- return this[callback]();
561
- };
562
- }
563
- if (token) {
564
- formatTokenFunctions[token] = func;
565
- }
566
- if (padded) {
567
- formatTokenFunctions[padded[0]] = function () {
568
- return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
569
- };
570
- }
571
- if (ordinal) {
572
- formatTokenFunctions[ordinal] = function () {
573
- return this.localeData().ordinal(func.apply(this, arguments), token);
574
- };
575
- }
576
- }
577
-
578
- function removeFormattingTokens(input) {
579
- if (input.match(/\[[\s\S]/)) {
580
- return input.replace(/^\[|\]$/g, '');
581
- }
582
- return input.replace(/\\/g, '');
583
- }
584
-
585
- function makeFormatFunction(format) {
586
- var array = format.match(formattingTokens), i, length;
587
-
588
- for (i = 0, length = array.length; i < length; i++) {
589
- if (formatTokenFunctions[array[i]]) {
590
- array[i] = formatTokenFunctions[array[i]];
591
- } else {
592
- array[i] = removeFormattingTokens(array[i]);
593
- }
594
- }
595
-
596
- return function (mom) {
597
- var output = '', i;
598
- for (i = 0; i < length; i++) {
599
- output += isFunction(array[i]) ? array[i].call(mom, format) : array[i];
600
- }
601
- return output;
602
- };
603
- }
604
-
605
- // format date using native date object
606
- function formatMoment(m, format) {
607
- if (!m.isValid()) {
608
- return m.localeData().invalidDate();
609
- }
610
-
611
- format = expandFormat(format, m.localeData());
612
- formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
613
-
614
- return formatFunctions[format](m);
615
- }
616
-
617
- function expandFormat(format, locale) {
618
- var i = 5;
619
-
620
- function replaceLongDateFormatTokens(input) {
621
- return locale.longDateFormat(input) || input;
622
- }
623
-
624
- localFormattingTokens.lastIndex = 0;
625
- while (i >= 0 && localFormattingTokens.test(format)) {
626
- format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
627
- localFormattingTokens.lastIndex = 0;
628
- i -= 1;
629
- }
630
-
631
- return format;
632
- }
633
-
634
- var match1 = /\d/; // 0 - 9
635
- var match2 = /\d\d/; // 00 - 99
636
- var match3 = /\d{3}/; // 000 - 999
637
- var match4 = /\d{4}/; // 0000 - 9999
638
- var match6 = /[+-]?\d{6}/; // -999999 - 999999
639
- var match1to2 = /\d\d?/; // 0 - 99
640
- var match3to4 = /\d\d\d\d?/; // 999 - 9999
641
- var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999
642
- var match1to3 = /\d{1,3}/; // 0 - 999
643
- var match1to4 = /\d{1,4}/; // 0 - 9999
644
- var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999
645
-
646
- var matchUnsigned = /\d+/; // 0 - inf
647
- var matchSigned = /[+-]?\d+/; // -inf - inf
648
-
649
- var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
650
- var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z
651
-
652
- var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
653
-
654
- // any word (or two) characters or numbers including two/three word month in arabic.
655
- // includes scottish gaelic two word and hyphenated months
656
- var matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;
657
-
658
- var regexes = {};
659
-
660
- function addRegexToken (token, regex, strictRegex) {
661
- regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) {
662
- return (isStrict && strictRegex) ? strictRegex : regex;
663
- };
664
- }
665
-
666
- function getParseRegexForToken (token, config) {
667
- if (!hasOwnProp(regexes, token)) {
668
- return new RegExp(unescapeFormat(token));
669
- }
670
-
671
- return regexes[token](config._strict, config._locale);
672
- }
673
-
674
- // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
675
- function unescapeFormat(s) {
676
- return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
677
- return p1 || p2 || p3 || p4;
678
- }));
679
- }
680
-
681
- function regexEscape(s) {
682
- return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
683
- }
684
-
685
- var tokens = {};
686
-
687
- function addParseToken (token, callback) {
688
- var i, func = callback;
689
- if (typeof token === 'string') {
690
- token = [token];
691
- }
692
- if (isNumber(callback)) {
693
- func = function (input, array) {
694
- array[callback] = toInt(input);
695
- };
696
- }
697
- for (i = 0; i < token.length; i++) {
698
- tokens[token[i]] = func;
699
- }
700
- }
701
-
702
- function addWeekParseToken (token, callback) {
703
- addParseToken(token, function (input, array, config, token) {
704
- config._w = config._w || {};
705
- callback(input, config._w, config, token);
706
- });
707
- }
708
-
709
- function addTimeToArrayFromToken(token, input, config) {
710
- if (input != null && hasOwnProp(tokens, token)) {
711
- tokens[token](input, config._a, config, token);
712
- }
713
- }
714
-
715
- var YEAR = 0;
716
- var MONTH = 1;
717
- var DATE = 2;
718
- var HOUR = 3;
719
- var MINUTE = 4;
720
- var SECOND = 5;
721
- var MILLISECOND = 6;
722
- var WEEK = 7;
723
- var WEEKDAY = 8;
724
-
725
- // FORMATTING
726
-
727
- addFormatToken('Y', 0, 0, function () {
728
- var y = this.year();
729
- return y <= 9999 ? '' + y : '+' + y;
730
- });
731
-
732
- addFormatToken(0, ['YY', 2], 0, function () {
733
- return this.year() % 100;
734
- });
735
-
736
- addFormatToken(0, ['YYYY', 4], 0, 'year');
737
- addFormatToken(0, ['YYYYY', 5], 0, 'year');
738
- addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
739
-
740
- // ALIASES
741
-
742
- addUnitAlias('year', 'y');
743
-
744
- // PRIORITIES
745
-
746
- addUnitPriority('year', 1);
747
-
748
- // PARSING
749
-
750
- addRegexToken('Y', matchSigned);
751
- addRegexToken('YY', match1to2, match2);
752
- addRegexToken('YYYY', match1to4, match4);
753
- addRegexToken('YYYYY', match1to6, match6);
754
- addRegexToken('YYYYYY', match1to6, match6);
755
-
756
- addParseToken(['YYYYY', 'YYYYYY'], YEAR);
757
- addParseToken('YYYY', function (input, array) {
758
- array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
759
- });
760
- addParseToken('YY', function (input, array) {
761
- array[YEAR] = hooks.parseTwoDigitYear(input);
762
- });
763
- addParseToken('Y', function (input, array) {
764
- array[YEAR] = parseInt(input, 10);
765
- });
766
-
767
- // HELPERS
768
-
769
- function daysInYear(year) {
770
- return isLeapYear(year) ? 366 : 365;
771
- }
772
-
773
- function isLeapYear(year) {
774
- return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
775
- }
776
-
777
- // HOOKS
778
-
779
- hooks.parseTwoDigitYear = function (input) {
780
- return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
781
- };
782
-
783
- // MOMENTS
784
-
785
- var getSetYear = makeGetSet('FullYear', true);
786
-
787
- function getIsLeapYear () {
788
- return isLeapYear(this.year());
789
- }
790
-
791
- function makeGetSet (unit, keepTime) {
792
- return function (value) {
793
- if (value != null) {
794
- set(this, unit, value);
795
- hooks.updateOffset(this, keepTime);
796
- return this;
797
- } else {
798
- return get$2(this, unit);
799
- }
800
- };
801
- }
802
-
803
- function get$2 (mom, unit) {
804
- return mom.isValid() ?
805
- mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN;
806
- }
807
-
808
- function set (mom, unit, value) {
809
- if (mom.isValid() && !isNaN(value)) {
810
- if (unit === 'FullYear' && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29) {
811
- mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value, mom.month(), daysInMonth(value, mom.month()));
812
- }
813
- else {
814
- mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
815
- }
816
- }
817
- }
818
-
819
- // MOMENTS
820
-
821
- function stringGet (units) {
822
- units = normalizeUnits(units);
823
- if (isFunction(this[units])) {
824
- return this[units]();
825
- }
826
- return this;
827
- }
828
-
829
-
830
- function stringSet (units, value) {
831
- if (typeof units === 'object') {
832
- units = normalizeObjectUnits(units);
833
- var prioritized = getPrioritizedUnits(units);
834
- for (var i = 0; i < prioritized.length; i++) {
835
- this[prioritized[i].unit](units[prioritized[i].unit]);
836
- }
837
- } else {
838
- units = normalizeUnits(units);
839
- if (isFunction(this[units])) {
840
- return this[units](value);
841
- }
842
- }
843
- return this;
844
- }
845
-
846
- function mod$1(n, x) {
847
- return ((n % x) + x) % x;
848
- }
849
-
850
- var indexOf;
851
-
852
- if (Array.prototype.indexOf) {
853
- indexOf = Array.prototype.indexOf;
854
- } else {
855
- indexOf = function (o) {
856
- // I know
857
- var i;
858
- for (i = 0; i < this.length; ++i) {
859
- if (this[i] === o) {
860
- return i;
861
- }
862
- }
863
- return -1;
864
- };
865
- }
866
-
867
- function daysInMonth(year, month) {
868
- if (isNaN(year) || isNaN(month)) {
869
- return NaN;
870
- }
871
- var modMonth = mod$1(month, 12);
872
- year += (month - modMonth) / 12;
873
- return modMonth === 1 ? (isLeapYear(year) ? 29 : 28) : (31 - modMonth % 7 % 2);
874
- }
875
-
876
- // FORMATTING
877
-
878
- addFormatToken('M', ['MM', 2], 'Mo', function () {
879
- return this.month() + 1;
880
- });
881
-
882
- addFormatToken('MMM', 0, 0, function (format) {
883
- return this.localeData().monthsShort(this, format);
884
- });
885
-
886
- addFormatToken('MMMM', 0, 0, function (format) {
887
- return this.localeData().months(this, format);
888
- });
889
-
890
- // ALIASES
891
-
892
- addUnitAlias('month', 'M');
893
-
894
- // PRIORITY
895
-
896
- addUnitPriority('month', 8);
897
-
898
- // PARSING
899
-
900
- addRegexToken('M', match1to2);
901
- addRegexToken('MM', match1to2, match2);
902
- addRegexToken('MMM', function (isStrict, locale) {
903
- return locale.monthsShortRegex(isStrict);
904
- });
905
- addRegexToken('MMMM', function (isStrict, locale) {
906
- return locale.monthsRegex(isStrict);
907
- });
908
-
909
- addParseToken(['M', 'MM'], function (input, array) {
910
- array[MONTH] = toInt(input) - 1;
911
- });
912
-
913
- addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
914
- var month = config._locale.monthsParse(input, token, config._strict);
915
- // if we didn't find a month name, mark the date as invalid.
916
- if (month != null) {
917
- array[MONTH] = month;
918
- } else {
919
- getParsingFlags(config).invalidMonth = input;
920
- }
921
- });
922
-
923
- // LOCALES
924
-
925
- var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;
926
- var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
927
- function localeMonths (m, format) {
928
- if (!m) {
929
- return isArray(this._months) ? this._months :
930
- this._months['standalone'];
931
- }
932
- return isArray(this._months) ? this._months[m.month()] :
933
- this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()];
934
- }
935
-
936
- var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
937
- function localeMonthsShort (m, format) {
938
- if (!m) {
939
- return isArray(this._monthsShort) ? this._monthsShort :
940
- this._monthsShort['standalone'];
941
- }
942
- return isArray(this._monthsShort) ? this._monthsShort[m.month()] :
943
- this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
944
- }
945
-
946
- function handleStrictParse$1(monthName, format, strict) {
947
- var i, ii, mom, llc = monthName.toLocaleLowerCase();
948
- if (!this._monthsParse) {
949
- // this is not used
950
- this._monthsParse = [];
951
- this._longMonthsParse = [];
952
- this._shortMonthsParse = [];
953
- for (i = 0; i < 12; ++i) {
954
- mom = createUTC([2000, i]);
955
- this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase();
956
- this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
957
- }
958
- }
959
-
960
- if (strict) {
961
- if (format === 'MMM') {
962
- ii = indexOf.call(this._shortMonthsParse, llc);
963
- return ii !== -1 ? ii : null;
964
- } else {
965
- ii = indexOf.call(this._longMonthsParse, llc);
966
- return ii !== -1 ? ii : null;
967
- }
968
- } else {
969
- if (format === 'MMM') {
970
- ii = indexOf.call(this._shortMonthsParse, llc);
971
- if (ii !== -1) {
972
- return ii;
973
- }
974
- ii = indexOf.call(this._longMonthsParse, llc);
975
- return ii !== -1 ? ii : null;
976
- } else {
977
- ii = indexOf.call(this._longMonthsParse, llc);
978
- if (ii !== -1) {
979
- return ii;
980
- }
981
- ii = indexOf.call(this._shortMonthsParse, llc);
982
- return ii !== -1 ? ii : null;
983
- }
984
- }
985
- }
986
-
987
- function localeMonthsParse (monthName, format, strict) {
988
- var i, mom, regex;
989
-
990
- if (this._monthsParseExact) {
991
- return handleStrictParse$1.call(this, monthName, format, strict);
992
- }
993
-
994
- if (!this._monthsParse) {
995
- this._monthsParse = [];
996
- this._longMonthsParse = [];
997
- this._shortMonthsParse = [];
998
- }
999
-
1000
- // TODO: add sorting
1001
- // Sorting makes sure if one month (or abbr) is a prefix of another
1002
- // see sorting in computeMonthsParse
1003
- for (i = 0; i < 12; i++) {
1004
- // make the regex if we don't have it already
1005
- mom = createUTC([2000, i]);
1006
- if (strict && !this._longMonthsParse[i]) {
1007
- this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
1008
- this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
1009
- }
1010
- if (!strict && !this._monthsParse[i]) {
1011
- regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
1012
- this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
1013
- }
1014
- // test the regex
1015
- if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
1016
- return i;
1017
- } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
1018
- return i;
1019
- } else if (!strict && this._monthsParse[i].test(monthName)) {
1020
- return i;
1021
- }
1022
- }
1023
- }
1024
-
1025
- // MOMENTS
1026
-
1027
- function setMonth (mom, value) {
1028
- var dayOfMonth;
1029
-
1030
- if (!mom.isValid()) {
1031
- // No op
1032
- return mom;
1033
- }
1034
-
1035
- if (typeof value === 'string') {
1036
- if (/^\d+$/.test(value)) {
1037
- value = toInt(value);
1038
- } else {
1039
- value = mom.localeData().monthsParse(value);
1040
- // TODO: Another silent failure?
1041
- if (!isNumber(value)) {
1042
- return mom;
1043
- }
1044
- }
1045
- }
1046
-
1047
- dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
1048
- mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
1049
- return mom;
1050
- }
1051
-
1052
- function getSetMonth (value) {
1053
- if (value != null) {
1054
- setMonth(this, value);
1055
- hooks.updateOffset(this, true);
1056
- return this;
1057
- } else {
1058
- return get$2(this, 'Month');
1059
- }
1060
- }
1061
-
1062
- function getDaysInMonth () {
1063
- return daysInMonth(this.year(), this.month());
1064
- }
1065
-
1066
- var defaultMonthsShortRegex = matchWord;
1067
- function monthsShortRegex (isStrict) {
1068
- if (this._monthsParseExact) {
1069
- if (!hasOwnProp(this, '_monthsRegex')) {
1070
- computeMonthsParse.call(this);
1071
- }
1072
- if (isStrict) {
1073
- return this._monthsShortStrictRegex;
1074
- } else {
1075
- return this._monthsShortRegex;
1076
- }
1077
- } else {
1078
- if (!hasOwnProp(this, '_monthsShortRegex')) {
1079
- this._monthsShortRegex = defaultMonthsShortRegex;
1080
- }
1081
- return this._monthsShortStrictRegex && isStrict ?
1082
- this._monthsShortStrictRegex : this._monthsShortRegex;
1083
- }
1084
- }
1085
-
1086
- var defaultMonthsRegex = matchWord;
1087
- function monthsRegex (isStrict) {
1088
- if (this._monthsParseExact) {
1089
- if (!hasOwnProp(this, '_monthsRegex')) {
1090
- computeMonthsParse.call(this);
1091
- }
1092
- if (isStrict) {
1093
- return this._monthsStrictRegex;
1094
- } else {
1095
- return this._monthsRegex;
1096
- }
1097
- } else {
1098
- if (!hasOwnProp(this, '_monthsRegex')) {
1099
- this._monthsRegex = defaultMonthsRegex;
1100
- }
1101
- return this._monthsStrictRegex && isStrict ?
1102
- this._monthsStrictRegex : this._monthsRegex;
1103
- }
1104
- }
1105
-
1106
- function computeMonthsParse () {
1107
- function cmpLenRev(a, b) {
1108
- return b.length - a.length;
1109
- }
1110
-
1111
- var shortPieces = [], longPieces = [], mixedPieces = [],
1112
- i, mom;
1113
- for (i = 0; i < 12; i++) {
1114
- // make the regex if we don't have it already
1115
- mom = createUTC([2000, i]);
1116
- shortPieces.push(this.monthsShort(mom, ''));
1117
- longPieces.push(this.months(mom, ''));
1118
- mixedPieces.push(this.months(mom, ''));
1119
- mixedPieces.push(this.monthsShort(mom, ''));
1120
- }
1121
- // Sorting makes sure if one month (or abbr) is a prefix of another it
1122
- // will match the longer piece.
1123
- shortPieces.sort(cmpLenRev);
1124
- longPieces.sort(cmpLenRev);
1125
- mixedPieces.sort(cmpLenRev);
1126
- for (i = 0; i < 12; i++) {
1127
- shortPieces[i] = regexEscape(shortPieces[i]);
1128
- longPieces[i] = regexEscape(longPieces[i]);
1129
- }
1130
- for (i = 0; i < 24; i++) {
1131
- mixedPieces[i] = regexEscape(mixedPieces[i]);
1132
- }
1133
-
1134
- this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
1135
- this._monthsShortRegex = this._monthsRegex;
1136
- this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
1137
- this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
1138
- }
1139
-
1140
- function createDate (y, m, d, h, M, s, ms) {
1141
- // can't just apply() to create a date:
1142
- // https://stackoverflow.com/q/181348
1143
- var date;
1144
- // the date constructor remaps years 0-99 to 1900-1999
1145
- if (y < 100 && y >= 0) {
1146
- // preserve leap years using a full 400 year cycle, then reset
1147
- date = new Date(y + 400, m, d, h, M, s, ms);
1148
- if (isFinite(date.getFullYear())) {
1149
- date.setFullYear(y);
1150
- }
1151
- } else {
1152
- date = new Date(y, m, d, h, M, s, ms);
1153
- }
1154
-
1155
- return date;
1156
- }
1157
-
1158
- function createUTCDate (y) {
1159
- var date;
1160
- // the Date.UTC function remaps years 0-99 to 1900-1999
1161
- if (y < 100 && y >= 0) {
1162
- var args = Array.prototype.slice.call(arguments);
1163
- // preserve leap years using a full 400 year cycle, then reset
1164
- args[0] = y + 400;
1165
- date = new Date(Date.UTC.apply(null, args));
1166
- if (isFinite(date.getUTCFullYear())) {
1167
- date.setUTCFullYear(y);
1168
- }
1169
- } else {
1170
- date = new Date(Date.UTC.apply(null, arguments));
1171
- }
1172
-
1173
- return date;
1174
- }
1175
-
1176
- // start-of-first-week - start-of-year
1177
- function firstWeekOffset(year, dow, doy) {
1178
- var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
1179
- fwd = 7 + dow - doy,
1180
- // first-week day local weekday -- which local weekday is fwd
1181
- fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
1182
-
1183
- return -fwdlw + fwd - 1;
1184
- }
1185
-
1186
- // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
1187
- function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
1188
- var localWeekday = (7 + weekday - dow) % 7,
1189
- weekOffset = firstWeekOffset(year, dow, doy),
1190
- dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
1191
- resYear, resDayOfYear;
1192
-
1193
- if (dayOfYear <= 0) {
1194
- resYear = year - 1;
1195
- resDayOfYear = daysInYear(resYear) + dayOfYear;
1196
- } else if (dayOfYear > daysInYear(year)) {
1197
- resYear = year + 1;
1198
- resDayOfYear = dayOfYear - daysInYear(year);
1199
- } else {
1200
- resYear = year;
1201
- resDayOfYear = dayOfYear;
1202
- }
1203
-
1204
- return {
1205
- year: resYear,
1206
- dayOfYear: resDayOfYear
1207
- };
1208
- }
1209
-
1210
- function weekOfYear(mom, dow, doy) {
1211
- var weekOffset = firstWeekOffset(mom.year(), dow, doy),
1212
- week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
1213
- resWeek, resYear;
1214
-
1215
- if (week < 1) {
1216
- resYear = mom.year() - 1;
1217
- resWeek = week + weeksInYear(resYear, dow, doy);
1218
- } else if (week > weeksInYear(mom.year(), dow, doy)) {
1219
- resWeek = week - weeksInYear(mom.year(), dow, doy);
1220
- resYear = mom.year() + 1;
1221
- } else {
1222
- resYear = mom.year();
1223
- resWeek = week;
1224
- }
1225
-
1226
- return {
1227
- week: resWeek,
1228
- year: resYear
1229
- };
1230
- }
1231
-
1232
- function weeksInYear(year, dow, doy) {
1233
- var weekOffset = firstWeekOffset(year, dow, doy),
1234
- weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
1235
- return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
1236
- }
1237
-
1238
- // FORMATTING
1239
-
1240
- addFormatToken('w', ['ww', 2], 'wo', 'week');
1241
- addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
1242
-
1243
- // ALIASES
1244
-
1245
- addUnitAlias('week', 'w');
1246
- addUnitAlias('isoWeek', 'W');
1247
-
1248
- // PRIORITIES
1249
-
1250
- addUnitPriority('week', 5);
1251
- addUnitPriority('isoWeek', 5);
1252
-
1253
- // PARSING
1254
-
1255
- addRegexToken('w', match1to2);
1256
- addRegexToken('ww', match1to2, match2);
1257
- addRegexToken('W', match1to2);
1258
- addRegexToken('WW', match1to2, match2);
1259
-
1260
- addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
1261
- week[token.substr(0, 1)] = toInt(input);
1262
- });
1263
-
1264
- // HELPERS
1265
-
1266
- // LOCALES
1267
-
1268
- function localeWeek (mom) {
1269
- return weekOfYear(mom, this._week.dow, this._week.doy).week;
1270
- }
1271
-
1272
- var defaultLocaleWeek = {
1273
- dow : 0, // Sunday is the first day of the week.
1274
- doy : 6 // The week that contains Jan 6th is the first week of the year.
1275
- };
1276
-
1277
- function localeFirstDayOfWeek () {
1278
- return this._week.dow;
1279
- }
1280
-
1281
- function localeFirstDayOfYear () {
1282
- return this._week.doy;
1283
- }
1284
-
1285
- // MOMENTS
1286
-
1287
- function getSetWeek (input) {
1288
- var week = this.localeData().week(this);
1289
- return input == null ? week : this.add((input - week) * 7, 'd');
1290
- }
1291
-
1292
- function getSetISOWeek (input) {
1293
- var week = weekOfYear(this, 1, 4).week;
1294
- return input == null ? week : this.add((input - week) * 7, 'd');
1295
- }
1296
-
1297
- // FORMATTING
1298
-
1299
- addFormatToken('d', 0, 'do', 'day');
1300
-
1301
- addFormatToken('dd', 0, 0, function (format) {
1302
- return this.localeData().weekdaysMin(this, format);
1303
- });
1304
-
1305
- addFormatToken('ddd', 0, 0, function (format) {
1306
- return this.localeData().weekdaysShort(this, format);
1307
- });
1308
-
1309
- addFormatToken('dddd', 0, 0, function (format) {
1310
- return this.localeData().weekdays(this, format);
1311
- });
1312
-
1313
- addFormatToken('e', 0, 0, 'weekday');
1314
- addFormatToken('E', 0, 0, 'isoWeekday');
1315
-
1316
- // ALIASES
1317
-
1318
- addUnitAlias('day', 'd');
1319
- addUnitAlias('weekday', 'e');
1320
- addUnitAlias('isoWeekday', 'E');
1321
-
1322
- // PRIORITY
1323
- addUnitPriority('day', 11);
1324
- addUnitPriority('weekday', 11);
1325
- addUnitPriority('isoWeekday', 11);
1326
-
1327
- // PARSING
1328
-
1329
- addRegexToken('d', match1to2);
1330
- addRegexToken('e', match1to2);
1331
- addRegexToken('E', match1to2);
1332
- addRegexToken('dd', function (isStrict, locale) {
1333
- return locale.weekdaysMinRegex(isStrict);
1334
- });
1335
- addRegexToken('ddd', function (isStrict, locale) {
1336
- return locale.weekdaysShortRegex(isStrict);
1337
- });
1338
- addRegexToken('dddd', function (isStrict, locale) {
1339
- return locale.weekdaysRegex(isStrict);
1340
- });
1341
-
1342
- addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
1343
- var weekday = config._locale.weekdaysParse(input, token, config._strict);
1344
- // if we didn't get a weekday name, mark the date as invalid
1345
- if (weekday != null) {
1346
- week.d = weekday;
1347
- } else {
1348
- getParsingFlags(config).invalidWeekday = input;
1349
- }
1350
- });
1351
-
1352
- addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
1353
- week[token] = toInt(input);
1354
- });
1355
-
1356
- // HELPERS
1357
-
1358
- function parseWeekday(input, locale) {
1359
- if (typeof input !== 'string') {
1360
- return input;
1361
- }
1362
-
1363
- if (!isNaN(input)) {
1364
- return parseInt(input, 10);
1365
- }
1366
-
1367
- input = locale.weekdaysParse(input);
1368
- if (typeof input === 'number') {
1369
- return input;
1370
- }
1371
-
1372
- return null;
1373
- }
1374
-
1375
- function parseIsoWeekday(input, locale) {
1376
- if (typeof input === 'string') {
1377
- return locale.weekdaysParse(input) % 7 || 7;
1378
- }
1379
- return isNaN(input) ? null : input;
1380
- }
1381
-
1382
- // LOCALES
1383
- function shiftWeekdays (ws, n) {
1384
- return ws.slice(n, 7).concat(ws.slice(0, n));
1385
- }
1386
-
1387
- var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
1388
- function localeWeekdays (m, format) {
1389
- var weekdays = isArray(this._weekdays) ? this._weekdays :
1390
- this._weekdays[(m && m !== true && this._weekdays.isFormat.test(format)) ? 'format' : 'standalone'];
1391
- return (m === true) ? shiftWeekdays(weekdays, this._week.dow)
1392
- : (m) ? weekdays[m.day()] : weekdays;
1393
- }
1394
-
1395
- var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
1396
- function localeWeekdaysShort (m) {
1397
- return (m === true) ? shiftWeekdays(this._weekdaysShort, this._week.dow)
1398
- : (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
1399
- }
1400
-
1401
- var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
1402
- function localeWeekdaysMin (m) {
1403
- return (m === true) ? shiftWeekdays(this._weekdaysMin, this._week.dow)
1404
- : (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin;
1405
- }
1406
-
1407
- function handleStrictParse(weekdayName, format, strict) {
1408
- var i, ii, mom, llc = weekdayName.toLocaleLowerCase();
1409
- if (!this._weekdaysParse) {
1410
- this._weekdaysParse = [];
1411
- this._shortWeekdaysParse = [];
1412
- this._minWeekdaysParse = [];
1413
-
1414
- for (i = 0; i < 7; ++i) {
1415
- mom = createUTC([2000, 1]).day(i);
1416
- this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase();
1417
- this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase();
1418
- this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
1419
- }
1420
- }
1421
-
1422
- if (strict) {
1423
- if (format === 'dddd') {
1424
- ii = indexOf.call(this._weekdaysParse, llc);
1425
- return ii !== -1 ? ii : null;
1426
- } else if (format === 'ddd') {
1427
- ii = indexOf.call(this._shortWeekdaysParse, llc);
1428
- return ii !== -1 ? ii : null;
1429
- } else {
1430
- ii = indexOf.call(this._minWeekdaysParse, llc);
1431
- return ii !== -1 ? ii : null;
1432
- }
1433
- } else {
1434
- if (format === 'dddd') {
1435
- ii = indexOf.call(this._weekdaysParse, llc);
1436
- if (ii !== -1) {
1437
- return ii;
1438
- }
1439
- ii = indexOf.call(this._shortWeekdaysParse, llc);
1440
- if (ii !== -1) {
1441
- return ii;
1442
- }
1443
- ii = indexOf.call(this._minWeekdaysParse, llc);
1444
- return ii !== -1 ? ii : null;
1445
- } else if (format === 'ddd') {
1446
- ii = indexOf.call(this._shortWeekdaysParse, llc);
1447
- if (ii !== -1) {
1448
- return ii;
1449
- }
1450
- ii = indexOf.call(this._weekdaysParse, llc);
1451
- if (ii !== -1) {
1452
- return ii;
1453
- }
1454
- ii = indexOf.call(this._minWeekdaysParse, llc);
1455
- return ii !== -1 ? ii : null;
1456
- } else {
1457
- ii = indexOf.call(this._minWeekdaysParse, llc);
1458
- if (ii !== -1) {
1459
- return ii;
1460
- }
1461
- ii = indexOf.call(this._weekdaysParse, llc);
1462
- if (ii !== -1) {
1463
- return ii;
1464
- }
1465
- ii = indexOf.call(this._shortWeekdaysParse, llc);
1466
- return ii !== -1 ? ii : null;
1467
- }
1468
- }
1469
- }
1470
-
1471
- function localeWeekdaysParse (weekdayName, format, strict) {
1472
- var i, mom, regex;
1473
-
1474
- if (this._weekdaysParseExact) {
1475
- return handleStrictParse.call(this, weekdayName, format, strict);
1476
- }
1477
-
1478
- if (!this._weekdaysParse) {
1479
- this._weekdaysParse = [];
1480
- this._minWeekdaysParse = [];
1481
- this._shortWeekdaysParse = [];
1482
- this._fullWeekdaysParse = [];
1483
- }
1484
-
1485
- for (i = 0; i < 7; i++) {
1486
- // make the regex if we don't have it already
1487
-
1488
- mom = createUTC([2000, 1]).day(i);
1489
- if (strict && !this._fullWeekdaysParse[i]) {
1490
- this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 'i');
1491
- this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 'i');
1492
- this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 'i');
1493
- }
1494
- if (!this._weekdaysParse[i]) {
1495
- regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
1496
- this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
1497
- }
1498
- // test the regex
1499
- if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) {
1500
- return i;
1501
- } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) {
1502
- return i;
1503
- } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) {
1504
- return i;
1505
- } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
1506
- return i;
1507
- }
1508
- }
1509
- }
1510
-
1511
- // MOMENTS
1512
-
1513
- function getSetDayOfWeek (input) {
1514
- if (!this.isValid()) {
1515
- return input != null ? this : NaN;
1516
- }
1517
- var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
1518
- if (input != null) {
1519
- input = parseWeekday(input, this.localeData());
1520
- return this.add(input - day, 'd');
1521
- } else {
1522
- return day;
1523
- }
1524
- }
1525
-
1526
- function getSetLocaleDayOfWeek (input) {
1527
- if (!this.isValid()) {
1528
- return input != null ? this : NaN;
1529
- }
1530
- var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
1531
- return input == null ? weekday : this.add(input - weekday, 'd');
1532
- }
1533
-
1534
- function getSetISODayOfWeek (input) {
1535
- if (!this.isValid()) {
1536
- return input != null ? this : NaN;
1537
- }
1538
-
1539
- // behaves the same as moment#day except
1540
- // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
1541
- // as a setter, sunday should belong to the previous week.
1542
-
1543
- if (input != null) {
1544
- var weekday = parseIsoWeekday(input, this.localeData());
1545
- return this.day(this.day() % 7 ? weekday : weekday - 7);
1546
- } else {
1547
- return this.day() || 7;
1548
- }
1549
- }
1550
-
1551
- var defaultWeekdaysRegex = matchWord;
1552
- function weekdaysRegex (isStrict) {
1553
- if (this._weekdaysParseExact) {
1554
- if (!hasOwnProp(this, '_weekdaysRegex')) {
1555
- computeWeekdaysParse.call(this);
1556
- }
1557
- if (isStrict) {
1558
- return this._weekdaysStrictRegex;
1559
- } else {
1560
- return this._weekdaysRegex;
1561
- }
1562
- } else {
1563
- if (!hasOwnProp(this, '_weekdaysRegex')) {
1564
- this._weekdaysRegex = defaultWeekdaysRegex;
1565
- }
1566
- return this._weekdaysStrictRegex && isStrict ?
1567
- this._weekdaysStrictRegex : this._weekdaysRegex;
1568
- }
1569
- }
1570
-
1571
- var defaultWeekdaysShortRegex = matchWord;
1572
- function weekdaysShortRegex (isStrict) {
1573
- if (this._weekdaysParseExact) {
1574
- if (!hasOwnProp(this, '_weekdaysRegex')) {
1575
- computeWeekdaysParse.call(this);
1576
- }
1577
- if (isStrict) {
1578
- return this._weekdaysShortStrictRegex;
1579
- } else {
1580
- return this._weekdaysShortRegex;
1581
- }
1582
- } else {
1583
- if (!hasOwnProp(this, '_weekdaysShortRegex')) {
1584
- this._weekdaysShortRegex = defaultWeekdaysShortRegex;
1585
- }
1586
- return this._weekdaysShortStrictRegex && isStrict ?
1587
- this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
1588
- }
1589
- }
1590
-
1591
- var defaultWeekdaysMinRegex = matchWord;
1592
- function weekdaysMinRegex (isStrict) {
1593
- if (this._weekdaysParseExact) {
1594
- if (!hasOwnProp(this, '_weekdaysRegex')) {
1595
- computeWeekdaysParse.call(this);
1596
- }
1597
- if (isStrict) {
1598
- return this._weekdaysMinStrictRegex;
1599
- } else {
1600
- return this._weekdaysMinRegex;
1601
- }
1602
- } else {
1603
- if (!hasOwnProp(this, '_weekdaysMinRegex')) {
1604
- this._weekdaysMinRegex = defaultWeekdaysMinRegex;
1605
- }
1606
- return this._weekdaysMinStrictRegex && isStrict ?
1607
- this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
1608
- }
1609
- }
1610
-
1611
-
1612
- function computeWeekdaysParse () {
1613
- function cmpLenRev(a, b) {
1614
- return b.length - a.length;
1615
- }
1616
-
1617
- var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [],
1618
- i, mom, minp, shortp, longp;
1619
- for (i = 0; i < 7; i++) {
1620
- // make the regex if we don't have it already
1621
- mom = createUTC([2000, 1]).day(i);
1622
- minp = this.weekdaysMin(mom, '');
1623
- shortp = this.weekdaysShort(mom, '');
1624
- longp = this.weekdays(mom, '');
1625
- minPieces.push(minp);
1626
- shortPieces.push(shortp);
1627
- longPieces.push(longp);
1628
- mixedPieces.push(minp);
1629
- mixedPieces.push(shortp);
1630
- mixedPieces.push(longp);
1631
- }
1632
- // Sorting makes sure if one weekday (or abbr) is a prefix of another it
1633
- // will match the longer piece.
1634
- minPieces.sort(cmpLenRev);
1635
- shortPieces.sort(cmpLenRev);
1636
- longPieces.sort(cmpLenRev);
1637
- mixedPieces.sort(cmpLenRev);
1638
- for (i = 0; i < 7; i++) {
1639
- shortPieces[i] = regexEscape(shortPieces[i]);
1640
- longPieces[i] = regexEscape(longPieces[i]);
1641
- mixedPieces[i] = regexEscape(mixedPieces[i]);
1642
- }
1643
-
1644
- this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
1645
- this._weekdaysShortRegex = this._weekdaysRegex;
1646
- this._weekdaysMinRegex = this._weekdaysRegex;
1647
-
1648
- this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
1649
- this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
1650
- this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i');
1651
- }
1652
-
1653
- // FORMATTING
1654
-
1655
- function hFormat() {
1656
- return this.hours() % 12 || 12;
1657
- }
1658
-
1659
- function kFormat() {
1660
- return this.hours() || 24;
1661
- }
1662
-
1663
- addFormatToken('H', ['HH', 2], 0, 'hour');
1664
- addFormatToken('h', ['hh', 2], 0, hFormat);
1665
- addFormatToken('k', ['kk', 2], 0, kFormat);
1666
-
1667
- addFormatToken('hmm', 0, 0, function () {
1668
- return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
1669
- });
1670
-
1671
- addFormatToken('hmmss', 0, 0, function () {
1672
- return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) +
1673
- zeroFill(this.seconds(), 2);
1674
- });
1675
-
1676
- addFormatToken('Hmm', 0, 0, function () {
1677
- return '' + this.hours() + zeroFill(this.minutes(), 2);
1678
- });
1679
-
1680
- addFormatToken('Hmmss', 0, 0, function () {
1681
- return '' + this.hours() + zeroFill(this.minutes(), 2) +
1682
- zeroFill(this.seconds(), 2);
1683
- });
1684
-
1685
- function meridiem (token, lowercase) {
1686
- addFormatToken(token, 0, 0, function () {
1687
- return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
1688
- });
1689
- }
1690
-
1691
- meridiem('a', true);
1692
- meridiem('A', false);
1693
-
1694
- // ALIASES
1695
-
1696
- addUnitAlias('hour', 'h');
1697
-
1698
- // PRIORITY
1699
- addUnitPriority('hour', 13);
1700
-
1701
- // PARSING
1702
-
1703
- function matchMeridiem (isStrict, locale) {
1704
- return locale._meridiemParse;
1705
- }
1706
-
1707
- addRegexToken('a', matchMeridiem);
1708
- addRegexToken('A', matchMeridiem);
1709
- addRegexToken('H', match1to2);
1710
- addRegexToken('h', match1to2);
1711
- addRegexToken('k', match1to2);
1712
- addRegexToken('HH', match1to2, match2);
1713
- addRegexToken('hh', match1to2, match2);
1714
- addRegexToken('kk', match1to2, match2);
1715
-
1716
- addRegexToken('hmm', match3to4);
1717
- addRegexToken('hmmss', match5to6);
1718
- addRegexToken('Hmm', match3to4);
1719
- addRegexToken('Hmmss', match5to6);
1720
-
1721
- addParseToken(['H', 'HH'], HOUR);
1722
- addParseToken(['k', 'kk'], function (input, array, config) {
1723
- var kInput = toInt(input);
1724
- array[HOUR] = kInput === 24 ? 0 : kInput;
1725
- });
1726
- addParseToken(['a', 'A'], function (input, array, config) {
1727
- config._isPm = config._locale.isPM(input);
1728
- config._meridiem = input;
1729
- });
1730
- addParseToken(['h', 'hh'], function (input, array, config) {
1731
- array[HOUR] = toInt(input);
1732
- getParsingFlags(config).bigHour = true;
1733
- });
1734
- addParseToken('hmm', function (input, array, config) {
1735
- var pos = input.length - 2;
1736
- array[HOUR] = toInt(input.substr(0, pos));
1737
- array[MINUTE] = toInt(input.substr(pos));
1738
- getParsingFlags(config).bigHour = true;
1739
- });
1740
- addParseToken('hmmss', function (input, array, config) {
1741
- var pos1 = input.length - 4;
1742
- var pos2 = input.length - 2;
1743
- array[HOUR] = toInt(input.substr(0, pos1));
1744
- array[MINUTE] = toInt(input.substr(pos1, 2));
1745
- array[SECOND] = toInt(input.substr(pos2));
1746
- getParsingFlags(config).bigHour = true;
1747
- });
1748
- addParseToken('Hmm', function (input, array, config) {
1749
- var pos = input.length - 2;
1750
- array[HOUR] = toInt(input.substr(0, pos));
1751
- array[MINUTE] = toInt(input.substr(pos));
1752
- });
1753
- addParseToken('Hmmss', function (input, array, config) {
1754
- var pos1 = input.length - 4;
1755
- var pos2 = input.length - 2;
1756
- array[HOUR] = toInt(input.substr(0, pos1));
1757
- array[MINUTE] = toInt(input.substr(pos1, 2));
1758
- array[SECOND] = toInt(input.substr(pos2));
1759
- });
1760
-
1761
- // LOCALES
1762
-
1763
- function localeIsPM (input) {
1764
- // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
1765
- // Using charAt should be more compatible.
1766
- return ((input + '').toLowerCase().charAt(0) === 'p');
1767
- }
1768
-
1769
- var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
1770
- function localeMeridiem (hours, minutes, isLower) {
1771
- if (hours > 11) {
1772
- return isLower ? 'pm' : 'PM';
1773
- } else {
1774
- return isLower ? 'am' : 'AM';
1775
- }
1776
- }
1777
-
1778
-
1779
- // MOMENTS
1780
-
1781
- // Setting the hour should keep the time, because the user explicitly
1782
- // specified which hour they want. So trying to maintain the same hour (in
1783
- // a new timezone) makes sense. Adding/subtracting hours does not follow
1784
- // this rule.
1785
- var getSetHour = makeGetSet('Hours', true);
1786
-
1787
- var baseConfig = {
1788
- calendar: defaultCalendar,
1789
- longDateFormat: defaultLongDateFormat,
1790
- invalidDate: defaultInvalidDate,
1791
- ordinal: defaultOrdinal,
1792
- dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
1793
- relativeTime: defaultRelativeTime,
1794
-
1795
- months: defaultLocaleMonths,
1796
- monthsShort: defaultLocaleMonthsShort,
1797
-
1798
- week: defaultLocaleWeek,
1799
-
1800
- weekdays: defaultLocaleWeekdays,
1801
- weekdaysMin: defaultLocaleWeekdaysMin,
1802
- weekdaysShort: defaultLocaleWeekdaysShort,
1803
-
1804
- meridiemParse: defaultLocaleMeridiemParse
1805
- };
1806
-
1807
- // internal storage for locale config files
1808
- var locales = {};
1809
- var localeFamilies = {};
1810
- var globalLocale;
1811
-
1812
- function normalizeLocale(key) {
1813
- return key ? key.toLowerCase().replace('_', '-') : key;
1814
- }
1815
-
1816
- // pick the locale from the array
1817
- // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
1818
- // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
1819
- function chooseLocale(names) {
1820
- var i = 0, j, next, locale, split;
1821
-
1822
- while (i < names.length) {
1823
- split = normalizeLocale(names[i]).split('-');
1824
- j = split.length;
1825
- next = normalizeLocale(names[i + 1]);
1826
- next = next ? next.split('-') : null;
1827
- while (j > 0) {
1828
- locale = loadLocale(split.slice(0, j).join('-'));
1829
- if (locale) {
1830
- return locale;
1831
- }
1832
- if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
1833
- //the next array item is better than a shallower substring of this one
1834
- break;
1835
- }
1836
- j--;
1837
- }
1838
- i++;
1839
- }
1840
- return globalLocale;
1841
- }
1842
-
1843
- function loadLocale(name) {
1844
- var oldLocale = null;
1845
- // TODO: Find a better way to register and load all the locales in Node
1846
- if (!locales[name] && (typeof module !== 'undefined') &&
1847
- module && module.exports) {
1848
- try {
1849
- oldLocale = globalLocale._abbr;
1850
- var aliasedRequire = require;
1851
- aliasedRequire('./locale/' + name);
1852
- getSetGlobalLocale(oldLocale);
1853
- } catch (e) {}
1854
- }
1855
- return locales[name];
1856
- }
1857
-
1858
- // This function will load locale and then set the global locale. If
1859
- // no arguments are passed in, it will simply return the current global
1860
- // locale key.
1861
- function getSetGlobalLocale (key, values) {
1862
- var data;
1863
- if (key) {
1864
- if (isUndefined(values)) {
1865
- data = getLocale(key);
1866
- }
1867
- else {
1868
- data = defineLocale(key, values);
1869
- }
1870
-
1871
- if (data) {
1872
- // moment.duration._locale = moment._locale = data;
1873
- globalLocale = data;
1874
- }
1875
- else {
1876
- if ((typeof console !== 'undefined') && console.warn) {
1877
- //warn user if arguments are passed but the locale could not be set
1878
- console.warn('Locale ' + key + ' not found. Did you forget to load it?');
1879
- }
1880
- }
1881
- }
1882
-
1883
- return globalLocale._abbr;
1884
- }
1885
-
1886
- function defineLocale (name, config) {
1887
- if (config !== null) {
1888
- var locale, parentConfig = baseConfig;
1889
- config.abbr = name;
1890
- if (locales[name] != null) {
1891
- deprecateSimple('defineLocaleOverride',
1892
- 'use moment.updateLocale(localeName, config) to change ' +
1893
- 'an existing locale. moment.defineLocale(localeName, ' +
1894
- 'config) should only be used for creating a new locale ' +
1895
- 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.');
1896
- parentConfig = locales[name]._config;
1897
- } else if (config.parentLocale != null) {
1898
- if (locales[config.parentLocale] != null) {
1899
- parentConfig = locales[config.parentLocale]._config;
1900
- } else {
1901
- locale = loadLocale(config.parentLocale);
1902
- if (locale != null) {
1903
- parentConfig = locale._config;
1904
- } else {
1905
- if (!localeFamilies[config.parentLocale]) {
1906
- localeFamilies[config.parentLocale] = [];
1907
- }
1908
- localeFamilies[config.parentLocale].push({
1909
- name: name,
1910
- config: config
1911
- });
1912
- return null;
1913
- }
1914
- }
1915
- }
1916
- locales[name] = new Locale(mergeConfigs(parentConfig, config));
1917
-
1918
- if (localeFamilies[name]) {
1919
- localeFamilies[name].forEach(function (x) {
1920
- defineLocale(x.name, x.config);
1921
- });
1922
- }
1923
-
1924
- // backwards compat for now: also set the locale
1925
- // make sure we set the locale AFTER all child locales have been
1926
- // created, so we won't end up with the child locale set.
1927
- getSetGlobalLocale(name);
1928
-
1929
-
1930
- return locales[name];
1931
- } else {
1932
- // useful for testing
1933
- delete locales[name];
1934
- return null;
1935
- }
1936
- }
1937
-
1938
- function updateLocale(name, config) {
1939
- if (config != null) {
1940
- var locale, tmpLocale, parentConfig = baseConfig;
1941
- // MERGE
1942
- tmpLocale = loadLocale(name);
1943
- if (tmpLocale != null) {
1944
- parentConfig = tmpLocale._config;
1945
- }
1946
- config = mergeConfigs(parentConfig, config);
1947
- locale = new Locale(config);
1948
- locale.parentLocale = locales[name];
1949
- locales[name] = locale;
1950
-
1951
- // backwards compat for now: also set the locale
1952
- getSetGlobalLocale(name);
1953
- } else {
1954
- // pass null for config to unupdate, useful for tests
1955
- if (locales[name] != null) {
1956
- if (locales[name].parentLocale != null) {
1957
- locales[name] = locales[name].parentLocale;
1958
- } else if (locales[name] != null) {
1959
- delete locales[name];
1960
- }
1961
- }
1962
- }
1963
- return locales[name];
1964
- }
1965
-
1966
- // returns locale data
1967
- function getLocale (key) {
1968
- var locale;
1969
-
1970
- if (key && key._locale && key._locale._abbr) {
1971
- key = key._locale._abbr;
1972
- }
1973
-
1974
- if (!key) {
1975
- return globalLocale;
1976
- }
1977
-
1978
- if (!isArray(key)) {
1979
- //short-circuit everything else
1980
- locale = loadLocale(key);
1981
- if (locale) {
1982
- return locale;
1983
- }
1984
- key = [key];
1985
- }
1986
-
1987
- return chooseLocale(key);
1988
- }
1989
-
1990
- function listLocales() {
1991
- return keys(locales);
1992
- }
1993
-
1994
- function checkOverflow (m) {
1995
- var overflow;
1996
- var a = m._a;
1997
-
1998
- if (a && getParsingFlags(m).overflow === -2) {
1999
- overflow =
2000
- a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
2001
- a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
2002
- a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
2003
- a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE :
2004
- a[SECOND] < 0 || a[SECOND] > 59 ? SECOND :
2005
- a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
2006
- -1;
2007
-
2008
- if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
2009
- overflow = DATE;
2010
- }
2011
- if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
2012
- overflow = WEEK;
2013
- }
2014
- if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
2015
- overflow = WEEKDAY;
2016
- }
2017
-
2018
- getParsingFlags(m).overflow = overflow;
2019
- }
2020
-
2021
- return m;
2022
- }
2023
-
2024
- // Pick the first defined of two or three arguments.
2025
- function defaults(a, b, c) {
2026
- if (a != null) {
2027
- return a;
2028
- }
2029
- if (b != null) {
2030
- return b;
2031
- }
2032
- return c;
2033
- }
2034
-
2035
- function currentDateArray(config) {
2036
- // hooks is actually the exported moment object
2037
- var nowValue = new Date(hooks.now());
2038
- if (config._useUTC) {
2039
- return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()];
2040
- }
2041
- return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
2042
- }
2043
-
2044
- // convert an array to a date.
2045
- // the array should mirror the parameters below
2046
- // note: all values past the year are optional and will default to the lowest possible value.
2047
- // [year, month, day , hour, minute, second, millisecond]
2048
- function configFromArray (config) {
2049
- var i, date, input = [], currentDate, expectedWeekday, yearToUse;
2050
-
2051
- if (config._d) {
2052
- return;
2053
- }
2054
-
2055
- currentDate = currentDateArray(config);
2056
-
2057
- //compute day of the year from weeks and weekdays
2058
- if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
2059
- dayOfYearFromWeekInfo(config);
2060
- }
2061
-
2062
- //if the day of the year is set, figure out what it is
2063
- if (config._dayOfYear != null) {
2064
- yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
2065
-
2066
- if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {
2067
- getParsingFlags(config)._overflowDayOfYear = true;
2068
- }
2069
-
2070
- date = createUTCDate(yearToUse, 0, config._dayOfYear);
2071
- config._a[MONTH] = date.getUTCMonth();
2072
- config._a[DATE] = date.getUTCDate();
2073
- }
2074
-
2075
- // Default to current date.
2076
- // * if no year, month, day of month are given, default to today
2077
- // * if day of month is given, default month and year
2078
- // * if month is given, default only year
2079
- // * if year is given, don't default anything
2080
- for (i = 0; i < 3 && config._a[i] == null; ++i) {
2081
- config._a[i] = input[i] = currentDate[i];
2082
- }
2083
-
2084
- // Zero out whatever was not defaulted, including time
2085
- for (; i < 7; i++) {
2086
- config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
2087
- }
2088
-
2089
- // Check for 24:00:00.000
2090
- if (config._a[HOUR] === 24 &&
2091
- config._a[MINUTE] === 0 &&
2092
- config._a[SECOND] === 0 &&
2093
- config._a[MILLISECOND] === 0) {
2094
- config._nextDay = true;
2095
- config._a[HOUR] = 0;
2096
- }
2097
-
2098
- config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
2099
- expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay();
2100
-
2101
- // Apply timezone offset from input. The actual utcOffset can be changed
2102
- // with parseZone.
2103
- if (config._tzm != null) {
2104
- config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
2105
- }
2106
-
2107
- if (config._nextDay) {
2108
- config._a[HOUR] = 24;
2109
- }
2110
-
2111
- // check for mismatching day of week
2112
- if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) {
2113
- getParsingFlags(config).weekdayMismatch = true;
2114
- }
2115
- }
2116
-
2117
- function dayOfYearFromWeekInfo(config) {
2118
- var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
2119
-
2120
- w = config._w;
2121
- if (w.GG != null || w.W != null || w.E != null) {
2122
- dow = 1;
2123
- doy = 4;
2124
-
2125
- // TODO: We need to take the current isoWeekYear, but that depends on
2126
- // how we interpret now (local, utc, fixed offset). So create
2127
- // a now version of current config (take local/utc/offset flags, and
2128
- // create now).
2129
- weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year);
2130
- week = defaults(w.W, 1);
2131
- weekday = defaults(w.E, 1);
2132
- if (weekday < 1 || weekday > 7) {
2133
- weekdayOverflow = true;
2134
- }
2135
- } else {
2136
- dow = config._locale._week.dow;
2137
- doy = config._locale._week.doy;
2138
-
2139
- var curWeek = weekOfYear(createLocal(), dow, doy);
2140
-
2141
- weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
2142
-
2143
- // Default to current week.
2144
- week = defaults(w.w, curWeek.week);
2145
-
2146
- if (w.d != null) {
2147
- // weekday -- low day numbers are considered next week
2148
- weekday = w.d;
2149
- if (weekday < 0 || weekday > 6) {
2150
- weekdayOverflow = true;
2151
- }
2152
- } else if (w.e != null) {
2153
- // local weekday -- counting starts from beginning of week
2154
- weekday = w.e + dow;
2155
- if (w.e < 0 || w.e > 6) {
2156
- weekdayOverflow = true;
2157
- }
2158
- } else {
2159
- // default to beginning of week
2160
- weekday = dow;
2161
- }
2162
- }
2163
- if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
2164
- getParsingFlags(config)._overflowWeeks = true;
2165
- } else if (weekdayOverflow != null) {
2166
- getParsingFlags(config)._overflowWeekday = true;
2167
- } else {
2168
- temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
2169
- config._a[YEAR] = temp.year;
2170
- config._dayOfYear = temp.dayOfYear;
2171
- }
2172
- }
2173
-
2174
- // iso 8601 regex
2175
- // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
2176
- var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
2177
- var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
2178
-
2179
- var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
2180
-
2181
- var isoDates = [
2182
- ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
2183
- ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
2184
- ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
2185
- ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
2186
- ['YYYY-DDD', /\d{4}-\d{3}/],
2187
- ['YYYY-MM', /\d{4}-\d\d/, false],
2188
- ['YYYYYYMMDD', /[+-]\d{10}/],
2189
- ['YYYYMMDD', /\d{8}/],
2190
- // YYYYMM is NOT allowed by the standard
2191
- ['GGGG[W]WWE', /\d{4}W\d{3}/],
2192
- ['GGGG[W]WW', /\d{4}W\d{2}/, false],
2193
- ['YYYYDDD', /\d{7}/]
2194
- ];
2195
-
2196
- // iso time formats and regexes
2197
- var isoTimes = [
2198
- ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
2199
- ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
2200
- ['HH:mm:ss', /\d\d:\d\d:\d\d/],
2201
- ['HH:mm', /\d\d:\d\d/],
2202
- ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
2203
- ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
2204
- ['HHmmss', /\d\d\d\d\d\d/],
2205
- ['HHmm', /\d\d\d\d/],
2206
- ['HH', /\d\d/]
2207
- ];
2208
-
2209
- var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
2210
-
2211
- // date from iso format
2212
- function configFromISO(config) {
2213
- var i, l,
2214
- string = config._i,
2215
- match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
2216
- allowTime, dateFormat, timeFormat, tzFormat;
2217
-
2218
- if (match) {
2219
- getParsingFlags(config).iso = true;
2220
-
2221
- for (i = 0, l = isoDates.length; i < l; i++) {
2222
- if (isoDates[i][1].exec(match[1])) {
2223
- dateFormat = isoDates[i][0];
2224
- allowTime = isoDates[i][2] !== false;
2225
- break;
2226
- }
2227
- }
2228
- if (dateFormat == null) {
2229
- config._isValid = false;
2230
- return;
2231
- }
2232
- if (match[3]) {
2233
- for (i = 0, l = isoTimes.length; i < l; i++) {
2234
- if (isoTimes[i][1].exec(match[3])) {
2235
- // match[2] should be 'T' or space
2236
- timeFormat = (match[2] || ' ') + isoTimes[i][0];
2237
- break;
2238
- }
2239
- }
2240
- if (timeFormat == null) {
2241
- config._isValid = false;
2242
- return;
2243
- }
2244
- }
2245
- if (!allowTime && timeFormat != null) {
2246
- config._isValid = false;
2247
- return;
2248
- }
2249
- if (match[4]) {
2250
- if (tzRegex.exec(match[4])) {
2251
- tzFormat = 'Z';
2252
- } else {
2253
- config._isValid = false;
2254
- return;
2255
- }
2256
- }
2257
- config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
2258
- configFromStringAndFormat(config);
2259
- } else {
2260
- config._isValid = false;
2261
- }
2262
- }
2263
-
2264
- // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
2265
- var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;
2266
-
2267
- function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
2268
- var result = [
2269
- untruncateYear(yearStr),
2270
- defaultLocaleMonthsShort.indexOf(monthStr),
2271
- parseInt(dayStr, 10),
2272
- parseInt(hourStr, 10),
2273
- parseInt(minuteStr, 10)
2274
- ];
2275
-
2276
- if (secondStr) {
2277
- result.push(parseInt(secondStr, 10));
2278
- }
2279
-
2280
- return result;
2281
- }
2282
-
2283
- function untruncateYear(yearStr) {
2284
- var year = parseInt(yearStr, 10);
2285
- if (year <= 49) {
2286
- return 2000 + year;
2287
- } else if (year <= 999) {
2288
- return 1900 + year;
2289
- }
2290
- return year;
2291
- }
2292
-
2293
- function preprocessRFC2822(s) {
2294
- // Remove comments and folding whitespace and replace multiple-spaces with a single space
2295
- return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, '');
2296
- }
2297
-
2298
- function checkWeekday(weekdayStr, parsedInput, config) {
2299
- if (weekdayStr) {
2300
- // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check.
2301
- var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
2302
- weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay();
2303
- if (weekdayProvided !== weekdayActual) {
2304
- getParsingFlags(config).weekdayMismatch = true;
2305
- config._isValid = false;
2306
- return false;
2307
- }
2308
- }
2309
- return true;
2310
- }
2311
-
2312
- var obsOffsets = {
2313
- UT: 0,
2314
- GMT: 0,
2315
- EDT: -4 * 60,
2316
- EST: -5 * 60,
2317
- CDT: -5 * 60,
2318
- CST: -6 * 60,
2319
- MDT: -6 * 60,
2320
- MST: -7 * 60,
2321
- PDT: -7 * 60,
2322
- PST: -8 * 60
2323
- };
2324
-
2325
- function calculateOffset(obsOffset, militaryOffset, numOffset) {
2326
- if (obsOffset) {
2327
- return obsOffsets[obsOffset];
2328
- } else if (militaryOffset) {
2329
- // the only allowed military tz is Z
2330
- return 0;
2331
- } else {
2332
- var hm = parseInt(numOffset, 10);
2333
- var m = hm % 100, h = (hm - m) / 100;
2334
- return h * 60 + m;
2335
- }
2336
- }
2337
-
2338
- // date and time from ref 2822 format
2339
- function configFromRFC2822(config) {
2340
- var match = rfc2822.exec(preprocessRFC2822(config._i));
2341
- if (match) {
2342
- var parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]);
2343
- if (!checkWeekday(match[1], parsedArray, config)) {
2344
- return;
2345
- }
2346
-
2347
- config._a = parsedArray;
2348
- config._tzm = calculateOffset(match[8], match[9], match[10]);
2349
-
2350
- config._d = createUTCDate.apply(null, config._a);
2351
- config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
2352
-
2353
- getParsingFlags(config).rfc2822 = true;
2354
- } else {
2355
- config._isValid = false;
2356
- }
2357
- }
2358
-
2359
- // date from iso format or fallback
2360
- function configFromString(config) {
2361
- var matched = aspNetJsonRegex.exec(config._i);
2362
-
2363
- if (matched !== null) {
2364
- config._d = new Date(+matched[1]);
2365
- return;
2366
- }
2367
-
2368
- configFromISO(config);
2369
- if (config._isValid === false) {
2370
- delete config._isValid;
2371
- } else {
2372
- return;
2373
- }
2374
-
2375
- configFromRFC2822(config);
2376
- if (config._isValid === false) {
2377
- delete config._isValid;
2378
- } else {
2379
- return;
2380
- }
2381
-
2382
- // Final attempt, use Input Fallback
2383
- hooks.createFromInputFallback(config);
2384
- }
2385
-
2386
- hooks.createFromInputFallback = deprecate(
2387
- 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
2388
- 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
2389
- 'discouraged and will be removed in an upcoming major release. Please refer to ' +
2390
- 'http://momentjs.com/guides/#/warnings/js-date/ for more info.',
2391
- function (config) {
2392
- config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
2393
- }
2394
- );
2395
-
2396
- // constant that refers to the ISO standard
2397
- hooks.ISO_8601 = function () {};
2398
-
2399
- // constant that refers to the RFC 2822 form
2400
- hooks.RFC_2822 = function () {};
2401
-
2402
- // date from string and format string
2403
- function configFromStringAndFormat(config) {
2404
- // TODO: Move this to another part of the creation flow to prevent circular deps
2405
- if (config._f === hooks.ISO_8601) {
2406
- configFromISO(config);
2407
- return;
2408
- }
2409
- if (config._f === hooks.RFC_2822) {
2410
- configFromRFC2822(config);
2411
- return;
2412
- }
2413
- config._a = [];
2414
- getParsingFlags(config).empty = true;
2415
-
2416
- // This array is used to make a Date, either with `new Date` or `Date.UTC`
2417
- var string = '' + config._i,
2418
- i, parsedInput, tokens, token, skipped,
2419
- stringLength = string.length,
2420
- totalParsedInputLength = 0;
2421
-
2422
- tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
2423
-
2424
- for (i = 0; i < tokens.length; i++) {
2425
- token = tokens[i];
2426
- parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
2427
- // console.log('token', token, 'parsedInput', parsedInput,
2428
- // 'regex', getParseRegexForToken(token, config));
2429
- if (parsedInput) {
2430
- skipped = string.substr(0, string.indexOf(parsedInput));
2431
- if (skipped.length > 0) {
2432
- getParsingFlags(config).unusedInput.push(skipped);
2433
- }
2434
- string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
2435
- totalParsedInputLength += parsedInput.length;
2436
- }
2437
- // don't parse if it's not a known token
2438
- if (formatTokenFunctions[token]) {
2439
- if (parsedInput) {
2440
- getParsingFlags(config).empty = false;
2441
- }
2442
- else {
2443
- getParsingFlags(config).unusedTokens.push(token);
2444
- }
2445
- addTimeToArrayFromToken(token, parsedInput, config);
2446
- }
2447
- else if (config._strict && !parsedInput) {
2448
- getParsingFlags(config).unusedTokens.push(token);
2449
- }
2450
- }
2451
-
2452
- // add remaining unparsed input length to the string
2453
- getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
2454
- if (string.length > 0) {
2455
- getParsingFlags(config).unusedInput.push(string);
2456
- }
2457
-
2458
- // clear _12h flag if hour is <= 12
2459
- if (config._a[HOUR] <= 12 &&
2460
- getParsingFlags(config).bigHour === true &&
2461
- config._a[HOUR] > 0) {
2462
- getParsingFlags(config).bigHour = undefined;
2463
- }
2464
-
2465
- getParsingFlags(config).parsedDateParts = config._a.slice(0);
2466
- getParsingFlags(config).meridiem = config._meridiem;
2467
- // handle meridiem
2468
- config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
2469
-
2470
- configFromArray(config);
2471
- checkOverflow(config);
2472
- }
2473
-
2474
-
2475
- function meridiemFixWrap (locale, hour, meridiem) {
2476
- var isPm;
2477
-
2478
- if (meridiem == null) {
2479
- // nothing to do
2480
- return hour;
2481
- }
2482
- if (locale.meridiemHour != null) {
2483
- return locale.meridiemHour(hour, meridiem);
2484
- } else if (locale.isPM != null) {
2485
- // Fallback
2486
- isPm = locale.isPM(meridiem);
2487
- if (isPm && hour < 12) {
2488
- hour += 12;
2489
- }
2490
- if (!isPm && hour === 12) {
2491
- hour = 0;
2492
- }
2493
- return hour;
2494
- } else {
2495
- // this is not supposed to happen
2496
- return hour;
2497
- }
2498
- }
2499
-
2500
- // date from string and array of format strings
2501
- function configFromStringAndArray(config) {
2502
- var tempConfig,
2503
- bestMoment,
2504
-
2505
- scoreToBeat,
2506
- i,
2507
- currentScore;
2508
-
2509
- if (config._f.length === 0) {
2510
- getParsingFlags(config).invalidFormat = true;
2511
- config._d = new Date(NaN);
2512
- return;
2513
- }
2514
-
2515
- for (i = 0; i < config._f.length; i++) {
2516
- currentScore = 0;
2517
- tempConfig = copyConfig({}, config);
2518
- if (config._useUTC != null) {
2519
- tempConfig._useUTC = config._useUTC;
2520
- }
2521
- tempConfig._f = config._f[i];
2522
- configFromStringAndFormat(tempConfig);
2523
-
2524
- if (!isValid$2(tempConfig)) {
2525
- continue;
2526
- }
2527
-
2528
- // if there is any input that was not parsed add a penalty for that format
2529
- currentScore += getParsingFlags(tempConfig).charsLeftOver;
2530
-
2531
- //or tokens
2532
- currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
2533
-
2534
- getParsingFlags(tempConfig).score = currentScore;
2535
-
2536
- if (scoreToBeat == null || currentScore < scoreToBeat) {
2537
- scoreToBeat = currentScore;
2538
- bestMoment = tempConfig;
2539
- }
2540
- }
2541
-
2542
- extend(config, bestMoment || tempConfig);
2543
- }
2544
-
2545
- function configFromObject(config) {
2546
- if (config._d) {
2547
- return;
2548
- }
2549
-
2550
- var i = normalizeObjectUnits(config._i);
2551
- config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) {
2552
- return obj && parseInt(obj, 10);
2553
- });
2554
-
2555
- configFromArray(config);
2556
- }
2557
-
2558
- function createFromConfig (config) {
2559
- var res = new Moment(checkOverflow(prepareConfig(config)));
2560
- if (res._nextDay) {
2561
- // Adding is smart enough around DST
2562
- res.add(1, 'd');
2563
- res._nextDay = undefined;
2564
- }
2565
-
2566
- return res;
2567
- }
2568
-
2569
- function prepareConfig (config) {
2570
- var input = config._i,
2571
- format = config._f;
2572
-
2573
- config._locale = config._locale || getLocale(config._l);
2574
-
2575
- if (input === null || (format === undefined && input === '')) {
2576
- return createInvalid$1({nullInput: true});
2577
- }
2578
-
2579
- if (typeof input === 'string') {
2580
- config._i = input = config._locale.preparse(input);
2581
- }
2582
-
2583
- if (isMoment(input)) {
2584
- return new Moment(checkOverflow(input));
2585
- } else if (isDate(input)) {
2586
- config._d = input;
2587
- } else if (isArray(format)) {
2588
- configFromStringAndArray(config);
2589
- } else if (format) {
2590
- configFromStringAndFormat(config);
2591
- } else {
2592
- configFromInput(config);
2593
- }
2594
-
2595
- if (!isValid$2(config)) {
2596
- config._d = null;
2597
- }
2598
-
2599
- return config;
2600
- }
2601
-
2602
- function configFromInput(config) {
2603
- var input = config._i;
2604
- if (isUndefined(input)) {
2605
- config._d = new Date(hooks.now());
2606
- } else if (isDate(input)) {
2607
- config._d = new Date(input.valueOf());
2608
- } else if (typeof input === 'string') {
2609
- configFromString(config);
2610
- } else if (isArray(input)) {
2611
- config._a = map(input.slice(0), function (obj) {
2612
- return parseInt(obj, 10);
2613
- });
2614
- configFromArray(config);
2615
- } else if (isObject(input)) {
2616
- configFromObject(config);
2617
- } else if (isNumber(input)) {
2618
- // from milliseconds
2619
- config._d = new Date(input);
2620
- } else {
2621
- hooks.createFromInputFallback(config);
2622
- }
2623
- }
2624
-
2625
- function createLocalOrUTC (input, format, locale, strict, isUTC) {
2626
- var c = {};
2627
-
2628
- if (locale === true || locale === false) {
2629
- strict = locale;
2630
- locale = undefined;
2631
- }
2632
-
2633
- if ((isObject(input) && isObjectEmpty(input)) ||
2634
- (isArray(input) && input.length === 0)) {
2635
- input = undefined;
2636
- }
2637
- // object construction must be done this way.
2638
- // https://github.com/moment/moment/issues/1423
2639
- c._isAMomentObject = true;
2640
- c._useUTC = c._isUTC = isUTC;
2641
- c._l = locale;
2642
- c._i = input;
2643
- c._f = format;
2644
- c._strict = strict;
2645
-
2646
- return createFromConfig(c);
2647
- }
2648
-
2649
- function createLocal (input, format, locale, strict) {
2650
- return createLocalOrUTC(input, format, locale, strict, false);
2651
- }
2652
-
2653
- var prototypeMin = deprecate(
2654
- 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
2655
- function () {
2656
- var other = createLocal.apply(null, arguments);
2657
- if (this.isValid() && other.isValid()) {
2658
- return other < this ? this : other;
2659
- } else {
2660
- return createInvalid$1();
2661
- }
2662
- }
2663
- );
2664
-
2665
- var prototypeMax = deprecate(
2666
- 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
2667
- function () {
2668
- var other = createLocal.apply(null, arguments);
2669
- if (this.isValid() && other.isValid()) {
2670
- return other > this ? this : other;
2671
- } else {
2672
- return createInvalid$1();
2673
- }
2674
- }
2675
- );
2676
-
2677
- // Pick a moment m from moments so that m[fn](other) is true for all
2678
- // other. This relies on the function fn to be transitive.
2679
- //
2680
- // moments should either be an array of moment objects or an array, whose
2681
- // first element is an array of moment objects.
2682
- function pickBy(fn, moments) {
2683
- var res, i;
2684
- if (moments.length === 1 && isArray(moments[0])) {
2685
- moments = moments[0];
2686
- }
2687
- if (!moments.length) {
2688
- return createLocal();
2689
- }
2690
- res = moments[0];
2691
- for (i = 1; i < moments.length; ++i) {
2692
- if (!moments[i].isValid() || moments[i][fn](res)) {
2693
- res = moments[i];
2694
- }
2695
- }
2696
- return res;
2697
- }
2698
-
2699
- // TODO: Use [].sort instead?
2700
- function min () {
2701
- var args = [].slice.call(arguments, 0);
2702
-
2703
- return pickBy('isBefore', args);
2704
- }
2705
-
2706
- function max () {
2707
- var args = [].slice.call(arguments, 0);
2708
-
2709
- return pickBy('isAfter', args);
2710
- }
2711
-
2712
- var now = function () {
2713
- return Date.now ? Date.now() : +(new Date());
2714
- };
2715
-
2716
- var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond'];
2717
-
2718
- function isDurationValid(m) {
2719
- for (var key in m) {
2720
- if (!(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) {
2721
- return false;
2722
- }
2723
- }
2724
-
2725
- var unitHasDecimal = false;
2726
- for (var i = 0; i < ordering.length; ++i) {
2727
- if (m[ordering[i]]) {
2728
- if (unitHasDecimal) {
2729
- return false; // only allow non-integers for smallest unit
2730
- }
2731
- if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
2732
- unitHasDecimal = true;
2733
- }
2734
- }
2735
- }
2736
-
2737
- return true;
2738
- }
2739
-
2740
- function isValid$1() {
2741
- return this._isValid;
2742
- }
2743
-
2744
- function createInvalid() {
2745
- return createDuration(NaN);
2746
- }
2747
-
2748
- function Duration (duration) {
2749
- var normalizedInput = normalizeObjectUnits(duration),
2750
- years = normalizedInput.year || 0,
2751
- quarters = normalizedInput.quarter || 0,
2752
- months = normalizedInput.month || 0,
2753
- weeks = normalizedInput.week || normalizedInput.isoWeek || 0,
2754
- days = normalizedInput.day || 0,
2755
- hours = normalizedInput.hour || 0,
2756
- minutes = normalizedInput.minute || 0,
2757
- seconds = normalizedInput.second || 0,
2758
- milliseconds = normalizedInput.millisecond || 0;
2759
-
2760
- this._isValid = isDurationValid(normalizedInput);
2761
-
2762
- // representation for dateAddRemove
2763
- this._milliseconds = +milliseconds +
2764
- seconds * 1e3 + // 1000
2765
- minutes * 6e4 + // 1000 * 60
2766
- hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
2767
- // Because of dateAddRemove treats 24 hours as different from a
2768
- // day when working around DST, we need to store them separately
2769
- this._days = +days +
2770
- weeks * 7;
2771
- // It is impossible to translate months into days without knowing
2772
- // which months you are are talking about, so we have to store
2773
- // it separately.
2774
- this._months = +months +
2775
- quarters * 3 +
2776
- years * 12;
2777
-
2778
- this._data = {};
2779
-
2780
- this._locale = getLocale();
2781
-
2782
- this._bubble();
2783
- }
2784
-
2785
- function isDuration (obj) {
2786
- return obj instanceof Duration;
2787
- }
2788
-
2789
- function absRound (number) {
2790
- if (number < 0) {
2791
- return Math.round(-1 * number) * -1;
2792
- } else {
2793
- return Math.round(number);
2794
- }
2795
- }
2796
-
2797
- // FORMATTING
2798
-
2799
- function offset (token, separator) {
2800
- addFormatToken(token, 0, 0, function () {
2801
- var offset = this.utcOffset();
2802
- var sign = '+';
2803
- if (offset < 0) {
2804
- offset = -offset;
2805
- sign = '-';
2806
- }
2807
- return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2);
2808
- });
2809
- }
2810
-
2811
- offset('Z', ':');
2812
- offset('ZZ', '');
2813
-
2814
- // PARSING
2815
-
2816
- addRegexToken('Z', matchShortOffset);
2817
- addRegexToken('ZZ', matchShortOffset);
2818
- addParseToken(['Z', 'ZZ'], function (input, array, config) {
2819
- config._useUTC = true;
2820
- config._tzm = offsetFromString(matchShortOffset, input);
2821
- });
2822
-
2823
- // HELPERS
2824
-
2825
- // timezone chunker
2826
- // '+10:00' > ['10', '00']
2827
- // '-1530' > ['-15', '30']
2828
- var chunkOffset = /([\+\-]|\d\d)/gi;
2829
-
2830
- function offsetFromString(matcher, string) {
2831
- var matches = (string || '').match(matcher);
2832
-
2833
- if (matches === null) {
2834
- return null;
2835
- }
2836
-
2837
- var chunk = matches[matches.length - 1] || [];
2838
- var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
2839
- var minutes = +(parts[1] * 60) + toInt(parts[2]);
2840
-
2841
- return minutes === 0 ?
2842
- 0 :
2843
- parts[0] === '+' ? minutes : -minutes;
2844
- }
2845
-
2846
- // Return a moment from input, that is local/utc/zone equivalent to model.
2847
- function cloneWithOffset(input, model) {
2848
- var res, diff;
2849
- if (model._isUTC) {
2850
- res = model.clone();
2851
- diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();
2852
- // Use low-level api, because this fn is low-level api.
2853
- res._d.setTime(res._d.valueOf() + diff);
2854
- hooks.updateOffset(res, false);
2855
- return res;
2856
- } else {
2857
- return createLocal(input).local();
2858
- }
2859
- }
2860
-
2861
- function getDateOffset (m) {
2862
- // On Firefox.24 Date#getTimezoneOffset returns a floating point.
2863
- // https://github.com/moment/moment/pull/1871
2864
- return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
2865
- }
2866
-
2867
- // HOOKS
2868
-
2869
- // This function will be called whenever a moment is mutated.
2870
- // It is intended to keep the offset in sync with the timezone.
2871
- hooks.updateOffset = function () {};
2872
-
2873
- // MOMENTS
2874
-
2875
- // keepLocalTime = true means only change the timezone, without
2876
- // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
2877
- // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
2878
- // +0200, so we adjust the time as needed, to be valid.
2879
- //
2880
- // Keeping the time actually adds/subtracts (one hour)
2881
- // from the actual represented time. That is why we call updateOffset
2882
- // a second time. In case it wants us to change the offset again
2883
- // _changeInProgress == true case, then we have to adjust, because
2884
- // there is no such time in the given timezone.
2885
- function getSetOffset (input, keepLocalTime, keepMinutes) {
2886
- var offset = this._offset || 0,
2887
- localAdjust;
2888
- if (!this.isValid()) {
2889
- return input != null ? this : NaN;
2890
- }
2891
- if (input != null) {
2892
- if (typeof input === 'string') {
2893
- input = offsetFromString(matchShortOffset, input);
2894
- if (input === null) {
2895
- return this;
2896
- }
2897
- } else if (Math.abs(input) < 16 && !keepMinutes) {
2898
- input = input * 60;
2899
- }
2900
- if (!this._isUTC && keepLocalTime) {
2901
- localAdjust = getDateOffset(this);
2902
- }
2903
- this._offset = input;
2904
- this._isUTC = true;
2905
- if (localAdjust != null) {
2906
- this.add(localAdjust, 'm');
2907
- }
2908
- if (offset !== input) {
2909
- if (!keepLocalTime || this._changeInProgress) {
2910
- addSubtract$1(this, createDuration(input - offset, 'm'), 1, false);
2911
- } else if (!this._changeInProgress) {
2912
- this._changeInProgress = true;
2913
- hooks.updateOffset(this, true);
2914
- this._changeInProgress = null;
2915
- }
2916
- }
2917
- return this;
2918
- } else {
2919
- return this._isUTC ? offset : getDateOffset(this);
2920
- }
2921
- }
2922
-
2923
- function getSetZone (input, keepLocalTime) {
2924
- if (input != null) {
2925
- if (typeof input !== 'string') {
2926
- input = -input;
2927
- }
2928
-
2929
- this.utcOffset(input, keepLocalTime);
2930
-
2931
- return this;
2932
- } else {
2933
- return -this.utcOffset();
2934
- }
2935
- }
2936
-
2937
- function setOffsetToUTC (keepLocalTime) {
2938
- return this.utcOffset(0, keepLocalTime);
2939
- }
2940
-
2941
- function setOffsetToLocal (keepLocalTime) {
2942
- if (this._isUTC) {
2943
- this.utcOffset(0, keepLocalTime);
2944
- this._isUTC = false;
2945
-
2946
- if (keepLocalTime) {
2947
- this.subtract(getDateOffset(this), 'm');
2948
- }
2949
- }
2950
- return this;
2951
- }
2952
-
2953
- function setOffsetToParsedOffset () {
2954
- if (this._tzm != null) {
2955
- this.utcOffset(this._tzm, false, true);
2956
- } else if (typeof this._i === 'string') {
2957
- var tZone = offsetFromString(matchOffset, this._i);
2958
- if (tZone != null) {
2959
- this.utcOffset(tZone);
2960
- }
2961
- else {
2962
- this.utcOffset(0, true);
2963
- }
2964
- }
2965
- return this;
2966
- }
2967
-
2968
- function hasAlignedHourOffset (input) {
2969
- if (!this.isValid()) {
2970
- return false;
2971
- }
2972
- input = input ? createLocal(input).utcOffset() : 0;
2973
-
2974
- return (this.utcOffset() - input) % 60 === 0;
2975
- }
2976
-
2977
- function isDaylightSavingTime () {
2978
- return (
2979
- this.utcOffset() > this.clone().month(0).utcOffset() ||
2980
- this.utcOffset() > this.clone().month(5).utcOffset()
2981
- );
2982
- }
2983
-
2984
- function isDaylightSavingTimeShifted () {
2985
- if (!isUndefined(this._isDSTShifted)) {
2986
- return this._isDSTShifted;
2987
- }
2988
-
2989
- var c = {};
2990
-
2991
- copyConfig(c, this);
2992
- c = prepareConfig(c);
2993
-
2994
- if (c._a) {
2995
- var other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
2996
- this._isDSTShifted = this.isValid() &&
2997
- compareArrays(c._a, other.toArray()) > 0;
2998
- } else {
2999
- this._isDSTShifted = false;
3000
- }
3001
-
3002
- return this._isDSTShifted;
3003
- }
3004
-
3005
- function isLocal () {
3006
- return this.isValid() ? !this._isUTC : false;
3007
- }
3008
-
3009
- function isUtcOffset () {
3010
- return this.isValid() ? this._isUTC : false;
3011
- }
3012
-
3013
- function isUtc () {
3014
- return this.isValid() ? this._isUTC && this._offset === 0 : false;
3015
- }
3016
-
3017
- // ASP.NET json date format regex
3018
- var aspNetRegex = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/;
3019
-
3020
- // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
3021
- // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
3022
- // and further modified to allow for strings containing both week and day
3023
- var isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
3024
-
3025
- function createDuration (input, key) {
3026
- var duration = input,
3027
- // matching against regexp is expensive, do it on demand
3028
- match = null,
3029
- sign,
3030
- ret,
3031
- diffRes;
3032
-
3033
- if (isDuration(input)) {
3034
- duration = {
3035
- ms : input._milliseconds,
3036
- d : input._days,
3037
- M : input._months
3038
- };
3039
- } else if (isNumber(input)) {
3040
- duration = {};
3041
- if (key) {
3042
- duration[key] = input;
3043
- } else {
3044
- duration.milliseconds = input;
3045
- }
3046
- } else if (!!(match = aspNetRegex.exec(input))) {
3047
- sign = (match[1] === '-') ? -1 : 1;
3048
- duration = {
3049
- y : 0,
3050
- d : toInt(match[DATE]) * sign,
3051
- h : toInt(match[HOUR]) * sign,
3052
- m : toInt(match[MINUTE]) * sign,
3053
- s : toInt(match[SECOND]) * sign,
3054
- ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match
3055
- };
3056
- } else if (!!(match = isoRegex.exec(input))) {
3057
- sign = (match[1] === '-') ? -1 : 1;
3058
- duration = {
3059
- y : parseIso(match[2], sign),
3060
- M : parseIso(match[3], sign),
3061
- w : parseIso(match[4], sign),
3062
- d : parseIso(match[5], sign),
3063
- h : parseIso(match[6], sign),
3064
- m : parseIso(match[7], sign),
3065
- s : parseIso(match[8], sign)
3066
- };
3067
- } else if (duration == null) {// checks for null or undefined
3068
- duration = {};
3069
- } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {
3070
- diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to));
3071
-
3072
- duration = {};
3073
- duration.ms = diffRes.milliseconds;
3074
- duration.M = diffRes.months;
3075
- }
3076
-
3077
- ret = new Duration(duration);
3078
-
3079
- if (isDuration(input) && hasOwnProp(input, '_locale')) {
3080
- ret._locale = input._locale;
3081
- }
3082
-
3083
- return ret;
3084
- }
3085
-
3086
- createDuration.fn = Duration.prototype;
3087
- createDuration.invalid = createInvalid;
3088
-
3089
- function parseIso (inp, sign) {
3090
- // We'd normally use ~~inp for this, but unfortunately it also
3091
- // converts floats to ints.
3092
- // inp may be undefined, so careful calling replace on it.
3093
- var res = inp && parseFloat(inp.replace(',', '.'));
3094
- // apply sign while we're at it
3095
- return (isNaN(res) ? 0 : res) * sign;
3096
- }
3097
-
3098
- function positiveMomentsDifference(base, other) {
3099
- var res = {};
3100
-
3101
- res.months = other.month() - base.month() +
3102
- (other.year() - base.year()) * 12;
3103
- if (base.clone().add(res.months, 'M').isAfter(other)) {
3104
- --res.months;
3105
- }
3106
-
3107
- res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
3108
-
3109
- return res;
3110
- }
3111
-
3112
- function momentsDifference(base, other) {
3113
- var res;
3114
- if (!(base.isValid() && other.isValid())) {
3115
- return {milliseconds: 0, months: 0};
3116
- }
3117
-
3118
- other = cloneWithOffset(other, base);
3119
- if (base.isBefore(other)) {
3120
- res = positiveMomentsDifference(base, other);
3121
- } else {
3122
- res = positiveMomentsDifference(other, base);
3123
- res.milliseconds = -res.milliseconds;
3124
- res.months = -res.months;
3125
- }
3126
-
3127
- return res;
3128
- }
3129
-
3130
- // TODO: remove 'name' arg after deprecation is removed
3131
- function createAdder(direction, name) {
3132
- return function (val, period) {
3133
- var dur, tmp;
3134
- //invert the arguments, but complain about it
3135
- if (period !== null && !isNaN(+period)) {
3136
- deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' +
3137
- 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.');
3138
- tmp = val; val = period; period = tmp;
3139
- }
3140
-
3141
- val = typeof val === 'string' ? +val : val;
3142
- dur = createDuration(val, period);
3143
- addSubtract$1(this, dur, direction);
3144
- return this;
3145
- };
3146
- }
3147
-
3148
- function addSubtract$1 (mom, duration, isAdding, updateOffset) {
3149
- var milliseconds = duration._milliseconds,
3150
- days = absRound(duration._days),
3151
- months = absRound(duration._months);
3152
-
3153
- if (!mom.isValid()) {
3154
- // No op
3155
- return;
3156
- }
3157
-
3158
- updateOffset = updateOffset == null ? true : updateOffset;
3159
-
3160
- if (months) {
3161
- setMonth(mom, get$2(mom, 'Month') + months * isAdding);
3162
- }
3163
- if (days) {
3164
- set(mom, 'Date', get$2(mom, 'Date') + days * isAdding);
3165
- }
3166
- if (milliseconds) {
3167
- mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
3168
- }
3169
- if (updateOffset) {
3170
- hooks.updateOffset(mom, days || months);
3171
- }
3172
- }
3173
-
3174
- var add$1 = createAdder(1, 'add');
3175
- var subtract$1 = createAdder(-1, 'subtract');
3176
-
3177
- function getCalendarFormat(myMoment, now) {
3178
- var diff = myMoment.diff(now, 'days', true);
3179
- return diff < -6 ? 'sameElse' :
3180
- diff < -1 ? 'lastWeek' :
3181
- diff < 0 ? 'lastDay' :
3182
- diff < 1 ? 'sameDay' :
3183
- diff < 2 ? 'nextDay' :
3184
- diff < 7 ? 'nextWeek' : 'sameElse';
3185
- }
3186
-
3187
- function calendar (time, formats) {
3188
- // We want to compare the start of today, vs this.
3189
- // Getting start-of-today depends on whether we're local/utc/offset or not.
3190
- var now = time || createLocal(),
3191
- sod = cloneWithOffset(now, this).startOf('day'),
3192
- format = hooks.calendarFormat(this, sod) || 'sameElse';
3193
-
3194
- var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);
3195
-
3196
- return this.format(output || this.localeData().calendar(format, this, createLocal(now)));
3197
- }
3198
-
3199
- function clone$1 () {
3200
- return new Moment(this);
3201
- }
3202
-
3203
- function isAfter (input, units) {
3204
- var localInput = isMoment(input) ? input : createLocal(input);
3205
- if (!(this.isValid() && localInput.isValid())) {
3206
- return false;
3207
- }
3208
- units = normalizeUnits(units) || 'millisecond';
3209
- if (units === 'millisecond') {
3210
- return this.valueOf() > localInput.valueOf();
3211
- } else {
3212
- return localInput.valueOf() < this.clone().startOf(units).valueOf();
3213
- }
3214
- }
3215
-
3216
- function isBefore (input, units) {
3217
- var localInput = isMoment(input) ? input : createLocal(input);
3218
- if (!(this.isValid() && localInput.isValid())) {
3219
- return false;
3220
- }
3221
- units = normalizeUnits(units) || 'millisecond';
3222
- if (units === 'millisecond') {
3223
- return this.valueOf() < localInput.valueOf();
3224
- } else {
3225
- return this.clone().endOf(units).valueOf() < localInput.valueOf();
3226
- }
3227
- }
3228
-
3229
- function isBetween (from, to, units, inclusivity) {
3230
- var localFrom = isMoment(from) ? from : createLocal(from),
3231
- localTo = isMoment(to) ? to : createLocal(to);
3232
- if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
3233
- return false;
3234
- }
3235
- inclusivity = inclusivity || '()';
3236
- return (inclusivity[0] === '(' ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) &&
3237
- (inclusivity[1] === ')' ? this.isBefore(localTo, units) : !this.isAfter(localTo, units));
3238
- }
3239
-
3240
- function isSame (input, units) {
3241
- var localInput = isMoment(input) ? input : createLocal(input),
3242
- inputMs;
3243
- if (!(this.isValid() && localInput.isValid())) {
3244
- return false;
3245
- }
3246
- units = normalizeUnits(units) || 'millisecond';
3247
- if (units === 'millisecond') {
3248
- return this.valueOf() === localInput.valueOf();
3249
- } else {
3250
- inputMs = localInput.valueOf();
3251
- return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
3252
- }
3253
- }
3254
-
3255
- function isSameOrAfter (input, units) {
3256
- return this.isSame(input, units) || this.isAfter(input, units);
3257
- }
3258
-
3259
- function isSameOrBefore (input, units) {
3260
- return this.isSame(input, units) || this.isBefore(input, units);
3261
- }
3262
-
3263
- function diff (input, units, asFloat) {
3264
- var that,
3265
- zoneDelta,
3266
- output;
3267
-
3268
- if (!this.isValid()) {
3269
- return NaN;
3270
- }
3271
-
3272
- that = cloneWithOffset(input, this);
3273
-
3274
- if (!that.isValid()) {
3275
- return NaN;
3276
- }
3277
-
3278
- zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
3279
-
3280
- units = normalizeUnits(units);
3281
-
3282
- switch (units) {
3283
- case 'year': output = monthDiff(this, that) / 12; break;
3284
- case 'month': output = monthDiff(this, that); break;
3285
- case 'quarter': output = monthDiff(this, that) / 3; break;
3286
- case 'second': output = (this - that) / 1e3; break; // 1000
3287
- case 'minute': output = (this - that) / 6e4; break; // 1000 * 60
3288
- case 'hour': output = (this - that) / 36e5; break; // 1000 * 60 * 60
3289
- case 'day': output = (this - that - zoneDelta) / 864e5; break; // 1000 * 60 * 60 * 24, negate dst
3290
- case 'week': output = (this - that - zoneDelta) / 6048e5; break; // 1000 * 60 * 60 * 24 * 7, negate dst
3291
- default: output = this - that;
3292
- }
3293
-
3294
- return asFloat ? output : absFloor(output);
3295
- }
3296
-
3297
- function monthDiff (a, b) {
3298
- // difference in months
3299
- var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()),
3300
- // b is in (anchor - 1 month, anchor + 1 month)
3301
- anchor = a.clone().add(wholeMonthDiff, 'months'),
3302
- anchor2, adjust;
3303
-
3304
- if (b - anchor < 0) {
3305
- anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
3306
- // linear across the month
3307
- adjust = (b - anchor) / (anchor - anchor2);
3308
- } else {
3309
- anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
3310
- // linear across the month
3311
- adjust = (b - anchor) / (anchor2 - anchor);
3312
- }
3313
-
3314
- //check for negative zero, return zero if negative zero
3315
- return -(wholeMonthDiff + adjust) || 0;
3316
- }
3317
-
3318
- hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
3319
- hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
3320
-
3321
- function toString () {
3322
- return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
3323
- }
3324
-
3325
- function toISOString$1(keepOffset) {
3326
- if (!this.isValid()) {
3327
- return null;
3328
- }
3329
- var utc = keepOffset !== true;
3330
- var m = utc ? this.clone().utc() : this;
3331
- if (m.year() < 0 || m.year() > 9999) {
3332
- return formatMoment(m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ');
3333
- }
3334
- if (isFunction(Date.prototype.toISOString)) {
3335
- // native implementation is ~50x faster, use it when we can
3336
- if (utc) {
3337
- return this.toDate().toISOString();
3338
- } else {
3339
- return new Date(this.valueOf() + this.utcOffset() * 60 * 1000).toISOString().replace('Z', formatMoment(m, 'Z'));
3340
- }
3341
- }
3342
- return formatMoment(m, utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ');
3343
- }
3344
-
3345
- /**
3346
- * Return a human readable representation of a moment that can
3347
- * also be evaluated to get a new moment which is the same
3348
- *
3349
- * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
3350
- */
3351
- function inspect () {
3352
- if (!this.isValid()) {
3353
- return 'moment.invalid(/* ' + this._i + ' */)';
3354
- }
3355
- var func = 'moment';
3356
- var zone = '';
3357
- if (!this.isLocal()) {
3358
- func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
3359
- zone = 'Z';
3360
- }
3361
- var prefix = '[' + func + '("]';
3362
- var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';
3363
- var datetime = '-MM-DD[T]HH:mm:ss.SSS';
3364
- var suffix = zone + '[")]';
3365
-
3366
- return this.format(prefix + year + datetime + suffix);
3367
- }
3368
-
3369
- function format (inputString) {
3370
- if (!inputString) {
3371
- inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat;
3372
- }
3373
- var output = formatMoment(this, inputString);
3374
- return this.localeData().postformat(output);
3375
- }
3376
-
3377
- function from (time, withoutSuffix) {
3378
- if (this.isValid() &&
3379
- ((isMoment(time) && time.isValid()) ||
3380
- createLocal(time).isValid())) {
3381
- return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
3382
- } else {
3383
- return this.localeData().invalidDate();
3384
- }
3385
- }
3386
-
3387
- function fromNow (withoutSuffix) {
3388
- return this.from(createLocal(), withoutSuffix);
3389
- }
3390
-
3391
- function to (time, withoutSuffix) {
3392
- if (this.isValid() &&
3393
- ((isMoment(time) && time.isValid()) ||
3394
- createLocal(time).isValid())) {
3395
- return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
3396
- } else {
3397
- return this.localeData().invalidDate();
3398
- }
3399
- }
3400
-
3401
- function toNow (withoutSuffix) {
3402
- return this.to(createLocal(), withoutSuffix);
3403
- }
3404
-
3405
- // If passed a locale key, it will set the locale for this
3406
- // instance. Otherwise, it will return the locale configuration
3407
- // variables for this instance.
3408
- function locale (key) {
3409
- var newLocaleData;
3410
-
3411
- if (key === undefined) {
3412
- return this._locale._abbr;
3413
- } else {
3414
- newLocaleData = getLocale(key);
3415
- if (newLocaleData != null) {
3416
- this._locale = newLocaleData;
3417
- }
3418
- return this;
3419
- }
3420
- }
3421
-
3422
- var lang = deprecate(
3423
- 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
3424
- function (key) {
3425
- if (key === undefined) {
3426
- return this.localeData();
3427
- } else {
3428
- return this.locale(key);
3429
- }
3430
- }
3431
- );
3432
-
3433
- function localeData () {
3434
- return this._locale;
3435
- }
3436
-
3437
- var MS_PER_SECOND = 1000;
3438
- var MS_PER_MINUTE = 60 * MS_PER_SECOND;
3439
- var MS_PER_HOUR = 60 * MS_PER_MINUTE;
3440
- var MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
3441
-
3442
- // actual modulo - handles negative numbers (for dates before 1970):
3443
- function mod(dividend, divisor) {
3444
- return (dividend % divisor + divisor) % divisor;
3445
- }
3446
-
3447
- function localStartOfDate(y, m, d) {
3448
- // the date constructor remaps years 0-99 to 1900-1999
3449
- if (y < 100 && y >= 0) {
3450
- // preserve leap years using a full 400 year cycle, then reset
3451
- return new Date(y + 400, m, d) - MS_PER_400_YEARS;
3452
- } else {
3453
- return new Date(y, m, d).valueOf();
3454
- }
3455
- }
3456
-
3457
- function utcStartOfDate(y, m, d) {
3458
- // Date.UTC remaps years 0-99 to 1900-1999
3459
- if (y < 100 && y >= 0) {
3460
- // preserve leap years using a full 400 year cycle, then reset
3461
- return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
3462
- } else {
3463
- return Date.UTC(y, m, d);
3464
- }
3465
- }
3466
-
3467
- function startOf (units) {
3468
- var time;
3469
- units = normalizeUnits(units);
3470
- if (units === undefined || units === 'millisecond' || !this.isValid()) {
3471
- return this;
3472
- }
3473
-
3474
- var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
3475
-
3476
- switch (units) {
3477
- case 'year':
3478
- time = startOfDate(this.year(), 0, 1);
3479
- break;
3480
- case 'quarter':
3481
- time = startOfDate(this.year(), this.month() - this.month() % 3, 1);
3482
- break;
3483
- case 'month':
3484
- time = startOfDate(this.year(), this.month(), 1);
3485
- break;
3486
- case 'week':
3487
- time = startOfDate(this.year(), this.month(), this.date() - this.weekday());
3488
- break;
3489
- case 'isoWeek':
3490
- time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1));
3491
- break;
3492
- case 'day':
3493
- case 'date':
3494
- time = startOfDate(this.year(), this.month(), this.date());
3495
- break;
3496
- case 'hour':
3497
- time = this._d.valueOf();
3498
- time -= mod(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR);
3499
- break;
3500
- case 'minute':
3501
- time = this._d.valueOf();
3502
- time -= mod(time, MS_PER_MINUTE);
3503
- break;
3504
- case 'second':
3505
- time = this._d.valueOf();
3506
- time -= mod(time, MS_PER_SECOND);
3507
- break;
3508
- }
3509
-
3510
- this._d.setTime(time);
3511
- hooks.updateOffset(this, true);
3512
- return this;
3513
- }
3514
-
3515
- function endOf (units) {
3516
- var time;
3517
- units = normalizeUnits(units);
3518
- if (units === undefined || units === 'millisecond' || !this.isValid()) {
3519
- return this;
3520
- }
3521
-
3522
- var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
3523
-
3524
- switch (units) {
3525
- case 'year':
3526
- time = startOfDate(this.year() + 1, 0, 1) - 1;
3527
- break;
3528
- case 'quarter':
3529
- time = startOfDate(this.year(), this.month() - this.month() % 3 + 3, 1) - 1;
3530
- break;
3531
- case 'month':
3532
- time = startOfDate(this.year(), this.month() + 1, 1) - 1;
3533
- break;
3534
- case 'week':
3535
- time = startOfDate(this.year(), this.month(), this.date() - this.weekday() + 7) - 1;
3536
- break;
3537
- case 'isoWeek':
3538
- time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1;
3539
- break;
3540
- case 'day':
3541
- case 'date':
3542
- time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
3543
- break;
3544
- case 'hour':
3545
- time = this._d.valueOf();
3546
- time += MS_PER_HOUR - mod(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR) - 1;
3547
- break;
3548
- case 'minute':
3549
- time = this._d.valueOf();
3550
- time += MS_PER_MINUTE - mod(time, MS_PER_MINUTE) - 1;
3551
- break;
3552
- case 'second':
3553
- time = this._d.valueOf();
3554
- time += MS_PER_SECOND - mod(time, MS_PER_SECOND) - 1;
3555
- break;
3556
- }
3557
-
3558
- this._d.setTime(time);
3559
- hooks.updateOffset(this, true);
3560
- return this;
3561
- }
3562
-
3563
- function valueOf$1 () {
3564
- return this._d.valueOf() - ((this._offset || 0) * 60000);
3565
- }
3566
-
3567
- function unix () {
3568
- return Math.floor(this.valueOf() / 1000);
3569
- }
3570
-
3571
- function toDate () {
3572
- return new Date(this.valueOf());
3573
- }
3574
-
3575
- function toArray () {
3576
- var m = this;
3577
- return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
3578
- }
3579
-
3580
- function toObject () {
3581
- var m = this;
3582
- return {
3583
- years: m.year(),
3584
- months: m.month(),
3585
- date: m.date(),
3586
- hours: m.hours(),
3587
- minutes: m.minutes(),
3588
- seconds: m.seconds(),
3589
- milliseconds: m.milliseconds()
3590
- };
3591
- }
3592
-
3593
- function toJSON () {
3594
- // new Date(NaN).toJSON() === null
3595
- return this.isValid() ? this.toISOString() : null;
3596
- }
3597
-
3598
- function isValid () {
3599
- return isValid$2(this);
3600
- }
3601
-
3602
- function parsingFlags () {
3603
- return extend({}, getParsingFlags(this));
3604
- }
3605
-
3606
- function invalidAt () {
3607
- return getParsingFlags(this).overflow;
3608
- }
3609
-
3610
- function creationData() {
3611
- return {
3612
- input: this._i,
3613
- format: this._f,
3614
- locale: this._locale,
3615
- isUTC: this._isUTC,
3616
- strict: this._strict
3617
- };
3618
- }
3619
-
3620
- // FORMATTING
3621
-
3622
- addFormatToken(0, ['gg', 2], 0, function () {
3623
- return this.weekYear() % 100;
3624
- });
3625
-
3626
- addFormatToken(0, ['GG', 2], 0, function () {
3627
- return this.isoWeekYear() % 100;
3628
- });
3629
-
3630
- function addWeekYearFormatToken (token, getter) {
3631
- addFormatToken(0, [token, token.length], 0, getter);
3632
- }
3633
-
3634
- addWeekYearFormatToken('gggg', 'weekYear');
3635
- addWeekYearFormatToken('ggggg', 'weekYear');
3636
- addWeekYearFormatToken('GGGG', 'isoWeekYear');
3637
- addWeekYearFormatToken('GGGGG', 'isoWeekYear');
3638
-
3639
- // ALIASES
3640
-
3641
- addUnitAlias('weekYear', 'gg');
3642
- addUnitAlias('isoWeekYear', 'GG');
3643
-
3644
- // PRIORITY
3645
-
3646
- addUnitPriority('weekYear', 1);
3647
- addUnitPriority('isoWeekYear', 1);
3648
-
3649
-
3650
- // PARSING
3651
-
3652
- addRegexToken('G', matchSigned);
3653
- addRegexToken('g', matchSigned);
3654
- addRegexToken('GG', match1to2, match2);
3655
- addRegexToken('gg', match1to2, match2);
3656
- addRegexToken('GGGG', match1to4, match4);
3657
- addRegexToken('gggg', match1to4, match4);
3658
- addRegexToken('GGGGG', match1to6, match6);
3659
- addRegexToken('ggggg', match1to6, match6);
3660
-
3661
- addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
3662
- week[token.substr(0, 2)] = toInt(input);
3663
- });
3664
-
3665
- addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
3666
- week[token] = hooks.parseTwoDigitYear(input);
3667
- });
3668
-
3669
- // MOMENTS
3670
-
3671
- function getSetWeekYear (input) {
3672
- return getSetWeekYearHelper.call(this,
3673
- input,
3674
- this.week(),
3675
- this.weekday(),
3676
- this.localeData()._week.dow,
3677
- this.localeData()._week.doy);
3678
- }
3679
-
3680
- function getSetISOWeekYear (input) {
3681
- return getSetWeekYearHelper.call(this,
3682
- input, this.isoWeek(), this.isoWeekday(), 1, 4);
3683
- }
3684
-
3685
- function getISOWeeksInYear () {
3686
- return weeksInYear(this.year(), 1, 4);
3687
- }
3688
-
3689
- function getWeeksInYear () {
3690
- var weekInfo = this.localeData()._week;
3691
- return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
3692
- }
3693
-
3694
- function getSetWeekYearHelper(input, week, weekday, dow, doy) {
3695
- var weeksTarget;
3696
- if (input == null) {
3697
- return weekOfYear(this, dow, doy).year;
3698
- } else {
3699
- weeksTarget = weeksInYear(input, dow, doy);
3700
- if (week > weeksTarget) {
3701
- week = weeksTarget;
3702
- }
3703
- return setWeekAll.call(this, input, week, weekday, dow, doy);
3704
- }
3705
- }
3706
-
3707
- function setWeekAll(weekYear, week, weekday, dow, doy) {
3708
- var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
3709
- date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
3710
-
3711
- this.year(date.getUTCFullYear());
3712
- this.month(date.getUTCMonth());
3713
- this.date(date.getUTCDate());
3714
- return this;
3715
- }
3716
-
3717
- // FORMATTING
3718
-
3719
- addFormatToken('Q', 0, 'Qo', 'quarter');
3720
-
3721
- // ALIASES
3722
-
3723
- addUnitAlias('quarter', 'Q');
3724
-
3725
- // PRIORITY
3726
-
3727
- addUnitPriority('quarter', 7);
3728
-
3729
- // PARSING
3730
-
3731
- addRegexToken('Q', match1);
3732
- addParseToken('Q', function (input, array) {
3733
- array[MONTH] = (toInt(input) - 1) * 3;
3734
- });
3735
-
3736
- // MOMENTS
3737
-
3738
- function getSetQuarter (input) {
3739
- return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
3740
- }
3741
-
3742
- // FORMATTING
3743
-
3744
- addFormatToken('D', ['DD', 2], 'Do', 'date');
3745
-
3746
- // ALIASES
3747
-
3748
- addUnitAlias('date', 'D');
3749
-
3750
- // PRIORITY
3751
- addUnitPriority('date', 9);
3752
-
3753
- // PARSING
3754
-
3755
- addRegexToken('D', match1to2);
3756
- addRegexToken('DD', match1to2, match2);
3757
- addRegexToken('Do', function (isStrict, locale) {
3758
- // TODO: Remove "ordinalParse" fallback in next major release.
3759
- return isStrict ?
3760
- (locale._dayOfMonthOrdinalParse || locale._ordinalParse) :
3761
- locale._dayOfMonthOrdinalParseLenient;
3762
- });
3763
-
3764
- addParseToken(['D', 'DD'], DATE);
3765
- addParseToken('Do', function (input, array) {
3766
- array[DATE] = toInt(input.match(match1to2)[0]);
3767
- });
3768
-
3769
- // MOMENTS
3770
-
3771
- var getSetDayOfMonth = makeGetSet('Date', true);
3772
-
3773
- // FORMATTING
3774
-
3775
- addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
3776
-
3777
- // ALIASES
3778
-
3779
- addUnitAlias('dayOfYear', 'DDD');
3780
-
3781
- // PRIORITY
3782
- addUnitPriority('dayOfYear', 4);
3783
-
3784
- // PARSING
3785
-
3786
- addRegexToken('DDD', match1to3);
3787
- addRegexToken('DDDD', match3);
3788
- addParseToken(['DDD', 'DDDD'], function (input, array, config) {
3789
- config._dayOfYear = toInt(input);
3790
- });
3791
-
3792
- // HELPERS
3793
-
3794
- // MOMENTS
3795
-
3796
- function getSetDayOfYear (input) {
3797
- var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
3798
- return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
3799
- }
3800
-
3801
- // FORMATTING
3802
-
3803
- addFormatToken('m', ['mm', 2], 0, 'minute');
3804
-
3805
- // ALIASES
3806
-
3807
- addUnitAlias('minute', 'm');
3808
-
3809
- // PRIORITY
3810
-
3811
- addUnitPriority('minute', 14);
3812
-
3813
- // PARSING
3814
-
3815
- addRegexToken('m', match1to2);
3816
- addRegexToken('mm', match1to2, match2);
3817
- addParseToken(['m', 'mm'], MINUTE);
3818
-
3819
- // MOMENTS
3820
-
3821
- var getSetMinute = makeGetSet('Minutes', false);
3822
-
3823
- // FORMATTING
3824
-
3825
- addFormatToken('s', ['ss', 2], 0, 'second');
3826
-
3827
- // ALIASES
3828
-
3829
- addUnitAlias('second', 's');
3830
-
3831
- // PRIORITY
3832
-
3833
- addUnitPriority('second', 15);
3834
-
3835
- // PARSING
3836
-
3837
- addRegexToken('s', match1to2);
3838
- addRegexToken('ss', match1to2, match2);
3839
- addParseToken(['s', 'ss'], SECOND);
3840
-
3841
- // MOMENTS
3842
-
3843
- var getSetSecond = makeGetSet('Seconds', false);
3844
-
3845
- // FORMATTING
3846
-
3847
- addFormatToken('S', 0, 0, function () {
3848
- return ~~(this.millisecond() / 100);
3849
- });
3850
-
3851
- addFormatToken(0, ['SS', 2], 0, function () {
3852
- return ~~(this.millisecond() / 10);
3853
- });
3854
-
3855
- addFormatToken(0, ['SSS', 3], 0, 'millisecond');
3856
- addFormatToken(0, ['SSSS', 4], 0, function () {
3857
- return this.millisecond() * 10;
3858
- });
3859
- addFormatToken(0, ['SSSSS', 5], 0, function () {
3860
- return this.millisecond() * 100;
3861
- });
3862
- addFormatToken(0, ['SSSSSS', 6], 0, function () {
3863
- return this.millisecond() * 1000;
3864
- });
3865
- addFormatToken(0, ['SSSSSSS', 7], 0, function () {
3866
- return this.millisecond() * 10000;
3867
- });
3868
- addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
3869
- return this.millisecond() * 100000;
3870
- });
3871
- addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
3872
- return this.millisecond() * 1000000;
3873
- });
3874
-
3875
-
3876
- // ALIASES
3877
-
3878
- addUnitAlias('millisecond', 'ms');
3879
-
3880
- // PRIORITY
3881
-
3882
- addUnitPriority('millisecond', 16);
3883
-
3884
- // PARSING
3885
-
3886
- addRegexToken('S', match1to3, match1);
3887
- addRegexToken('SS', match1to3, match2);
3888
- addRegexToken('SSS', match1to3, match3);
3889
-
3890
- var token;
3891
- for (token = 'SSSS'; token.length <= 9; token += 'S') {
3892
- addRegexToken(token, matchUnsigned);
3893
- }
3894
-
3895
- function parseMs(input, array) {
3896
- array[MILLISECOND] = toInt(('0.' + input) * 1000);
3897
- }
3898
-
3899
- for (token = 'S'; token.length <= 9; token += 'S') {
3900
- addParseToken(token, parseMs);
3901
- }
3902
- // MOMENTS
3903
-
3904
- var getSetMillisecond = makeGetSet('Milliseconds', false);
3905
-
3906
- // FORMATTING
3907
-
3908
- addFormatToken('z', 0, 0, 'zoneAbbr');
3909
- addFormatToken('zz', 0, 0, 'zoneName');
3910
-
3911
- // MOMENTS
3912
-
3913
- function getZoneAbbr () {
3914
- return this._isUTC ? 'UTC' : '';
3915
- }
3916
-
3917
- function getZoneName () {
3918
- return this._isUTC ? 'Coordinated Universal Time' : '';
3919
- }
3920
-
3921
- var proto$2 = Moment.prototype;
3922
-
3923
- proto$2.add = add$1;
3924
- proto$2.calendar = calendar;
3925
- proto$2.clone = clone$1;
3926
- proto$2.diff = diff;
3927
- proto$2.endOf = endOf;
3928
- proto$2.format = format;
3929
- proto$2.from = from;
3930
- proto$2.fromNow = fromNow;
3931
- proto$2.to = to;
3932
- proto$2.toNow = toNow;
3933
- proto$2.get = stringGet;
3934
- proto$2.invalidAt = invalidAt;
3935
- proto$2.isAfter = isAfter;
3936
- proto$2.isBefore = isBefore;
3937
- proto$2.isBetween = isBetween;
3938
- proto$2.isSame = isSame;
3939
- proto$2.isSameOrAfter = isSameOrAfter;
3940
- proto$2.isSameOrBefore = isSameOrBefore;
3941
- proto$2.isValid = isValid;
3942
- proto$2.lang = lang;
3943
- proto$2.locale = locale;
3944
- proto$2.localeData = localeData;
3945
- proto$2.max = prototypeMax;
3946
- proto$2.min = prototypeMin;
3947
- proto$2.parsingFlags = parsingFlags;
3948
- proto$2.set = stringSet;
3949
- proto$2.startOf = startOf;
3950
- proto$2.subtract = subtract$1;
3951
- proto$2.toArray = toArray;
3952
- proto$2.toObject = toObject;
3953
- proto$2.toDate = toDate;
3954
- proto$2.toISOString = toISOString$1;
3955
- proto$2.inspect = inspect;
3956
- proto$2.toJSON = toJSON;
3957
- proto$2.toString = toString;
3958
- proto$2.unix = unix;
3959
- proto$2.valueOf = valueOf$1;
3960
- proto$2.creationData = creationData;
3961
- proto$2.year = getSetYear;
3962
- proto$2.isLeapYear = getIsLeapYear;
3963
- proto$2.weekYear = getSetWeekYear;
3964
- proto$2.isoWeekYear = getSetISOWeekYear;
3965
- proto$2.quarter = proto$2.quarters = getSetQuarter;
3966
- proto$2.month = getSetMonth;
3967
- proto$2.daysInMonth = getDaysInMonth;
3968
- proto$2.week = proto$2.weeks = getSetWeek;
3969
- proto$2.isoWeek = proto$2.isoWeeks = getSetISOWeek;
3970
- proto$2.weeksInYear = getWeeksInYear;
3971
- proto$2.isoWeeksInYear = getISOWeeksInYear;
3972
- proto$2.date = getSetDayOfMonth;
3973
- proto$2.day = proto$2.days = getSetDayOfWeek;
3974
- proto$2.weekday = getSetLocaleDayOfWeek;
3975
- proto$2.isoWeekday = getSetISODayOfWeek;
3976
- proto$2.dayOfYear = getSetDayOfYear;
3977
- proto$2.hour = proto$2.hours = getSetHour;
3978
- proto$2.minute = proto$2.minutes = getSetMinute;
3979
- proto$2.second = proto$2.seconds = getSetSecond;
3980
- proto$2.millisecond = proto$2.milliseconds = getSetMillisecond;
3981
- proto$2.utcOffset = getSetOffset;
3982
- proto$2.utc = setOffsetToUTC;
3983
- proto$2.local = setOffsetToLocal;
3984
- proto$2.parseZone = setOffsetToParsedOffset;
3985
- proto$2.hasAlignedHourOffset = hasAlignedHourOffset;
3986
- proto$2.isDST = isDaylightSavingTime;
3987
- proto$2.isLocal = isLocal;
3988
- proto$2.isUtcOffset = isUtcOffset;
3989
- proto$2.isUtc = isUtc;
3990
- proto$2.isUTC = isUtc;
3991
- proto$2.zoneAbbr = getZoneAbbr;
3992
- proto$2.zoneName = getZoneName;
3993
- proto$2.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
3994
- proto$2.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
3995
- proto$2.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
3996
- proto$2.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone);
3997
- proto$2.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted);
3998
-
3999
- function createUnix (input) {
4000
- return createLocal(input * 1000);
4001
- }
4002
-
4003
- function createInZone () {
4004
- return createLocal.apply(null, arguments).parseZone();
4005
- }
4006
-
4007
- function preParsePostFormat (string) {
4008
- return string;
4009
- }
4010
-
4011
- var proto$1 = Locale.prototype;
4012
-
4013
- proto$1.calendar = calendar$1;
4014
- proto$1.longDateFormat = longDateFormat;
4015
- proto$1.invalidDate = invalidDate;
4016
- proto$1.ordinal = ordinal;
4017
- proto$1.preparse = preParsePostFormat;
4018
- proto$1.postformat = preParsePostFormat;
4019
- proto$1.relativeTime = relativeTime$1;
4020
- proto$1.pastFuture = pastFuture;
4021
- proto$1.set = set$1;
4022
-
4023
- proto$1.months = localeMonths;
4024
- proto$1.monthsShort = localeMonthsShort;
4025
- proto$1.monthsParse = localeMonthsParse;
4026
- proto$1.monthsRegex = monthsRegex;
4027
- proto$1.monthsShortRegex = monthsShortRegex;
4028
- proto$1.week = localeWeek;
4029
- proto$1.firstDayOfYear = localeFirstDayOfYear;
4030
- proto$1.firstDayOfWeek = localeFirstDayOfWeek;
4031
-
4032
- proto$1.weekdays = localeWeekdays;
4033
- proto$1.weekdaysMin = localeWeekdaysMin;
4034
- proto$1.weekdaysShort = localeWeekdaysShort;
4035
- proto$1.weekdaysParse = localeWeekdaysParse;
4036
-
4037
- proto$1.weekdaysRegex = weekdaysRegex;
4038
- proto$1.weekdaysShortRegex = weekdaysShortRegex;
4039
- proto$1.weekdaysMinRegex = weekdaysMinRegex;
4040
-
4041
- proto$1.isPM = localeIsPM;
4042
- proto$1.meridiem = localeMeridiem;
4043
-
4044
- function get$1 (format, index, field, setter) {
4045
- var locale = getLocale();
4046
- var utc = createUTC().set(setter, index);
4047
- return locale[field](utc, format);
4048
- }
4049
-
4050
- function listMonthsImpl (format, index, field) {
4051
- if (isNumber(format)) {
4052
- index = format;
4053
- format = undefined;
4054
- }
4055
-
4056
- format = format || '';
4057
-
4058
- if (index != null) {
4059
- return get$1(format, index, field, 'month');
4060
- }
4061
-
4062
- var i;
4063
- var out = [];
4064
- for (i = 0; i < 12; i++) {
4065
- out[i] = get$1(format, i, field, 'month');
4066
- }
4067
- return out;
4068
- }
4069
-
4070
- // ()
4071
- // (5)
4072
- // (fmt, 5)
4073
- // (fmt)
4074
- // (true)
4075
- // (true, 5)
4076
- // (true, fmt, 5)
4077
- // (true, fmt)
4078
- function listWeekdaysImpl (localeSorted, format, index, field) {
4079
- if (typeof localeSorted === 'boolean') {
4080
- if (isNumber(format)) {
4081
- index = format;
4082
- format = undefined;
4083
- }
4084
-
4085
- format = format || '';
4086
- } else {
4087
- format = localeSorted;
4088
- index = format;
4089
- localeSorted = false;
4090
-
4091
- if (isNumber(format)) {
4092
- index = format;
4093
- format = undefined;
4094
- }
4095
-
4096
- format = format || '';
4097
- }
4098
-
4099
- var locale = getLocale(),
4100
- shift = localeSorted ? locale._week.dow : 0;
4101
-
4102
- if (index != null) {
4103
- return get$1(format, (index + shift) % 7, field, 'day');
4104
- }
4105
-
4106
- var i;
4107
- var out = [];
4108
- for (i = 0; i < 7; i++) {
4109
- out[i] = get$1(format, (i + shift) % 7, field, 'day');
4110
- }
4111
- return out;
4112
- }
4113
-
4114
- function listMonths (format, index) {
4115
- return listMonthsImpl(format, index, 'months');
4116
- }
4117
-
4118
- function listMonthsShort (format, index) {
4119
- return listMonthsImpl(format, index, 'monthsShort');
4120
- }
4121
-
4122
- function listWeekdays (localeSorted, format, index) {
4123
- return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
4124
- }
4125
-
4126
- function listWeekdaysShort (localeSorted, format, index) {
4127
- return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
4128
- }
4129
-
4130
- function listWeekdaysMin (localeSorted, format, index) {
4131
- return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
4132
- }
4133
-
4134
- getSetGlobalLocale('en', {
4135
- dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
4136
- ordinal : function (number) {
4137
- var b = number % 10,
4138
- output = (toInt(number % 100 / 10) === 1) ? 'th' :
4139
- (b === 1) ? 'st' :
4140
- (b === 2) ? 'nd' :
4141
- (b === 3) ? 'rd' : 'th';
4142
- return number + output;
4143
- }
4144
- });
4145
-
4146
- // Side effect imports
4147
-
4148
- hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale);
4149
- hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale);
4150
-
4151
- var mathAbs = Math.abs;
4152
-
4153
- function abs$1 () {
4154
- var data = this._data;
4155
-
4156
- this._milliseconds = mathAbs(this._milliseconds);
4157
- this._days = mathAbs(this._days);
4158
- this._months = mathAbs(this._months);
4159
-
4160
- data.milliseconds = mathAbs(data.milliseconds);
4161
- data.seconds = mathAbs(data.seconds);
4162
- data.minutes = mathAbs(data.minutes);
4163
- data.hours = mathAbs(data.hours);
4164
- data.months = mathAbs(data.months);
4165
- data.years = mathAbs(data.years);
4166
-
4167
- return this;
4168
- }
4169
-
4170
- function addSubtract (duration, input, value, direction) {
4171
- var other = createDuration(input, value);
4172
-
4173
- duration._milliseconds += direction * other._milliseconds;
4174
- duration._days += direction * other._days;
4175
- duration._months += direction * other._months;
4176
-
4177
- return duration._bubble();
4178
- }
4179
-
4180
- // supports only 2.0-style add(1, 's') or add(duration)
4181
- function add (input, value) {
4182
- return addSubtract(this, input, value, 1);
4183
- }
4184
-
4185
- // supports only 2.0-style subtract(1, 's') or subtract(duration)
4186
- function subtract (input, value) {
4187
- return addSubtract(this, input, value, -1);
4188
- }
4189
-
4190
- function absCeil (number) {
4191
- if (number < 0) {
4192
- return Math.floor(number);
4193
- } else {
4194
- return Math.ceil(number);
4195
- }
4196
- }
4197
-
4198
- function bubble () {
4199
- var milliseconds = this._milliseconds;
4200
- var days = this._days;
4201
- var months = this._months;
4202
- var data = this._data;
4203
- var seconds, minutes, hours, years, monthsFromDays;
4204
-
4205
- // if we have a mix of positive and negative values, bubble down first
4206
- // check: https://github.com/moment/moment/issues/2166
4207
- if (!((milliseconds >= 0 && days >= 0 && months >= 0) ||
4208
- (milliseconds <= 0 && days <= 0 && months <= 0))) {
4209
- milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
4210
- days = 0;
4211
- months = 0;
4212
- }
4213
-
4214
- // The following code bubbles up values, see the tests for
4215
- // examples of what that means.
4216
- data.milliseconds = milliseconds % 1000;
4217
-
4218
- seconds = absFloor(milliseconds / 1000);
4219
- data.seconds = seconds % 60;
4220
-
4221
- minutes = absFloor(seconds / 60);
4222
- data.minutes = minutes % 60;
4223
-
4224
- hours = absFloor(minutes / 60);
4225
- data.hours = hours % 24;
4226
-
4227
- days += absFloor(hours / 24);
4228
-
4229
- // convert days to months
4230
- monthsFromDays = absFloor(daysToMonths(days));
4231
- months += monthsFromDays;
4232
- days -= absCeil(monthsToDays(monthsFromDays));
4233
-
4234
- // 12 months -> 1 year
4235
- years = absFloor(months / 12);
4236
- months %= 12;
4237
-
4238
- data.days = days;
4239
- data.months = months;
4240
- data.years = years;
4241
-
4242
- return this;
4243
- }
4244
-
4245
- function daysToMonths (days) {
4246
- // 400 years have 146097 days (taking into account leap year rules)
4247
- // 400 years have 12 months === 4800
4248
- return days * 4800 / 146097;
4249
- }
4250
-
4251
- function monthsToDays (months) {
4252
- // the reverse of daysToMonths
4253
- return months * 146097 / 4800;
4254
- }
4255
-
4256
- function as (units) {
4257
- if (!this.isValid()) {
4258
- return NaN;
4259
- }
4260
- var days;
4261
- var months;
4262
- var milliseconds = this._milliseconds;
4263
-
4264
- units = normalizeUnits(units);
4265
-
4266
- if (units === 'month' || units === 'quarter' || units === 'year') {
4267
- days = this._days + milliseconds / 864e5;
4268
- months = this._months + daysToMonths(days);
4269
- switch (units) {
4270
- case 'month': return months;
4271
- case 'quarter': return months / 3;
4272
- case 'year': return months / 12;
4273
- }
4274
- } else {
4275
- // handle milliseconds separately because of floating point math errors (issue #1867)
4276
- days = this._days + Math.round(monthsToDays(this._months));
4277
- switch (units) {
4278
- case 'week' : return days / 7 + milliseconds / 6048e5;
4279
- case 'day' : return days + milliseconds / 864e5;
4280
- case 'hour' : return days * 24 + milliseconds / 36e5;
4281
- case 'minute' : return days * 1440 + milliseconds / 6e4;
4282
- case 'second' : return days * 86400 + milliseconds / 1000;
4283
- // Math.floor prevents floating point math errors here
4284
- case 'millisecond': return Math.floor(days * 864e5) + milliseconds;
4285
- default: throw new Error('Unknown unit ' + units);
4286
- }
4287
- }
4288
- }
4289
-
4290
- // TODO: Use this.as('ms')?
4291
- function valueOf () {
4292
- if (!this.isValid()) {
4293
- return NaN;
4294
- }
4295
- return (
4296
- this._milliseconds +
4297
- this._days * 864e5 +
4298
- (this._months % 12) * 2592e6 +
4299
- toInt(this._months / 12) * 31536e6
4300
- );
4301
- }
4302
-
4303
- function makeAs (alias) {
4304
- return function () {
4305
- return this.as(alias);
4306
- };
4307
- }
4308
-
4309
- var asMilliseconds = makeAs('ms');
4310
- var asSeconds = makeAs('s');
4311
- var asMinutes = makeAs('m');
4312
- var asHours = makeAs('h');
4313
- var asDays = makeAs('d');
4314
- var asWeeks = makeAs('w');
4315
- var asMonths = makeAs('M');
4316
- var asQuarters = makeAs('Q');
4317
- var asYears = makeAs('y');
4318
-
4319
- function clone () {
4320
- return createDuration(this);
4321
- }
4322
-
4323
- function get (units) {
4324
- units = normalizeUnits(units);
4325
- return this.isValid() ? this[units + 's']() : NaN;
4326
- }
4327
-
4328
- function makeGetter(name) {
4329
- return function () {
4330
- return this.isValid() ? this._data[name] : NaN;
4331
- };
4332
- }
4333
-
4334
- var milliseconds = makeGetter('milliseconds');
4335
- var seconds = makeGetter('seconds');
4336
- var minutes = makeGetter('minutes');
4337
- var hours = makeGetter('hours');
4338
- var days = makeGetter('days');
4339
- var months = makeGetter('months');
4340
- var years = makeGetter('years');
4341
-
4342
- function weeks () {
4343
- return absFloor(this.days() / 7);
4344
- }
4345
-
4346
- var round = Math.round;
4347
- var thresholds = {
4348
- ss: 44, // a few seconds to seconds
4349
- s : 45, // seconds to minute
4350
- m : 45, // minutes to hour
4351
- h : 22, // hours to day
4352
- d : 26, // days to month
4353
- M : 11 // months to year
4354
- };
4355
-
4356
- // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
4357
- function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
4358
- return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
4359
- }
4360
-
4361
- function relativeTime (posNegDuration, withoutSuffix, locale) {
4362
- var duration = createDuration(posNegDuration).abs();
4363
- var seconds = round(duration.as('s'));
4364
- var minutes = round(duration.as('m'));
4365
- var hours = round(duration.as('h'));
4366
- var days = round(duration.as('d'));
4367
- var months = round(duration.as('M'));
4368
- var years = round(duration.as('y'));
4369
-
4370
- var a = seconds <= thresholds.ss && ['s', seconds] ||
4371
- seconds < thresholds.s && ['ss', seconds] ||
4372
- minutes <= 1 && ['m'] ||
4373
- minutes < thresholds.m && ['mm', minutes] ||
4374
- hours <= 1 && ['h'] ||
4375
- hours < thresholds.h && ['hh', hours] ||
4376
- days <= 1 && ['d'] ||
4377
- days < thresholds.d && ['dd', days] ||
4378
- months <= 1 && ['M'] ||
4379
- months < thresholds.M && ['MM', months] ||
4380
- years <= 1 && ['y'] || ['yy', years];
4381
-
4382
- a[2] = withoutSuffix;
4383
- a[3] = +posNegDuration > 0;
4384
- a[4] = locale;
4385
- return substituteTimeAgo.apply(null, a);
4386
- }
4387
-
4388
- // This function allows you to set the rounding function for relative time strings
4389
- function getSetRelativeTimeRounding (roundingFunction) {
4390
- if (roundingFunction === undefined) {
4391
- return round;
4392
- }
4393
- if (typeof(roundingFunction) === 'function') {
4394
- round = roundingFunction;
4395
- return true;
4396
- }
4397
- return false;
4398
- }
4399
-
4400
- // This function allows you to set a threshold for relative time strings
4401
- function getSetRelativeTimeThreshold (threshold, limit) {
4402
- if (thresholds[threshold] === undefined) {
4403
- return false;
4404
- }
4405
- if (limit === undefined) {
4406
- return thresholds[threshold];
4407
- }
4408
- thresholds[threshold] = limit;
4409
- if (threshold === 's') {
4410
- thresholds.ss = limit - 1;
4411
- }
4412
- return true;
4413
- }
4414
-
4415
- function humanize (withSuffix) {
4416
- if (!this.isValid()) {
4417
- return this.localeData().invalidDate();
4418
- }
4419
-
4420
- var locale = this.localeData();
4421
- var output = relativeTime(this, !withSuffix, locale);
4422
-
4423
- if (withSuffix) {
4424
- output = locale.pastFuture(+this, output);
4425
- }
4426
-
4427
- return locale.postformat(output);
4428
- }
4429
-
4430
- var abs = Math.abs;
4431
-
4432
- function sign(x) {
4433
- return ((x > 0) - (x < 0)) || +x;
4434
- }
4435
-
4436
- function toISOString() {
4437
- // for ISO strings we do not use the normal bubbling rules:
4438
- // * milliseconds bubble up until they become hours
4439
- // * days do not bubble at all
4440
- // * months bubble up until they become years
4441
- // This is because there is no context-free conversion between hours and days
4442
- // (think of clock changes)
4443
- // and also not between days and months (28-31 days per month)
4444
- if (!this.isValid()) {
4445
- return this.localeData().invalidDate();
4446
- }
4447
-
4448
- var seconds = abs(this._milliseconds) / 1000;
4449
- var days = abs(this._days);
4450
- var months = abs(this._months);
4451
- var minutes, hours, years;
4452
-
4453
- // 3600 seconds -> 60 minutes -> 1 hour
4454
- minutes = absFloor(seconds / 60);
4455
- hours = absFloor(minutes / 60);
4456
- seconds %= 60;
4457
- minutes %= 60;
4458
-
4459
- // 12 months -> 1 year
4460
- years = absFloor(months / 12);
4461
- months %= 12;
4462
-
4463
-
4464
- // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
4465
- var Y = years;
4466
- var M = months;
4467
- var D = days;
4468
- var h = hours;
4469
- var m = minutes;
4470
- var s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
4471
- var total = this.asSeconds();
4472
-
4473
- if (!total) {
4474
- // this is the same as C#'s (Noda) and python (isodate)...
4475
- // but not other JS (goog.date)
4476
- return 'P0D';
4477
- }
4478
-
4479
- var totalSign = total < 0 ? '-' : '';
4480
- var ymSign = sign(this._months) !== sign(total) ? '-' : '';
4481
- var daysSign = sign(this._days) !== sign(total) ? '-' : '';
4482
- var hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
4483
-
4484
- return totalSign + 'P' +
4485
- (Y ? ymSign + Y + 'Y' : '') +
4486
- (M ? ymSign + M + 'M' : '') +
4487
- (D ? daysSign + D + 'D' : '') +
4488
- ((h || m || s) ? 'T' : '') +
4489
- (h ? hmsSign + h + 'H' : '') +
4490
- (m ? hmsSign + m + 'M' : '') +
4491
- (s ? hmsSign + s + 'S' : '');
4492
- }
4493
-
4494
- var proto = Duration.prototype;
4495
-
4496
- proto.isValid = isValid$1;
4497
- proto.abs = abs$1;
4498
- proto.add = add;
4499
- proto.subtract = subtract;
4500
- proto.as = as;
4501
- proto.asMilliseconds = asMilliseconds;
4502
- proto.asSeconds = asSeconds;
4503
- proto.asMinutes = asMinutes;
4504
- proto.asHours = asHours;
4505
- proto.asDays = asDays;
4506
- proto.asWeeks = asWeeks;
4507
- proto.asMonths = asMonths;
4508
- proto.asQuarters = asQuarters;
4509
- proto.asYears = asYears;
4510
- proto.valueOf = valueOf;
4511
- proto._bubble = bubble;
4512
- proto.clone = clone;
4513
- proto.get = get;
4514
- proto.milliseconds = milliseconds;
4515
- proto.seconds = seconds;
4516
- proto.minutes = minutes;
4517
- proto.hours = hours;
4518
- proto.days = days;
4519
- proto.weeks = weeks;
4520
- proto.months = months;
4521
- proto.years = years;
4522
- proto.humanize = humanize;
4523
- proto.toISOString = toISOString;
4524
- proto.toString = toISOString;
4525
- proto.toJSON = toISOString;
4526
- proto.locale = locale;
4527
- proto.localeData = localeData;
4528
-
4529
- proto.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString);
4530
- proto.lang = lang;
4531
-
4532
- // FORMATTING
4533
-
4534
- addFormatToken('X', 0, 0, 'unix');
4535
- addFormatToken('x', 0, 0, 'valueOf');
4536
-
4537
- // PARSING
4538
-
4539
- addRegexToken('x', matchSigned);
4540
- addRegexToken('X', matchTimestamp);
4541
- addParseToken('X', function (input, array, config) {
4542
- config._d = new Date(parseFloat(input, 10) * 1000);
4543
- });
4544
- addParseToken('x', function (input, array, config) {
4545
- config._d = new Date(toInt(input));
4546
- });
4547
-
4548
- //! moment.js
4549
-
4550
- hooks.version = '2.24.0';
4551
-
4552
- setHookCallback(createLocal);
4553
-
4554
- hooks.fn = proto$2;
4555
- hooks.min = min;
4556
- hooks.max = max;
4557
- hooks.now = now;
4558
- hooks.utc = createUTC;
4559
- hooks.unix = createUnix;
4560
- hooks.months = listMonths;
4561
- hooks.isDate = isDate;
4562
- hooks.locale = getSetGlobalLocale;
4563
- hooks.invalid = createInvalid$1;
4564
- hooks.duration = createDuration;
4565
- hooks.isMoment = isMoment;
4566
- hooks.weekdays = listWeekdays;
4567
- hooks.parseZone = createInZone;
4568
- hooks.localeData = getLocale;
4569
- hooks.isDuration = isDuration;
4570
- hooks.monthsShort = listMonthsShort;
4571
- hooks.weekdaysMin = listWeekdaysMin;
4572
- hooks.defineLocale = defineLocale;
4573
- hooks.updateLocale = updateLocale;
4574
- hooks.locales = listLocales;
4575
- hooks.weekdaysShort = listWeekdaysShort;
4576
- hooks.normalizeUnits = normalizeUnits;
4577
- hooks.relativeTimeRounding = getSetRelativeTimeRounding;
4578
- hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
4579
- hooks.calendarFormat = getCalendarFormat;
4580
- hooks.prototype = proto$2;
4581
-
4582
- // currently HTML5 input type only supports 24-hour formats
4583
- hooks.HTML5_FMT = {
4584
- DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" />
4585
- DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" />
4586
- DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" />
4587
- DATE: 'YYYY-MM-DD', // <input type="date" />
4588
- TIME: 'HH:mm', // <input type="time" />
4589
- TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" />
4590
- TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" />
4591
- WEEK: 'GGGG-[W]WW', // <input type="week" />
4592
- MONTH: 'YYYY-MM' // <input type="month" />
4593
- };
4594
-
4595
- const moment = /*#__PURE__*/Object.freeze({
4596
- __proto__: null,
4597
- 'default': hooks
4598
- });
4599
-
4600
- exports.hooks = hooks;
4601
- exports.moment = moment;