card-mod-date 0.15.4 → 0.15.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (879) hide show
  1. checksums.yaml +4 -4
  2. data/vendor/moment/CHANGELOG.md +964 -0
  3. data/vendor/moment/CONTRIBUTING.md +103 -0
  4. data/vendor/moment/FAQ.md +28 -0
  5. data/vendor/moment/Gruntfile.js +255 -0
  6. data/vendor/moment/LICENSE +22 -0
  7. data/vendor/moment/Moment.js.nuspec +31 -0
  8. data/vendor/moment/README.md +55 -0
  9. data/vendor/moment/benchmarks/add.js +22 -0
  10. data/vendor/moment/benchmarks/clone.js +10 -0
  11. data/vendor/moment/benchmarks/compare.js +33 -0
  12. data/vendor/moment/benchmarks/endOf.js +22 -0
  13. data/vendor/moment/benchmarks/fromDate.js +12 -0
  14. data/vendor/moment/benchmarks/fromDateUtc.js +12 -0
  15. data/vendor/moment/benchmarks/get.js +21 -0
  16. data/vendor/moment/benchmarks/isObjectEmpty.js +67 -0
  17. data/vendor/moment/benchmarks/load-missing.js +13 -0
  18. data/vendor/moment/benchmarks/makeDuration.js +11 -0
  19. data/vendor/moment/benchmarks/query.js +40 -0
  20. data/vendor/moment/benchmarks/set.js +22 -0
  21. data/vendor/moment/benchmarks/startOf.js +22 -0
  22. data/vendor/moment/benchmarks/subtract.js +22 -0
  23. data/vendor/moment/benchmarks/zeroFill.js +43 -0
  24. data/vendor/moment/bower.json +26 -0
  25. data/vendor/moment/component.json +147 -0
  26. data/vendor/moment/composer.json +33 -0
  27. data/vendor/moment/dist/locale/af.js +71 -0
  28. data/vendor/moment/dist/locale/ar-dz.js +156 -0
  29. data/vendor/moment/dist/locale/ar-kw.js +54 -0
  30. data/vendor/moment/dist/locale/ar-ly.js +171 -0
  31. data/vendor/moment/dist/locale/ar-ma.js +55 -0
  32. data/vendor/moment/dist/locale/ar-sa.js +104 -0
  33. data/vendor/moment/dist/locale/ar-tn.js +54 -0
  34. data/vendor/moment/dist/locale/ar.js +189 -0
  35. data/vendor/moment/dist/locale/az.js +101 -0
  36. data/vendor/moment/dist/locale/be.js +141 -0
  37. data/vendor/moment/dist/locale/bg.js +87 -0
  38. data/vendor/moment/dist/locale/bm.js +52 -0
  39. data/vendor/moment/dist/locale/bn-bd.js +128 -0
  40. data/vendor/moment/dist/locale/bn.js +118 -0
  41. data/vendor/moment/dist/locale/bo.js +122 -0
  42. data/vendor/moment/dist/locale/br.js +165 -0
  43. data/vendor/moment/dist/locale/bs.js +149 -0
  44. data/vendor/moment/dist/locale/ca.js +97 -0
  45. data/vendor/moment/dist/locale/cs.js +171 -0
  46. data/vendor/moment/dist/locale/cv.js +62 -0
  47. data/vendor/moment/dist/locale/cy.js +97 -0
  48. data/vendor/moment/dist/locale/da.js +53 -0
  49. data/vendor/moment/dist/locale/de-at.js +79 -0
  50. data/vendor/moment/dist/locale/de-ch.js +78 -0
  51. data/vendor/moment/dist/locale/de.js +78 -0
  52. data/vendor/moment/dist/locale/dv.js +90 -0
  53. data/vendor/moment/dist/locale/el.js +104 -0
  54. data/vendor/moment/dist/locale/en-au.js +68 -0
  55. data/vendor/moment/dist/locale/en-ca.js +64 -0
  56. data/vendor/moment/dist/locale/en-gb.js +68 -0
  57. data/vendor/moment/dist/locale/en-ie.js +68 -0
  58. data/vendor/moment/dist/locale/en-il.js +64 -0
  59. data/vendor/moment/dist/locale/en-in.js +68 -0
  60. data/vendor/moment/dist/locale/en-nz.js +68 -0
  61. data/vendor/moment/dist/locale/en-sg.js +68 -0
  62. data/vendor/moment/dist/locale/eo.js +68 -0
  63. data/vendor/moment/dist/locale/es-do.js +104 -0
  64. data/vendor/moment/dist/locale/es-mx.js +106 -0
  65. data/vendor/moment/dist/locale/es-us.js +106 -0
  66. data/vendor/moment/dist/locale/es.js +106 -0
  67. data/vendor/moment/dist/locale/et.js +78 -0
  68. data/vendor/moment/dist/locale/eu.js +63 -0
  69. data/vendor/moment/dist/locale/fa.js +110 -0
  70. data/vendor/moment/dist/locale/fi.js +121 -0
  71. data/vendor/moment/dist/locale/fil.js +58 -0
  72. data/vendor/moment/dist/locale/fo.js +56 -0
  73. data/vendor/moment/dist/locale/fr-ca.js +69 -0
  74. data/vendor/moment/dist/locale/fr-ch.js +73 -0
  75. data/vendor/moment/dist/locale/fr.js +104 -0
  76. data/vendor/moment/dist/locale/fy.js +77 -0
  77. data/vendor/moment/dist/locale/ga.js +95 -0
  78. data/vendor/moment/dist/locale/gd.js +95 -0
  79. data/vendor/moment/dist/locale/gl.js +74 -0
  80. data/vendor/moment/dist/locale/gom-deva.js +124 -0
  81. data/vendor/moment/dist/locale/gom-latn.js +124 -0
  82. data/vendor/moment/dist/locale/gu.js +121 -0
  83. data/vendor/moment/dist/locale/he.js +94 -0
  84. data/vendor/moment/dist/locale/hi.js +119 -0
  85. data/vendor/moment/dist/locale/hr.js +154 -0
  86. data/vendor/moment/dist/locale/hu.js +118 -0
  87. data/vendor/moment/dist/locale/hy-am.js +92 -0
  88. data/vendor/moment/dist/locale/id.js +76 -0
  89. data/vendor/moment/dist/locale/is.js +139 -0
  90. data/vendor/moment/dist/locale/it-ch.js +64 -0
  91. data/vendor/moment/dist/locale/it.js +106 -0
  92. data/vendor/moment/dist/locale/ja.js +148 -0
  93. data/vendor/moment/dist/locale/jv.js +76 -0
  94. data/vendor/moment/dist/locale/ka.js +92 -0
  95. data/vendor/moment/dist/locale/kk.js +82 -0
  96. data/vendor/moment/dist/locale/km.js +102 -0
  97. data/vendor/moment/dist/locale/kn.js +123 -0
  98. data/vendor/moment/dist/locale/ko.js +75 -0
  99. data/vendor/moment/dist/locale/ku.js +118 -0
  100. data/vendor/moment/dist/locale/ky.js +84 -0
  101. data/vendor/moment/dist/locale/lb.js +135 -0
  102. data/vendor/moment/dist/locale/lo.js +65 -0
  103. data/vendor/moment/dist/locale/lt.js +123 -0
  104. data/vendor/moment/dist/locale/lv.js +93 -0
  105. data/vendor/moment/dist/locale/me.js +118 -0
  106. data/vendor/moment/dist/locale/mi.js +59 -0
  107. data/vendor/moment/dist/locale/mk.js +85 -0
  108. data/vendor/moment/dist/locale/ml.js +80 -0
  109. data/vendor/moment/dist/locale/mn.js +99 -0
  110. data/vendor/moment/dist/locale/mr.js +202 -0
  111. data/vendor/moment/dist/locale/ms-my.js +76 -0
  112. data/vendor/moment/dist/locale/ms.js +75 -0
  113. data/vendor/moment/dist/locale/mt.js +55 -0
  114. data/vendor/moment/dist/locale/my.js +91 -0
  115. data/vendor/moment/dist/locale/nb.js +61 -0
  116. data/vendor/moment/dist/locale/ne.js +120 -0
  117. data/vendor/moment/dist/locale/nl-be.js +102 -0
  118. data/vendor/moment/dist/locale/nl.js +104 -0
  119. data/vendor/moment/dist/locale/nn.js +60 -0
  120. data/vendor/moment/dist/locale/oc-lnc.js +83 -0
  121. data/vendor/moment/dist/locale/pa-in.js +121 -0
  122. data/vendor/moment/dist/locale/pl.js +139 -0
  123. data/vendor/moment/dist/locale/pt-br.js +57 -0
  124. data/vendor/moment/dist/locale/pt.js +62 -0
  125. data/vendor/moment/dist/locale/ro.js +75 -0
  126. data/vendor/moment/dist/locale/ru.js +206 -0
  127. data/vendor/moment/dist/locale/sd.js +81 -0
  128. data/vendor/moment/dist/locale/se.js +57 -0
  129. data/vendor/moment/dist/locale/si.js +68 -0
  130. data/vendor/moment/dist/locale/sk.js +144 -0
  131. data/vendor/moment/dist/locale/sl.js +170 -0
  132. data/vendor/moment/dist/locale/sq.js +65 -0
  133. data/vendor/moment/dist/locale/sr-cyrl.js +116 -0
  134. data/vendor/moment/dist/locale/sr.js +118 -0
  135. data/vendor/moment/dist/locale/ss.js +83 -0
  136. data/vendor/moment/dist/locale/sv.js +68 -0
  137. data/vendor/moment/dist/locale/sw.js +54 -0
  138. data/vendor/moment/dist/locale/ta.js +129 -0
  139. data/vendor/moment/dist/locale/te.js +86 -0
  140. data/vendor/moment/dist/locale/tet.js +68 -0
  141. data/vendor/moment/dist/locale/tg.js +116 -0
  142. data/vendor/moment/dist/locale/th.js +64 -0
  143. data/vendor/moment/dist/locale/tk.js +91 -0
  144. data/vendor/moment/dist/locale/tl-ph.js +57 -0
  145. data/vendor/moment/dist/locale/tlh.js +125 -0
  146. data/vendor/moment/dist/locale/tr.js +106 -0
  147. data/vendor/moment/dist/locale/tzl.js +89 -0
  148. data/vendor/moment/dist/locale/tzm-latn.js +53 -0
  149. data/vendor/moment/dist/locale/tzm.js +53 -0
  150. data/vendor/moment/dist/locale/ug-cn.js +110 -0
  151. data/vendor/moment/dist/locale/uk.js +163 -0
  152. data/vendor/moment/dist/locale/ur.js +82 -0
  153. data/vendor/moment/dist/locale/uz-latn.js +53 -0
  154. data/vendor/moment/dist/locale/uz.js +51 -0
  155. data/vendor/moment/dist/locale/vi.js +79 -0
  156. data/vendor/moment/dist/locale/x-pseudo.js +71 -0
  157. data/vendor/moment/dist/locale/yo.js +53 -0
  158. data/vendor/moment/dist/locale/zh-cn.js +120 -0
  159. data/vendor/moment/dist/locale/zh-hk.js +101 -0
  160. data/vendor/moment/dist/locale/zh-mo.js +100 -0
  161. data/vendor/moment/dist/locale/zh-tw.js +99 -0
  162. data/vendor/moment/dist/moment.js +5663 -0
  163. data/vendor/moment/ender.js +1 -0
  164. data/vendor/moment/locale/af.js +82 -0
  165. data/vendor/moment/locale/ar-dz.js +167 -0
  166. data/vendor/moment/locale/ar-kw.js +65 -0
  167. data/vendor/moment/locale/ar-ly.js +182 -0
  168. data/vendor/moment/locale/ar-ma.js +66 -0
  169. data/vendor/moment/locale/ar-sa.js +115 -0
  170. data/vendor/moment/locale/ar-tn.js +65 -0
  171. data/vendor/moment/locale/ar.js +200 -0
  172. data/vendor/moment/locale/az.js +112 -0
  173. data/vendor/moment/locale/be.js +152 -0
  174. data/vendor/moment/locale/bg.js +98 -0
  175. data/vendor/moment/locale/bm.js +62 -0
  176. data/vendor/moment/locale/bn-bd.js +139 -0
  177. data/vendor/moment/locale/bn.js +129 -0
  178. data/vendor/moment/locale/bo.js +133 -0
  179. data/vendor/moment/locale/br.js +176 -0
  180. data/vendor/moment/locale/bs.js +160 -0
  181. data/vendor/moment/locale/ca.js +108 -0
  182. data/vendor/moment/locale/cs.js +182 -0
  183. data/vendor/moment/locale/cv.js +73 -0
  184. data/vendor/moment/locale/cy.js +108 -0
  185. data/vendor/moment/locale/da.js +64 -0
  186. data/vendor/moment/locale/de-at.js +90 -0
  187. data/vendor/moment/locale/de-ch.js +87 -0
  188. data/vendor/moment/locale/de.js +89 -0
  189. data/vendor/moment/locale/dv.js +101 -0
  190. data/vendor/moment/locale/el.js +115 -0
  191. data/vendor/moment/locale/en-au.js +79 -0
  192. data/vendor/moment/locale/en-ca.js +75 -0
  193. data/vendor/moment/locale/en-gb.js +79 -0
  194. data/vendor/moment/locale/en-ie.js +79 -0
  195. data/vendor/moment/locale/en-il.js +75 -0
  196. data/vendor/moment/locale/en-in.js +79 -0
  197. data/vendor/moment/locale/en-nz.js +79 -0
  198. data/vendor/moment/locale/en-sg.js +79 -0
  199. data/vendor/moment/locale/eo.js +79 -0
  200. data/vendor/moment/locale/es-do.js +115 -0
  201. data/vendor/moment/locale/es-mx.js +117 -0
  202. data/vendor/moment/locale/es-us.js +117 -0
  203. data/vendor/moment/locale/es.js +117 -0
  204. data/vendor/moment/locale/et.js +89 -0
  205. data/vendor/moment/locale/eu.js +74 -0
  206. data/vendor/moment/locale/fa.js +121 -0
  207. data/vendor/moment/locale/fi.js +132 -0
  208. data/vendor/moment/locale/fil.js +69 -0
  209. data/vendor/moment/locale/fo.js +67 -0
  210. data/vendor/moment/locale/fr-ca.js +80 -0
  211. data/vendor/moment/locale/fr-ch.js +84 -0
  212. data/vendor/moment/locale/fr.js +115 -0
  213. data/vendor/moment/locale/fy.js +88 -0
  214. data/vendor/moment/locale/ga.js +106 -0
  215. data/vendor/moment/locale/gd.js +106 -0
  216. data/vendor/moment/locale/gl.js +85 -0
  217. data/vendor/moment/locale/gom-deva.js +135 -0
  218. data/vendor/moment/locale/gom-latn.js +135 -0
  219. data/vendor/moment/locale/gu.js +132 -0
  220. data/vendor/moment/locale/he.js +105 -0
  221. data/vendor/moment/locale/hi.js +130 -0
  222. data/vendor/moment/locale/hr.js +165 -0
  223. data/vendor/moment/locale/hu.js +129 -0
  224. data/vendor/moment/locale/hy-am.js +103 -0
  225. data/vendor/moment/locale/id.js +87 -0
  226. data/vendor/moment/locale/is.js +150 -0
  227. data/vendor/moment/locale/it-ch.js +75 -0
  228. data/vendor/moment/locale/it.js +117 -0
  229. data/vendor/moment/locale/ja.js +159 -0
  230. data/vendor/moment/locale/jv.js +87 -0
  231. data/vendor/moment/locale/ka.js +103 -0
  232. data/vendor/moment/locale/kk.js +93 -0
  233. data/vendor/moment/locale/km.js +113 -0
  234. data/vendor/moment/locale/kn.js +134 -0
  235. data/vendor/moment/locale/ko.js +86 -0
  236. data/vendor/moment/locale/ku.js +129 -0
  237. data/vendor/moment/locale/ky.js +95 -0
  238. data/vendor/moment/locale/lb.js +146 -0
  239. data/vendor/moment/locale/lo.js +76 -0
  240. data/vendor/moment/locale/lt.js +134 -0
  241. data/vendor/moment/locale/lv.js +104 -0
  242. data/vendor/moment/locale/me.js +129 -0
  243. data/vendor/moment/locale/mi.js +70 -0
  244. data/vendor/moment/locale/mk.js +97 -0
  245. data/vendor/moment/locale/ml.js +91 -0
  246. data/vendor/moment/locale/mn.js +110 -0
  247. data/vendor/moment/locale/mr.js +213 -0
  248. data/vendor/moment/locale/ms-my.js +87 -0
  249. data/vendor/moment/locale/ms.js +86 -0
  250. data/vendor/moment/locale/mt.js +66 -0
  251. data/vendor/moment/locale/my.js +102 -0
  252. data/vendor/moment/locale/nb.js +72 -0
  253. data/vendor/moment/locale/ne.js +131 -0
  254. data/vendor/moment/locale/nl-be.js +113 -0
  255. data/vendor/moment/locale/nl.js +115 -0
  256. data/vendor/moment/locale/nn.js +71 -0
  257. data/vendor/moment/locale/oc-lnc.js +94 -0
  258. data/vendor/moment/locale/pa-in.js +132 -0
  259. data/vendor/moment/locale/pl.js +150 -0
  260. data/vendor/moment/locale/pt-br.js +68 -0
  261. data/vendor/moment/locale/pt.js +73 -0
  262. data/vendor/moment/locale/ro.js +86 -0
  263. data/vendor/moment/locale/ru.js +217 -0
  264. data/vendor/moment/locale/sd.js +92 -0
  265. data/vendor/moment/locale/se.js +68 -0
  266. data/vendor/moment/locale/si.js +79 -0
  267. data/vendor/moment/locale/sk.js +155 -0
  268. data/vendor/moment/locale/sl.js +181 -0
  269. data/vendor/moment/locale/sq.js +76 -0
  270. data/vendor/moment/locale/sr-cyrl.js +127 -0
  271. data/vendor/moment/locale/sr.js +129 -0
  272. data/vendor/moment/locale/ss.js +94 -0
  273. data/vendor/moment/locale/sv.js +79 -0
  274. data/vendor/moment/locale/sw.js +65 -0
  275. data/vendor/moment/locale/ta.js +140 -0
  276. data/vendor/moment/locale/te.js +97 -0
  277. data/vendor/moment/locale/tet.js +79 -0
  278. data/vendor/moment/locale/tg.js +127 -0
  279. data/vendor/moment/locale/th.js +75 -0
  280. data/vendor/moment/locale/tk.js +102 -0
  281. data/vendor/moment/locale/tl-ph.js +68 -0
  282. data/vendor/moment/locale/tlh.js +136 -0
  283. data/vendor/moment/locale/tr.js +117 -0
  284. data/vendor/moment/locale/tzl.js +100 -0
  285. data/vendor/moment/locale/tzm-latn.js +64 -0
  286. data/vendor/moment/locale/tzm.js +64 -0
  287. data/vendor/moment/locale/ug-cn.js +121 -0
  288. data/vendor/moment/locale/uk.js +174 -0
  289. data/vendor/moment/locale/ur.js +93 -0
  290. data/vendor/moment/locale/uz-latn.js +64 -0
  291. data/vendor/moment/locale/uz.js +62 -0
  292. data/vendor/moment/locale/vi.js +90 -0
  293. data/vendor/moment/locale/x-pseudo.js +82 -0
  294. data/vendor/moment/locale/yo.js +64 -0
  295. data/vendor/moment/locale/zh-cn.js +131 -0
  296. data/vendor/moment/locale/zh-hk.js +112 -0
  297. data/vendor/moment/locale/zh-mo.js +111 -0
  298. data/vendor/moment/locale/zh-tw.js +110 -0
  299. data/vendor/moment/meteor/README.md +5 -0
  300. data/vendor/moment/meteor/export.js +6 -0
  301. data/vendor/moment/meteor/moment.js +1 -0
  302. data/vendor/moment/meteor/package.js +27 -0
  303. data/vendor/moment/meteor/test.js +5 -0
  304. data/vendor/moment/min/locales.js +12384 -0
  305. data/vendor/moment/min/locales.min.js +2 -0
  306. data/vendor/moment/min/locales.min.js.map +1 -0
  307. data/vendor/moment/min/moment-with-locales.js +18039 -0
  308. data/vendor/moment/min/moment-with-locales.min.js +2 -0
  309. data/vendor/moment/min/moment-with-locales.min.js.map +1 -0
  310. data/vendor/moment/min/moment.min.js +2 -0
  311. data/vendor/moment/min/moment.min.js.map +1 -0
  312. data/vendor/moment/min/tests.js +146872 -0
  313. data/vendor/moment/moment.d.ts +796 -0
  314. data/vendor/moment/moment.js +5671 -0
  315. data/vendor/moment/package-lock.json +6460 -0
  316. data/vendor/moment/package.js +11 -0
  317. data/vendor/moment/package.json +112 -0
  318. data/vendor/moment/scripts/locales.js +146 -0
  319. data/vendor/moment/scripts/npm_prepublish.sh +49 -0
  320. data/vendor/moment/src/lib/create/check-overflow.js +57 -0
  321. data/vendor/moment/src/lib/create/date-from-array.js +35 -0
  322. data/vendor/moment/src/lib/create/from-anything.js +117 -0
  323. data/vendor/moment/src/lib/create/from-array.js +187 -0
  324. data/vendor/moment/src/lib/create/from-object.js +20 -0
  325. data/vendor/moment/src/lib/create/from-string-and-array.js +66 -0
  326. data/vendor/moment/src/lib/create/from-string-and-format.js +134 -0
  327. data/vendor/moment/src/lib/create/from-string.js +255 -0
  328. data/vendor/moment/src/lib/create/local.js +5 -0
  329. data/vendor/moment/src/lib/create/parsing-flags.js +28 -0
  330. data/vendor/moment/src/lib/create/utc.js +5 -0
  331. data/vendor/moment/src/lib/create/valid.js +51 -0
  332. data/vendor/moment/src/lib/duration/abs.js +18 -0
  333. data/vendor/moment/src/lib/duration/add-subtract.js +21 -0
  334. data/vendor/moment/src/lib/duration/as.js +88 -0
  335. data/vendor/moment/src/lib/duration/bubble.js +68 -0
  336. data/vendor/moment/src/lib/duration/clone.js +5 -0
  337. data/vendor/moment/src/lib/duration/constructor.js +42 -0
  338. data/vendor/moment/src/lib/duration/create.js +132 -0
  339. data/vendor/moment/src/lib/duration/duration.js +16 -0
  340. data/vendor/moment/src/lib/duration/get.js +27 -0
  341. data/vendor/moment/src/lib/duration/humanize.js +114 -0
  342. data/vendor/moment/src/lib/duration/iso-string.js +68 -0
  343. data/vendor/moment/src/lib/duration/prototype.js +78 -0
  344. data/vendor/moment/src/lib/duration/valid.js +54 -0
  345. data/vendor/moment/src/lib/format/format.js +103 -0
  346. data/vendor/moment/src/lib/locale/base-config.js +41 -0
  347. data/vendor/moment/src/lib/locale/calendar.js +15 -0
  348. data/vendor/moment/src/lib/locale/constructor.js +5 -0
  349. data/vendor/moment/src/lib/locale/en.js +39 -0
  350. data/vendor/moment/src/lib/locale/formats.js +36 -0
  351. data/vendor/moment/src/lib/locale/invalid.js +5 -0
  352. data/vendor/moment/src/lib/locale/lists.js +93 -0
  353. data/vendor/moment/src/lib/locale/locale.js +45 -0
  354. data/vendor/moment/src/lib/locale/locales.js +242 -0
  355. data/vendor/moment/src/lib/locale/ordinal.js +8 -0
  356. data/vendor/moment/src/lib/locale/pre-post-format.js +3 -0
  357. data/vendor/moment/src/lib/locale/prototype.js +88 -0
  358. data/vendor/moment/src/lib/locale/relative.js +32 -0
  359. data/vendor/moment/src/lib/locale/set.js +56 -0
  360. data/vendor/moment/src/lib/moment/add-subtract.js +61 -0
  361. data/vendor/moment/src/lib/moment/calendar.js +53 -0
  362. data/vendor/moment/src/lib/moment/clone.js +5 -0
  363. data/vendor/moment/src/lib/moment/compare.js +72 -0
  364. data/vendor/moment/src/lib/moment/constructor.js +77 -0
  365. data/vendor/moment/src/lib/moment/creation-data.js +9 -0
  366. data/vendor/moment/src/lib/moment/diff.js +79 -0
  367. data/vendor/moment/src/lib/moment/format.js +78 -0
  368. data/vendor/moment/src/lib/moment/from.js +20 -0
  369. data/vendor/moment/src/lib/moment/get-set.js +72 -0
  370. data/vendor/moment/src/lib/moment/locale.js +34 -0
  371. data/vendor/moment/src/lib/moment/min-max.js +62 -0
  372. data/vendor/moment/src/lib/moment/moment.js +28 -0
  373. data/vendor/moment/src/lib/moment/now.js +3 -0
  374. data/vendor/moment/src/lib/moment/prototype.js +197 -0
  375. data/vendor/moment/src/lib/moment/start-end-of.js +164 -0
  376. data/vendor/moment/src/lib/moment/to-type.js +42 -0
  377. data/vendor/moment/src/lib/moment/to.js +20 -0
  378. data/vendor/moment/src/lib/moment/valid.js +15 -0
  379. data/vendor/moment/src/lib/parse/regex.js +82 -0
  380. data/vendor/moment/src/lib/parse/token.js +34 -0
  381. data/vendor/moment/src/lib/units/aliases.js +31 -0
  382. data/vendor/moment/src/lib/units/constants.js +9 -0
  383. data/vendor/moment/src/lib/units/day-of-month.js +39 -0
  384. data/vendor/moment/src/lib/units/day-of-week.js +444 -0
  385. data/vendor/moment/src/lib/units/day-of-year.js +37 -0
  386. data/vendor/moment/src/lib/units/era.js +289 -0
  387. data/vendor/moment/src/lib/units/hour.js +159 -0
  388. data/vendor/moment/src/lib/units/millisecond.js +76 -0
  389. data/vendor/moment/src/lib/units/minute.js +29 -0
  390. data/vendor/moment/src/lib/units/month.js +349 -0
  391. data/vendor/moment/src/lib/units/offset.js +249 -0
  392. data/vendor/moment/src/lib/units/priorities.js +21 -0
  393. data/vendor/moment/src/lib/units/quarter.js +34 -0
  394. data/vendor/moment/src/lib/units/second.js +29 -0
  395. data/vendor/moment/src/lib/units/timestamp.js +20 -0
  396. data/vendor/moment/src/lib/units/timezone.js +16 -0
  397. data/vendor/moment/src/lib/units/units.js +20 -0
  398. data/vendor/moment/src/lib/units/week-calendar-utils.js +66 -0
  399. data/vendor/moment/src/lib/units/week-year.js +140 -0
  400. data/vendor/moment/src/lib/units/week.js +71 -0
  401. data/vendor/moment/src/lib/units/year.js +85 -0
  402. data/vendor/moment/src/lib/utils/abs-ceil.js +7 -0
  403. data/vendor/moment/src/lib/utils/abs-floor.js +8 -0
  404. data/vendor/moment/src/lib/utils/abs-round.js +7 -0
  405. data/vendor/moment/src/lib/utils/compare-arrays.js +18 -0
  406. data/vendor/moment/src/lib/utils/defaults.js +10 -0
  407. data/vendor/moment/src/lib/utils/deprecate.js +68 -0
  408. data/vendor/moment/src/lib/utils/extend.js +19 -0
  409. data/vendor/moment/src/lib/utils/has-own-prop.js +3 -0
  410. data/vendor/moment/src/lib/utils/hooks.js +13 -0
  411. data/vendor/moment/src/lib/utils/index-of.js +18 -0
  412. data/vendor/moment/src/lib/utils/is-array.js +6 -0
  413. data/vendor/moment/src/lib/utils/is-calendar-spec.js +25 -0
  414. data/vendor/moment/src/lib/utils/is-date.js +6 -0
  415. data/vendor/moment/src/lib/utils/is-function.js +6 -0
  416. data/vendor/moment/src/lib/utils/is-leap-year.js +3 -0
  417. data/vendor/moment/src/lib/utils/is-moment-input.js +74 -0
  418. data/vendor/moment/src/lib/utils/is-number.js +6 -0
  419. data/vendor/moment/src/lib/utils/is-object-empty.js +15 -0
  420. data/vendor/moment/src/lib/utils/is-object.js +8 -0
  421. data/vendor/moment/src/lib/utils/is-string.js +3 -0
  422. data/vendor/moment/src/lib/utils/is-undefined.js +3 -0
  423. data/vendor/moment/src/lib/utils/keys.js +20 -0
  424. data/vendor/moment/src/lib/utils/map.js +8 -0
  425. data/vendor/moment/src/lib/utils/mod.js +3 -0
  426. data/vendor/moment/src/lib/utils/some.js +20 -0
  427. data/vendor/moment/src/lib/utils/to-int.js +12 -0
  428. data/vendor/moment/src/lib/utils/zero-fill.js +10 -0
  429. data/vendor/moment/src/locale/af.js +71 -0
  430. data/vendor/moment/src/locale/ar-dz.js +156 -0
  431. data/vendor/moment/src/locale/ar-kw.js +54 -0
  432. data/vendor/moment/src/locale/ar-ly.js +171 -0
  433. data/vendor/moment/src/locale/ar-ma.js +55 -0
  434. data/vendor/moment/src/locale/ar-sa.js +104 -0
  435. data/vendor/moment/src/locale/ar-tn.js +54 -0
  436. data/vendor/moment/src/locale/ar.js +189 -0
  437. data/vendor/moment/src/locale/az.js +101 -0
  438. data/vendor/moment/src/locale/be.js +141 -0
  439. data/vendor/moment/src/locale/bg.js +87 -0
  440. data/vendor/moment/src/locale/bm.js +52 -0
  441. data/vendor/moment/src/locale/bn-bd.js +128 -0
  442. data/vendor/moment/src/locale/bn.js +118 -0
  443. data/vendor/moment/src/locale/bo.js +122 -0
  444. data/vendor/moment/src/locale/br.js +165 -0
  445. data/vendor/moment/src/locale/bs.js +149 -0
  446. data/vendor/moment/src/locale/ca.js +97 -0
  447. data/vendor/moment/src/locale/cs.js +171 -0
  448. data/vendor/moment/src/locale/cv.js +62 -0
  449. data/vendor/moment/src/locale/cy.js +97 -0
  450. data/vendor/moment/src/locale/da.js +53 -0
  451. data/vendor/moment/src/locale/de-at.js +79 -0
  452. data/vendor/moment/src/locale/de-ch.js +78 -0
  453. data/vendor/moment/src/locale/de.js +78 -0
  454. data/vendor/moment/src/locale/dv.js +90 -0
  455. data/vendor/moment/src/locale/el.js +104 -0
  456. data/vendor/moment/src/locale/en-au.js +68 -0
  457. data/vendor/moment/src/locale/en-ca.js +64 -0
  458. data/vendor/moment/src/locale/en-gb.js +68 -0
  459. data/vendor/moment/src/locale/en-ie.js +68 -0
  460. data/vendor/moment/src/locale/en-il.js +64 -0
  461. data/vendor/moment/src/locale/en-in.js +68 -0
  462. data/vendor/moment/src/locale/en-nz.js +68 -0
  463. data/vendor/moment/src/locale/en-sg.js +68 -0
  464. data/vendor/moment/src/locale/eo.js +68 -0
  465. data/vendor/moment/src/locale/es-do.js +104 -0
  466. data/vendor/moment/src/locale/es-mx.js +106 -0
  467. data/vendor/moment/src/locale/es-us.js +106 -0
  468. data/vendor/moment/src/locale/es.js +106 -0
  469. data/vendor/moment/src/locale/et.js +78 -0
  470. data/vendor/moment/src/locale/eu.js +63 -0
  471. data/vendor/moment/src/locale/fa.js +110 -0
  472. data/vendor/moment/src/locale/fi.js +121 -0
  473. data/vendor/moment/src/locale/fil.js +58 -0
  474. data/vendor/moment/src/locale/fo.js +56 -0
  475. data/vendor/moment/src/locale/fr-ca.js +69 -0
  476. data/vendor/moment/src/locale/fr-ch.js +73 -0
  477. data/vendor/moment/src/locale/fr.js +104 -0
  478. data/vendor/moment/src/locale/fy.js +77 -0
  479. data/vendor/moment/src/locale/ga.js +95 -0
  480. data/vendor/moment/src/locale/gd.js +95 -0
  481. data/vendor/moment/src/locale/gl.js +74 -0
  482. data/vendor/moment/src/locale/gom-deva.js +124 -0
  483. data/vendor/moment/src/locale/gom-latn.js +124 -0
  484. data/vendor/moment/src/locale/gu.js +121 -0
  485. data/vendor/moment/src/locale/he.js +94 -0
  486. data/vendor/moment/src/locale/hi.js +119 -0
  487. data/vendor/moment/src/locale/hr.js +154 -0
  488. data/vendor/moment/src/locale/hu.js +118 -0
  489. data/vendor/moment/src/locale/hy-am.js +92 -0
  490. data/vendor/moment/src/locale/id.js +76 -0
  491. data/vendor/moment/src/locale/is.js +139 -0
  492. data/vendor/moment/src/locale/it-ch.js +64 -0
  493. data/vendor/moment/src/locale/it.js +106 -0
  494. data/vendor/moment/src/locale/ja.js +148 -0
  495. data/vendor/moment/src/locale/jv.js +76 -0
  496. data/vendor/moment/src/locale/ka.js +92 -0
  497. data/vendor/moment/src/locale/kk.js +82 -0
  498. data/vendor/moment/src/locale/km.js +102 -0
  499. data/vendor/moment/src/locale/kn.js +123 -0
  500. data/vendor/moment/src/locale/ko.js +75 -0
  501. data/vendor/moment/src/locale/ku.js +118 -0
  502. data/vendor/moment/src/locale/ky.js +84 -0
  503. data/vendor/moment/src/locale/lb.js +135 -0
  504. data/vendor/moment/src/locale/lo.js +65 -0
  505. data/vendor/moment/src/locale/lt.js +123 -0
  506. data/vendor/moment/src/locale/lv.js +93 -0
  507. data/vendor/moment/src/locale/me.js +118 -0
  508. data/vendor/moment/src/locale/mi.js +59 -0
  509. data/vendor/moment/src/locale/mk.js +85 -0
  510. data/vendor/moment/src/locale/ml.js +80 -0
  511. data/vendor/moment/src/locale/mn.js +99 -0
  512. data/vendor/moment/src/locale/mr.js +202 -0
  513. data/vendor/moment/src/locale/ms-my.js +76 -0
  514. data/vendor/moment/src/locale/ms.js +75 -0
  515. data/vendor/moment/src/locale/mt.js +55 -0
  516. data/vendor/moment/src/locale/my.js +91 -0
  517. data/vendor/moment/src/locale/nb.js +61 -0
  518. data/vendor/moment/src/locale/ne.js +120 -0
  519. data/vendor/moment/src/locale/nl-be.js +102 -0
  520. data/vendor/moment/src/locale/nl.js +104 -0
  521. data/vendor/moment/src/locale/nn.js +60 -0
  522. data/vendor/moment/src/locale/oc-lnc.js +83 -0
  523. data/vendor/moment/src/locale/pa-in.js +121 -0
  524. data/vendor/moment/src/locale/pl.js +139 -0
  525. data/vendor/moment/src/locale/pt-br.js +57 -0
  526. data/vendor/moment/src/locale/pt.js +62 -0
  527. data/vendor/moment/src/locale/ro.js +75 -0
  528. data/vendor/moment/src/locale/ru.js +206 -0
  529. data/vendor/moment/src/locale/sd.js +81 -0
  530. data/vendor/moment/src/locale/se.js +57 -0
  531. data/vendor/moment/src/locale/si.js +68 -0
  532. data/vendor/moment/src/locale/sk.js +144 -0
  533. data/vendor/moment/src/locale/sl.js +170 -0
  534. data/vendor/moment/src/locale/sq.js +65 -0
  535. data/vendor/moment/src/locale/sr-cyrl.js +116 -0
  536. data/vendor/moment/src/locale/sr.js +118 -0
  537. data/vendor/moment/src/locale/ss.js +83 -0
  538. data/vendor/moment/src/locale/sv.js +68 -0
  539. data/vendor/moment/src/locale/sw.js +54 -0
  540. data/vendor/moment/src/locale/ta.js +129 -0
  541. data/vendor/moment/src/locale/te.js +86 -0
  542. data/vendor/moment/src/locale/tet.js +68 -0
  543. data/vendor/moment/src/locale/tg.js +116 -0
  544. data/vendor/moment/src/locale/th.js +64 -0
  545. data/vendor/moment/src/locale/tk.js +91 -0
  546. data/vendor/moment/src/locale/tl-ph.js +57 -0
  547. data/vendor/moment/src/locale/tlh.js +125 -0
  548. data/vendor/moment/src/locale/tr.js +106 -0
  549. data/vendor/moment/src/locale/tzl.js +89 -0
  550. data/vendor/moment/src/locale/tzm-latn.js +53 -0
  551. data/vendor/moment/src/locale/tzm.js +53 -0
  552. data/vendor/moment/src/locale/ug-cn.js +110 -0
  553. data/vendor/moment/src/locale/uk.js +163 -0
  554. data/vendor/moment/src/locale/ur.js +82 -0
  555. data/vendor/moment/src/locale/uz-latn.js +53 -0
  556. data/vendor/moment/src/locale/uz.js +51 -0
  557. data/vendor/moment/src/locale/vi.js +79 -0
  558. data/vendor/moment/src/locale/x-pseudo.js +71 -0
  559. data/vendor/moment/src/locale/yo.js +53 -0
  560. data/vendor/moment/src/locale/zh-cn.js +120 -0
  561. data/vendor/moment/src/locale/zh-hk.js +101 -0
  562. data/vendor/moment/src/locale/zh-mo.js +100 -0
  563. data/vendor/moment/src/locale/zh-tw.js +99 -0
  564. data/vendor/moment/src/moment.js +93 -0
  565. data/vendor/moment/src/test/helpers/common-locale.js +265 -0
  566. data/vendor/moment/src/test/helpers/deprecation-handler.js +62 -0
  567. data/vendor/moment/src/test/helpers/dst.js +8 -0
  568. data/vendor/moment/src/test/helpers/each-own-prop.js +8 -0
  569. data/vendor/moment/src/test/helpers/each.js +8 -0
  570. data/vendor/moment/src/test/helpers/has-own-prop.js +3 -0
  571. data/vendor/moment/src/test/helpers/object-keys.js +17 -0
  572. data/vendor/moment/src/test/locale/af.js +446 -0
  573. data/vendor/moment/src/test/locale/ar-dz.js +482 -0
  574. data/vendor/moment/src/test/locale/ar-kw.js +446 -0
  575. data/vendor/moment/src/test/locale/ar-ly.js +521 -0
  576. data/vendor/moment/src/test/locale/ar-ma.js +446 -0
  577. data/vendor/moment/src/test/locale/ar-sa.js +465 -0
  578. data/vendor/moment/src/test/locale/ar-tn.js +611 -0
  579. data/vendor/moment/src/test/locale/ar.js +521 -0
  580. data/vendor/moment/src/test/locale/az.js +453 -0
  581. data/vendor/moment/src/test/locale/be.js +575 -0
  582. data/vendor/moment/src/test/locale/bg.js +459 -0
  583. data/vendor/moment/src/test/locale/bm.js +408 -0
  584. data/vendor/moment/src/test/locale/bn-bd.js +473 -0
  585. data/vendor/moment/src/test/locale/bn.js +481 -0
  586. data/vendor/moment/src/test/locale/bo.js +501 -0
  587. data/vendor/moment/src/test/locale/br.js +541 -0
  588. data/vendor/moment/src/test/locale/bs.js +478 -0
  589. data/vendor/moment/src/test/locale/ca.js +472 -0
  590. data/vendor/moment/src/test/locale/cs.js +635 -0
  591. data/vendor/moment/src/test/locale/cv.js +459 -0
  592. data/vendor/moment/src/test/locale/cy.js +444 -0
  593. data/vendor/moment/src/test/locale/da.js +447 -0
  594. data/vendor/moment/src/test/locale/de-at.js +476 -0
  595. data/vendor/moment/src/test/locale/de-ch.js +481 -0
  596. data/vendor/moment/src/test/locale/de.js +480 -0
  597. data/vendor/moment/src/test/locale/dv.js +419 -0
  598. data/vendor/moment/src/test/locale/el.js +544 -0
  599. data/vendor/moment/src/test/locale/en-au.js +480 -0
  600. data/vendor/moment/src/test/locale/en-ca.js +451 -0
  601. data/vendor/moment/src/test/locale/en-gb.js +446 -0
  602. data/vendor/moment/src/test/locale/en-ie.js +446 -0
  603. data/vendor/moment/src/test/locale/en-il.js +454 -0
  604. data/vendor/moment/src/test/locale/en-in.js +464 -0
  605. data/vendor/moment/src/test/locale/en-nz.js +446 -0
  606. data/vendor/moment/src/test/locale/en-sg.js +430 -0
  607. data/vendor/moment/src/test/locale/en.js +562 -0
  608. data/vendor/moment/src/test/locale/eo.js +455 -0
  609. data/vendor/moment/src/test/locale/es-do.js +473 -0
  610. data/vendor/moment/src/test/locale/es-mx.js +514 -0
  611. data/vendor/moment/src/test/locale/es-us.js +489 -0
  612. data/vendor/moment/src/test/locale/es.js +476 -0
  613. data/vendor/moment/src/test/locale/et.js +533 -0
  614. data/vendor/moment/src/test/locale/eu.js +445 -0
  615. data/vendor/moment/src/test/locale/fa.js +461 -0
  616. data/vendor/moment/src/test/locale/fi.js +489 -0
  617. data/vendor/moment/src/test/locale/fil.js +448 -0
  618. data/vendor/moment/src/test/locale/fo.js +454 -0
  619. data/vendor/moment/src/test/locale/fr-ca.js +460 -0
  620. data/vendor/moment/src/test/locale/fr-ch.js +460 -0
  621. data/vendor/moment/src/test/locale/fr.js +482 -0
  622. data/vendor/moment/src/test/locale/fy.js +461 -0
  623. data/vendor/moment/src/test/locale/ga.js +445 -0
  624. data/vendor/moment/src/test/locale/gd.js +464 -0
  625. data/vendor/moment/src/test/locale/gl.js +466 -0
  626. data/vendor/moment/src/test/locale/gom-deva.js +445 -0
  627. data/vendor/moment/src/test/locale/gom-latn.js +459 -0
  628. data/vendor/moment/src/test/locale/gu.js +487 -0
  629. data/vendor/moment/src/test/locale/he.js +417 -0
  630. data/vendor/moment/src/test/locale/hi.js +484 -0
  631. data/vendor/moment/src/test/locale/hr.js +478 -0
  632. data/vendor/moment/src/test/locale/hu.js +468 -0
  633. data/vendor/moment/src/test/locale/hy-am.js +609 -0
  634. data/vendor/moment/src/test/locale/id.js +407 -0
  635. data/vendor/moment/src/test/locale/is.js +479 -0
  636. data/vendor/moment/src/test/locale/it-ch.js +427 -0
  637. data/vendor/moment/src/test/locale/it.js +479 -0
  638. data/vendor/moment/src/test/locale/ja.js +591 -0
  639. data/vendor/moment/src/test/locale/jv.js +418 -0
  640. data/vendor/moment/src/test/locale/ka.js +452 -0
  641. data/vendor/moment/src/test/locale/kk.js +445 -0
  642. data/vendor/moment/src/test/locale/km.js +471 -0
  643. data/vendor/moment/src/test/locale/kn.js +493 -0
  644. data/vendor/moment/src/test/locale/ko.js +496 -0
  645. data/vendor/moment/src/test/locale/ku.js +465 -0
  646. data/vendor/moment/src/test/locale/ky.js +445 -0
  647. data/vendor/moment/src/test/locale/lb.js +432 -0
  648. data/vendor/moment/src/test/locale/lo.js +445 -0
  649. data/vendor/moment/src/test/locale/lt.js +504 -0
  650. data/vendor/moment/src/test/locale/lv.js +567 -0
  651. data/vendor/moment/src/test/locale/me.js +481 -0
  652. data/vendor/moment/src/test/locale/mi.js +450 -0
  653. data/vendor/moment/src/test/locale/mk.js +460 -0
  654. data/vendor/moment/src/test/locale/ml.js +497 -0
  655. data/vendor/moment/src/test/locale/mn.js +555 -0
  656. data/vendor/moment/src/test/locale/mr.js +497 -0
  657. data/vendor/moment/src/test/locale/ms-my.js +454 -0
  658. data/vendor/moment/src/test/locale/ms.js +454 -0
  659. data/vendor/moment/src/test/locale/mt.js +446 -0
  660. data/vendor/moment/src/test/locale/my.js +616 -0
  661. data/vendor/moment/src/test/locale/nb.js +446 -0
  662. data/vendor/moment/src/test/locale/ne.js +484 -0
  663. data/vendor/moment/src/test/locale/nl-be.js +471 -0
  664. data/vendor/moment/src/test/locale/nl.js +471 -0
  665. data/vendor/moment/src/test/locale/nn.js +445 -0
  666. data/vendor/moment/src/test/locale/oc-lnc.js +440 -0
  667. data/vendor/moment/src/test/locale/pa-in.js +769 -0
  668. data/vendor/moment/src/test/locale/pl.js +557 -0
  669. data/vendor/moment/src/test/locale/pt-br.js +472 -0
  670. data/vendor/moment/src/test/locale/pt.js +449 -0
  671. data/vendor/moment/src/test/locale/ro.js +485 -0
  672. data/vendor/moment/src/test/locale/ru.js +706 -0
  673. data/vendor/moment/src/test/locale/sd.js +434 -0
  674. data/vendor/moment/src/test/locale/se.js +456 -0
  675. data/vendor/moment/src/test/locale/si.js +422 -0
  676. data/vendor/moment/src/test/locale/sk.js +640 -0
  677. data/vendor/moment/src/test/locale/sl.js +816 -0
  678. data/vendor/moment/src/test/locale/sq.js +457 -0
  679. data/vendor/moment/src/test/locale/sr-cyrl.js +478 -0
  680. data/vendor/moment/src/test/locale/sr.js +478 -0
  681. data/vendor/moment/src/test/locale/ss.js +510 -0
  682. data/vendor/moment/src/test/locale/sv.js +441 -0
  683. data/vendor/moment/src/test/locale/sw.js +449 -0
  684. data/vendor/moment/src/test/locale/ta.js +452 -0
  685. data/vendor/moment/src/test/locale/te.js +497 -0
  686. data/vendor/moment/src/test/locale/tet.js +446 -0
  687. data/vendor/moment/src/test/locale/tg.js +462 -0
  688. data/vendor/moment/src/test/locale/th.js +408 -0
  689. data/vendor/moment/src/test/locale/tk.js +445 -0
  690. data/vendor/moment/src/test/locale/tl-ph.js +448 -0
  691. data/vendor/moment/src/test/locale/tlh.js +484 -0
  692. data/vendor/moment/src/test/locale/tr.js +461 -0
  693. data/vendor/moment/src/test/locale/tzl.js +453 -0
  694. data/vendor/moment/src/test/locale/tzm-latn.js +449 -0
  695. data/vendor/moment/src/test/locale/tzm.js +449 -0
  696. data/vendor/moment/src/test/locale/ug-cn.js +427 -0
  697. data/vendor/moment/src/test/locale/uk.js +521 -0
  698. data/vendor/moment/src/test/locale/ur.js +439 -0
  699. data/vendor/moment/src/test/locale/uz-latn.js +450 -0
  700. data/vendor/moment/src/test/locale/uz.js +447 -0
  701. data/vendor/moment/src/test/locale/vi.js +452 -0
  702. data/vendor/moment/src/test/locale/x-pseudo.js +446 -0
  703. data/vendor/moment/src/test/locale/yo.js +447 -0
  704. data/vendor/moment/src/test/locale/zh-cn.js +459 -0
  705. data/vendor/moment/src/test/locale/zh-hk.js +443 -0
  706. data/vendor/moment/src/test/locale/zh-mo.js +427 -0
  707. data/vendor/moment/src/test/locale/zh-tw.js +443 -0
  708. data/vendor/moment/src/test/moment/add_subtract.js +545 -0
  709. data/vendor/moment/src/test/moment/calendar.js +214 -0
  710. data/vendor/moment/src/test/moment/create.js +2816 -0
  711. data/vendor/moment/src/test/moment/creation-data.js +40 -0
  712. data/vendor/moment/src/test/moment/days_in_month.js +122 -0
  713. data/vendor/moment/src/test/moment/days_in_year.js +11 -0
  714. data/vendor/moment/src/test/moment/deprecate.js +14 -0
  715. data/vendor/moment/src/test/moment/diff.js +624 -0
  716. data/vendor/moment/src/test/moment/duration.js +2024 -0
  717. data/vendor/moment/src/test/moment/duration_from_moments.js +53 -0
  718. data/vendor/moment/src/test/moment/duration_invalid.js +145 -0
  719. data/vendor/moment/src/test/moment/format.js +951 -0
  720. data/vendor/moment/src/test/moment/from_to.js +148 -0
  721. data/vendor/moment/src/test/moment/getters_setters.js +504 -0
  722. data/vendor/moment/src/test/moment/instanceof.js +42 -0
  723. data/vendor/moment/src/test/moment/invalid.js +212 -0
  724. data/vendor/moment/src/test/moment/is-leap-year.js +89 -0
  725. data/vendor/moment/src/test/moment/is_after.js +674 -0
  726. data/vendor/moment/src/test/moment/is_array.js +18 -0
  727. data/vendor/moment/src/test/moment/is_before.js +674 -0
  728. data/vendor/moment/src/test/moment/is_between.js +1082 -0
  729. data/vendor/moment/src/test/moment/is_date.js +32 -0
  730. data/vendor/moment/src/test/moment/is_moment.js +52 -0
  731. data/vendor/moment/src/test/moment/is_number.js +27 -0
  732. data/vendor/moment/src/test/moment/is_same.js +554 -0
  733. data/vendor/moment/src/test/moment/is_same_or_after.js +777 -0
  734. data/vendor/moment/src/test/moment/is_same_or_before.js +777 -0
  735. data/vendor/moment/src/test/moment/is_valid.js +563 -0
  736. data/vendor/moment/src/test/moment/leapyear.js +11 -0
  737. data/vendor/moment/src/test/moment/listers.js +172 -0
  738. data/vendor/moment/src/test/moment/locale.js +1029 -0
  739. data/vendor/moment/src/test/moment/locale_inheritance.js +332 -0
  740. data/vendor/moment/src/test/moment/locale_update.js +321 -0
  741. data/vendor/moment/src/test/moment/min_max.js +72 -0
  742. data/vendor/moment/src/test/moment/mutable.js +26 -0
  743. data/vendor/moment/src/test/moment/normalize_units.js +83 -0
  744. data/vendor/moment/src/test/moment/now.js +100 -0
  745. data/vendor/moment/src/test/moment/parsing_flags.js +434 -0
  746. data/vendor/moment/src/test/moment/preparse_postformat.js +121 -0
  747. data/vendor/moment/src/test/moment/quarter.js +117 -0
  748. data/vendor/moment/src/test/moment/relative_time.js +424 -0
  749. data/vendor/moment/src/test/moment/start_end_of.js +538 -0
  750. data/vendor/moment/src/test/moment/string_prototype.js +17 -0
  751. data/vendor/moment/src/test/moment/to_type.js +53 -0
  752. data/vendor/moment/src/test/moment/utc.js +138 -0
  753. data/vendor/moment/src/test/moment/utc_offset.js +894 -0
  754. data/vendor/moment/src/test/moment/week_year.js +1075 -0
  755. data/vendor/moment/src/test/moment/weekday.js +470 -0
  756. data/vendor/moment/src/test/moment/weeks.js +861 -0
  757. data/vendor/moment/src/test/moment/weeks_in_year.js +224 -0
  758. data/vendor/moment/src/test/moment/zone_switching.js +160 -0
  759. data/vendor/moment/src/test/moment/zones.js +840 -0
  760. data/vendor/moment/src/test/qunit-locale.js +32 -0
  761. data/vendor/moment/src/test/qunit.js +31 -0
  762. data/vendor/moment/tasks/bump_version.js +81 -0
  763. data/vendor/moment/tasks/check_sauce_creds.js +13 -0
  764. data/vendor/moment/tasks/component.js +13 -0
  765. data/vendor/moment/tasks/nuget.js +50 -0
  766. data/vendor/moment/tasks/qtest.js +56 -0
  767. data/vendor/moment/tasks/transpile.js +362 -0
  768. data/vendor/moment/tasks/update_index.js +32 -0
  769. data/vendor/moment/templates/default.js +5 -0
  770. data/vendor/moment/templates/empty.js +0 -0
  771. data/vendor/moment/templates/locale-header.js +6 -0
  772. data/vendor/moment/templates/test-header.js +6 -0
  773. data/vendor/moment/ts3.1-typing-tests/moment-tests.ts +547 -0
  774. data/vendor/moment/ts3.1-typing-tests/tsconfig.json +14 -0
  775. data/vendor/moment/ts3.1-typings/moment.d.ts +785 -0
  776. data/vendor/moment/typing-tests/moment-tests.ts +557 -0
  777. data/vendor/moment/typing-tests/tsconfig.json +12 -0
  778. data/vendor/tempusdominus/CONTRIBUTING.md +38 -0
  779. data/vendor/tempusdominus/Gruntfile.js +188 -0
  780. data/vendor/tempusdominus/LICENSE +21 -0
  781. data/vendor/tempusdominus/README.md +30 -0
  782. data/vendor/tempusdominus/build/css/tempusdominus-bootstrap-4.css +206 -0
  783. data/vendor/tempusdominus/build/css/tempusdominus-bootstrap-4.min.css +206 -0
  784. data/vendor/tempusdominus/build/js/tempusdominus-bootstrap-4.js +2779 -0
  785. data/vendor/tempusdominus/build/js/tempusdominus-bootstrap-4.min.js +7 -0
  786. data/vendor/tempusdominus/composer.json +29 -0
  787. data/vendor/tempusdominus/docs/Changelog/index.html +189 -0
  788. data/vendor/tempusdominus/docs/ContributorsGuide/index.html +290 -0
  789. data/vendor/tempusdominus/docs/Events/index.html +244 -0
  790. data/vendor/tempusdominus/docs/Extras/index.html +210 -0
  791. data/vendor/tempusdominus/docs/FAQ/index.html +186 -0
  792. data/vendor/tempusdominus/docs/Functions/index.html +239 -0
  793. data/vendor/tempusdominus/docs/Installing/index.html +233 -0
  794. data/vendor/tempusdominus/docs/Options/index.html +862 -0
  795. data/vendor/tempusdominus/docs/Usage/index.html +853 -0
  796. data/vendor/tempusdominus/docs/android-chrome-192x192.png +0 -0
  797. data/vendor/tempusdominus/docs/android-chrome-256x256.png +0 -0
  798. data/vendor/tempusdominus/docs/apple-touch-icon.png +0 -0
  799. data/vendor/tempusdominus/docs/browserconfig.xml +9 -0
  800. data/vendor/tempusdominus/docs/css/base.css +1705 -0
  801. data/vendor/tempusdominus/docs/css/tempusdominus-bootstrap-4.css +206 -0
  802. data/vendor/tempusdominus/docs/favicon-16x16.png +0 -0
  803. data/vendor/tempusdominus/docs/favicon-32x32.png +0 -0
  804. data/vendor/tempusdominus/docs/favicon.ico +0 -0
  805. data/vendor/tempusdominus/docs/index.html +208 -0
  806. data/vendor/tempusdominus/docs/js/base.js +62 -0
  807. data/vendor/tempusdominus/docs/js/tempusdominus-bootstrap-4.js +2779 -0
  808. data/vendor/tempusdominus/docs/manifest.json +18 -0
  809. data/vendor/tempusdominus/docs/mstile-150x150.png +0 -0
  810. data/vendor/tempusdominus/docs/safari-pinned-tab.svg +18 -0
  811. data/vendor/tempusdominus/docs/search/lunr.min.js +7 -0
  812. data/vendor/tempusdominus/docs/search/mustache.min.js +1 -0
  813. data/vendor/tempusdominus/docs/search/require.js +36 -0
  814. data/vendor/tempusdominus/docs/search/search-results-template.mustache +4 -0
  815. data/vendor/tempusdominus/docs/search/search.js +92 -0
  816. data/vendor/tempusdominus/docs/search/search_index.json +1084 -0
  817. data/vendor/tempusdominus/docs/search/text.js +390 -0
  818. data/vendor/tempusdominus/docs/sitemap.xml +84 -0
  819. data/vendor/tempusdominus/docs/theme/404.html +12 -0
  820. data/vendor/tempusdominus/docs/theme/android-chrome-192x192.png +0 -0
  821. data/vendor/tempusdominus/docs/theme/android-chrome-256x256.png +0 -0
  822. data/vendor/tempusdominus/docs/theme/apple-touch-icon.png +0 -0
  823. data/vendor/tempusdominus/docs/theme/base.html +105 -0
  824. data/vendor/tempusdominus/docs/theme/browserconfig.xml +9 -0
  825. data/vendor/tempusdominus/docs/theme/content.html +8 -0
  826. data/vendor/tempusdominus/docs/theme/css/base.css +1705 -0
  827. data/vendor/tempusdominus/docs/theme/css/tempusdominus-bootstrap-4.css +206 -0
  828. data/vendor/tempusdominus/docs/theme/favicon-16x16.png +0 -0
  829. data/vendor/tempusdominus/docs/theme/favicon-32x32.png +0 -0
  830. data/vendor/tempusdominus/docs/theme/favicon.ico +0 -0
  831. data/vendor/tempusdominus/docs/theme/js/base.js +62 -0
  832. data/vendor/tempusdominus/docs/theme/js/tempusdominus-bootstrap-4.js +2779 -0
  833. data/vendor/tempusdominus/docs/theme/main.html +1 -0
  834. data/vendor/tempusdominus/docs/theme/manifest.json +18 -0
  835. data/vendor/tempusdominus/docs/theme/mstile-150x150.png +0 -0
  836. data/vendor/tempusdominus/docs/theme/nav.html +32 -0
  837. data/vendor/tempusdominus/docs/theme/safari-pinned-tab.svg +18 -0
  838. data/vendor/tempusdominus/docs/theme/search-modal.html +24 -0
  839. data/vendor/tempusdominus/docs/theme/toc.html +13 -0
  840. data/vendor/tempusdominus/eslintrc.json +125 -0
  841. data/vendor/tempusdominus/mkdocs.yml +19 -0
  842. data/vendor/tempusdominus/package-lock.json +6426 -0
  843. data/vendor/tempusdominus/package.json +79 -0
  844. data/vendor/tempusdominus/src/docs/ChangeLog.md +20 -0
  845. data/vendor/tempusdominus/src/docs/ContributorsGuide.md +85 -0
  846. data/vendor/tempusdominus/src/docs/Events.md +95 -0
  847. data/vendor/tempusdominus/src/docs/Extras.md +49 -0
  848. data/vendor/tempusdominus/src/docs/FAQ.md +22 -0
  849. data/vendor/tempusdominus/src/docs/Functions.md +82 -0
  850. data/vendor/tempusdominus/src/docs/Installing.md +67 -0
  851. data/vendor/tempusdominus/src/docs/Options.md +940 -0
  852. data/vendor/tempusdominus/src/docs/Usage.md +724 -0
  853. data/vendor/tempusdominus/src/docs/index.md +53 -0
  854. data/vendor/tempusdominus/src/docs/theme/404.html +12 -0
  855. data/vendor/tempusdominus/src/docs/theme/android-chrome-192x192.png +0 -0
  856. data/vendor/tempusdominus/src/docs/theme/android-chrome-256x256.png +0 -0
  857. data/vendor/tempusdominus/src/docs/theme/apple-touch-icon.png +0 -0
  858. data/vendor/tempusdominus/src/docs/theme/base.html +105 -0
  859. data/vendor/tempusdominus/src/docs/theme/browserconfig.xml +9 -0
  860. data/vendor/tempusdominus/src/docs/theme/content.html +8 -0
  861. data/vendor/tempusdominus/src/docs/theme/css/base.css +1705 -0
  862. data/vendor/tempusdominus/src/docs/theme/css/tempusdominus-bootstrap-4.css +206 -0
  863. data/vendor/tempusdominus/src/docs/theme/favicon-16x16.png +0 -0
  864. data/vendor/tempusdominus/src/docs/theme/favicon-32x32.png +0 -0
  865. data/vendor/tempusdominus/src/docs/theme/favicon.ico +0 -0
  866. data/vendor/tempusdominus/src/docs/theme/js/base.js +62 -0
  867. data/vendor/tempusdominus/src/docs/theme/js/tempusdominus-bootstrap-4.js +2779 -0
  868. data/vendor/tempusdominus/src/docs/theme/main.html +1 -0
  869. data/vendor/tempusdominus/src/docs/theme/manifest.json +18 -0
  870. data/vendor/tempusdominus/src/docs/theme/mstile-150x150.png +0 -0
  871. data/vendor/tempusdominus/src/docs/theme/nav.html +32 -0
  872. data/vendor/tempusdominus/src/docs/theme/safari-pinned-tab.svg +18 -0
  873. data/vendor/tempusdominus/src/docs/theme/search-modal.html +24 -0
  874. data/vendor/tempusdominus/src/docs/theme/toc.html +13 -0
  875. data/vendor/tempusdominus/src/js/tempusdominus-bootstrap-4.js +1182 -0
  876. data/vendor/tempusdominus/src/sass/_tempusdominus-bootstrap-4.scss +342 -0
  877. data/vendor/tempusdominus/src/sass/tempusdominus-bootstrap-4-build.scss +17 -0
  878. data/vendor/tempusdominus/tasks/bump_version.js +75 -0
  879. metadata +882 -5
@@ -0,0 +1,2024 @@
1
+ import { module, test } from '../qunit';
2
+ import moment from '../../moment';
3
+
4
+ module('duration');
5
+
6
+ test('object instantiation', function (assert) {
7
+ var d = moment.duration({
8
+ years: 2,
9
+ months: 3,
10
+ weeks: 2,
11
+ days: 1,
12
+ hours: 8,
13
+ minutes: 9,
14
+ seconds: 20,
15
+ milliseconds: 12,
16
+ });
17
+
18
+ assert.equal(d.years(), 2, 'years');
19
+ assert.equal(d.months(), 3, 'months');
20
+ assert.equal(d.weeks(), 2, 'weeks');
21
+ assert.equal(d.days(), 15, 'days'); // two weeks + 1 day
22
+ assert.equal(d.hours(), 8, 'hours');
23
+ assert.equal(d.minutes(), 9, 'minutes');
24
+ assert.equal(d.seconds(), 20, 'seconds');
25
+ assert.equal(d.milliseconds(), 12, 'milliseconds');
26
+ });
27
+
28
+ test('object instantiation with strings', function (assert) {
29
+ var d = moment.duration({
30
+ years: '2',
31
+ months: '3',
32
+ weeks: '2',
33
+ days: '1',
34
+ hours: '8',
35
+ minutes: '9',
36
+ seconds: '20',
37
+ milliseconds: '12',
38
+ });
39
+
40
+ assert.equal(d.years(), 2, 'years');
41
+ assert.equal(d.months(), 3, 'months');
42
+ assert.equal(d.weeks(), 2, 'weeks');
43
+ assert.equal(d.days(), 15, 'days'); // two weeks + 1 day
44
+ assert.equal(d.hours(), 8, 'hours');
45
+ assert.equal(d.minutes(), 9, 'minutes');
46
+ assert.equal(d.seconds(), 20, 'seconds');
47
+ assert.equal(d.milliseconds(), 12, 'milliseconds');
48
+ });
49
+
50
+ test('milliseconds instantiation', function (assert) {
51
+ assert.equal(moment.duration(72).milliseconds(), 72, 'milliseconds');
52
+ assert.equal(
53
+ moment.duration(72).humanize(),
54
+ 'a few seconds',
55
+ 'Duration should be valid'
56
+ );
57
+ });
58
+
59
+ test('milliseconds instantiation with string', function (assert) {
60
+ assert.equal(moment.duration('72').milliseconds(), 72, 'milliseconds');
61
+ assert.equal(
62
+ moment.duration('72').humanize(),
63
+ 'a few seconds',
64
+ 'Duration should be valid'
65
+ );
66
+ });
67
+
68
+ test('undefined instantiation', function (assert) {
69
+ assert.equal(moment.duration(undefined).milliseconds(), 0, 'milliseconds');
70
+ assert.equal(moment.duration(undefined).isValid(), true, '_isValid');
71
+ assert.equal(
72
+ moment.duration(undefined).humanize(),
73
+ 'a few seconds',
74
+ 'Duration should be valid'
75
+ );
76
+ });
77
+
78
+ test('null instantiation', function (assert) {
79
+ assert.equal(moment.duration(null).milliseconds(), 0, 'milliseconds');
80
+ assert.equal(moment.duration(null).isValid(), true, '_isValid');
81
+ assert.equal(
82
+ moment.duration(null).humanize(),
83
+ 'a few seconds',
84
+ 'Duration should be valid'
85
+ );
86
+ });
87
+
88
+ test('NaN instantiation', function (assert) {
89
+ assert.ok(
90
+ isNaN(moment.duration(NaN).milliseconds()),
91
+ 'milliseconds should be NaN'
92
+ );
93
+ assert.equal(moment.duration(NaN).isValid(), false, '_isValid');
94
+ assert.equal(
95
+ moment.duration(NaN).humanize(),
96
+ 'Invalid date',
97
+ 'Duration should be invalid'
98
+ );
99
+ });
100
+
101
+ test('instantiation by type', function (assert) {
102
+ assert.equal(moment.duration(1, 'years').years(), 1, 'years');
103
+ assert.equal(moment.duration(1, 'y').years(), 1, 'y');
104
+ assert.equal(moment.duration(2, 'months').months(), 2, 'months');
105
+ assert.equal(moment.duration(2, 'M').months(), 2, 'M');
106
+ assert.equal(moment.duration(3, 'weeks').weeks(), 3, 'weeks');
107
+ assert.equal(moment.duration(3, 'w').weeks(), 3, 'weeks');
108
+ assert.equal(moment.duration(4, 'days').days(), 4, 'days');
109
+ assert.equal(moment.duration(4, 'd').days(), 4, 'd');
110
+ assert.equal(moment.duration(5, 'hours').hours(), 5, 'hours');
111
+ assert.equal(moment.duration(5, 'h').hours(), 5, 'h');
112
+ assert.equal(moment.duration(6, 'minutes').minutes(), 6, 'minutes');
113
+ assert.equal(moment.duration(6, 'm').minutes(), 6, 'm');
114
+ assert.equal(moment.duration(7, 'seconds').seconds(), 7, 'seconds');
115
+ assert.equal(moment.duration(7, 's').seconds(), 7, 's');
116
+ assert.equal(
117
+ moment.duration(8, 'milliseconds').milliseconds(),
118
+ 8,
119
+ 'milliseconds'
120
+ );
121
+ assert.equal(moment.duration(8, 'ms').milliseconds(), 8, 'ms');
122
+ });
123
+
124
+ test('instantiation by type with string', function (assert) {
125
+ assert.equal(moment.duration('1', 'years').years(), 1, 'years');
126
+ assert.equal(moment.duration('1', 'y').years(), 1, 'y');
127
+ assert.equal(moment.duration('2', 'months').months(), 2, 'months');
128
+ assert.equal(moment.duration('2', 'M').months(), 2, 'M');
129
+ assert.equal(moment.duration('3', 'weeks').weeks(), 3, 'weeks');
130
+ assert.equal(moment.duration('3', 'w').weeks(), 3, 'weeks');
131
+ assert.equal(moment.duration('4', 'days').days(), 4, 'days');
132
+ assert.equal(moment.duration('4', 'd').days(), 4, 'd');
133
+ assert.equal(moment.duration('5', 'hours').hours(), 5, 'hours');
134
+ assert.equal(moment.duration('5', 'h').hours(), 5, 'h');
135
+ assert.equal(moment.duration('6', 'minutes').minutes(), 6, 'minutes');
136
+ assert.equal(moment.duration('6', 'm').minutes(), 6, 'm');
137
+ assert.equal(moment.duration('7', 'seconds').seconds(), 7, 'seconds');
138
+ assert.equal(moment.duration('7', 's').seconds(), 7, 's');
139
+ assert.equal(
140
+ moment.duration('8', 'milliseconds').milliseconds(),
141
+ 8,
142
+ 'milliseconds'
143
+ );
144
+ assert.equal(moment.duration('8', 'ms').milliseconds(), 8, 'ms');
145
+ });
146
+
147
+ test('shortcuts', function (assert) {
148
+ assert.equal(moment.duration({ y: 1 }).years(), 1, 'years = y');
149
+ assert.equal(moment.duration({ M: 2 }).months(), 2, 'months = M');
150
+ assert.equal(moment.duration({ w: 3 }).weeks(), 3, 'weeks = w');
151
+ assert.equal(moment.duration({ d: 4 }).days(), 4, 'days = d');
152
+ assert.equal(moment.duration({ h: 5 }).hours(), 5, 'hours = h');
153
+ assert.equal(moment.duration({ m: 6 }).minutes(), 6, 'minutes = m');
154
+ assert.equal(moment.duration({ s: 7 }).seconds(), 7, 'seconds = s');
155
+ assert.equal(
156
+ moment.duration({ ms: 8 }).milliseconds(),
157
+ 8,
158
+ 'milliseconds = ms'
159
+ );
160
+ });
161
+
162
+ test('generic getter', function (assert) {
163
+ assert.equal(moment.duration(1, 'years').get('years'), 1, 'years');
164
+ assert.equal(moment.duration(1, 'years').get('year'), 1, 'years = year');
165
+ assert.equal(moment.duration(1, 'years').get('y'), 1, 'years = y');
166
+ assert.equal(moment.duration(2, 'months').get('months'), 2, 'months');
167
+ assert.equal(
168
+ moment.duration(2, 'months').get('month'),
169
+ 2,
170
+ 'months = month'
171
+ );
172
+ assert.equal(moment.duration(2, 'months').get('M'), 2, 'months = M');
173
+ assert.equal(moment.duration(3, 'weeks').get('weeks'), 3, 'weeks');
174
+ assert.equal(moment.duration(3, 'weeks').get('week'), 3, 'weeks = week');
175
+ assert.equal(moment.duration(3, 'weeks').get('w'), 3, 'weeks = w');
176
+ assert.equal(moment.duration(4, 'days').get('days'), 4, 'days');
177
+ assert.equal(moment.duration(4, 'days').get('day'), 4, 'days = day');
178
+ assert.equal(moment.duration(4, 'days').get('d'), 4, 'days = d');
179
+ assert.equal(moment.duration(5, 'hours').get('hours'), 5, 'hours');
180
+ assert.equal(moment.duration(5, 'hours').get('hour'), 5, 'hours = hour');
181
+ assert.equal(moment.duration(5, 'hours').get('h'), 5, 'hours = h');
182
+ assert.equal(moment.duration(6, 'minutes').get('minutes'), 6, 'minutes');
183
+ assert.equal(
184
+ moment.duration(6, 'minutes').get('minute'),
185
+ 6,
186
+ 'minutes = minute'
187
+ );
188
+ assert.equal(moment.duration(6, 'minutes').get('m'), 6, 'minutes = m');
189
+ assert.equal(moment.duration(7, 'seconds').get('seconds'), 7, 'seconds');
190
+ assert.equal(
191
+ moment.duration(7, 'seconds').get('second'),
192
+ 7,
193
+ 'seconds = second'
194
+ );
195
+ assert.equal(moment.duration(7, 'seconds').get('s'), 7, 'seconds = s');
196
+ assert.equal(
197
+ moment.duration(8, 'milliseconds').get('milliseconds'),
198
+ 8,
199
+ 'milliseconds'
200
+ );
201
+ assert.equal(
202
+ moment.duration(8, 'milliseconds').get('millisecond'),
203
+ 8,
204
+ 'milliseconds = millisecond'
205
+ );
206
+ assert.equal(
207
+ moment.duration(8, 'milliseconds').get('ms'),
208
+ 8,
209
+ 'milliseconds = ms'
210
+ );
211
+ });
212
+
213
+ test('instantiation from another duration', function (assert) {
214
+ var simple = moment.duration(1234),
215
+ lengthy = moment.duration(60 * 60 * 24 * 360 * 1e3),
216
+ complicated = moment.duration({
217
+ years: 2,
218
+ months: 3,
219
+ weeks: 4,
220
+ days: 1,
221
+ hours: 8,
222
+ minutes: 9,
223
+ seconds: 20,
224
+ milliseconds: 12,
225
+ }),
226
+ modified = moment.duration(1, 'day').add(moment.duration(1, 'day'));
227
+
228
+ assert.deepEqual(
229
+ moment.duration(simple),
230
+ simple,
231
+ 'simple clones are equal'
232
+ );
233
+ assert.deepEqual(
234
+ moment.duration(lengthy),
235
+ lengthy,
236
+ 'lengthy clones are equal'
237
+ );
238
+ assert.deepEqual(
239
+ moment.duration(complicated),
240
+ complicated,
241
+ 'complicated clones are equal'
242
+ );
243
+ assert.deepEqual(
244
+ moment.duration(modified),
245
+ modified,
246
+ 'cloning modified duration works'
247
+ );
248
+ });
249
+
250
+ test('explicit cloning', function (assert) {
251
+ var durationA = moment.duration(5, 'milliseconds'),
252
+ durationB = durationA.clone();
253
+ durationA.add(5, 'milliseconds');
254
+ assert.notEqual(
255
+ durationA.milliseconds(),
256
+ durationB.milliseconds(),
257
+ 'Calling duration.clone() on a duration will create a clone'
258
+ );
259
+ });
260
+
261
+ test('instantiation from 24-hour time zero', function (assert) {
262
+ assert.equal(moment.duration('00:00').years(), 0, '0 years');
263
+ assert.equal(moment.duration('00:00').days(), 0, '0 days');
264
+ assert.equal(moment.duration('00:00').hours(), 0, '0 hours');
265
+ assert.equal(moment.duration('00:00').minutes(), 0, '0 minutes');
266
+ assert.equal(moment.duration('00:00').seconds(), 0, '0 seconds');
267
+ assert.equal(moment.duration('00:00').milliseconds(), 0, '0 milliseconds');
268
+ });
269
+
270
+ test('instantiation from 24-hour time <24 hours', function (assert) {
271
+ assert.equal(moment.duration('06:45').years(), 0, '0 years');
272
+ assert.equal(moment.duration('06:45').days(), 0, '0 days');
273
+ assert.equal(moment.duration('06:45').hours(), 6, '6 hours');
274
+ assert.equal(moment.duration('06:45').minutes(), 45, '45 minutes');
275
+ assert.equal(moment.duration('06:45').seconds(), 0, '0 seconds');
276
+ assert.equal(moment.duration('06:45').milliseconds(), 0, '0 milliseconds');
277
+ });
278
+
279
+ test('instantiation from 24-hour time >24 hours', function (assert) {
280
+ assert.equal(moment.duration('26:45').years(), 0, '0 years');
281
+ assert.equal(moment.duration('26:45').days(), 1, '0 days');
282
+ assert.equal(moment.duration('26:45').hours(), 2, '2 hours');
283
+ assert.equal(moment.duration('26:45').minutes(), 45, '45 minutes');
284
+ assert.equal(moment.duration('26:45').seconds(), 0, '0 seconds');
285
+ assert.equal(moment.duration('26:45').milliseconds(), 0, '0 milliseconds');
286
+ });
287
+
288
+ test('instantiation from serialized C# TimeSpan zero', function (assert) {
289
+ assert.equal(moment.duration('00:00:00').years(), 0, '0 years');
290
+ assert.equal(moment.duration('00:00:00').days(), 0, '0 days');
291
+ assert.equal(moment.duration('00:00:00').hours(), 0, '0 hours');
292
+ assert.equal(moment.duration('00:00:00').minutes(), 0, '0 minutes');
293
+ assert.equal(moment.duration('00:00:00').seconds(), 0, '0 seconds');
294
+ assert.equal(
295
+ moment.duration('00:00:00').milliseconds(),
296
+ 0,
297
+ '0 milliseconds'
298
+ );
299
+ });
300
+
301
+ test('instantiation from serialized C# TimeSpan with days', function (assert) {
302
+ assert.equal(moment.duration('1.02:03:04.9999999').years(), 0, '0 years');
303
+ assert.equal(moment.duration('1.02:03:04.9999999').days(), 1, '1 day');
304
+ assert.equal(moment.duration('1.02:03:04.9999999').hours(), 2, '2 hours');
305
+ assert.equal(
306
+ moment.duration('1.02:03:04.9999999').minutes(),
307
+ 3,
308
+ '3 minutes'
309
+ );
310
+ assert.equal(
311
+ moment.duration('1.02:03:04.9999999').seconds(),
312
+ 5,
313
+ '5 seconds'
314
+ );
315
+ assert.equal(
316
+ moment.duration('1.02:03:04.9999999').milliseconds(),
317
+ 0,
318
+ '0 milliseconds'
319
+ );
320
+
321
+ assert.equal(moment.duration('1 02:03:04.9999999').years(), 0, '0 years');
322
+ assert.equal(moment.duration('1 02:03:04.9999999').days(), 1, '1 day');
323
+ assert.equal(moment.duration('1 02:03:04.9999999').hours(), 2, '2 hours');
324
+ assert.equal(
325
+ moment.duration('1 02:03:04.9999999').minutes(),
326
+ 3,
327
+ '3 minutes'
328
+ );
329
+ assert.equal(
330
+ moment.duration('1 02:03:04.9999999').seconds(),
331
+ 5,
332
+ '5 seconds'
333
+ );
334
+ assert.equal(
335
+ moment.duration('1 02:03:04.9999999').milliseconds(),
336
+ 0,
337
+ '0 milliseconds'
338
+ );
339
+ });
340
+
341
+ test('instantiation from serialized C# TimeSpan without days', function (assert) {
342
+ assert.equal(moment.duration('01:02:03.9999999').years(), 0, '0 years');
343
+ assert.equal(moment.duration('01:02:03.9999999').days(), 0, '0 days');
344
+ assert.equal(moment.duration('01:02:03.9999999').hours(), 1, '1 hour');
345
+ assert.equal(moment.duration('01:02:03.9999999').minutes(), 2, '2 minutes');
346
+ assert.equal(moment.duration('01:02:03.9999999').seconds(), 4, '4 seconds');
347
+ assert.equal(
348
+ moment.duration('01:02:03.9999999').milliseconds(),
349
+ 0,
350
+ '0 milliseconds'
351
+ );
352
+
353
+ assert.equal(moment.duration('23:59:59.9999999').days(), 1, '1 days');
354
+ assert.equal(moment.duration('23:59:59.9999999').hours(), 0, '0 hours');
355
+ assert.equal(moment.duration('23:59:59.9999999').minutes(), 0, '0 minutes');
356
+ assert.equal(moment.duration('23:59:59.9999999').seconds(), 0, '0 seconds');
357
+ assert.equal(
358
+ moment.duration('23:59:59.9999999').milliseconds(),
359
+ 0,
360
+ '0 milliseconds'
361
+ );
362
+
363
+ assert.equal(
364
+ moment.duration('500:59:59.8888888').days(),
365
+ 20,
366
+ '500 hours overflows to 20 days'
367
+ );
368
+ assert.equal(
369
+ moment.duration('500:59:59.8888888').hours(),
370
+ 20,
371
+ '500 hours overflows to 20 hours'
372
+ );
373
+ });
374
+
375
+ test('instantiation from serialized C# TimeSpan without days or milliseconds', function (assert) {
376
+ assert.equal(moment.duration('01:02:03').years(), 0, '0 years');
377
+ assert.equal(moment.duration('01:02:03').days(), 0, '0 days');
378
+ assert.equal(moment.duration('01:02:03').hours(), 1, '1 hour');
379
+ assert.equal(moment.duration('01:02:03').minutes(), 2, '2 minutes');
380
+ assert.equal(moment.duration('01:02:03').seconds(), 3, '3 seconds');
381
+ assert.equal(
382
+ moment.duration('01:02:03').milliseconds(),
383
+ 0,
384
+ '0 milliseconds'
385
+ );
386
+ });
387
+
388
+ test('instantiation from serialized C# TimeSpan without milliseconds', function (assert) {
389
+ assert.equal(moment.duration('1.02:03:04').years(), 0, '0 years');
390
+ assert.equal(moment.duration('1.02:03:04').days(), 1, '1 day');
391
+ assert.equal(moment.duration('1.02:03:04').hours(), 2, '2 hours');
392
+ assert.equal(moment.duration('1.02:03:04').minutes(), 3, '3 minutes');
393
+ assert.equal(moment.duration('1.02:03:04').seconds(), 4, '4 seconds');
394
+ assert.equal(
395
+ moment.duration('1.02:03:04').milliseconds(),
396
+ 0,
397
+ '0 milliseconds'
398
+ );
399
+ });
400
+
401
+ test('instantiation from serialized C# TimeSpan with low millisecond precision', function (assert) {
402
+ assert.equal(moment.duration('00:00:15.72').years(), 0, '0 years');
403
+ assert.equal(moment.duration('00:00:15.72').days(), 0, '0 days');
404
+ assert.equal(moment.duration('00:00:15.72').hours(), 0, '0 hours');
405
+ assert.equal(moment.duration('00:00:15.72').minutes(), 0, '0 minutes');
406
+ assert.equal(moment.duration('00:00:15.72').seconds(), 15, '15 seconds');
407
+ assert.equal(
408
+ moment.duration('00:00:15.72').milliseconds(),
409
+ 720,
410
+ '720 milliseconds'
411
+ );
412
+
413
+ assert.equal(
414
+ moment.duration('00:00:15.7').milliseconds(),
415
+ 700,
416
+ '700 milliseconds'
417
+ );
418
+
419
+ assert.equal(
420
+ moment.duration('00:00:15.').milliseconds(),
421
+ 0,
422
+ '0 milliseconds'
423
+ );
424
+ });
425
+
426
+ test('instantiation from serialized C# TimeSpan with high millisecond precision', function (assert) {
427
+ assert.equal(
428
+ moment.duration('00:00:15.7200000').seconds(),
429
+ 15,
430
+ '15 seconds'
431
+ );
432
+ assert.equal(
433
+ moment.duration('00:00:15.7200000').milliseconds(),
434
+ 720,
435
+ '720 milliseconds'
436
+ );
437
+
438
+ assert.equal(
439
+ moment.duration('00:00:15.7209999').seconds(),
440
+ 15,
441
+ '15 seconds'
442
+ );
443
+ assert.equal(
444
+ moment.duration('00:00:15.7209999').milliseconds(),
445
+ 721,
446
+ '721 milliseconds'
447
+ );
448
+
449
+ assert.equal(
450
+ moment.duration('00:00:15.7205000').seconds(),
451
+ 15,
452
+ '15 seconds'
453
+ );
454
+ assert.equal(
455
+ moment.duration('00:00:15.7205000').milliseconds(),
456
+ 721,
457
+ '721 milliseconds'
458
+ );
459
+
460
+ assert.equal(
461
+ moment.duration('-00:00:15.7205000').seconds(),
462
+ -15,
463
+ '15 seconds'
464
+ );
465
+ assert.equal(
466
+ moment.duration('-00:00:15.7205000').milliseconds(),
467
+ -721,
468
+ '721 milliseconds'
469
+ );
470
+
471
+ assert.equal(
472
+ moment.duration('+00:00:15.7205000').seconds(),
473
+ 15,
474
+ '15 seconds'
475
+ );
476
+ assert.equal(
477
+ moment.duration('+00:00:15.7205000').milliseconds(),
478
+ 721,
479
+ '721 milliseconds'
480
+ );
481
+ });
482
+
483
+ test('instantiation from serialized C# TimeSpan maxValue', function (assert) {
484
+ var d = moment.duration('10675199.02:48:05.4775807');
485
+
486
+ assert.equal(d.years(), 29227, '29227 years');
487
+ assert.equal(d.months(), 8, '8 months');
488
+ assert.equal(d.days(), 12, '12 day'); // if you have to change this value -- just do it
489
+
490
+ assert.equal(d.hours(), 2, '2 hours');
491
+ assert.equal(d.minutes(), 48, '48 minutes');
492
+ assert.equal(d.seconds(), 5, '5 seconds');
493
+ assert.equal(d.milliseconds(), 478, '478 milliseconds');
494
+ });
495
+
496
+ test('instantiation from serialized C# TimeSpan minValue', function (assert) {
497
+ var d = moment.duration('-10675199.02:48:05.4775808');
498
+
499
+ assert.equal(d.years(), -29227, '29653 years');
500
+ assert.equal(d.months(), -8, '8 day');
501
+ assert.equal(d.days(), -12, '12 day'); // if you have to change this value -- just do it
502
+
503
+ assert.equal(d.hours(), -2, '2 hours');
504
+ assert.equal(d.minutes(), -48, '48 minutes');
505
+ assert.equal(d.seconds(), -5, '5 seconds');
506
+ assert.equal(d.milliseconds(), -478, '478 milliseconds');
507
+ });
508
+
509
+ test('instantiation from serialized C# TimeSpan maxValue with + sign', function (assert) {
510
+ var d = moment.duration('+10675199.02:48:05.4775808');
511
+
512
+ assert.equal(d.years(), 29227, '29653 years');
513
+ assert.equal(d.months(), 8, '8 day');
514
+ assert.equal(d.days(), 12, '12 day'); // if you have to change this value -- just do it
515
+
516
+ assert.equal(d.hours(), 2, '2 hours');
517
+ assert.equal(d.minutes(), 48, '48 minutes');
518
+ assert.equal(d.seconds(), 5, '5 seconds');
519
+ assert.equal(d.milliseconds(), 478, '478 milliseconds');
520
+ });
521
+
522
+ test('instantiation from ISO 8601 duration', function (assert) {
523
+ assert.equal(
524
+ moment.duration('P1Y2M3DT4H5M6S').asSeconds(),
525
+ moment.duration({ y: 1, M: 2, d: 3, h: 4, m: 5, s: 6 }).asSeconds(),
526
+ 'all fields'
527
+ );
528
+ assert.equal(
529
+ moment.duration('P3W3D').asSeconds(),
530
+ moment.duration({ w: 3, d: 3 }).asSeconds(),
531
+ 'week and day fields'
532
+ );
533
+ assert.equal(
534
+ moment.duration('P1M').asSeconds(),
535
+ moment.duration({ M: 1 }).asSeconds(),
536
+ 'single month field'
537
+ );
538
+ assert.equal(
539
+ moment.duration('PT1M').asSeconds(),
540
+ moment.duration({ m: 1 }).asSeconds(),
541
+ 'single minute field'
542
+ );
543
+ assert.equal(
544
+ moment.duration('P1MT2H').asSeconds(),
545
+ moment.duration({ M: 1, h: 2 }).asSeconds(),
546
+ 'random fields missing'
547
+ );
548
+ assert.equal(
549
+ moment.duration('-P60D').asSeconds(),
550
+ moment.duration({ d: -60 }).asSeconds(),
551
+ 'negative days'
552
+ );
553
+ assert.equal(
554
+ moment.duration('+P60D').asSeconds(),
555
+ moment.duration({ d: 60 }).asSeconds(),
556
+ 'positive days'
557
+ );
558
+ assert.equal(
559
+ moment.duration('PT0.5S').asSeconds(),
560
+ moment.duration({ s: 0.5 }).asSeconds(),
561
+ 'fractional seconds'
562
+ );
563
+ assert.equal(
564
+ moment.duration('PT0,5S').asSeconds(),
565
+ moment.duration({ s: 0.5 }).asSeconds(),
566
+ 'fractional seconds (comma)'
567
+ );
568
+ });
569
+
570
+ test('serialization to ISO 8601 duration strings', function (assert) {
571
+ assert.equal(
572
+ moment.duration({ y: 1, M: 2, d: 3, h: 4, m: 5, s: 6 }).toISOString(),
573
+ 'P1Y2M3DT4H5M6S',
574
+ 'all fields'
575
+ );
576
+ assert.equal(
577
+ moment.duration({ M: -1 }).toISOString(),
578
+ '-P1M',
579
+ 'one month ago'
580
+ );
581
+ assert.equal(
582
+ moment.duration({ m: -1 }).toISOString(),
583
+ '-PT1M',
584
+ 'one minute ago'
585
+ );
586
+ assert.equal(
587
+ moment.duration({ s: -0.5 }).toISOString(),
588
+ '-PT0.5S',
589
+ 'one half second ago'
590
+ );
591
+ assert.equal(
592
+ moment.duration({ y: -1, M: 1 }).toISOString(),
593
+ '-P11M',
594
+ 'a month after a year ago'
595
+ );
596
+ assert.equal(
597
+ moment.duration({ y: -1, h: 1 }).toISOString(),
598
+ '-P1YT-1H',
599
+ 'an hour after a year ago'
600
+ );
601
+ assert.equal(
602
+ moment.duration({ y: -1, h: 1, m: -1 }).toISOString(),
603
+ '-P1YT-59M',
604
+ '59 minutes after a year ago'
605
+ );
606
+ assert.equal(
607
+ moment.duration({ y: -1, h: 1, s: -1 }).toISOString(),
608
+ '-P1YT-59M-59S',
609
+ '59 minutes 59 seconds after a year ago'
610
+ );
611
+ assert.equal(
612
+ moment.duration({ y: -1, h: -1, s: 1 }).toISOString(),
613
+ '-P1YT59M59S',
614
+ '59 minutes 59 seconds after a year ago'
615
+ );
616
+ assert.equal(
617
+ moment.duration({ y: -1, d: 2 }).toISOString(),
618
+ '-P1Y-2D',
619
+ '1 year less 2 days ago'
620
+ );
621
+ assert.equal(
622
+ moment.duration({ M: +1 }).toISOString(),
623
+ 'P1M',
624
+ 'one month ago'
625
+ );
626
+ assert.equal(
627
+ moment.duration({ m: +1 }).toISOString(),
628
+ 'PT1M',
629
+ 'one minute ago'
630
+ );
631
+ assert.equal(
632
+ moment.duration({ s: +0.5 }).toISOString(),
633
+ 'PT0.5S',
634
+ 'one half second ago'
635
+ );
636
+ assert.equal(
637
+ moment.duration({ y: +1, M: 1 }).toISOString(),
638
+ 'P1Y1M',
639
+ 'a month after a year in future'
640
+ );
641
+ assert.equal(
642
+ moment.duration({ y: -1, h: 1 }).toISOString(),
643
+ '-P1YT-1H',
644
+ 'an hour after a year ago'
645
+ );
646
+ assert.equal(moment.duration({}).toISOString(), 'P0D', 'zero duration');
647
+ assert.equal(
648
+ moment.duration({ M: 16, d: 40, s: 86465 }).toISOString(),
649
+ 'P1Y4M40DT24H1M5S',
650
+ 'all fields'
651
+ );
652
+ assert.equal(
653
+ moment.duration({ ms: 123456789 }).toISOString(),
654
+ 'PT34H17M36.789S',
655
+ 'check floating-point errors'
656
+ );
657
+ assert.equal(
658
+ moment.duration({ ms: 31952 }).toISOString(),
659
+ 'PT31.952S',
660
+ 'check floating-point errors'
661
+ );
662
+ });
663
+
664
+ test('toString acts as toISOString', function (assert) {
665
+ assert.equal(
666
+ moment.duration({ y: 1, M: 2, d: 3, h: 4, m: 5, s: 6 }).toString(),
667
+ 'P1Y2M3DT4H5M6S',
668
+ 'all fields'
669
+ );
670
+ assert.equal(
671
+ moment.duration({ M: -1 }).toString(),
672
+ '-P1M',
673
+ 'one month ago'
674
+ );
675
+ assert.equal(
676
+ moment.duration({ m: -1 }).toString(),
677
+ '-PT1M',
678
+ 'one minute ago'
679
+ );
680
+ assert.equal(
681
+ moment.duration({ s: -0.5 }).toString(),
682
+ '-PT0.5S',
683
+ 'one half second ago'
684
+ );
685
+ assert.equal(
686
+ moment.duration({ y: -1, M: 1 }).toString(),
687
+ '-P11M',
688
+ 'a month after a year ago'
689
+ );
690
+ assert.equal(moment.duration({ M: +1 }).toString(), 'P1M', 'one month ago');
691
+ assert.equal(
692
+ moment.duration({ m: +1 }).toString(),
693
+ 'PT1M',
694
+ 'one minute ago'
695
+ );
696
+ assert.equal(
697
+ moment.duration({ s: +0.5 }).toString(),
698
+ 'PT0.5S',
699
+ 'one half second ago'
700
+ );
701
+ assert.equal(
702
+ moment.duration({ y: +1, M: 1 }).toString(),
703
+ 'P1Y1M',
704
+ 'a month after a year in future'
705
+ );
706
+ assert.equal(moment.duration({}).toString(), 'P0D', 'zero duration');
707
+ assert.equal(
708
+ moment.duration({ M: 16, d: 40, s: 86465 }).toString(),
709
+ 'P1Y4M40DT24H1M5S',
710
+ 'all fields'
711
+ );
712
+ });
713
+
714
+ test('toIsoString deprecation', function (assert) {
715
+ test.expectedDeprecations('toIsoString()');
716
+
717
+ assert.equal(
718
+ moment.duration({}).toIsoString(),
719
+ moment.duration({}).toISOString(),
720
+ 'toIsoString delegates to toISOString'
721
+ );
722
+ });
723
+
724
+ test('`isodate` (python) test cases', function (assert) {
725
+ assert.equal(
726
+ moment.duration('P18Y9M4DT11H9M8S').asSeconds(),
727
+ moment.duration({ y: 18, M: 9, d: 4, h: 11, m: 9, s: 8 }).asSeconds(),
728
+ 'python isodate 1'
729
+ );
730
+ assert.equal(
731
+ moment.duration('P2W').asSeconds(),
732
+ moment.duration({ w: 2 }).asSeconds(),
733
+ 'python isodate 2'
734
+ );
735
+ assert.equal(
736
+ moment.duration('P3Y6M4DT12H30M5S').asSeconds(),
737
+ moment.duration({ y: 3, M: 6, d: 4, h: 12, m: 30, s: 5 }).asSeconds(),
738
+ 'python isodate 3'
739
+ );
740
+ assert.equal(
741
+ moment.duration('P23DT23H').asSeconds(),
742
+ moment.duration({ d: 23, h: 23 }).asSeconds(),
743
+ 'python isodate 4'
744
+ );
745
+ assert.equal(
746
+ moment.duration('P4Y').asSeconds(),
747
+ moment.duration({ y: 4 }).asSeconds(),
748
+ 'python isodate 5'
749
+ );
750
+ assert.equal(
751
+ moment.duration('P1M').asSeconds(),
752
+ moment.duration({ M: 1 }).asSeconds(),
753
+ 'python isodate 6'
754
+ );
755
+ assert.equal(
756
+ moment.duration('PT1M').asSeconds(),
757
+ moment.duration({ m: 1 }).asSeconds(),
758
+ 'python isodate 7'
759
+ );
760
+ assert.equal(
761
+ moment.duration('P0.5Y').asSeconds(),
762
+ moment.duration({ y: 0.5 }).asSeconds(),
763
+ 'python isodate 8'
764
+ );
765
+ assert.equal(
766
+ moment.duration('PT36H').asSeconds(),
767
+ moment.duration({ h: 36 }).asSeconds(),
768
+ 'python isodate 9'
769
+ );
770
+ assert.equal(
771
+ moment.duration('P1DT12H').asSeconds(),
772
+ moment.duration({ d: 1, h: 12 }).asSeconds(),
773
+ 'python isodate 10'
774
+ );
775
+ assert.equal(
776
+ moment.duration('-P2W').asSeconds(),
777
+ moment.duration({ w: -2 }).asSeconds(),
778
+ 'python isodate 11'
779
+ );
780
+ assert.equal(
781
+ moment.duration('-P2.2W').asSeconds(),
782
+ moment.duration({ w: -2.2 }).asSeconds(),
783
+ 'python isodate 12'
784
+ );
785
+ assert.equal(
786
+ moment.duration('+P2W').asSeconds(),
787
+ moment.duration({ w: 2 }).asSeconds(),
788
+ 'python isodate 11'
789
+ );
790
+ assert.equal(
791
+ moment.duration('+P2.2W').asSeconds(),
792
+ moment.duration({ w: 2.2 }).asSeconds(),
793
+ 'python isodate 12'
794
+ );
795
+ assert.equal(
796
+ moment.duration('P1DT2H3M4S').asSeconds(),
797
+ moment.duration({ d: 1, h: 2, m: 3, s: 4 }).asSeconds(),
798
+ 'python isodate 13'
799
+ );
800
+ assert.equal(
801
+ moment.duration('P1DT2H3M').asSeconds(),
802
+ moment.duration({ d: 1, h: 2, m: 3 }).asSeconds(),
803
+ 'python isodate 14'
804
+ );
805
+ assert.equal(
806
+ moment.duration('P1DT2H').asSeconds(),
807
+ moment.duration({ d: 1, h: 2 }).asSeconds(),
808
+ 'python isodate 15'
809
+ );
810
+ assert.equal(
811
+ moment.duration('PT2H').asSeconds(),
812
+ moment.duration({ h: 2 }).asSeconds(),
813
+ 'python isodate 16'
814
+ );
815
+ assert.equal(
816
+ moment.duration('PT2.3H').asSeconds(),
817
+ moment.duration({ h: 2.3 }).asSeconds(),
818
+ 'python isodate 17'
819
+ );
820
+ assert.equal(
821
+ moment.duration('PT2H3M4S').asSeconds(),
822
+ moment.duration({ h: 2, m: 3, s: 4 }).asSeconds(),
823
+ 'python isodate 18'
824
+ );
825
+ assert.equal(
826
+ moment.duration('PT3M4S').asSeconds(),
827
+ moment.duration({ m: 3, s: 4 }).asSeconds(),
828
+ 'python isodate 19'
829
+ );
830
+ assert.equal(
831
+ moment.duration('PT22S').asSeconds(),
832
+ moment.duration({ s: 22 }).asSeconds(),
833
+ 'python isodate 20'
834
+ );
835
+ assert.equal(
836
+ moment.duration('PT22.22S').asSeconds(),
837
+ moment.duration({ s: 22.22 }).asSeconds(),
838
+ 'python isodate 21'
839
+ );
840
+ assert.equal(
841
+ moment.duration('-P2Y').asSeconds(),
842
+ moment.duration({ y: -2 }).asSeconds(),
843
+ 'python isodate 22'
844
+ );
845
+ assert.equal(
846
+ moment.duration('-P3Y6M4DT12H30M5S').asSeconds(),
847
+ moment
848
+ .duration({ y: -3, M: -6, d: -4, h: -12, m: -30, s: -5 })
849
+ .asSeconds(),
850
+ 'python isodate 23'
851
+ );
852
+ assert.equal(
853
+ moment.duration('-P1DT2H3M4S').asSeconds(),
854
+ moment.duration({ d: -1, h: -2, m: -3, s: -4 }).asSeconds(),
855
+ 'python isodate 24'
856
+ );
857
+ assert.equal(
858
+ moment.duration('PT-6H3M').asSeconds(),
859
+ moment.duration({ h: -6, m: 3 }).asSeconds(),
860
+ 'python isodate 25'
861
+ );
862
+ assert.equal(
863
+ moment.duration('-PT-6H3M').asSeconds(),
864
+ moment.duration({ h: 6, m: -3 }).asSeconds(),
865
+ 'python isodate 26'
866
+ );
867
+ assert.equal(
868
+ moment.duration('-P-3Y-6M-4DT-12H-30M-5S').asSeconds(),
869
+ moment.duration({ y: 3, M: 6, d: 4, h: 12, m: 30, s: 5 }).asSeconds(),
870
+ 'python isodate 27'
871
+ );
872
+ assert.equal(
873
+ moment.duration('P-3Y-6M-4DT-12H-30M-5S').asSeconds(),
874
+ moment
875
+ .duration({ y: -3, M: -6, d: -4, h: -12, m: -30, s: -5 })
876
+ .asSeconds(),
877
+ 'python isodate 28'
878
+ );
879
+ assert.equal(
880
+ moment.duration('-P-2W').asSeconds(),
881
+ moment.duration({ w: 2 }).asSeconds(),
882
+ 'python isodate 29'
883
+ );
884
+ assert.equal(
885
+ moment.duration('P-2W').asSeconds(),
886
+ moment.duration({ w: -2 }).asSeconds(),
887
+ 'python isodate 30'
888
+ );
889
+ assert.equal(
890
+ moment.duration('+P2Y').asSeconds(),
891
+ moment.duration({ y: 2 }).asSeconds(),
892
+ 'python isodate 31'
893
+ );
894
+ assert.equal(
895
+ moment.duration('+P3Y6M4DT12H30M5S').asSeconds(),
896
+ moment.duration({ y: 3, M: 6, d: 4, h: 12, m: 30, s: 5 }).asSeconds(),
897
+ 'python isodate 32'
898
+ );
899
+ assert.equal(
900
+ moment.duration('+P1DT2H3M4S').asSeconds(),
901
+ moment.duration({ d: 1, h: 2, m: 3, s: 4 }).asSeconds(),
902
+ 'python isodate 34'
903
+ );
904
+ assert.equal(
905
+ moment.duration('PT+6H3M').asSeconds(),
906
+ moment.duration({ h: 6, m: 3 }).asSeconds(),
907
+ 'python isodate 35'
908
+ );
909
+ assert.equal(
910
+ moment.duration('+PT+6H3M').asSeconds(),
911
+ moment.duration({ h: 6, m: 3 }).asSeconds(),
912
+ 'python isodate 36'
913
+ );
914
+ assert.equal(
915
+ moment.duration('+PT-6H3M').asSeconds(),
916
+ moment.duration({ h: -6, m: 3 }).asSeconds(),
917
+ 'python isodate 37'
918
+ );
919
+ assert.equal(
920
+ moment.duration('+P+3Y+6M+4DT+12H+30M+5S').asSeconds(),
921
+ moment.duration({ y: 3, M: 6, d: 4, h: 12, m: 30, s: 5 }).asSeconds(),
922
+ 'python isodate 38'
923
+ );
924
+ assert.equal(
925
+ moment.duration('+P-3Y-6M-4DT-12H-30M-5S').asSeconds(),
926
+ moment
927
+ .duration({ y: -3, M: -6, d: -4, h: -12, m: -30, s: -5 })
928
+ .asSeconds(),
929
+ 'python isodate 39'
930
+ );
931
+ assert.equal(
932
+ moment.duration('P+3Y+6M+4DT+12H+30M+5S').asSeconds(),
933
+ moment.duration({ y: 3, M: 6, d: 4, h: 12, m: 30, s: 5 }).asSeconds(),
934
+ 'python isodate 40'
935
+ );
936
+ assert.equal(
937
+ moment.duration('+P+2W').asSeconds(),
938
+ moment.duration({ w: 2 }).asSeconds(),
939
+ 'python isodate 41'
940
+ );
941
+ assert.equal(
942
+ moment.duration('+P-2W').asSeconds(),
943
+ moment.duration({ w: -2 }).asSeconds(),
944
+ 'python isodate 41'
945
+ );
946
+ assert.equal(
947
+ moment.duration('P+2W').asSeconds(),
948
+ moment.duration({ w: 2 }).asSeconds(),
949
+ 'python isodate 43'
950
+ );
951
+ });
952
+
953
+ test('ISO 8601 misuse cases', function (assert) {
954
+ assert.equal(moment.duration('P').asSeconds(), 0, 'lonely P');
955
+ assert.equal(moment.duration('PT').asSeconds(), 0, 'just P and T');
956
+ assert.equal(moment.duration('P1H').asSeconds(), 0, 'missing T');
957
+ assert.equal(moment.duration('P1D1Y').asSeconds(), 0, 'out of order');
958
+ assert.equal(
959
+ moment.duration('PT.5S').asSeconds(),
960
+ 0.5,
961
+ 'accept no leading zero for decimal'
962
+ );
963
+ assert.equal(
964
+ moment.duration('PT1,S').asSeconds(),
965
+ 1,
966
+ 'accept trailing decimal separator'
967
+ );
968
+ assert.equal(
969
+ moment.duration('PT1M0,,5S').asSeconds(),
970
+ 60,
971
+ 'extra decimal separators are ignored as 0'
972
+ );
973
+ });
974
+
975
+ test('humanize', function (assert) {
976
+ moment.locale('en');
977
+ assert.equal(
978
+ moment.duration({ seconds: 44 }).humanize(),
979
+ 'a few seconds',
980
+ '44 seconds = a few seconds'
981
+ );
982
+ assert.equal(
983
+ moment.duration({ seconds: 45 }).humanize(),
984
+ 'a minute',
985
+ '45 seconds = a minute'
986
+ );
987
+ assert.equal(
988
+ moment.duration({ seconds: 89 }).humanize(),
989
+ 'a minute',
990
+ '89 seconds = a minute'
991
+ );
992
+ assert.equal(
993
+ moment.duration({ seconds: 90 }).humanize(),
994
+ '2 minutes',
995
+ '90 seconds = 2 minutes'
996
+ );
997
+ assert.equal(
998
+ moment.duration({ minutes: 44 }).humanize(),
999
+ '44 minutes',
1000
+ '44 minutes = 44 minutes'
1001
+ );
1002
+ assert.equal(
1003
+ moment.duration({ minutes: 45 }).humanize(),
1004
+ 'an hour',
1005
+ '45 minutes = an hour'
1006
+ );
1007
+ assert.equal(
1008
+ moment.duration({ minutes: 89 }).humanize(),
1009
+ 'an hour',
1010
+ '89 minutes = an hour'
1011
+ );
1012
+ assert.equal(
1013
+ moment.duration({ minutes: 90 }).humanize(),
1014
+ '2 hours',
1015
+ '90 minutes = 2 hours'
1016
+ );
1017
+ assert.equal(
1018
+ moment.duration({ hours: 5 }).humanize(),
1019
+ '5 hours',
1020
+ '5 hours = 5 hours'
1021
+ );
1022
+ assert.equal(
1023
+ moment.duration({ hours: 21 }).humanize(),
1024
+ '21 hours',
1025
+ '21 hours = 21 hours'
1026
+ );
1027
+ assert.equal(
1028
+ moment.duration({ hours: 22 }).humanize(),
1029
+ 'a day',
1030
+ '22 hours = a day'
1031
+ );
1032
+ assert.equal(
1033
+ moment.duration({ hours: 35 }).humanize(),
1034
+ 'a day',
1035
+ '35 hours = a day'
1036
+ );
1037
+ assert.equal(
1038
+ moment.duration({ hours: 36 }).humanize(),
1039
+ '2 days',
1040
+ '36 hours = 2 days'
1041
+ );
1042
+ assert.equal(
1043
+ moment.duration({ days: 1 }).humanize(),
1044
+ 'a day',
1045
+ '1 day = a day'
1046
+ );
1047
+ assert.equal(
1048
+ moment.duration({ days: 5 }).humanize(),
1049
+ '5 days',
1050
+ '5 days = 5 days'
1051
+ );
1052
+ assert.equal(
1053
+ moment.duration({ weeks: 1 }).humanize(),
1054
+ '7 days',
1055
+ '1 week = 7 days'
1056
+ );
1057
+ assert.equal(
1058
+ moment.duration({ days: 25 }).humanize(),
1059
+ '25 days',
1060
+ '25 days = 25 days'
1061
+ );
1062
+ assert.equal(
1063
+ moment.duration({ days: 26 }).humanize(),
1064
+ 'a month',
1065
+ '26 days = a month'
1066
+ );
1067
+ assert.equal(
1068
+ moment.duration({ days: 30 }).humanize(),
1069
+ 'a month',
1070
+ '30 days = a month'
1071
+ );
1072
+ assert.equal(
1073
+ moment.duration({ days: 45 }).humanize(),
1074
+ 'a month',
1075
+ '45 days = a month'
1076
+ );
1077
+ assert.equal(
1078
+ moment.duration({ days: 46 }).humanize(),
1079
+ '2 months',
1080
+ '46 days = 2 months'
1081
+ );
1082
+ assert.equal(
1083
+ moment.duration({ days: 74 }).humanize(),
1084
+ '2 months',
1085
+ '74 days = 2 months'
1086
+ );
1087
+ assert.equal(
1088
+ moment.duration({ days: 77 }).humanize(),
1089
+ '3 months',
1090
+ '77 days = 3 months'
1091
+ );
1092
+ assert.equal(
1093
+ moment.duration({ months: 1 }).humanize(),
1094
+ 'a month',
1095
+ '1 month = a month'
1096
+ );
1097
+ assert.equal(
1098
+ moment.duration({ months: 5 }).humanize(),
1099
+ '5 months',
1100
+ '5 months = 5 months'
1101
+ );
1102
+ assert.equal(
1103
+ moment.duration({ days: 344 }).humanize(),
1104
+ 'a year',
1105
+ '344 days = a year'
1106
+ );
1107
+ assert.equal(
1108
+ moment.duration({ days: 345 }).humanize(),
1109
+ 'a year',
1110
+ '345 days = a year'
1111
+ );
1112
+ assert.equal(
1113
+ moment.duration({ days: 547 }).humanize(),
1114
+ 'a year',
1115
+ '547 days = a year'
1116
+ );
1117
+ assert.equal(
1118
+ moment.duration({ days: 548 }).humanize(),
1119
+ '2 years',
1120
+ '548 days = 2 years'
1121
+ );
1122
+ assert.equal(
1123
+ moment.duration({ years: 1 }).humanize(),
1124
+ 'a year',
1125
+ '1 year = a year'
1126
+ );
1127
+ assert.equal(
1128
+ moment.duration({ years: 5 }).humanize(),
1129
+ '5 years',
1130
+ '5 years = 5 years'
1131
+ );
1132
+ assert.equal(
1133
+ moment.duration(7200000).humanize(),
1134
+ '2 hours',
1135
+ '7200000 = 2 hours'
1136
+ );
1137
+ });
1138
+
1139
+ test('humanize duration with suffix', function (assert) {
1140
+ moment.locale('en');
1141
+ assert.equal(
1142
+ moment.duration({ seconds: 44 }).humanize(true),
1143
+ 'in a few seconds',
1144
+ '44 seconds = a few seconds'
1145
+ );
1146
+ assert.equal(
1147
+ moment.duration({ seconds: -44 }).humanize(true),
1148
+ 'a few seconds ago',
1149
+ '44 seconds = a few seconds'
1150
+ );
1151
+ assert.equal(
1152
+ moment.duration({ seconds: +44 }).humanize(true),
1153
+ 'in a few seconds',
1154
+ '44 seconds = a few seconds'
1155
+ );
1156
+ });
1157
+
1158
+ test('humanize duration with thresholds', function (assert) {
1159
+ var thresholds = { s: 9 };
1160
+ moment.locale('en');
1161
+ assert.equal(
1162
+ moment.duration({ seconds: -10 }).humanize(thresholds),
1163
+ 'a minute',
1164
+ '10 seconds = a minute (with thresholds)'
1165
+ );
1166
+ assert.equal(
1167
+ moment.duration({ seconds: 10 }).humanize(true, thresholds),
1168
+ 'in a minute',
1169
+ '10 seconds = a minute (with thresholds and suffix)'
1170
+ );
1171
+ assert.equal(
1172
+ moment.duration({ weeks: 3 }).humanize(true, { d: 7, w: 4 }),
1173
+ 'in 3 weeks',
1174
+ 'in 3 weeks = in 3 weeks (with thresholds and suffix)'
1175
+ );
1176
+ assert.equal(
1177
+ moment.duration({ weeks: 3 }).humanize(false, { d: 7, w: 4 }),
1178
+ '3 weeks',
1179
+ '3 weeks = 3 weeks (with thresholds and suffix == false)'
1180
+ );
1181
+ });
1182
+
1183
+ test('bubble value up', function (assert) {
1184
+ assert.equal(
1185
+ moment.duration({ milliseconds: 61001 }).milliseconds(),
1186
+ 1,
1187
+ '61001 milliseconds has 1 millisecond left over'
1188
+ );
1189
+ assert.equal(
1190
+ moment.duration({ milliseconds: 61001 }).seconds(),
1191
+ 1,
1192
+ '61001 milliseconds has 1 second left over'
1193
+ );
1194
+ assert.equal(
1195
+ moment.duration({ milliseconds: 61001 }).minutes(),
1196
+ 1,
1197
+ '61001 milliseconds has 1 minute left over'
1198
+ );
1199
+
1200
+ assert.equal(
1201
+ moment.duration({ minutes: 350 }).minutes(),
1202
+ 50,
1203
+ '350 minutes has 50 minutes left over'
1204
+ );
1205
+ assert.equal(
1206
+ moment.duration({ minutes: 350 }).hours(),
1207
+ 5,
1208
+ '350 minutes has 5 hours left over'
1209
+ );
1210
+ });
1211
+
1212
+ test('clipping', function (assert) {
1213
+ assert.equal(
1214
+ moment.duration({ months: 11 }).months(),
1215
+ 11,
1216
+ '11 months is 11 months'
1217
+ );
1218
+ assert.equal(
1219
+ moment.duration({ months: 11 }).years(),
1220
+ 0,
1221
+ '11 months makes no year'
1222
+ );
1223
+ assert.equal(
1224
+ moment.duration({ months: 12 }).months(),
1225
+ 0,
1226
+ '12 months is 0 months left over'
1227
+ );
1228
+ assert.equal(
1229
+ moment.duration({ months: 12 }).years(),
1230
+ 1,
1231
+ '12 months makes 1 year'
1232
+ );
1233
+ assert.equal(
1234
+ moment.duration({ months: 13 }).months(),
1235
+ 1,
1236
+ '13 months is 1 month left over'
1237
+ );
1238
+ assert.equal(
1239
+ moment.duration({ months: 13 }).years(),
1240
+ 1,
1241
+ '13 months makes 1 year'
1242
+ );
1243
+
1244
+ assert.equal(
1245
+ moment.duration({ days: 30 }).days(),
1246
+ 30,
1247
+ '30 days is 30 days'
1248
+ );
1249
+ assert.equal(
1250
+ moment.duration({ days: 30 }).months(),
1251
+ 0,
1252
+ '30 days makes no month'
1253
+ );
1254
+ assert.equal(
1255
+ moment.duration({ days: 31 }).days(),
1256
+ 0,
1257
+ '31 days is 0 days left over'
1258
+ );
1259
+ assert.equal(
1260
+ moment.duration({ days: 31 }).months(),
1261
+ 1,
1262
+ '31 days is a month'
1263
+ );
1264
+ assert.equal(
1265
+ moment.duration({ days: 32 }).days(),
1266
+ 1,
1267
+ '32 days is 1 day left over'
1268
+ );
1269
+ assert.equal(
1270
+ moment.duration({ days: 32 }).months(),
1271
+ 1,
1272
+ '32 days is a month'
1273
+ );
1274
+
1275
+ assert.equal(
1276
+ moment.duration({ hours: 23 }).hours(),
1277
+ 23,
1278
+ '23 hours is 23 hours'
1279
+ );
1280
+ assert.equal(
1281
+ moment.duration({ hours: 23 }).days(),
1282
+ 0,
1283
+ '23 hours makes no day'
1284
+ );
1285
+ assert.equal(
1286
+ moment.duration({ hours: 24 }).hours(),
1287
+ 0,
1288
+ '24 hours is 0 hours left over'
1289
+ );
1290
+ assert.equal(
1291
+ moment.duration({ hours: 24 }).days(),
1292
+ 1,
1293
+ '24 hours makes 1 day'
1294
+ );
1295
+ assert.equal(
1296
+ moment.duration({ hours: 25 }).hours(),
1297
+ 1,
1298
+ '25 hours is 1 hour left over'
1299
+ );
1300
+ assert.equal(
1301
+ moment.duration({ hours: 25 }).days(),
1302
+ 1,
1303
+ '25 hours makes 1 day'
1304
+ );
1305
+ });
1306
+
1307
+ test('bubbling consistency', function (assert) {
1308
+ var days = 0,
1309
+ months = 0,
1310
+ newDays,
1311
+ newMonths,
1312
+ totalDays,
1313
+ d;
1314
+ for (totalDays = 1; totalDays <= 500; ++totalDays) {
1315
+ d = moment.duration(totalDays, 'days');
1316
+ newDays = d.days();
1317
+ newMonths = d.months() + d.years() * 12;
1318
+ assert.ok(
1319
+ (months === newMonths && days + 1 === newDays) ||
1320
+ (months + 1 === newMonths && newDays === 0),
1321
+ 'consistent total days ' +
1322
+ totalDays +
1323
+ ' was ' +
1324
+ months +
1325
+ ' ' +
1326
+ days +
1327
+ ' now ' +
1328
+ newMonths +
1329
+ ' ' +
1330
+ newDays
1331
+ );
1332
+ days = newDays;
1333
+ months = newMonths;
1334
+ }
1335
+ });
1336
+
1337
+ test('effective equivalency', function (assert) {
1338
+ assert.deepEqual(
1339
+ moment.duration({ seconds: 1 })._data,
1340
+ moment.duration({ milliseconds: 1000 })._data,
1341
+ '1 second is the same as 1000 milliseconds'
1342
+ );
1343
+ assert.deepEqual(
1344
+ moment.duration({ seconds: 60 })._data,
1345
+ moment.duration({ minutes: 1 })._data,
1346
+ '1 minute is the same as 60 seconds'
1347
+ );
1348
+ assert.deepEqual(
1349
+ moment.duration({ minutes: 60 })._data,
1350
+ moment.duration({ hours: 1 })._data,
1351
+ '1 hour is the same as 60 minutes'
1352
+ );
1353
+ assert.deepEqual(
1354
+ moment.duration({ hours: 24 })._data,
1355
+ moment.duration({ days: 1 })._data,
1356
+ '1 day is the same as 24 hours'
1357
+ );
1358
+ assert.deepEqual(
1359
+ moment.duration({ days: 7 })._data,
1360
+ moment.duration({ weeks: 1 })._data,
1361
+ '1 week is the same as 7 days'
1362
+ );
1363
+ assert.deepEqual(
1364
+ moment.duration({ days: 31 })._data,
1365
+ moment.duration({ months: 1 })._data,
1366
+ '1 month is the same as 30 days'
1367
+ );
1368
+ assert.deepEqual(
1369
+ moment.duration({ months: 12 })._data,
1370
+ moment.duration({ years: 1 })._data,
1371
+ '1 years is the same as 12 months'
1372
+ );
1373
+ });
1374
+
1375
+ test('asGetters', function (assert) {
1376
+ // 400 years have exactly 146097 days
1377
+
1378
+ // years
1379
+ assert.equal(moment.duration(1, 'year').asYears(), 1, '1 year as years');
1380
+ assert.equal(
1381
+ moment.duration(1, 'year').asQuarters(),
1382
+ 4,
1383
+ '1 year as quarters'
1384
+ );
1385
+ assert.equal(moment.duration(1, 'year').asMonths(), 12, '1 year as months');
1386
+ assert.equal(
1387
+ moment.duration(400, 'year').asMonths(),
1388
+ 4800,
1389
+ '400 years as months'
1390
+ );
1391
+ assert.equal(
1392
+ moment.duration(1, 'year').asWeeks().toFixed(3),
1393
+ 52.143,
1394
+ '1 year as weeks'
1395
+ );
1396
+ assert.equal(moment.duration(1, 'year').asDays(), 365, '1 year as days');
1397
+ assert.equal(moment.duration(2, 'year').asDays(), 730, '2 years as days');
1398
+ assert.equal(moment.duration(3, 'year').asDays(), 1096, '3 years as days');
1399
+ assert.equal(moment.duration(4, 'year').asDays(), 1461, '4 years as days');
1400
+ assert.equal(
1401
+ moment.duration(400, 'year').asDays(),
1402
+ 146097,
1403
+ '400 years as days'
1404
+ );
1405
+ assert.equal(moment.duration(1, 'year').asHours(), 8760, '1 year as hours');
1406
+ assert.equal(
1407
+ moment.duration(1, 'year').asMinutes(),
1408
+ 525600,
1409
+ '1 year as minutes'
1410
+ );
1411
+ assert.equal(
1412
+ moment.duration(1, 'year').asSeconds(),
1413
+ 31536000,
1414
+ '1 year as seconds'
1415
+ );
1416
+ assert.equal(
1417
+ moment.duration(1, 'year').asMilliseconds(),
1418
+ 31536000000,
1419
+ '1 year as milliseconds'
1420
+ );
1421
+
1422
+ // quarters
1423
+ assert.equal(
1424
+ moment.duration(1, 'quarter').asYears(),
1425
+ 0.25,
1426
+ '1 quarter as years'
1427
+ );
1428
+ assert.equal(
1429
+ moment.duration(1, 'quarter').asQuarters(),
1430
+ 1,
1431
+ '1 quarter as quarters'
1432
+ );
1433
+ assert.equal(
1434
+ moment.duration(1, 'quarter').asMonths(),
1435
+ 3,
1436
+ '1 quarter as months'
1437
+ );
1438
+ assert.equal(
1439
+ moment.duration(2, 'quarter').asWeeks().toFixed(3),
1440
+ 26.143,
1441
+ '2 month as quarters'
1442
+ );
1443
+ assert.equal(
1444
+ moment.duration(1, 'quarter').asDays(),
1445
+ 91,
1446
+ '1 quarter as days'
1447
+ );
1448
+ assert.equal(
1449
+ moment.duration(2, 'quarter').asDays(),
1450
+ 183,
1451
+ '2 quarter as days'
1452
+ );
1453
+ assert.equal(
1454
+ moment.duration(3, 'quarter').asDays(),
1455
+ 274,
1456
+ '4 quarter as days'
1457
+ );
1458
+ assert.equal(
1459
+ moment.duration(4, 'quarter').asDays(),
1460
+ 365,
1461
+ '4 quarter as days'
1462
+ );
1463
+ assert.equal(
1464
+ moment.duration(1, 'quarter').asHours(),
1465
+ 2184,
1466
+ '1 quarter as hours'
1467
+ );
1468
+ assert.equal(
1469
+ moment.duration(3, 'quarter').asHours(),
1470
+ 6576,
1471
+ '3 quarter as hours'
1472
+ );
1473
+ assert.equal(
1474
+ moment.duration(2, 'quarter').asMinutes(),
1475
+ 263520,
1476
+ '2 quarter as minutes'
1477
+ );
1478
+ assert.equal(
1479
+ moment.duration(3, 'quarter').asSeconds(),
1480
+ 23673600,
1481
+ '3 quarter as seconds'
1482
+ );
1483
+ assert.equal(
1484
+ moment.duration(1, 'quarter').asMilliseconds(),
1485
+ 7862400000,
1486
+ '1 quarter as milliseconds'
1487
+ );
1488
+
1489
+ // months
1490
+ assert.equal(
1491
+ moment.duration(1, 'month').asYears().toFixed(4),
1492
+ 0.0833,
1493
+ '1 month as years'
1494
+ );
1495
+ assert.equal(
1496
+ moment.duration(6, 'month').asQuarters(),
1497
+ 2,
1498
+ '6 month as quarters'
1499
+ );
1500
+ assert.equal(
1501
+ moment.duration(1, 'month').asMonths(),
1502
+ 1,
1503
+ '1 month as months'
1504
+ );
1505
+ assert.equal(
1506
+ moment.duration(1, 'month').asWeeks().toFixed(3),
1507
+ 4.286,
1508
+ '1 month as weeks'
1509
+ );
1510
+ assert.equal(moment.duration(1, 'month').asDays(), 30, '1 month as days');
1511
+ assert.equal(moment.duration(2, 'month').asDays(), 61, '2 months as days');
1512
+ assert.equal(moment.duration(3, 'month').asDays(), 91, '3 months as days');
1513
+ assert.equal(moment.duration(4, 'month').asDays(), 122, '4 months as days');
1514
+ assert.equal(moment.duration(5, 'month').asDays(), 152, '5 months as days');
1515
+ assert.equal(moment.duration(6, 'month').asDays(), 183, '6 months as days');
1516
+ assert.equal(moment.duration(7, 'month').asDays(), 213, '7 months as days');
1517
+ assert.equal(moment.duration(8, 'month').asDays(), 243, '8 months as days');
1518
+ assert.equal(moment.duration(9, 'month').asDays(), 274, '9 months as days');
1519
+ assert.equal(
1520
+ moment.duration(10, 'month').asDays(),
1521
+ 304,
1522
+ '10 months as days'
1523
+ );
1524
+ assert.equal(
1525
+ moment.duration(11, 'month').asDays(),
1526
+ 335,
1527
+ '11 months as days'
1528
+ );
1529
+ assert.equal(
1530
+ moment.duration(12, 'month').asDays(),
1531
+ 365,
1532
+ '12 months as days'
1533
+ );
1534
+ assert.equal(
1535
+ moment.duration(24, 'month').asDays(),
1536
+ 730,
1537
+ '24 months as days'
1538
+ );
1539
+ assert.equal(
1540
+ moment.duration(36, 'month').asDays(),
1541
+ 1096,
1542
+ '36 months as days'
1543
+ );
1544
+ assert.equal(
1545
+ moment.duration(48, 'month').asDays(),
1546
+ 1461,
1547
+ '48 months as days'
1548
+ );
1549
+ assert.equal(
1550
+ moment.duration(4800, 'month').asDays(),
1551
+ 146097,
1552
+ '4800 months as days'
1553
+ );
1554
+ assert.equal(
1555
+ moment.duration(1, 'month').asHours(),
1556
+ 720,
1557
+ '1 month as hours'
1558
+ );
1559
+ assert.equal(
1560
+ moment.duration(1, 'month').asMinutes(),
1561
+ 43200,
1562
+ '1 month as minutes'
1563
+ );
1564
+ assert.equal(
1565
+ moment.duration(1, 'month').asSeconds(),
1566
+ 2592000,
1567
+ '1 month as seconds'
1568
+ );
1569
+ assert.equal(
1570
+ moment.duration(1, 'month').asMilliseconds(),
1571
+ 2592000000,
1572
+ '1 month as milliseconds'
1573
+ );
1574
+
1575
+ // weeks
1576
+ assert.equal(
1577
+ moment.duration(1, 'week').asYears().toFixed(4),
1578
+ 0.0192,
1579
+ '1 week as years'
1580
+ );
1581
+ assert.equal(
1582
+ moment.duration(1, 'week').asQuarters().toFixed(4),
1583
+ 0.0767,
1584
+ '1 week as quarters'
1585
+ );
1586
+ assert.equal(
1587
+ moment.duration(1, 'week').asMonths().toFixed(3),
1588
+ 0.23,
1589
+ '1 week as months'
1590
+ );
1591
+ assert.equal(moment.duration(1, 'week').asWeeks(), 1, '1 week as weeks');
1592
+ assert.equal(moment.duration(1, 'week').asDays(), 7, '1 week as days');
1593
+ assert.equal(moment.duration(1, 'week').asHours(), 168, '1 week as hours');
1594
+ assert.equal(
1595
+ moment.duration(1, 'week').asMinutes(),
1596
+ 10080,
1597
+ '1 week as minutes'
1598
+ );
1599
+ assert.equal(
1600
+ moment.duration(1, 'week').asSeconds(),
1601
+ 604800,
1602
+ '1 week as seconds'
1603
+ );
1604
+ assert.equal(
1605
+ moment.duration(1, 'week').asMilliseconds(),
1606
+ 604800000,
1607
+ '1 week as milliseconds'
1608
+ );
1609
+
1610
+ // days
1611
+ assert.equal(
1612
+ moment.duration(1, 'day').asYears().toFixed(4),
1613
+ 0.0027,
1614
+ '1 day as years'
1615
+ );
1616
+ assert.equal(
1617
+ moment.duration(1, 'day').asQuarters().toFixed(4),
1618
+ 0.011,
1619
+ '1 day as quarters'
1620
+ );
1621
+ assert.equal(
1622
+ moment.duration(1, 'day').asMonths().toFixed(3),
1623
+ 0.033,
1624
+ '1 day as months'
1625
+ );
1626
+ assert.equal(
1627
+ moment.duration(1, 'day').asWeeks().toFixed(3),
1628
+ 0.143,
1629
+ '1 day as weeks'
1630
+ );
1631
+ assert.equal(moment.duration(1, 'day').asDays(), 1, '1 day as days');
1632
+ assert.equal(moment.duration(1, 'day').asHours(), 24, '1 day as hours');
1633
+ assert.equal(
1634
+ moment.duration(1, 'day').asMinutes(),
1635
+ 1440,
1636
+ '1 day as minutes'
1637
+ );
1638
+ assert.equal(
1639
+ moment.duration(1, 'day').asSeconds(),
1640
+ 86400,
1641
+ '1 day as seconds'
1642
+ );
1643
+ assert.equal(
1644
+ moment.duration(1, 'day').asMilliseconds(),
1645
+ 86400000,
1646
+ '1 day as milliseconds'
1647
+ );
1648
+
1649
+ // hours
1650
+ assert.equal(
1651
+ moment.duration(1, 'hour').asYears().toFixed(6),
1652
+ 0.000114,
1653
+ '1 hour as years'
1654
+ );
1655
+ assert.equal(
1656
+ moment.duration(1, 'hour').asQuarters().toFixed(6),
1657
+ 0.000456,
1658
+ '1 hour as quarters'
1659
+ );
1660
+ assert.equal(
1661
+ moment.duration(1, 'hour').asMonths().toFixed(5),
1662
+ 0.00137,
1663
+ '1 hour as months'
1664
+ );
1665
+ assert.equal(
1666
+ moment.duration(1, 'hour').asWeeks().toFixed(5),
1667
+ 0.00595,
1668
+ '1 hour as weeks'
1669
+ );
1670
+ assert.equal(
1671
+ moment.duration(1, 'hour').asDays().toFixed(4),
1672
+ 0.0417,
1673
+ '1 hour as days'
1674
+ );
1675
+ assert.equal(moment.duration(1, 'hour').asHours(), 1, '1 hour as hours');
1676
+ assert.equal(
1677
+ moment.duration(1, 'hour').asMinutes(),
1678
+ 60,
1679
+ '1 hour as minutes'
1680
+ );
1681
+ assert.equal(
1682
+ moment.duration(1, 'hour').asSeconds(),
1683
+ 3600,
1684
+ '1 hour as seconds'
1685
+ );
1686
+ assert.equal(
1687
+ moment.duration(1, 'hour').asMilliseconds(),
1688
+ 3600000,
1689
+ '1 hour as milliseconds'
1690
+ );
1691
+
1692
+ // minutes
1693
+ assert.equal(
1694
+ moment.duration(1, 'minute').asYears().toFixed(8),
1695
+ 0.0000019,
1696
+ '1 minute as years'
1697
+ );
1698
+ assert.equal(
1699
+ moment.duration(1, 'minute').asQuarters().toFixed(8),
1700
+ 0.00000761,
1701
+ '1 minute as quarters'
1702
+ );
1703
+ assert.equal(
1704
+ moment.duration(1, 'minute').asMonths().toFixed(7),
1705
+ 0.0000228,
1706
+ '1 minute as months'
1707
+ );
1708
+ assert.equal(
1709
+ moment.duration(1, 'minute').asWeeks().toFixed(7),
1710
+ 0.0000992,
1711
+ '1 minute as weeks'
1712
+ );
1713
+ assert.equal(
1714
+ moment.duration(1, 'minute').asDays().toFixed(6),
1715
+ 0.000694,
1716
+ '1 minute as days'
1717
+ );
1718
+ assert.equal(
1719
+ moment.duration(1, 'minute').asHours().toFixed(4),
1720
+ 0.0167,
1721
+ '1 minute as hours'
1722
+ );
1723
+ assert.equal(
1724
+ moment.duration(1, 'minute').asMinutes(),
1725
+ 1,
1726
+ '1 minute as minutes'
1727
+ );
1728
+ assert.equal(
1729
+ moment.duration(1, 'minute').asSeconds(),
1730
+ 60,
1731
+ '1 minute as seconds'
1732
+ );
1733
+ assert.equal(
1734
+ moment.duration(1, 'minute').asMilliseconds(),
1735
+ 60000,
1736
+ '1 minute as milliseconds'
1737
+ );
1738
+
1739
+ // seconds
1740
+ assert.equal(
1741
+ moment.duration(1, 'second').asYears().toFixed(10),
1742
+ 0.0000000317,
1743
+ '1 second as years'
1744
+ );
1745
+ assert.equal(
1746
+ moment.duration(1, 'second').asQuarters().toFixed(10),
1747
+ 0.0000001268,
1748
+ '1 second as quarters'
1749
+ );
1750
+ assert.equal(
1751
+ moment.duration(1, 'second').asMonths().toFixed(9),
1752
+ 0.00000038,
1753
+ '1 second as months'
1754
+ );
1755
+ assert.equal(
1756
+ moment.duration(1, 'second').asWeeks().toFixed(8),
1757
+ 0.00000165,
1758
+ '1 second as weeks'
1759
+ );
1760
+ assert.equal(
1761
+ moment.duration(1, 'second').asDays().toFixed(7),
1762
+ 0.0000116,
1763
+ '1 second as days'
1764
+ );
1765
+ assert.equal(
1766
+ moment.duration(1, 'second').asHours().toFixed(6),
1767
+ 0.000278,
1768
+ '1 second as hours'
1769
+ );
1770
+ assert.equal(
1771
+ moment.duration(1, 'second').asMinutes().toFixed(4),
1772
+ 0.0167,
1773
+ '1 second as minutes'
1774
+ );
1775
+ assert.equal(
1776
+ moment.duration(1, 'second').asSeconds(),
1777
+ 1,
1778
+ '1 second as seconds'
1779
+ );
1780
+ assert.equal(
1781
+ moment.duration(1, 'second').asMilliseconds(),
1782
+ 1000,
1783
+ '1 second as milliseconds'
1784
+ );
1785
+
1786
+ // milliseconds
1787
+ assert.equal(
1788
+ moment.duration(1, 'millisecond').asYears().toFixed(13),
1789
+ 0.0000000000317,
1790
+ '1 millisecond as years'
1791
+ );
1792
+ assert.equal(
1793
+ moment.duration(1, 'millisecond').asQuarters().toFixed(13),
1794
+ 0.0000000001268,
1795
+ '1 millisecond as quarters'
1796
+ );
1797
+ assert.equal(
1798
+ moment.duration(1, 'millisecond').asMonths().toFixed(12),
1799
+ 0.00000000038,
1800
+ '1 millisecond as months'
1801
+ );
1802
+ assert.equal(
1803
+ moment.duration(1, 'millisecond').asWeeks().toFixed(11),
1804
+ 0.00000000165,
1805
+ '1 millisecond as weeks'
1806
+ );
1807
+ assert.equal(
1808
+ moment.duration(1, 'millisecond').asDays().toFixed(10),
1809
+ 0.0000000116,
1810
+ '1 millisecond as days'
1811
+ );
1812
+ assert.equal(
1813
+ moment.duration(1, 'millisecond').asHours().toFixed(9),
1814
+ 0.000000278,
1815
+ '1 millisecond as hours'
1816
+ );
1817
+ assert.equal(
1818
+ moment.duration(1, 'millisecond').asMinutes().toFixed(7),
1819
+ 0.0000167,
1820
+ '1 millisecond as minutes'
1821
+ );
1822
+ assert.equal(
1823
+ moment.duration(1, 'millisecond').asSeconds(),
1824
+ 0.001,
1825
+ '1 millisecond as seconds'
1826
+ );
1827
+ assert.equal(
1828
+ moment.duration(1, 'millisecond').asMilliseconds(),
1829
+ 1,
1830
+ '1 millisecond as milliseconds'
1831
+ );
1832
+ });
1833
+
1834
+ test('as getters for small units', function (assert) {
1835
+ var dS = moment.duration(1, 'milliseconds'),
1836
+ ds = moment.duration(3, 'seconds'),
1837
+ dm = moment.duration(13, 'minutes');
1838
+
1839
+ // Tests for issue #1867.
1840
+ // Floating point errors for small duration units were introduced in version 2.8.0.
1841
+ assert.equal(dS.as('milliseconds'), 1, 'as("milliseconds")');
1842
+ assert.equal(dS.asMilliseconds(), 1, 'asMilliseconds()');
1843
+ assert.equal(ds.as('seconds'), 3, 'as("seconds")');
1844
+ assert.equal(ds.asSeconds(), 3, 'asSeconds()');
1845
+ assert.equal(dm.as('minutes'), 13, 'as("minutes")');
1846
+ assert.equal(dm.asMinutes(), 13, 'asMinutes()');
1847
+ });
1848
+
1849
+ test('minutes getter for floating point hours', function (assert) {
1850
+ // Tests for issue #2978.
1851
+ // For certain floating point hours, .minutes() getter produced incorrect values due to the rounding errors
1852
+ assert.equal(moment.duration(2.3, 'h').minutes(), 18, 'minutes()');
1853
+ assert.equal(moment.duration(4.1, 'h').minutes(), 6, 'minutes()');
1854
+ });
1855
+
1856
+ test('isDuration', function (assert) {
1857
+ assert.ok(
1858
+ moment.isDuration(moment.duration(12345678)),
1859
+ 'correctly says true'
1860
+ );
1861
+ assert.ok(!moment.isDuration(moment()), 'moment object is not a duration');
1862
+ assert.ok(
1863
+ !moment.isDuration({ milliseconds: 1 }),
1864
+ 'plain object is not a duration'
1865
+ );
1866
+ });
1867
+
1868
+ test('add', function (assert) {
1869
+ var d = moment.duration({ months: 4, weeks: 3, days: 2 });
1870
+ // for some reason, d._data._months does not get updated; use d._months instead.
1871
+ assert.equal(d.add(1, 'month')._months, 5, 'Add months');
1872
+ assert.equal(d.add(5, 'days')._days, 28, 'Add days');
1873
+ assert.equal(d.add(10000)._milliseconds, 10000, 'Add milliseconds');
1874
+ assert.equal(
1875
+ d.add({ h: 23, m: 59 })._milliseconds,
1876
+ 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 10000,
1877
+ 'Add hour:minute'
1878
+ );
1879
+ });
1880
+
1881
+ test('add to moment', function (assert) {
1882
+ var d = moment.duration({ months: 1, seconds: -1 }),
1883
+ m = moment('2017-03-01').add(d);
1884
+ assert.equal(m.month(), 2, 'Adds months before time');
1885
+ assert.equal(m.date(), 31, 'Adds time after months');
1886
+ });
1887
+
1888
+ test('add and bubble', function (assert) {
1889
+ var d;
1890
+
1891
+ assert.equal(
1892
+ moment.duration(1, 'second').add(1000, 'milliseconds').seconds(),
1893
+ 2,
1894
+ 'Adding milliseconds should bubble up to seconds'
1895
+ );
1896
+ assert.equal(
1897
+ moment.duration(1, 'minute').add(60, 'second').minutes(),
1898
+ 2,
1899
+ 'Adding seconds should bubble up to minutes'
1900
+ );
1901
+ assert.equal(
1902
+ moment.duration(1, 'hour').add(60, 'minutes').hours(),
1903
+ 2,
1904
+ 'Adding minutes should bubble up to hours'
1905
+ );
1906
+ assert.equal(
1907
+ moment.duration(1, 'day').add(24, 'hours').days(),
1908
+ 2,
1909
+ 'Adding hours should bubble up to days'
1910
+ );
1911
+
1912
+ d = moment.duration(-1, 'day').add(1, 'hour');
1913
+ assert.equal(d.hours(), -23, '-1 day + 1 hour == -23 hour (component)');
1914
+ assert.equal(d.asHours(), -23, '-1 day + 1 hour == -23 hours');
1915
+
1916
+ d = moment.duration(+1, 'day').add(1, 'hour');
1917
+ assert.equal(d.hours(), 1, '1 day + 1 hour == 1 hour (component)');
1918
+ assert.equal(d.asHours(), 25, '1 day + 1 hour == 25 hour');
1919
+
1920
+ d = moment.duration(-1, 'year').add(1, 'day');
1921
+ assert.equal(d.days(), -30, '- 1 year + 1 day == -30 days (component)');
1922
+ assert.equal(d.months(), -11, '- 1 year + 1 day == -11 months (component)');
1923
+ assert.equal(d.years(), 0, '- 1 year + 1 day == 0 years (component)');
1924
+ assert.equal(d.asDays(), -364, '- 1 year + 1 day == -364 days');
1925
+
1926
+ d = moment.duration(+1, 'year').add(1, 'day');
1927
+ assert.equal(d.days(), 1, '+ 1 year + 1 day == 1 days (component)');
1928
+ assert.equal(d.months(), 0, '+ 1 year + 1 day == 0 month (component)');
1929
+ assert.equal(d.years(), 1, '+ 1 year + 1 day == 1 year (component)');
1930
+ assert.equal(d.asDays(), 366, '+ 1 year + 1 day == +366 day');
1931
+
1932
+ d = moment.duration(-1, 'year').add(1, 'hour');
1933
+ assert.equal(d.hours(), -23, '- 1 year + 1 hour == -23 hours (component)');
1934
+ assert.equal(d.days(), -30, '- 1 year + 1 hour == -30 days (component)');
1935
+ assert.equal(
1936
+ d.months(),
1937
+ -11,
1938
+ '- 1 year + 1 hour == -11 months (component)'
1939
+ );
1940
+ assert.equal(d.years(), 0, '- 1 year + 1 hour == 0 years (component)');
1941
+
1942
+ d = moment.duration(+1, 'year').add(1, 'hour');
1943
+ assert.equal(d.hours(), 1, '+ 1 year + 1 hour == 1 hour (component)');
1944
+ assert.equal(d.days(), 0, '+ 1 year + 1 hour == 1 day (component)');
1945
+ assert.equal(d.months(), 0, '+ 1 year + 1 hour == 1 month (component)');
1946
+ assert.equal(d.years(), 1, '+ 1 year + 1 hour == 1 year (component)');
1947
+ });
1948
+
1949
+ test('subtract and bubble', function (assert) {
1950
+ var d;
1951
+
1952
+ assert.equal(
1953
+ moment.duration(2, 'second').subtract(1000, 'milliseconds').seconds(),
1954
+ 1,
1955
+ 'Subtracting milliseconds should bubble up to seconds'
1956
+ );
1957
+ assert.equal(
1958
+ moment.duration(2, 'minute').subtract(60, 'second').minutes(),
1959
+ 1,
1960
+ 'Subtracting seconds should bubble up to minutes'
1961
+ );
1962
+ assert.equal(
1963
+ moment.duration(2, 'hour').subtract(60, 'minutes').hours(),
1964
+ 1,
1965
+ 'Subtracting minutes should bubble up to hours'
1966
+ );
1967
+ assert.equal(
1968
+ moment.duration(2, 'day').subtract(24, 'hours').days(),
1969
+ 1,
1970
+ 'Subtracting hours should bubble up to days'
1971
+ );
1972
+
1973
+ d = moment.duration(1, 'day').subtract(1, 'hour');
1974
+ assert.equal(d.hours(), 23, '1 day - 1 hour == 23 hour (component)');
1975
+ assert.equal(d.asHours(), 23, '1 day - 1 hour == 23 hours');
1976
+
1977
+ d = moment.duration(1, 'year').subtract(1, 'day');
1978
+ assert.equal(d.days(), 30, '1 year - 1 day == 30 days (component)');
1979
+ assert.equal(d.months(), 11, '1 year - 1 day == 11 months (component)');
1980
+ assert.equal(d.years(), 0, '1 year - 1 day == 0 years (component)');
1981
+ assert.equal(d.asDays(), 364, '1 year - 1 day == 364 days');
1982
+
1983
+ d = moment.duration(1, 'year').subtract(1, 'hour');
1984
+ assert.equal(d.hours(), 23, '1 year - 1 hour == 23 hours (component)');
1985
+ assert.equal(d.days(), 30, '1 year - 1 hour == 30 days (component)');
1986
+ assert.equal(d.months(), 11, '1 year - 1 hour == 11 months (component)');
1987
+ assert.equal(d.years(), 0, '1 year - 1 hour == 0 years (component)');
1988
+ });
1989
+
1990
+ test('subtract', function (assert) {
1991
+ var d = moment.duration({ months: 2, weeks: 2, days: 0, hours: 5 });
1992
+ // for some reason, d._data._months does not get updated; use d._months instead.
1993
+ assert.equal(d.subtract(1, 'months')._months, 1, 'Subtract months');
1994
+ assert.equal(d.subtract(14, 'days')._days, 0, 'Subtract days');
1995
+ assert.equal(
1996
+ d.subtract(10000)._milliseconds,
1997
+ 5 * 60 * 60 * 1000 - 10000,
1998
+ 'Subtract milliseconds'
1999
+ );
2000
+ assert.equal(
2001
+ d.subtract({ h: 1, m: 59 })._milliseconds,
2002
+ 3 * 60 * 60 * 1000 + 1 * 60 * 1000 - 10000,
2003
+ 'Subtract hour:minute'
2004
+ );
2005
+ });
2006
+
2007
+ test('JSON.stringify duration', function (assert) {
2008
+ var d = moment.duration(1024, 'h');
2009
+
2010
+ assert.equal(
2011
+ JSON.stringify(d),
2012
+ '"' + d.toISOString() + '"',
2013
+ 'JSON.stringify on duration should return ISO string'
2014
+ );
2015
+ });
2016
+
2017
+ test('duration plugins', function (assert) {
2018
+ var durationObject = moment.duration();
2019
+ moment.duration.fn.foo = function (arg) {
2020
+ assert.equal(this, durationObject);
2021
+ assert.equal(arg, 5);
2022
+ };
2023
+ durationObject.foo(5);
2024
+ });