card-mod-date 0.14.2 → 0.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{vendor/moment/min/moment-with-locales.min.js → data/files/mod_date_script_datepicker_machine_output/file.js} +2819 -1
- data/data/real.yml +13 -0
- data/data/test.yml +23 -0
- data/set/all/calendar.rb +9 -4
- data/set/right/when_created.rb +6 -0
- data/set/right/when_last_edited.rb +6 -0
- metadata +10 -889
- data/assets/script/manifest.yml +0 -5
- data/assets/script/script_datepicker_config.js.coffee +0 -26
- data/assets/style/manifest.yml +0 -4
- data/assets/style/tempusdominus.scss +0 -12
- data/db/migrate_core_cards/20180509141814_add_datepicker.rb +0 -29
- data/db/migrate_core_cards/20210509141814_remove_datepicker_script_card.rb +0 -7
- data/set/self/datepicker.rb +0 -6
- data/vendor/moment/CHANGELOG.md +0 -964
- data/vendor/moment/CONTRIBUTING.md +0 -103
- data/vendor/moment/FAQ.md +0 -28
- data/vendor/moment/Gruntfile.js +0 -255
- data/vendor/moment/LICENSE +0 -22
- data/vendor/moment/Moment.js.nuspec +0 -31
- data/vendor/moment/README.md +0 -55
- data/vendor/moment/benchmarks/add.js +0 -22
- data/vendor/moment/benchmarks/clone.js +0 -10
- data/vendor/moment/benchmarks/compare.js +0 -33
- data/vendor/moment/benchmarks/endOf.js +0 -22
- data/vendor/moment/benchmarks/fromDate.js +0 -12
- data/vendor/moment/benchmarks/fromDateUtc.js +0 -12
- data/vendor/moment/benchmarks/get.js +0 -21
- data/vendor/moment/benchmarks/isObjectEmpty.js +0 -67
- data/vendor/moment/benchmarks/load-missing.js +0 -13
- data/vendor/moment/benchmarks/makeDuration.js +0 -11
- data/vendor/moment/benchmarks/query.js +0 -40
- data/vendor/moment/benchmarks/set.js +0 -22
- data/vendor/moment/benchmarks/startOf.js +0 -22
- data/vendor/moment/benchmarks/subtract.js +0 -22
- data/vendor/moment/benchmarks/zeroFill.js +0 -43
- data/vendor/moment/bower.json +0 -26
- data/vendor/moment/component.json +0 -147
- data/vendor/moment/composer.json +0 -33
- data/vendor/moment/dist/locale/af.js +0 -71
- data/vendor/moment/dist/locale/ar-dz.js +0 -156
- data/vendor/moment/dist/locale/ar-kw.js +0 -54
- data/vendor/moment/dist/locale/ar-ly.js +0 -171
- data/vendor/moment/dist/locale/ar-ma.js +0 -55
- data/vendor/moment/dist/locale/ar-sa.js +0 -104
- data/vendor/moment/dist/locale/ar-tn.js +0 -54
- data/vendor/moment/dist/locale/ar.js +0 -189
- data/vendor/moment/dist/locale/az.js +0 -101
- data/vendor/moment/dist/locale/be.js +0 -141
- data/vendor/moment/dist/locale/bg.js +0 -87
- data/vendor/moment/dist/locale/bm.js +0 -52
- data/vendor/moment/dist/locale/bn-bd.js +0 -128
- data/vendor/moment/dist/locale/bn.js +0 -118
- data/vendor/moment/dist/locale/bo.js +0 -122
- data/vendor/moment/dist/locale/br.js +0 -165
- data/vendor/moment/dist/locale/bs.js +0 -149
- data/vendor/moment/dist/locale/ca.js +0 -97
- data/vendor/moment/dist/locale/cs.js +0 -171
- data/vendor/moment/dist/locale/cv.js +0 -62
- data/vendor/moment/dist/locale/cy.js +0 -97
- data/vendor/moment/dist/locale/da.js +0 -53
- data/vendor/moment/dist/locale/de-at.js +0 -79
- data/vendor/moment/dist/locale/de-ch.js +0 -78
- data/vendor/moment/dist/locale/de.js +0 -78
- data/vendor/moment/dist/locale/dv.js +0 -90
- data/vendor/moment/dist/locale/el.js +0 -104
- data/vendor/moment/dist/locale/en-au.js +0 -68
- data/vendor/moment/dist/locale/en-ca.js +0 -64
- data/vendor/moment/dist/locale/en-gb.js +0 -68
- data/vendor/moment/dist/locale/en-ie.js +0 -68
- data/vendor/moment/dist/locale/en-il.js +0 -64
- data/vendor/moment/dist/locale/en-in.js +0 -68
- data/vendor/moment/dist/locale/en-nz.js +0 -68
- data/vendor/moment/dist/locale/en-sg.js +0 -68
- data/vendor/moment/dist/locale/eo.js +0 -68
- data/vendor/moment/dist/locale/es-do.js +0 -104
- data/vendor/moment/dist/locale/es-mx.js +0 -106
- data/vendor/moment/dist/locale/es-us.js +0 -106
- data/vendor/moment/dist/locale/es.js +0 -106
- data/vendor/moment/dist/locale/et.js +0 -78
- data/vendor/moment/dist/locale/eu.js +0 -63
- data/vendor/moment/dist/locale/fa.js +0 -110
- data/vendor/moment/dist/locale/fi.js +0 -121
- data/vendor/moment/dist/locale/fil.js +0 -58
- data/vendor/moment/dist/locale/fo.js +0 -56
- data/vendor/moment/dist/locale/fr-ca.js +0 -69
- data/vendor/moment/dist/locale/fr-ch.js +0 -73
- data/vendor/moment/dist/locale/fr.js +0 -104
- data/vendor/moment/dist/locale/fy.js +0 -77
- data/vendor/moment/dist/locale/ga.js +0 -95
- data/vendor/moment/dist/locale/gd.js +0 -95
- data/vendor/moment/dist/locale/gl.js +0 -74
- data/vendor/moment/dist/locale/gom-deva.js +0 -124
- data/vendor/moment/dist/locale/gom-latn.js +0 -124
- data/vendor/moment/dist/locale/gu.js +0 -121
- data/vendor/moment/dist/locale/he.js +0 -94
- data/vendor/moment/dist/locale/hi.js +0 -119
- data/vendor/moment/dist/locale/hr.js +0 -154
- data/vendor/moment/dist/locale/hu.js +0 -118
- data/vendor/moment/dist/locale/hy-am.js +0 -92
- data/vendor/moment/dist/locale/id.js +0 -76
- data/vendor/moment/dist/locale/is.js +0 -139
- data/vendor/moment/dist/locale/it-ch.js +0 -64
- data/vendor/moment/dist/locale/it.js +0 -106
- data/vendor/moment/dist/locale/ja.js +0 -148
- data/vendor/moment/dist/locale/jv.js +0 -76
- data/vendor/moment/dist/locale/ka.js +0 -92
- data/vendor/moment/dist/locale/kk.js +0 -82
- data/vendor/moment/dist/locale/km.js +0 -102
- data/vendor/moment/dist/locale/kn.js +0 -123
- data/vendor/moment/dist/locale/ko.js +0 -75
- data/vendor/moment/dist/locale/ku.js +0 -118
- data/vendor/moment/dist/locale/ky.js +0 -84
- data/vendor/moment/dist/locale/lb.js +0 -135
- data/vendor/moment/dist/locale/lo.js +0 -65
- data/vendor/moment/dist/locale/lt.js +0 -123
- data/vendor/moment/dist/locale/lv.js +0 -93
- data/vendor/moment/dist/locale/me.js +0 -118
- data/vendor/moment/dist/locale/mi.js +0 -59
- data/vendor/moment/dist/locale/mk.js +0 -85
- data/vendor/moment/dist/locale/ml.js +0 -80
- data/vendor/moment/dist/locale/mn.js +0 -99
- data/vendor/moment/dist/locale/mr.js +0 -202
- data/vendor/moment/dist/locale/ms-my.js +0 -76
- data/vendor/moment/dist/locale/ms.js +0 -75
- data/vendor/moment/dist/locale/mt.js +0 -55
- data/vendor/moment/dist/locale/my.js +0 -91
- data/vendor/moment/dist/locale/nb.js +0 -61
- data/vendor/moment/dist/locale/ne.js +0 -120
- data/vendor/moment/dist/locale/nl-be.js +0 -102
- data/vendor/moment/dist/locale/nl.js +0 -104
- data/vendor/moment/dist/locale/nn.js +0 -60
- data/vendor/moment/dist/locale/oc-lnc.js +0 -83
- data/vendor/moment/dist/locale/pa-in.js +0 -121
- data/vendor/moment/dist/locale/pl.js +0 -139
- data/vendor/moment/dist/locale/pt-br.js +0 -57
- data/vendor/moment/dist/locale/pt.js +0 -62
- data/vendor/moment/dist/locale/ro.js +0 -75
- data/vendor/moment/dist/locale/ru.js +0 -206
- data/vendor/moment/dist/locale/sd.js +0 -81
- data/vendor/moment/dist/locale/se.js +0 -57
- data/vendor/moment/dist/locale/si.js +0 -68
- data/vendor/moment/dist/locale/sk.js +0 -144
- data/vendor/moment/dist/locale/sl.js +0 -170
- data/vendor/moment/dist/locale/sq.js +0 -65
- data/vendor/moment/dist/locale/sr-cyrl.js +0 -116
- data/vendor/moment/dist/locale/sr.js +0 -118
- data/vendor/moment/dist/locale/ss.js +0 -83
- data/vendor/moment/dist/locale/sv.js +0 -68
- data/vendor/moment/dist/locale/sw.js +0 -54
- data/vendor/moment/dist/locale/ta.js +0 -129
- data/vendor/moment/dist/locale/te.js +0 -86
- data/vendor/moment/dist/locale/tet.js +0 -68
- data/vendor/moment/dist/locale/tg.js +0 -116
- data/vendor/moment/dist/locale/th.js +0 -64
- data/vendor/moment/dist/locale/tk.js +0 -91
- data/vendor/moment/dist/locale/tl-ph.js +0 -57
- data/vendor/moment/dist/locale/tlh.js +0 -125
- data/vendor/moment/dist/locale/tr.js +0 -106
- data/vendor/moment/dist/locale/tzl.js +0 -89
- data/vendor/moment/dist/locale/tzm-latn.js +0 -53
- data/vendor/moment/dist/locale/tzm.js +0 -53
- data/vendor/moment/dist/locale/ug-cn.js +0 -110
- data/vendor/moment/dist/locale/uk.js +0 -163
- data/vendor/moment/dist/locale/ur.js +0 -82
- data/vendor/moment/dist/locale/uz-latn.js +0 -53
- data/vendor/moment/dist/locale/uz.js +0 -51
- data/vendor/moment/dist/locale/vi.js +0 -79
- data/vendor/moment/dist/locale/x-pseudo.js +0 -71
- data/vendor/moment/dist/locale/yo.js +0 -53
- data/vendor/moment/dist/locale/zh-cn.js +0 -120
- data/vendor/moment/dist/locale/zh-hk.js +0 -101
- data/vendor/moment/dist/locale/zh-mo.js +0 -100
- data/vendor/moment/dist/locale/zh-tw.js +0 -99
- data/vendor/moment/dist/moment.js +0 -5663
- data/vendor/moment/ender.js +0 -1
- data/vendor/moment/locale/af.js +0 -82
- data/vendor/moment/locale/ar-dz.js +0 -167
- data/vendor/moment/locale/ar-kw.js +0 -65
- data/vendor/moment/locale/ar-ly.js +0 -182
- data/vendor/moment/locale/ar-ma.js +0 -66
- data/vendor/moment/locale/ar-sa.js +0 -115
- data/vendor/moment/locale/ar-tn.js +0 -65
- data/vendor/moment/locale/ar.js +0 -200
- data/vendor/moment/locale/az.js +0 -112
- data/vendor/moment/locale/be.js +0 -152
- data/vendor/moment/locale/bg.js +0 -98
- data/vendor/moment/locale/bm.js +0 -62
- data/vendor/moment/locale/bn-bd.js +0 -139
- data/vendor/moment/locale/bn.js +0 -129
- data/vendor/moment/locale/bo.js +0 -133
- data/vendor/moment/locale/br.js +0 -176
- data/vendor/moment/locale/bs.js +0 -160
- data/vendor/moment/locale/ca.js +0 -108
- data/vendor/moment/locale/cs.js +0 -182
- data/vendor/moment/locale/cv.js +0 -73
- data/vendor/moment/locale/cy.js +0 -108
- data/vendor/moment/locale/da.js +0 -64
- data/vendor/moment/locale/de-at.js +0 -90
- data/vendor/moment/locale/de-ch.js +0 -87
- data/vendor/moment/locale/de.js +0 -89
- data/vendor/moment/locale/dv.js +0 -101
- data/vendor/moment/locale/el.js +0 -115
- data/vendor/moment/locale/en-au.js +0 -79
- data/vendor/moment/locale/en-ca.js +0 -75
- data/vendor/moment/locale/en-gb.js +0 -79
- data/vendor/moment/locale/en-ie.js +0 -79
- data/vendor/moment/locale/en-il.js +0 -75
- data/vendor/moment/locale/en-in.js +0 -79
- data/vendor/moment/locale/en-nz.js +0 -79
- data/vendor/moment/locale/en-sg.js +0 -79
- data/vendor/moment/locale/eo.js +0 -79
- data/vendor/moment/locale/es-do.js +0 -115
- data/vendor/moment/locale/es-mx.js +0 -117
- data/vendor/moment/locale/es-us.js +0 -117
- data/vendor/moment/locale/es.js +0 -117
- data/vendor/moment/locale/et.js +0 -89
- data/vendor/moment/locale/eu.js +0 -74
- data/vendor/moment/locale/fa.js +0 -121
- data/vendor/moment/locale/fi.js +0 -132
- data/vendor/moment/locale/fil.js +0 -69
- data/vendor/moment/locale/fo.js +0 -67
- data/vendor/moment/locale/fr-ca.js +0 -80
- data/vendor/moment/locale/fr-ch.js +0 -84
- data/vendor/moment/locale/fr.js +0 -115
- data/vendor/moment/locale/fy.js +0 -88
- data/vendor/moment/locale/ga.js +0 -106
- data/vendor/moment/locale/gd.js +0 -106
- data/vendor/moment/locale/gl.js +0 -85
- data/vendor/moment/locale/gom-deva.js +0 -135
- data/vendor/moment/locale/gom-latn.js +0 -135
- data/vendor/moment/locale/gu.js +0 -132
- data/vendor/moment/locale/he.js +0 -105
- data/vendor/moment/locale/hi.js +0 -130
- data/vendor/moment/locale/hr.js +0 -165
- data/vendor/moment/locale/hu.js +0 -129
- data/vendor/moment/locale/hy-am.js +0 -103
- data/vendor/moment/locale/id.js +0 -87
- data/vendor/moment/locale/is.js +0 -150
- data/vendor/moment/locale/it-ch.js +0 -75
- data/vendor/moment/locale/it.js +0 -117
- data/vendor/moment/locale/ja.js +0 -159
- data/vendor/moment/locale/jv.js +0 -87
- data/vendor/moment/locale/ka.js +0 -103
- data/vendor/moment/locale/kk.js +0 -93
- data/vendor/moment/locale/km.js +0 -113
- data/vendor/moment/locale/kn.js +0 -134
- data/vendor/moment/locale/ko.js +0 -86
- data/vendor/moment/locale/ku.js +0 -129
- data/vendor/moment/locale/ky.js +0 -95
- data/vendor/moment/locale/lb.js +0 -146
- data/vendor/moment/locale/lo.js +0 -76
- data/vendor/moment/locale/lt.js +0 -134
- data/vendor/moment/locale/lv.js +0 -104
- data/vendor/moment/locale/me.js +0 -129
- data/vendor/moment/locale/mi.js +0 -70
- data/vendor/moment/locale/mk.js +0 -97
- data/vendor/moment/locale/ml.js +0 -91
- data/vendor/moment/locale/mn.js +0 -110
- data/vendor/moment/locale/mr.js +0 -213
- data/vendor/moment/locale/ms-my.js +0 -87
- data/vendor/moment/locale/ms.js +0 -86
- data/vendor/moment/locale/mt.js +0 -66
- data/vendor/moment/locale/my.js +0 -102
- data/vendor/moment/locale/nb.js +0 -72
- data/vendor/moment/locale/ne.js +0 -131
- data/vendor/moment/locale/nl-be.js +0 -113
- data/vendor/moment/locale/nl.js +0 -115
- data/vendor/moment/locale/nn.js +0 -71
- data/vendor/moment/locale/oc-lnc.js +0 -94
- data/vendor/moment/locale/pa-in.js +0 -132
- data/vendor/moment/locale/pl.js +0 -150
- data/vendor/moment/locale/pt-br.js +0 -68
- data/vendor/moment/locale/pt.js +0 -73
- data/vendor/moment/locale/ro.js +0 -86
- data/vendor/moment/locale/ru.js +0 -217
- data/vendor/moment/locale/sd.js +0 -92
- data/vendor/moment/locale/se.js +0 -68
- data/vendor/moment/locale/si.js +0 -79
- data/vendor/moment/locale/sk.js +0 -155
- data/vendor/moment/locale/sl.js +0 -181
- data/vendor/moment/locale/sq.js +0 -76
- data/vendor/moment/locale/sr-cyrl.js +0 -127
- data/vendor/moment/locale/sr.js +0 -129
- data/vendor/moment/locale/ss.js +0 -94
- data/vendor/moment/locale/sv.js +0 -79
- data/vendor/moment/locale/sw.js +0 -65
- data/vendor/moment/locale/ta.js +0 -140
- data/vendor/moment/locale/te.js +0 -97
- data/vendor/moment/locale/tet.js +0 -79
- data/vendor/moment/locale/tg.js +0 -127
- data/vendor/moment/locale/th.js +0 -75
- data/vendor/moment/locale/tk.js +0 -102
- data/vendor/moment/locale/tl-ph.js +0 -68
- data/vendor/moment/locale/tlh.js +0 -136
- data/vendor/moment/locale/tr.js +0 -117
- data/vendor/moment/locale/tzl.js +0 -100
- data/vendor/moment/locale/tzm-latn.js +0 -64
- data/vendor/moment/locale/tzm.js +0 -64
- data/vendor/moment/locale/ug-cn.js +0 -121
- data/vendor/moment/locale/uk.js +0 -174
- data/vendor/moment/locale/ur.js +0 -93
- data/vendor/moment/locale/uz-latn.js +0 -64
- data/vendor/moment/locale/uz.js +0 -62
- data/vendor/moment/locale/vi.js +0 -90
- data/vendor/moment/locale/x-pseudo.js +0 -82
- data/vendor/moment/locale/yo.js +0 -64
- data/vendor/moment/locale/zh-cn.js +0 -131
- data/vendor/moment/locale/zh-hk.js +0 -112
- data/vendor/moment/locale/zh-mo.js +0 -111
- data/vendor/moment/locale/zh-tw.js +0 -110
- data/vendor/moment/meteor/README.md +0 -5
- data/vendor/moment/meteor/export.js +0 -6
- data/vendor/moment/meteor/moment.js +0 -1
- data/vendor/moment/meteor/package.js +0 -27
- data/vendor/moment/meteor/test.js +0 -5
- data/vendor/moment/min/locales.js +0 -12384
- data/vendor/moment/min/locales.min.js +0 -2
- data/vendor/moment/min/locales.min.js.map +0 -1
- data/vendor/moment/min/moment-with-locales.js +0 -18039
- data/vendor/moment/min/moment-with-locales.min.js.map +0 -1
- data/vendor/moment/min/moment.min.js +0 -2
- data/vendor/moment/min/moment.min.js.map +0 -1
- data/vendor/moment/min/tests.js +0 -146872
- data/vendor/moment/moment.d.ts +0 -796
- data/vendor/moment/moment.js +0 -5671
- data/vendor/moment/package-lock.json +0 -6460
- data/vendor/moment/package.js +0 -11
- data/vendor/moment/package.json +0 -112
- data/vendor/moment/scripts/locales.js +0 -146
- data/vendor/moment/scripts/npm_prepublish.sh +0 -49
- data/vendor/moment/src/lib/create/check-overflow.js +0 -57
- data/vendor/moment/src/lib/create/date-from-array.js +0 -35
- data/vendor/moment/src/lib/create/from-anything.js +0 -117
- data/vendor/moment/src/lib/create/from-array.js +0 -187
- data/vendor/moment/src/lib/create/from-object.js +0 -20
- data/vendor/moment/src/lib/create/from-string-and-array.js +0 -66
- data/vendor/moment/src/lib/create/from-string-and-format.js +0 -134
- data/vendor/moment/src/lib/create/from-string.js +0 -255
- data/vendor/moment/src/lib/create/local.js +0 -5
- data/vendor/moment/src/lib/create/parsing-flags.js +0 -28
- data/vendor/moment/src/lib/create/utc.js +0 -5
- data/vendor/moment/src/lib/create/valid.js +0 -51
- data/vendor/moment/src/lib/duration/abs.js +0 -18
- data/vendor/moment/src/lib/duration/add-subtract.js +0 -21
- data/vendor/moment/src/lib/duration/as.js +0 -88
- data/vendor/moment/src/lib/duration/bubble.js +0 -68
- data/vendor/moment/src/lib/duration/clone.js +0 -5
- data/vendor/moment/src/lib/duration/constructor.js +0 -42
- data/vendor/moment/src/lib/duration/create.js +0 -132
- data/vendor/moment/src/lib/duration/duration.js +0 -16
- data/vendor/moment/src/lib/duration/get.js +0 -27
- data/vendor/moment/src/lib/duration/humanize.js +0 -114
- data/vendor/moment/src/lib/duration/iso-string.js +0 -68
- data/vendor/moment/src/lib/duration/prototype.js +0 -78
- data/vendor/moment/src/lib/duration/valid.js +0 -54
- data/vendor/moment/src/lib/format/format.js +0 -103
- data/vendor/moment/src/lib/locale/base-config.js +0 -41
- data/vendor/moment/src/lib/locale/calendar.js +0 -15
- data/vendor/moment/src/lib/locale/constructor.js +0 -5
- data/vendor/moment/src/lib/locale/en.js +0 -39
- data/vendor/moment/src/lib/locale/formats.js +0 -36
- data/vendor/moment/src/lib/locale/invalid.js +0 -5
- data/vendor/moment/src/lib/locale/lists.js +0 -93
- data/vendor/moment/src/lib/locale/locale.js +0 -45
- data/vendor/moment/src/lib/locale/locales.js +0 -242
- data/vendor/moment/src/lib/locale/ordinal.js +0 -8
- data/vendor/moment/src/lib/locale/pre-post-format.js +0 -3
- data/vendor/moment/src/lib/locale/prototype.js +0 -88
- data/vendor/moment/src/lib/locale/relative.js +0 -32
- data/vendor/moment/src/lib/locale/set.js +0 -56
- data/vendor/moment/src/lib/moment/add-subtract.js +0 -61
- data/vendor/moment/src/lib/moment/calendar.js +0 -53
- data/vendor/moment/src/lib/moment/clone.js +0 -5
- data/vendor/moment/src/lib/moment/compare.js +0 -72
- data/vendor/moment/src/lib/moment/constructor.js +0 -77
- data/vendor/moment/src/lib/moment/creation-data.js +0 -9
- data/vendor/moment/src/lib/moment/diff.js +0 -79
- data/vendor/moment/src/lib/moment/format.js +0 -78
- data/vendor/moment/src/lib/moment/from.js +0 -20
- data/vendor/moment/src/lib/moment/get-set.js +0 -72
- data/vendor/moment/src/lib/moment/locale.js +0 -34
- data/vendor/moment/src/lib/moment/min-max.js +0 -62
- data/vendor/moment/src/lib/moment/moment.js +0 -28
- data/vendor/moment/src/lib/moment/now.js +0 -3
- data/vendor/moment/src/lib/moment/prototype.js +0 -197
- data/vendor/moment/src/lib/moment/start-end-of.js +0 -164
- data/vendor/moment/src/lib/moment/to-type.js +0 -42
- data/vendor/moment/src/lib/moment/to.js +0 -20
- data/vendor/moment/src/lib/moment/valid.js +0 -15
- data/vendor/moment/src/lib/parse/regex.js +0 -82
- data/vendor/moment/src/lib/parse/token.js +0 -34
- data/vendor/moment/src/lib/units/aliases.js +0 -31
- data/vendor/moment/src/lib/units/constants.js +0 -9
- data/vendor/moment/src/lib/units/day-of-month.js +0 -39
- data/vendor/moment/src/lib/units/day-of-week.js +0 -444
- data/vendor/moment/src/lib/units/day-of-year.js +0 -37
- data/vendor/moment/src/lib/units/era.js +0 -289
- data/vendor/moment/src/lib/units/hour.js +0 -159
- data/vendor/moment/src/lib/units/millisecond.js +0 -76
- data/vendor/moment/src/lib/units/minute.js +0 -29
- data/vendor/moment/src/lib/units/month.js +0 -349
- data/vendor/moment/src/lib/units/offset.js +0 -249
- data/vendor/moment/src/lib/units/priorities.js +0 -21
- data/vendor/moment/src/lib/units/quarter.js +0 -34
- data/vendor/moment/src/lib/units/second.js +0 -29
- data/vendor/moment/src/lib/units/timestamp.js +0 -20
- data/vendor/moment/src/lib/units/timezone.js +0 -16
- data/vendor/moment/src/lib/units/units.js +0 -20
- data/vendor/moment/src/lib/units/week-calendar-utils.js +0 -66
- data/vendor/moment/src/lib/units/week-year.js +0 -140
- data/vendor/moment/src/lib/units/week.js +0 -71
- data/vendor/moment/src/lib/units/year.js +0 -85
- data/vendor/moment/src/lib/utils/abs-ceil.js +0 -7
- data/vendor/moment/src/lib/utils/abs-floor.js +0 -8
- data/vendor/moment/src/lib/utils/abs-round.js +0 -7
- data/vendor/moment/src/lib/utils/compare-arrays.js +0 -18
- data/vendor/moment/src/lib/utils/defaults.js +0 -10
- data/vendor/moment/src/lib/utils/deprecate.js +0 -68
- data/vendor/moment/src/lib/utils/extend.js +0 -19
- data/vendor/moment/src/lib/utils/has-own-prop.js +0 -3
- data/vendor/moment/src/lib/utils/hooks.js +0 -13
- data/vendor/moment/src/lib/utils/index-of.js +0 -18
- data/vendor/moment/src/lib/utils/is-array.js +0 -6
- data/vendor/moment/src/lib/utils/is-calendar-spec.js +0 -25
- data/vendor/moment/src/lib/utils/is-date.js +0 -6
- data/vendor/moment/src/lib/utils/is-function.js +0 -6
- data/vendor/moment/src/lib/utils/is-leap-year.js +0 -3
- data/vendor/moment/src/lib/utils/is-moment-input.js +0 -74
- data/vendor/moment/src/lib/utils/is-number.js +0 -6
- data/vendor/moment/src/lib/utils/is-object-empty.js +0 -15
- data/vendor/moment/src/lib/utils/is-object.js +0 -8
- data/vendor/moment/src/lib/utils/is-string.js +0 -3
- data/vendor/moment/src/lib/utils/is-undefined.js +0 -3
- data/vendor/moment/src/lib/utils/keys.js +0 -20
- data/vendor/moment/src/lib/utils/map.js +0 -8
- data/vendor/moment/src/lib/utils/mod.js +0 -3
- data/vendor/moment/src/lib/utils/some.js +0 -20
- data/vendor/moment/src/lib/utils/to-int.js +0 -12
- data/vendor/moment/src/lib/utils/zero-fill.js +0 -10
- data/vendor/moment/src/locale/af.js +0 -71
- data/vendor/moment/src/locale/ar-dz.js +0 -156
- data/vendor/moment/src/locale/ar-kw.js +0 -54
- data/vendor/moment/src/locale/ar-ly.js +0 -171
- data/vendor/moment/src/locale/ar-ma.js +0 -55
- data/vendor/moment/src/locale/ar-sa.js +0 -104
- data/vendor/moment/src/locale/ar-tn.js +0 -54
- data/vendor/moment/src/locale/ar.js +0 -189
- data/vendor/moment/src/locale/az.js +0 -101
- data/vendor/moment/src/locale/be.js +0 -141
- data/vendor/moment/src/locale/bg.js +0 -87
- data/vendor/moment/src/locale/bm.js +0 -52
- data/vendor/moment/src/locale/bn-bd.js +0 -128
- data/vendor/moment/src/locale/bn.js +0 -118
- data/vendor/moment/src/locale/bo.js +0 -122
- data/vendor/moment/src/locale/br.js +0 -165
- data/vendor/moment/src/locale/bs.js +0 -149
- data/vendor/moment/src/locale/ca.js +0 -97
- data/vendor/moment/src/locale/cs.js +0 -171
- data/vendor/moment/src/locale/cv.js +0 -62
- data/vendor/moment/src/locale/cy.js +0 -97
- data/vendor/moment/src/locale/da.js +0 -53
- data/vendor/moment/src/locale/de-at.js +0 -79
- data/vendor/moment/src/locale/de-ch.js +0 -78
- data/vendor/moment/src/locale/de.js +0 -78
- data/vendor/moment/src/locale/dv.js +0 -90
- data/vendor/moment/src/locale/el.js +0 -104
- data/vendor/moment/src/locale/en-au.js +0 -68
- data/vendor/moment/src/locale/en-ca.js +0 -64
- data/vendor/moment/src/locale/en-gb.js +0 -68
- data/vendor/moment/src/locale/en-ie.js +0 -68
- data/vendor/moment/src/locale/en-il.js +0 -64
- data/vendor/moment/src/locale/en-in.js +0 -68
- data/vendor/moment/src/locale/en-nz.js +0 -68
- data/vendor/moment/src/locale/en-sg.js +0 -68
- data/vendor/moment/src/locale/eo.js +0 -68
- data/vendor/moment/src/locale/es-do.js +0 -104
- data/vendor/moment/src/locale/es-mx.js +0 -106
- data/vendor/moment/src/locale/es-us.js +0 -106
- data/vendor/moment/src/locale/es.js +0 -106
- data/vendor/moment/src/locale/et.js +0 -78
- data/vendor/moment/src/locale/eu.js +0 -63
- data/vendor/moment/src/locale/fa.js +0 -110
- data/vendor/moment/src/locale/fi.js +0 -121
- data/vendor/moment/src/locale/fil.js +0 -58
- data/vendor/moment/src/locale/fo.js +0 -56
- data/vendor/moment/src/locale/fr-ca.js +0 -69
- data/vendor/moment/src/locale/fr-ch.js +0 -73
- data/vendor/moment/src/locale/fr.js +0 -104
- data/vendor/moment/src/locale/fy.js +0 -77
- data/vendor/moment/src/locale/ga.js +0 -95
- data/vendor/moment/src/locale/gd.js +0 -95
- data/vendor/moment/src/locale/gl.js +0 -74
- data/vendor/moment/src/locale/gom-deva.js +0 -124
- data/vendor/moment/src/locale/gom-latn.js +0 -124
- data/vendor/moment/src/locale/gu.js +0 -121
- data/vendor/moment/src/locale/he.js +0 -94
- data/vendor/moment/src/locale/hi.js +0 -119
- data/vendor/moment/src/locale/hr.js +0 -154
- data/vendor/moment/src/locale/hu.js +0 -118
- data/vendor/moment/src/locale/hy-am.js +0 -92
- data/vendor/moment/src/locale/id.js +0 -76
- data/vendor/moment/src/locale/is.js +0 -139
- data/vendor/moment/src/locale/it-ch.js +0 -64
- data/vendor/moment/src/locale/it.js +0 -106
- data/vendor/moment/src/locale/ja.js +0 -148
- data/vendor/moment/src/locale/jv.js +0 -76
- data/vendor/moment/src/locale/ka.js +0 -92
- data/vendor/moment/src/locale/kk.js +0 -82
- data/vendor/moment/src/locale/km.js +0 -102
- data/vendor/moment/src/locale/kn.js +0 -123
- data/vendor/moment/src/locale/ko.js +0 -75
- data/vendor/moment/src/locale/ku.js +0 -118
- data/vendor/moment/src/locale/ky.js +0 -84
- data/vendor/moment/src/locale/lb.js +0 -135
- data/vendor/moment/src/locale/lo.js +0 -65
- data/vendor/moment/src/locale/lt.js +0 -123
- data/vendor/moment/src/locale/lv.js +0 -93
- data/vendor/moment/src/locale/me.js +0 -118
- data/vendor/moment/src/locale/mi.js +0 -59
- data/vendor/moment/src/locale/mk.js +0 -85
- data/vendor/moment/src/locale/ml.js +0 -80
- data/vendor/moment/src/locale/mn.js +0 -99
- data/vendor/moment/src/locale/mr.js +0 -202
- data/vendor/moment/src/locale/ms-my.js +0 -76
- data/vendor/moment/src/locale/ms.js +0 -75
- data/vendor/moment/src/locale/mt.js +0 -55
- data/vendor/moment/src/locale/my.js +0 -91
- data/vendor/moment/src/locale/nb.js +0 -61
- data/vendor/moment/src/locale/ne.js +0 -120
- data/vendor/moment/src/locale/nl-be.js +0 -102
- data/vendor/moment/src/locale/nl.js +0 -104
- data/vendor/moment/src/locale/nn.js +0 -60
- data/vendor/moment/src/locale/oc-lnc.js +0 -83
- data/vendor/moment/src/locale/pa-in.js +0 -121
- data/vendor/moment/src/locale/pl.js +0 -139
- data/vendor/moment/src/locale/pt-br.js +0 -57
- data/vendor/moment/src/locale/pt.js +0 -62
- data/vendor/moment/src/locale/ro.js +0 -75
- data/vendor/moment/src/locale/ru.js +0 -206
- data/vendor/moment/src/locale/sd.js +0 -81
- data/vendor/moment/src/locale/se.js +0 -57
- data/vendor/moment/src/locale/si.js +0 -68
- data/vendor/moment/src/locale/sk.js +0 -144
- data/vendor/moment/src/locale/sl.js +0 -170
- data/vendor/moment/src/locale/sq.js +0 -65
- data/vendor/moment/src/locale/sr-cyrl.js +0 -116
- data/vendor/moment/src/locale/sr.js +0 -118
- data/vendor/moment/src/locale/ss.js +0 -83
- data/vendor/moment/src/locale/sv.js +0 -68
- data/vendor/moment/src/locale/sw.js +0 -54
- data/vendor/moment/src/locale/ta.js +0 -129
- data/vendor/moment/src/locale/te.js +0 -86
- data/vendor/moment/src/locale/tet.js +0 -68
- data/vendor/moment/src/locale/tg.js +0 -116
- data/vendor/moment/src/locale/th.js +0 -64
- data/vendor/moment/src/locale/tk.js +0 -91
- data/vendor/moment/src/locale/tl-ph.js +0 -57
- data/vendor/moment/src/locale/tlh.js +0 -125
- data/vendor/moment/src/locale/tr.js +0 -106
- data/vendor/moment/src/locale/tzl.js +0 -89
- data/vendor/moment/src/locale/tzm-latn.js +0 -53
- data/vendor/moment/src/locale/tzm.js +0 -53
- data/vendor/moment/src/locale/ug-cn.js +0 -110
- data/vendor/moment/src/locale/uk.js +0 -163
- data/vendor/moment/src/locale/ur.js +0 -82
- data/vendor/moment/src/locale/uz-latn.js +0 -53
- data/vendor/moment/src/locale/uz.js +0 -51
- data/vendor/moment/src/locale/vi.js +0 -79
- data/vendor/moment/src/locale/x-pseudo.js +0 -71
- data/vendor/moment/src/locale/yo.js +0 -53
- data/vendor/moment/src/locale/zh-cn.js +0 -120
- data/vendor/moment/src/locale/zh-hk.js +0 -101
- data/vendor/moment/src/locale/zh-mo.js +0 -100
- data/vendor/moment/src/locale/zh-tw.js +0 -99
- data/vendor/moment/src/moment.js +0 -93
- data/vendor/moment/src/test/helpers/common-locale.js +0 -265
- data/vendor/moment/src/test/helpers/deprecation-handler.js +0 -62
- data/vendor/moment/src/test/helpers/dst.js +0 -8
- data/vendor/moment/src/test/helpers/each-own-prop.js +0 -8
- data/vendor/moment/src/test/helpers/each.js +0 -8
- data/vendor/moment/src/test/helpers/has-own-prop.js +0 -3
- data/vendor/moment/src/test/helpers/object-keys.js +0 -17
- data/vendor/moment/src/test/locale/af.js +0 -446
- data/vendor/moment/src/test/locale/ar-dz.js +0 -482
- data/vendor/moment/src/test/locale/ar-kw.js +0 -446
- data/vendor/moment/src/test/locale/ar-ly.js +0 -521
- data/vendor/moment/src/test/locale/ar-ma.js +0 -446
- data/vendor/moment/src/test/locale/ar-sa.js +0 -465
- data/vendor/moment/src/test/locale/ar-tn.js +0 -611
- data/vendor/moment/src/test/locale/ar.js +0 -521
- data/vendor/moment/src/test/locale/az.js +0 -453
- data/vendor/moment/src/test/locale/be.js +0 -575
- data/vendor/moment/src/test/locale/bg.js +0 -459
- data/vendor/moment/src/test/locale/bm.js +0 -408
- data/vendor/moment/src/test/locale/bn-bd.js +0 -473
- data/vendor/moment/src/test/locale/bn.js +0 -481
- data/vendor/moment/src/test/locale/bo.js +0 -501
- data/vendor/moment/src/test/locale/br.js +0 -541
- data/vendor/moment/src/test/locale/bs.js +0 -478
- data/vendor/moment/src/test/locale/ca.js +0 -472
- data/vendor/moment/src/test/locale/cs.js +0 -635
- data/vendor/moment/src/test/locale/cv.js +0 -459
- data/vendor/moment/src/test/locale/cy.js +0 -444
- data/vendor/moment/src/test/locale/da.js +0 -447
- data/vendor/moment/src/test/locale/de-at.js +0 -476
- data/vendor/moment/src/test/locale/de-ch.js +0 -481
- data/vendor/moment/src/test/locale/de.js +0 -480
- data/vendor/moment/src/test/locale/dv.js +0 -419
- data/vendor/moment/src/test/locale/el.js +0 -544
- data/vendor/moment/src/test/locale/en-au.js +0 -480
- data/vendor/moment/src/test/locale/en-ca.js +0 -451
- data/vendor/moment/src/test/locale/en-gb.js +0 -446
- data/vendor/moment/src/test/locale/en-ie.js +0 -446
- data/vendor/moment/src/test/locale/en-il.js +0 -454
- data/vendor/moment/src/test/locale/en-in.js +0 -464
- data/vendor/moment/src/test/locale/en-nz.js +0 -446
- data/vendor/moment/src/test/locale/en-sg.js +0 -430
- data/vendor/moment/src/test/locale/en.js +0 -562
- data/vendor/moment/src/test/locale/eo.js +0 -455
- data/vendor/moment/src/test/locale/es-do.js +0 -473
- data/vendor/moment/src/test/locale/es-mx.js +0 -514
- data/vendor/moment/src/test/locale/es-us.js +0 -489
- data/vendor/moment/src/test/locale/es.js +0 -476
- data/vendor/moment/src/test/locale/et.js +0 -533
- data/vendor/moment/src/test/locale/eu.js +0 -445
- data/vendor/moment/src/test/locale/fa.js +0 -461
- data/vendor/moment/src/test/locale/fi.js +0 -489
- data/vendor/moment/src/test/locale/fil.js +0 -448
- data/vendor/moment/src/test/locale/fo.js +0 -454
- data/vendor/moment/src/test/locale/fr-ca.js +0 -460
- data/vendor/moment/src/test/locale/fr-ch.js +0 -460
- data/vendor/moment/src/test/locale/fr.js +0 -482
- data/vendor/moment/src/test/locale/fy.js +0 -461
- data/vendor/moment/src/test/locale/ga.js +0 -445
- data/vendor/moment/src/test/locale/gd.js +0 -464
- data/vendor/moment/src/test/locale/gl.js +0 -466
- data/vendor/moment/src/test/locale/gom-deva.js +0 -445
- data/vendor/moment/src/test/locale/gom-latn.js +0 -459
- data/vendor/moment/src/test/locale/gu.js +0 -487
- data/vendor/moment/src/test/locale/he.js +0 -417
- data/vendor/moment/src/test/locale/hi.js +0 -484
- data/vendor/moment/src/test/locale/hr.js +0 -478
- data/vendor/moment/src/test/locale/hu.js +0 -468
- data/vendor/moment/src/test/locale/hy-am.js +0 -609
- data/vendor/moment/src/test/locale/id.js +0 -407
- data/vendor/moment/src/test/locale/is.js +0 -479
- data/vendor/moment/src/test/locale/it-ch.js +0 -427
- data/vendor/moment/src/test/locale/it.js +0 -479
- data/vendor/moment/src/test/locale/ja.js +0 -591
- data/vendor/moment/src/test/locale/jv.js +0 -418
- data/vendor/moment/src/test/locale/ka.js +0 -452
- data/vendor/moment/src/test/locale/kk.js +0 -445
- data/vendor/moment/src/test/locale/km.js +0 -471
- data/vendor/moment/src/test/locale/kn.js +0 -493
- data/vendor/moment/src/test/locale/ko.js +0 -496
- data/vendor/moment/src/test/locale/ku.js +0 -465
- data/vendor/moment/src/test/locale/ky.js +0 -445
- data/vendor/moment/src/test/locale/lb.js +0 -432
- data/vendor/moment/src/test/locale/lo.js +0 -445
- data/vendor/moment/src/test/locale/lt.js +0 -504
- data/vendor/moment/src/test/locale/lv.js +0 -567
- data/vendor/moment/src/test/locale/me.js +0 -481
- data/vendor/moment/src/test/locale/mi.js +0 -450
- data/vendor/moment/src/test/locale/mk.js +0 -460
- data/vendor/moment/src/test/locale/ml.js +0 -497
- data/vendor/moment/src/test/locale/mn.js +0 -555
- data/vendor/moment/src/test/locale/mr.js +0 -497
- data/vendor/moment/src/test/locale/ms-my.js +0 -454
- data/vendor/moment/src/test/locale/ms.js +0 -454
- data/vendor/moment/src/test/locale/mt.js +0 -446
- data/vendor/moment/src/test/locale/my.js +0 -616
- data/vendor/moment/src/test/locale/nb.js +0 -446
- data/vendor/moment/src/test/locale/ne.js +0 -484
- data/vendor/moment/src/test/locale/nl-be.js +0 -471
- data/vendor/moment/src/test/locale/nl.js +0 -471
- data/vendor/moment/src/test/locale/nn.js +0 -445
- data/vendor/moment/src/test/locale/oc-lnc.js +0 -440
- data/vendor/moment/src/test/locale/pa-in.js +0 -769
- data/vendor/moment/src/test/locale/pl.js +0 -557
- data/vendor/moment/src/test/locale/pt-br.js +0 -472
- data/vendor/moment/src/test/locale/pt.js +0 -449
- data/vendor/moment/src/test/locale/ro.js +0 -485
- data/vendor/moment/src/test/locale/ru.js +0 -706
- data/vendor/moment/src/test/locale/sd.js +0 -434
- data/vendor/moment/src/test/locale/se.js +0 -456
- data/vendor/moment/src/test/locale/si.js +0 -422
- data/vendor/moment/src/test/locale/sk.js +0 -640
- data/vendor/moment/src/test/locale/sl.js +0 -816
- data/vendor/moment/src/test/locale/sq.js +0 -457
- data/vendor/moment/src/test/locale/sr-cyrl.js +0 -478
- data/vendor/moment/src/test/locale/sr.js +0 -478
- data/vendor/moment/src/test/locale/ss.js +0 -510
- data/vendor/moment/src/test/locale/sv.js +0 -441
- data/vendor/moment/src/test/locale/sw.js +0 -449
- data/vendor/moment/src/test/locale/ta.js +0 -452
- data/vendor/moment/src/test/locale/te.js +0 -497
- data/vendor/moment/src/test/locale/tet.js +0 -446
- data/vendor/moment/src/test/locale/tg.js +0 -462
- data/vendor/moment/src/test/locale/th.js +0 -408
- data/vendor/moment/src/test/locale/tk.js +0 -445
- data/vendor/moment/src/test/locale/tl-ph.js +0 -448
- data/vendor/moment/src/test/locale/tlh.js +0 -484
- data/vendor/moment/src/test/locale/tr.js +0 -461
- data/vendor/moment/src/test/locale/tzl.js +0 -453
- data/vendor/moment/src/test/locale/tzm-latn.js +0 -449
- data/vendor/moment/src/test/locale/tzm.js +0 -449
- data/vendor/moment/src/test/locale/ug-cn.js +0 -427
- data/vendor/moment/src/test/locale/uk.js +0 -521
- data/vendor/moment/src/test/locale/ur.js +0 -439
- data/vendor/moment/src/test/locale/uz-latn.js +0 -450
- data/vendor/moment/src/test/locale/uz.js +0 -447
- data/vendor/moment/src/test/locale/vi.js +0 -452
- data/vendor/moment/src/test/locale/x-pseudo.js +0 -446
- data/vendor/moment/src/test/locale/yo.js +0 -447
- data/vendor/moment/src/test/locale/zh-cn.js +0 -459
- data/vendor/moment/src/test/locale/zh-hk.js +0 -443
- data/vendor/moment/src/test/locale/zh-mo.js +0 -427
- data/vendor/moment/src/test/locale/zh-tw.js +0 -443
- data/vendor/moment/src/test/moment/add_subtract.js +0 -545
- data/vendor/moment/src/test/moment/calendar.js +0 -214
- data/vendor/moment/src/test/moment/create.js +0 -2816
- data/vendor/moment/src/test/moment/creation-data.js +0 -40
- data/vendor/moment/src/test/moment/days_in_month.js +0 -122
- data/vendor/moment/src/test/moment/days_in_year.js +0 -11
- data/vendor/moment/src/test/moment/deprecate.js +0 -14
- data/vendor/moment/src/test/moment/diff.js +0 -624
- data/vendor/moment/src/test/moment/duration.js +0 -2024
- data/vendor/moment/src/test/moment/duration_from_moments.js +0 -53
- data/vendor/moment/src/test/moment/duration_invalid.js +0 -145
- data/vendor/moment/src/test/moment/format.js +0 -951
- data/vendor/moment/src/test/moment/from_to.js +0 -148
- data/vendor/moment/src/test/moment/getters_setters.js +0 -504
- data/vendor/moment/src/test/moment/instanceof.js +0 -42
- data/vendor/moment/src/test/moment/invalid.js +0 -212
- data/vendor/moment/src/test/moment/is-leap-year.js +0 -89
- data/vendor/moment/src/test/moment/is_after.js +0 -674
- data/vendor/moment/src/test/moment/is_array.js +0 -18
- data/vendor/moment/src/test/moment/is_before.js +0 -674
- data/vendor/moment/src/test/moment/is_between.js +0 -1082
- data/vendor/moment/src/test/moment/is_date.js +0 -32
- data/vendor/moment/src/test/moment/is_moment.js +0 -52
- data/vendor/moment/src/test/moment/is_number.js +0 -27
- data/vendor/moment/src/test/moment/is_same.js +0 -554
- data/vendor/moment/src/test/moment/is_same_or_after.js +0 -777
- data/vendor/moment/src/test/moment/is_same_or_before.js +0 -777
- data/vendor/moment/src/test/moment/is_valid.js +0 -563
- data/vendor/moment/src/test/moment/leapyear.js +0 -11
- data/vendor/moment/src/test/moment/listers.js +0 -172
- data/vendor/moment/src/test/moment/locale.js +0 -1029
- data/vendor/moment/src/test/moment/locale_inheritance.js +0 -332
- data/vendor/moment/src/test/moment/locale_update.js +0 -321
- data/vendor/moment/src/test/moment/min_max.js +0 -72
- data/vendor/moment/src/test/moment/mutable.js +0 -26
- data/vendor/moment/src/test/moment/normalize_units.js +0 -83
- data/vendor/moment/src/test/moment/now.js +0 -100
- data/vendor/moment/src/test/moment/parsing_flags.js +0 -434
- data/vendor/moment/src/test/moment/preparse_postformat.js +0 -121
- data/vendor/moment/src/test/moment/quarter.js +0 -117
- data/vendor/moment/src/test/moment/relative_time.js +0 -424
- data/vendor/moment/src/test/moment/start_end_of.js +0 -538
- data/vendor/moment/src/test/moment/string_prototype.js +0 -17
- data/vendor/moment/src/test/moment/to_type.js +0 -53
- data/vendor/moment/src/test/moment/utc.js +0 -138
- data/vendor/moment/src/test/moment/utc_offset.js +0 -894
- data/vendor/moment/src/test/moment/week_year.js +0 -1075
- data/vendor/moment/src/test/moment/weekday.js +0 -470
- data/vendor/moment/src/test/moment/weeks.js +0 -861
- data/vendor/moment/src/test/moment/weeks_in_year.js +0 -224
- data/vendor/moment/src/test/moment/zone_switching.js +0 -160
- data/vendor/moment/src/test/moment/zones.js +0 -840
- data/vendor/moment/src/test/qunit-locale.js +0 -32
- data/vendor/moment/src/test/qunit.js +0 -31
- data/vendor/moment/tasks/bump_version.js +0 -81
- data/vendor/moment/tasks/check_sauce_creds.js +0 -13
- data/vendor/moment/tasks/component.js +0 -13
- data/vendor/moment/tasks/nuget.js +0 -50
- data/vendor/moment/tasks/qtest.js +0 -56
- data/vendor/moment/tasks/transpile.js +0 -362
- data/vendor/moment/tasks/update_index.js +0 -32
- data/vendor/moment/templates/default.js +0 -5
- data/vendor/moment/templates/locale-header.js +0 -6
- data/vendor/moment/templates/test-header.js +0 -6
- data/vendor/moment/ts3.1-typing-tests/moment-tests.ts +0 -547
- data/vendor/moment/ts3.1-typing-tests/tsconfig.json +0 -14
- data/vendor/moment/ts3.1-typings/moment.d.ts +0 -785
- data/vendor/moment/typing-tests/moment-tests.ts +0 -557
- data/vendor/moment/typing-tests/tsconfig.json +0 -12
- data/vendor/tempusdominus/CONTRIBUTING.md +0 -38
- data/vendor/tempusdominus/Gruntfile.js +0 -188
- data/vendor/tempusdominus/LICENSE +0 -21
- data/vendor/tempusdominus/README.md +0 -30
- data/vendor/tempusdominus/build/css/tempusdominus-bootstrap-4.css +0 -206
- data/vendor/tempusdominus/build/css/tempusdominus-bootstrap-4.min.css +0 -206
- data/vendor/tempusdominus/build/js/tempusdominus-bootstrap-4.js +0 -2779
- data/vendor/tempusdominus/build/js/tempusdominus-bootstrap-4.min.js +0 -7
- data/vendor/tempusdominus/composer.json +0 -29
- data/vendor/tempusdominus/docs/Changelog/index.html +0 -189
- data/vendor/tempusdominus/docs/ContributorsGuide/index.html +0 -290
- data/vendor/tempusdominus/docs/Events/index.html +0 -244
- data/vendor/tempusdominus/docs/Extras/index.html +0 -210
- data/vendor/tempusdominus/docs/FAQ/index.html +0 -186
- data/vendor/tempusdominus/docs/Functions/index.html +0 -239
- data/vendor/tempusdominus/docs/Installing/index.html +0 -233
- data/vendor/tempusdominus/docs/Options/index.html +0 -862
- data/vendor/tempusdominus/docs/Usage/index.html +0 -853
- data/vendor/tempusdominus/docs/android-chrome-192x192.png +0 -0
- data/vendor/tempusdominus/docs/android-chrome-256x256.png +0 -0
- data/vendor/tempusdominus/docs/apple-touch-icon.png +0 -0
- data/vendor/tempusdominus/docs/browserconfig.xml +0 -9
- data/vendor/tempusdominus/docs/css/base.css +0 -1705
- data/vendor/tempusdominus/docs/css/tempusdominus-bootstrap-4.css +0 -206
- data/vendor/tempusdominus/docs/favicon-16x16.png +0 -0
- data/vendor/tempusdominus/docs/favicon-32x32.png +0 -0
- data/vendor/tempusdominus/docs/favicon.ico +0 -0
- data/vendor/tempusdominus/docs/index.html +0 -208
- data/vendor/tempusdominus/docs/js/base.js +0 -62
- data/vendor/tempusdominus/docs/js/tempusdominus-bootstrap-4.js +0 -2779
- data/vendor/tempusdominus/docs/manifest.json +0 -18
- data/vendor/tempusdominus/docs/mstile-150x150.png +0 -0
- data/vendor/tempusdominus/docs/safari-pinned-tab.svg +0 -18
- data/vendor/tempusdominus/docs/search/lunr.min.js +0 -7
- data/vendor/tempusdominus/docs/search/mustache.min.js +0 -1
- data/vendor/tempusdominus/docs/search/require.js +0 -36
- data/vendor/tempusdominus/docs/search/search-results-template.mustache +0 -4
- data/vendor/tempusdominus/docs/search/search.js +0 -92
- data/vendor/tempusdominus/docs/search/search_index.json +0 -1084
- data/vendor/tempusdominus/docs/search/text.js +0 -390
- data/vendor/tempusdominus/docs/sitemap.xml +0 -84
- data/vendor/tempusdominus/docs/theme/404.html +0 -12
- data/vendor/tempusdominus/docs/theme/android-chrome-192x192.png +0 -0
- data/vendor/tempusdominus/docs/theme/android-chrome-256x256.png +0 -0
- data/vendor/tempusdominus/docs/theme/apple-touch-icon.png +0 -0
- data/vendor/tempusdominus/docs/theme/base.html +0 -105
- data/vendor/tempusdominus/docs/theme/browserconfig.xml +0 -9
- data/vendor/tempusdominus/docs/theme/content.html +0 -8
- data/vendor/tempusdominus/docs/theme/css/base.css +0 -1705
- data/vendor/tempusdominus/docs/theme/css/tempusdominus-bootstrap-4.css +0 -206
- data/vendor/tempusdominus/docs/theme/favicon-16x16.png +0 -0
- data/vendor/tempusdominus/docs/theme/favicon-32x32.png +0 -0
- data/vendor/tempusdominus/docs/theme/favicon.ico +0 -0
- data/vendor/tempusdominus/docs/theme/js/base.js +0 -62
- data/vendor/tempusdominus/docs/theme/js/tempusdominus-bootstrap-4.js +0 -2779
- data/vendor/tempusdominus/docs/theme/main.html +0 -1
- data/vendor/tempusdominus/docs/theme/manifest.json +0 -18
- data/vendor/tempusdominus/docs/theme/mstile-150x150.png +0 -0
- data/vendor/tempusdominus/docs/theme/nav.html +0 -32
- data/vendor/tempusdominus/docs/theme/safari-pinned-tab.svg +0 -18
- data/vendor/tempusdominus/docs/theme/search-modal.html +0 -24
- data/vendor/tempusdominus/docs/theme/toc.html +0 -13
- data/vendor/tempusdominus/eslintrc.json +0 -125
- data/vendor/tempusdominus/mkdocs.yml +0 -19
- data/vendor/tempusdominus/package-lock.json +0 -6426
- data/vendor/tempusdominus/package.json +0 -79
- data/vendor/tempusdominus/src/docs/ChangeLog.md +0 -20
- data/vendor/tempusdominus/src/docs/ContributorsGuide.md +0 -85
- data/vendor/tempusdominus/src/docs/Events.md +0 -95
- data/vendor/tempusdominus/src/docs/Extras.md +0 -49
- data/vendor/tempusdominus/src/docs/FAQ.md +0 -22
- data/vendor/tempusdominus/src/docs/Functions.md +0 -82
- data/vendor/tempusdominus/src/docs/Installing.md +0 -67
- data/vendor/tempusdominus/src/docs/Options.md +0 -940
- data/vendor/tempusdominus/src/docs/Usage.md +0 -724
- data/vendor/tempusdominus/src/docs/index.md +0 -53
- data/vendor/tempusdominus/src/docs/theme/404.html +0 -12
- data/vendor/tempusdominus/src/docs/theme/android-chrome-192x192.png +0 -0
- data/vendor/tempusdominus/src/docs/theme/android-chrome-256x256.png +0 -0
- data/vendor/tempusdominus/src/docs/theme/apple-touch-icon.png +0 -0
- data/vendor/tempusdominus/src/docs/theme/base.html +0 -105
- data/vendor/tempusdominus/src/docs/theme/browserconfig.xml +0 -9
- data/vendor/tempusdominus/src/docs/theme/content.html +0 -8
- data/vendor/tempusdominus/src/docs/theme/css/base.css +0 -1705
- data/vendor/tempusdominus/src/docs/theme/css/tempusdominus-bootstrap-4.css +0 -206
- data/vendor/tempusdominus/src/docs/theme/favicon-16x16.png +0 -0
- data/vendor/tempusdominus/src/docs/theme/favicon-32x32.png +0 -0
- data/vendor/tempusdominus/src/docs/theme/favicon.ico +0 -0
- data/vendor/tempusdominus/src/docs/theme/js/base.js +0 -62
- data/vendor/tempusdominus/src/docs/theme/js/tempusdominus-bootstrap-4.js +0 -2779
- data/vendor/tempusdominus/src/docs/theme/main.html +0 -1
- data/vendor/tempusdominus/src/docs/theme/manifest.json +0 -18
- data/vendor/tempusdominus/src/docs/theme/mstile-150x150.png +0 -0
- data/vendor/tempusdominus/src/docs/theme/nav.html +0 -32
- data/vendor/tempusdominus/src/docs/theme/safari-pinned-tab.svg +0 -18
- data/vendor/tempusdominus/src/docs/theme/search-modal.html +0 -24
- data/vendor/tempusdominus/src/docs/theme/toc.html +0 -13
- data/vendor/tempusdominus/src/js/tempusdominus-bootstrap-4.js +0 -1182
- data/vendor/tempusdominus/src/sass/_tempusdominus-bootstrap-4.scss +0 -342
- data/vendor/tempusdominus/src/sass/tempusdominus-bootstrap-4-build.scss +0 -17
- data/vendor/tempusdominus/tasks/bump_version.js +0 -75
- /data/{vendor/moment/templates/empty.js → data/files/mod_date_script_asset_output/file.js} +0 -0
@@ -1,2816 +0,0 @@
|
|
1
|
-
import { module, test } from '../qunit';
|
2
|
-
import eachOwnProp from '../helpers/each-own-prop';
|
3
|
-
import hasOwnProp from '../helpers/has-own-prop';
|
4
|
-
import moment from '../../moment';
|
5
|
-
|
6
|
-
module('create');
|
7
|
-
|
8
|
-
test('array', function (assert) {
|
9
|
-
assert.ok(moment([2010]).toDate() instanceof Date, '[2010]');
|
10
|
-
assert.ok(moment([2010, 1]).toDate() instanceof Date, '[2010, 1]');
|
11
|
-
assert.ok(moment([2010, 1, 12]).toDate() instanceof Date, '[2010, 1, 12]');
|
12
|
-
assert.ok(
|
13
|
-
moment([2010, 1, 12, 1]).toDate() instanceof Date,
|
14
|
-
'[2010, 1, 12, 1]'
|
15
|
-
);
|
16
|
-
assert.ok(
|
17
|
-
moment([2010, 1, 12, 1, 1]).toDate() instanceof Date,
|
18
|
-
'[2010, 1, 12, 1, 1]'
|
19
|
-
);
|
20
|
-
assert.ok(
|
21
|
-
moment([2010, 1, 12, 1, 1, 1]).toDate() instanceof Date,
|
22
|
-
'[2010, 1, 12, 1, 1, 1]'
|
23
|
-
);
|
24
|
-
assert.ok(
|
25
|
-
moment([2010, 1, 12, 1, 1, 1, 1]).toDate() instanceof Date,
|
26
|
-
'[2010, 1, 12, 1, 1, 1, 1]'
|
27
|
-
);
|
28
|
-
assert.equal(
|
29
|
-
+moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
30
|
-
+moment([2010, 1, 14, 15, 25, 50, 125]),
|
31
|
-
'constructing with array === constructing with new Date()'
|
32
|
-
);
|
33
|
-
});
|
34
|
-
|
35
|
-
test('array with invalid arguments', function (assert) {
|
36
|
-
assert.ok(!moment([2010, null, null]).isValid(), '[2010, null, null]');
|
37
|
-
assert.ok(
|
38
|
-
!moment([1945, null, null]).isValid(),
|
39
|
-
'[1945, null, null] (pre-1970)'
|
40
|
-
);
|
41
|
-
});
|
42
|
-
|
43
|
-
test('array copying', function (assert) {
|
44
|
-
var importantArray = [2009, 11];
|
45
|
-
moment(importantArray);
|
46
|
-
assert.deepEqual(
|
47
|
-
importantArray,
|
48
|
-
[2009, 11],
|
49
|
-
'initializer should not mutate the original array'
|
50
|
-
);
|
51
|
-
});
|
52
|
-
|
53
|
-
test('object', function (assert) {
|
54
|
-
var fmt = 'YYYY-MM-DD HH:mm:ss.SSS',
|
55
|
-
tests = [
|
56
|
-
[{ year: 2010 }, '2010-01-01 00:00:00.000'],
|
57
|
-
[{ year: 2010, month: 1 }, '2010-02-01 00:00:00.000'],
|
58
|
-
[{ year: 2010, month: 1, day: 12 }, '2010-02-12 00:00:00.000'],
|
59
|
-
[{ year: 2010, month: 1, date: 12 }, '2010-02-12 00:00:00.000'],
|
60
|
-
[
|
61
|
-
{ year: 2010, month: 1, day: 12, hours: 1 },
|
62
|
-
'2010-02-12 01:00:00.000',
|
63
|
-
],
|
64
|
-
[
|
65
|
-
{ year: 2010, month: 1, date: 12, hours: 1 },
|
66
|
-
'2010-02-12 01:00:00.000',
|
67
|
-
],
|
68
|
-
[
|
69
|
-
{ year: 2010, month: 1, day: 12, hours: 1, minutes: 1 },
|
70
|
-
'2010-02-12 01:01:00.000',
|
71
|
-
],
|
72
|
-
[
|
73
|
-
{ year: 2010, month: 1, date: 12, hours: 1, minutes: 1 },
|
74
|
-
'2010-02-12 01:01:00.000',
|
75
|
-
],
|
76
|
-
[
|
77
|
-
{
|
78
|
-
year: 2010,
|
79
|
-
month: 1,
|
80
|
-
day: 12,
|
81
|
-
hours: 1,
|
82
|
-
minutes: 1,
|
83
|
-
seconds: 1,
|
84
|
-
},
|
85
|
-
'2010-02-12 01:01:01.000',
|
86
|
-
],
|
87
|
-
[
|
88
|
-
{
|
89
|
-
year: 2010,
|
90
|
-
month: 1,
|
91
|
-
day: 12,
|
92
|
-
hours: 1,
|
93
|
-
minutes: 1,
|
94
|
-
seconds: 1,
|
95
|
-
milliseconds: 1,
|
96
|
-
},
|
97
|
-
'2010-02-12 01:01:01.001',
|
98
|
-
],
|
99
|
-
[
|
100
|
-
{
|
101
|
-
years: 2010,
|
102
|
-
months: 1,
|
103
|
-
days: 14,
|
104
|
-
hours: 15,
|
105
|
-
minutes: 25,
|
106
|
-
seconds: 50,
|
107
|
-
milliseconds: 125,
|
108
|
-
},
|
109
|
-
'2010-02-14 15:25:50.125',
|
110
|
-
],
|
111
|
-
[
|
112
|
-
{
|
113
|
-
year: 2010,
|
114
|
-
month: 1,
|
115
|
-
day: 14,
|
116
|
-
hour: 15,
|
117
|
-
minute: 25,
|
118
|
-
second: 50,
|
119
|
-
millisecond: 125,
|
120
|
-
},
|
121
|
-
'2010-02-14 15:25:50.125',
|
122
|
-
],
|
123
|
-
[
|
124
|
-
{ y: 2010, M: 1, d: 14, h: 15, m: 25, s: 50, ms: 125 },
|
125
|
-
'2010-02-14 15:25:50.125',
|
126
|
-
],
|
127
|
-
],
|
128
|
-
i;
|
129
|
-
for (i = 0; i < tests.length; ++i) {
|
130
|
-
assert.equal(moment(tests[i][0]).format(fmt), tests[i][1]);
|
131
|
-
}
|
132
|
-
});
|
133
|
-
|
134
|
-
test('invalid date for object with zero value date or day keys', function (assert) {
|
135
|
-
assert.equal(moment({ date: '0' }).format(), 'Invalid date');
|
136
|
-
assert.equal(moment({ date: 0 }).format(), 'Invalid date');
|
137
|
-
assert.equal(moment({ day: '0' }).format(), 'Invalid date');
|
138
|
-
assert.equal(moment({ day: 0 }).format(), 'Invalid date');
|
139
|
-
});
|
140
|
-
|
141
|
-
test('multi format array copying', function (assert) {
|
142
|
-
var importantArray = ['MM/DD/YYYY', 'YYYY-MM-DD', 'MM-DD-YYYY'];
|
143
|
-
moment('1999-02-13', importantArray);
|
144
|
-
assert.deepEqual(
|
145
|
-
importantArray,
|
146
|
-
['MM/DD/YYYY', 'YYYY-MM-DD', 'MM-DD-YYYY'],
|
147
|
-
'initializer should not mutate the original array'
|
148
|
-
);
|
149
|
-
});
|
150
|
-
|
151
|
-
test('number', function (assert) {
|
152
|
-
assert.ok(moment(1000).toDate() instanceof Date, '1000');
|
153
|
-
assert.equal(moment(1000).valueOf(), 1000, 'asserting valueOf');
|
154
|
-
assert.equal(moment.utc(1000).valueOf(), 1000, 'asserting valueOf');
|
155
|
-
});
|
156
|
-
|
157
|
-
test('unix', function (assert) {
|
158
|
-
assert.equal(
|
159
|
-
moment.unix(1).valueOf(),
|
160
|
-
1000,
|
161
|
-
'1 unix timestamp == 1000 Date.valueOf'
|
162
|
-
);
|
163
|
-
assert.equal(
|
164
|
-
moment(1000).unix(),
|
165
|
-
1,
|
166
|
-
'1000 Date.valueOf == 1 unix timestamp'
|
167
|
-
);
|
168
|
-
assert.equal(
|
169
|
-
moment.unix(1000).valueOf(),
|
170
|
-
1000000,
|
171
|
-
'1000 unix timestamp == 1000000 Date.valueOf'
|
172
|
-
);
|
173
|
-
assert.equal(
|
174
|
-
moment(1500).unix(),
|
175
|
-
1,
|
176
|
-
'1500 Date.valueOf == 1 unix timestamp'
|
177
|
-
);
|
178
|
-
assert.equal(
|
179
|
-
moment(1900).unix(),
|
180
|
-
1,
|
181
|
-
'1900 Date.valueOf == 1 unix timestamp'
|
182
|
-
);
|
183
|
-
assert.equal(
|
184
|
-
moment(2100).unix(),
|
185
|
-
2,
|
186
|
-
'2100 Date.valueOf == 2 unix timestamp'
|
187
|
-
);
|
188
|
-
assert.equal(
|
189
|
-
moment(1333129333524).unix(),
|
190
|
-
1333129333,
|
191
|
-
'1333129333524 Date.valueOf == 1333129333 unix timestamp'
|
192
|
-
);
|
193
|
-
assert.equal(
|
194
|
-
moment(1333129333524000).unix(),
|
195
|
-
1333129333524,
|
196
|
-
'1333129333524000 Date.valueOf == 1333129333524 unix timestamp'
|
197
|
-
);
|
198
|
-
});
|
199
|
-
|
200
|
-
test('date', function (assert) {
|
201
|
-
assert.ok(moment(new Date()).toDate() instanceof Date, 'new Date()');
|
202
|
-
assert.equal(
|
203
|
-
moment(new Date(2016, 0, 1), 'YYYY-MM-DD').format('YYYY-MM-DD'),
|
204
|
-
'2016-01-01',
|
205
|
-
'If date is provided, format string is ignored'
|
206
|
-
);
|
207
|
-
});
|
208
|
-
|
209
|
-
test('date with a format as an array', function (assert) {
|
210
|
-
var tests = [
|
211
|
-
new Date(2016, 9, 27),
|
212
|
-
new Date(2016, 9, 28),
|
213
|
-
new Date(2016, 9, 29),
|
214
|
-
new Date(2016, 9, 30),
|
215
|
-
new Date(2016, 9, 31),
|
216
|
-
],
|
217
|
-
i;
|
218
|
-
|
219
|
-
for (i = 0; i < tests.length; i++) {
|
220
|
-
assert.equal(
|
221
|
-
moment(tests[i]).format(),
|
222
|
-
moment(tests[i], ['MM/DD/YYYY'], false).format(),
|
223
|
-
'Passing date with a format array should still return the correct date'
|
224
|
-
);
|
225
|
-
}
|
226
|
-
});
|
227
|
-
|
228
|
-
test('date mutation', function (assert) {
|
229
|
-
var a = new Date();
|
230
|
-
assert.ok(
|
231
|
-
moment(a).toDate() !== a,
|
232
|
-
'the date moment uses should not be the date passed in'
|
233
|
-
);
|
234
|
-
});
|
235
|
-
|
236
|
-
test('moment', function (assert) {
|
237
|
-
assert.ok(moment(moment()).toDate() instanceof Date, 'moment(moment())');
|
238
|
-
assert.ok(
|
239
|
-
moment(moment(moment())).toDate() instanceof Date,
|
240
|
-
'moment(moment(moment()))'
|
241
|
-
);
|
242
|
-
});
|
243
|
-
|
244
|
-
test('cloning moment should only copy own properties', function (assert) {
|
245
|
-
assert.ok(
|
246
|
-
!hasOwnProp(moment().clone(), 'month'),
|
247
|
-
'Should not clone prototype methods'
|
248
|
-
);
|
249
|
-
});
|
250
|
-
|
251
|
-
test('cloning moment works with weird clones', function (assert) {
|
252
|
-
var extend = function (a, b) {
|
253
|
-
var i;
|
254
|
-
for (i in b) {
|
255
|
-
a[i] = b[i];
|
256
|
-
}
|
257
|
-
return a;
|
258
|
-
},
|
259
|
-
now = moment(),
|
260
|
-
nowu = moment.utc();
|
261
|
-
|
262
|
-
assert.equal(
|
263
|
-
+extend({}, now).clone(),
|
264
|
-
+now,
|
265
|
-
'cloning extend-ed now is now'
|
266
|
-
);
|
267
|
-
assert.equal(
|
268
|
-
+extend({}, nowu).clone(),
|
269
|
-
+nowu,
|
270
|
-
'cloning extend-ed utc now is utc now'
|
271
|
-
);
|
272
|
-
});
|
273
|
-
|
274
|
-
test('cloning respects moment.momentProperties', function (assert) {
|
275
|
-
var m = moment();
|
276
|
-
|
277
|
-
assert.equal(
|
278
|
-
m.clone()._special,
|
279
|
-
undefined,
|
280
|
-
'cloning ignores extra properties'
|
281
|
-
);
|
282
|
-
m._special = 'bacon';
|
283
|
-
moment.momentProperties.push('_special');
|
284
|
-
assert.equal(
|
285
|
-
m.clone()._special,
|
286
|
-
'bacon',
|
287
|
-
'cloning respects momentProperties'
|
288
|
-
);
|
289
|
-
moment.momentProperties.pop();
|
290
|
-
});
|
291
|
-
|
292
|
-
test('undefined', function (assert) {
|
293
|
-
assert.ok(moment().toDate() instanceof Date, 'undefined');
|
294
|
-
});
|
295
|
-
|
296
|
-
test('iso with bad input', function (assert) {
|
297
|
-
assert.ok(
|
298
|
-
!moment('a', moment.ISO_8601).isValid(),
|
299
|
-
'iso parsing with invalid string'
|
300
|
-
);
|
301
|
-
assert.ok(
|
302
|
-
!moment('a', moment.ISO_8601, true).isValid(),
|
303
|
-
'iso parsing with invalid string, strict'
|
304
|
-
);
|
305
|
-
});
|
306
|
-
|
307
|
-
test('iso format 24hrs', function (assert) {
|
308
|
-
assert.equal(
|
309
|
-
moment('2014-01-01T24:00:00.000').format('YYYY-MM-DD[T]HH:mm:ss.SSS'),
|
310
|
-
'2014-01-02T00:00:00.000',
|
311
|
-
'iso format with 24:00 localtime'
|
312
|
-
);
|
313
|
-
assert.equal(
|
314
|
-
moment
|
315
|
-
.utc('2014-01-01T24:00:00.000')
|
316
|
-
.format('YYYY-MM-DD[T]HH:mm:ss.SSS'),
|
317
|
-
'2014-01-02T00:00:00.000',
|
318
|
-
'iso format with 24:00 utc'
|
319
|
-
);
|
320
|
-
});
|
321
|
-
|
322
|
-
test('string without format - json', function (assert) {
|
323
|
-
assert.equal(
|
324
|
-
moment('Date(1325132654000)').valueOf(),
|
325
|
-
1325132654000,
|
326
|
-
'Date(1325132654000)'
|
327
|
-
);
|
328
|
-
assert.equal(
|
329
|
-
moment('Date(-1325132654000)').valueOf(),
|
330
|
-
-1325132654000,
|
331
|
-
'Date(-1325132654000)'
|
332
|
-
);
|
333
|
-
assert.equal(
|
334
|
-
moment('/Date(1325132654000)/').valueOf(),
|
335
|
-
1325132654000,
|
336
|
-
'/Date(1325132654000)/'
|
337
|
-
);
|
338
|
-
assert.equal(
|
339
|
-
moment('/Date(1325132654000+0700)/').valueOf(),
|
340
|
-
1325132654000,
|
341
|
-
'/Date(1325132654000+0700)/'
|
342
|
-
);
|
343
|
-
assert.equal(
|
344
|
-
moment('/Date(1325132654000-0700)/').valueOf(),
|
345
|
-
1325132654000,
|
346
|
-
'/Date(1325132654000-0700)/'
|
347
|
-
);
|
348
|
-
});
|
349
|
-
|
350
|
-
test('string without format - strict parsing', function (assert) {
|
351
|
-
assert.equal(
|
352
|
-
moment('Date(1325132654000)', false).valueOf(),
|
353
|
-
1325132654000,
|
354
|
-
'Date(1325132654000)'
|
355
|
-
);
|
356
|
-
assert.equal(
|
357
|
-
moment('Date(1325132654000)', true).valueOf(),
|
358
|
-
1325132654000,
|
359
|
-
'Date(1325132654000)'
|
360
|
-
);
|
361
|
-
assert.equal(
|
362
|
-
moment('/Date(1325132654000)/', true).valueOf(),
|
363
|
-
1325132654000,
|
364
|
-
'/Date(1325132654000)/'
|
365
|
-
);
|
366
|
-
assert.equal(moment('1/1/2001', true).isValid(), false, '1/1/2001');
|
367
|
-
assert.equal(moment.utc('1/1/2001', true).isValid(), false, '1/1/2001 utc');
|
368
|
-
});
|
369
|
-
|
370
|
-
test('string with format dropped am/pm bug', function (assert) {
|
371
|
-
moment.locale('en');
|
372
|
-
|
373
|
-
assert.equal(
|
374
|
-
moment('05/1/2012 12:25:00', 'MM/DD/YYYY h:m:s a').format('MM/DD/YYYY'),
|
375
|
-
'05/01/2012',
|
376
|
-
'should not break if am/pm is left off from the parsing tokens'
|
377
|
-
);
|
378
|
-
assert.equal(
|
379
|
-
moment('05/1/2012 12:25:00 am', 'MM/DD/YYYY h:m:s a').format(
|
380
|
-
'MM/DD/YYYY'
|
381
|
-
),
|
382
|
-
'05/01/2012',
|
383
|
-
'should not break if am/pm is left off from the parsing tokens'
|
384
|
-
);
|
385
|
-
assert.equal(
|
386
|
-
moment('05/1/2012 12:25:00 pm', 'MM/DD/YYYY h:m:s a').format(
|
387
|
-
'MM/DD/YYYY'
|
388
|
-
),
|
389
|
-
'05/01/2012',
|
390
|
-
'should not break if am/pm is left off from the parsing tokens'
|
391
|
-
);
|
392
|
-
|
393
|
-
assert.ok(moment('05/1/2012 12:25:00', 'MM/DD/YYYY h:m:s a').isValid());
|
394
|
-
assert.ok(moment('05/1/2012 12:25:00 am', 'MM/DD/YYYY h:m:s a').isValid());
|
395
|
-
assert.ok(moment('05/1/2012 12:25:00 pm', 'MM/DD/YYYY h:m:s a').isValid());
|
396
|
-
});
|
397
|
-
|
398
|
-
test('empty string with formats', function (assert) {
|
399
|
-
assert.equal(
|
400
|
-
moment('', 'MM').format('YYYY-MM-DD HH:mm:ss'),
|
401
|
-
'Invalid date'
|
402
|
-
);
|
403
|
-
assert.equal(
|
404
|
-
moment(' ', 'MM').format('YYYY-MM-DD HH:mm:ss'),
|
405
|
-
'Invalid date'
|
406
|
-
);
|
407
|
-
assert.equal(
|
408
|
-
moment(' ', 'DD').format('YYYY-MM-DD HH:mm:ss'),
|
409
|
-
'Invalid date'
|
410
|
-
);
|
411
|
-
assert.equal(
|
412
|
-
moment(' ', ['MM', 'DD']).format('YYYY-MM-DD HH:mm:ss'),
|
413
|
-
'Invalid date'
|
414
|
-
);
|
415
|
-
|
416
|
-
assert.ok(!moment('', 'MM').isValid());
|
417
|
-
assert.ok(!moment(' ', 'MM').isValid());
|
418
|
-
assert.ok(!moment(' ', 'DD').isValid());
|
419
|
-
assert.ok(!moment(' ', ['MM', 'DD']).isValid());
|
420
|
-
});
|
421
|
-
|
422
|
-
test('undefined argument with formats', function (assert) {
|
423
|
-
assert.equal(
|
424
|
-
moment(undefined, 'MM').format('YYYY-MM-DD HH:mm:ss'),
|
425
|
-
'Invalid date'
|
426
|
-
);
|
427
|
-
assert.equal(
|
428
|
-
moment(undefined, 'DD').format('YYYY-MM-DD HH:mm:ss'),
|
429
|
-
'Invalid date'
|
430
|
-
);
|
431
|
-
assert.equal(
|
432
|
-
moment(undefined, ['MM', 'DD']).format('YYYY-MM-DD HH:mm:ss'),
|
433
|
-
'Invalid date'
|
434
|
-
);
|
435
|
-
|
436
|
-
assert.ok(!moment(undefined, 'MM').isValid());
|
437
|
-
assert.ok(!moment(undefined, 'MM').isValid());
|
438
|
-
assert.ok(!moment(undefined, 'DD').isValid());
|
439
|
-
assert.ok(!moment(undefined, ['MM', 'DD']).isValid());
|
440
|
-
});
|
441
|
-
|
442
|
-
test('defaulting to current date', function (assert) {
|
443
|
-
var now = moment();
|
444
|
-
assert.equal(
|
445
|
-
moment('12:13:14', 'hh:mm:ss').format('YYYY-MM-DD hh:mm:ss'),
|
446
|
-
now
|
447
|
-
.clone()
|
448
|
-
.hour(12)
|
449
|
-
.minute(13)
|
450
|
-
.second(14)
|
451
|
-
.format('YYYY-MM-DD hh:mm:ss'),
|
452
|
-
'given only time default to current date'
|
453
|
-
);
|
454
|
-
assert.equal(
|
455
|
-
moment('05', 'DD').format('YYYY-MM-DD'),
|
456
|
-
now.clone().date(5).format('YYYY-MM-DD'),
|
457
|
-
'given day of month default to current month, year'
|
458
|
-
);
|
459
|
-
assert.equal(
|
460
|
-
moment('05', 'MM').format('YYYY-MM-DD'),
|
461
|
-
now.clone().month(4).date(1).format('YYYY-MM-DD'),
|
462
|
-
'given month default to current year'
|
463
|
-
);
|
464
|
-
assert.equal(
|
465
|
-
moment('1996', 'YYYY').format('YYYY-MM-DD'),
|
466
|
-
now.clone().year(1996).month(0).date(1).format('YYYY-MM-DD'),
|
467
|
-
'given year do not default'
|
468
|
-
);
|
469
|
-
});
|
470
|
-
|
471
|
-
test('matching am/pm', function (assert) {
|
472
|
-
assert.equal(
|
473
|
-
moment('2012-09-03T03:00PM', 'YYYY-MM-DDThh:mmA').format(
|
474
|
-
'YYYY-MM-DDThh:mmA'
|
475
|
-
),
|
476
|
-
'2012-09-03T03:00PM',
|
477
|
-
'am/pm should parse correctly for PM'
|
478
|
-
);
|
479
|
-
assert.equal(
|
480
|
-
moment('2012-09-03T03:00P.M.', 'YYYY-MM-DDThh:mmA').format(
|
481
|
-
'YYYY-MM-DDThh:mmA'
|
482
|
-
),
|
483
|
-
'2012-09-03T03:00PM',
|
484
|
-
'am/pm should parse correctly for P.M.'
|
485
|
-
);
|
486
|
-
assert.equal(
|
487
|
-
moment('2012-09-03T03:00P', 'YYYY-MM-DDThh:mmA').format(
|
488
|
-
'YYYY-MM-DDThh:mmA'
|
489
|
-
),
|
490
|
-
'2012-09-03T03:00PM',
|
491
|
-
'am/pm should parse correctly for P'
|
492
|
-
);
|
493
|
-
assert.equal(
|
494
|
-
moment('2012-09-03T03:00pm', 'YYYY-MM-DDThh:mmA').format(
|
495
|
-
'YYYY-MM-DDThh:mmA'
|
496
|
-
),
|
497
|
-
'2012-09-03T03:00PM',
|
498
|
-
'am/pm should parse correctly for pm'
|
499
|
-
);
|
500
|
-
assert.equal(
|
501
|
-
moment('2012-09-03T03:00p.m.', 'YYYY-MM-DDThh:mmA').format(
|
502
|
-
'YYYY-MM-DDThh:mmA'
|
503
|
-
),
|
504
|
-
'2012-09-03T03:00PM',
|
505
|
-
'am/pm should parse correctly for p.m.'
|
506
|
-
);
|
507
|
-
assert.equal(
|
508
|
-
moment('2012-09-03T03:00p', 'YYYY-MM-DDThh:mmA').format(
|
509
|
-
'YYYY-MM-DDThh:mmA'
|
510
|
-
),
|
511
|
-
'2012-09-03T03:00PM',
|
512
|
-
'am/pm should parse correctly for p'
|
513
|
-
);
|
514
|
-
|
515
|
-
assert.equal(
|
516
|
-
moment('2012-09-03T03:00AM', 'YYYY-MM-DDThh:mmA').format(
|
517
|
-
'YYYY-MM-DDThh:mmA'
|
518
|
-
),
|
519
|
-
'2012-09-03T03:00AM',
|
520
|
-
'am/pm should parse correctly for AM'
|
521
|
-
);
|
522
|
-
assert.equal(
|
523
|
-
moment('2012-09-03T03:00A.M.', 'YYYY-MM-DDThh:mmA').format(
|
524
|
-
'YYYY-MM-DDThh:mmA'
|
525
|
-
),
|
526
|
-
'2012-09-03T03:00AM',
|
527
|
-
'am/pm should parse correctly for A.M.'
|
528
|
-
);
|
529
|
-
assert.equal(
|
530
|
-
moment('2012-09-03T03:00A', 'YYYY-MM-DDThh:mmA').format(
|
531
|
-
'YYYY-MM-DDThh:mmA'
|
532
|
-
),
|
533
|
-
'2012-09-03T03:00AM',
|
534
|
-
'am/pm should parse correctly for A'
|
535
|
-
);
|
536
|
-
assert.equal(
|
537
|
-
moment('2012-09-03T03:00am', 'YYYY-MM-DDThh:mmA').format(
|
538
|
-
'YYYY-MM-DDThh:mmA'
|
539
|
-
),
|
540
|
-
'2012-09-03T03:00AM',
|
541
|
-
'am/pm should parse correctly for am'
|
542
|
-
);
|
543
|
-
assert.equal(
|
544
|
-
moment('2012-09-03T03:00a.m.', 'YYYY-MM-DDThh:mmA').format(
|
545
|
-
'YYYY-MM-DDThh:mmA'
|
546
|
-
),
|
547
|
-
'2012-09-03T03:00AM',
|
548
|
-
'am/pm should parse correctly for a.m.'
|
549
|
-
);
|
550
|
-
assert.equal(
|
551
|
-
moment('2012-09-03T03:00a', 'YYYY-MM-DDThh:mmA').format(
|
552
|
-
'YYYY-MM-DDThh:mmA'
|
553
|
-
),
|
554
|
-
'2012-09-03T03:00AM',
|
555
|
-
'am/pm should parse correctly for a'
|
556
|
-
);
|
557
|
-
|
558
|
-
assert.equal(
|
559
|
-
moment('5:00p.m.March 4 2012', 'h:mmAMMMM D YYYY').format(
|
560
|
-
'YYYY-MM-DDThh:mmA'
|
561
|
-
),
|
562
|
-
'2012-03-04T05:00PM',
|
563
|
-
'am/pm should parse correctly before month names'
|
564
|
-
);
|
565
|
-
});
|
566
|
-
|
567
|
-
test('string with format', function (assert) {
|
568
|
-
moment.locale('en');
|
569
|
-
var a = [
|
570
|
-
['YYYY-Q', '2014-4'],
|
571
|
-
['MM-DD-YYYY', '12-02-1999'],
|
572
|
-
['DD-MM-YYYY', '12-02-1999'],
|
573
|
-
['DD/MM/YYYY', '12/02/1999'],
|
574
|
-
['DD_MM_YYYY', '12_02_1999'],
|
575
|
-
['DD:MM:YYYY', '12:02:1999'],
|
576
|
-
['D-M-YY', '2-2-99'],
|
577
|
-
['YY', '99'],
|
578
|
-
['DDD-YYYY', '300-1999'],
|
579
|
-
['DD-MM-YYYY h:m:s', '12-02-1999 2:45:10'],
|
580
|
-
['DD-MM-YYYY h:m:s a', '12-02-1999 2:45:10 am'],
|
581
|
-
['DD-MM-YYYY h:m:s a', '12-02-1999 2:45:10 pm'],
|
582
|
-
['h:mm a', '12:00 pm'],
|
583
|
-
['h:mm a', '12:30 pm'],
|
584
|
-
['h:mm a', '12:00 am'],
|
585
|
-
['h:mm a', '12:30 am'],
|
586
|
-
['HH:mm', '12:00'],
|
587
|
-
['kk:mm', '12:00'],
|
588
|
-
['YYYY-MM-DDTHH:mm:ss', '2011-11-11T11:11:11'],
|
589
|
-
['MM-DD-YYYY [M]', '12-02-1999 M'],
|
590
|
-
['ddd MMM DD HH:mm:ss YYYY', 'Tue Apr 07 22:52:51 2009'],
|
591
|
-
['HH:mm:ss', '12:00:00'],
|
592
|
-
['HH:mm:ss', '12:30:00'],
|
593
|
-
['HH:mm:ss', '00:00:00'],
|
594
|
-
['HH:mm:ss S', '00:30:00 1'],
|
595
|
-
['HH:mm:ss SS', '00:30:00 12'],
|
596
|
-
['HH:mm:ss SSS', '00:30:00 123'],
|
597
|
-
['HH:mm:ss S', '00:30:00 7'],
|
598
|
-
['HH:mm:ss SS', '00:30:00 78'],
|
599
|
-
['HH:mm:ss SSS', '00:30:00 789'],
|
600
|
-
['kk:mm:ss', '12:00:00'],
|
601
|
-
['kk:mm:ss', '12:30:00'],
|
602
|
-
['kk:mm:ss', '24:00:00'],
|
603
|
-
['kk:mm:ss S', '24:30:00 1'],
|
604
|
-
['kk:mm:ss SS', '24:30:00 12'],
|
605
|
-
['kk:mm:ss SSS', '24:30:00 123'],
|
606
|
-
['kk:mm:ss S', '24:30:00 7'],
|
607
|
-
['kk:mm:ss SS', '24:30:00 78'],
|
608
|
-
['kk:mm:ss SSS', '24:30:00 789'],
|
609
|
-
['X', '1234567890'],
|
610
|
-
['x', '1234567890123'],
|
611
|
-
['LT', '12:30 AM'],
|
612
|
-
['LTS', '12:30:29 AM'],
|
613
|
-
['L', '09/02/1999'],
|
614
|
-
['l', '9/2/1999'],
|
615
|
-
['LL', 'September 2, 1999'],
|
616
|
-
['ll', 'Sep 2, 1999'],
|
617
|
-
['LLL', 'September 2, 1999 12:30 AM'],
|
618
|
-
['lll', 'Sep 2, 1999 12:30 AM'],
|
619
|
-
['LLLL', 'Thursday, September 2, 1999 12:30 AM'],
|
620
|
-
['llll', 'Thu, Sep 2, 1999 12:30 AM'],
|
621
|
-
],
|
622
|
-
m,
|
623
|
-
i;
|
624
|
-
|
625
|
-
for (i = 0; i < a.length; i++) {
|
626
|
-
m = moment(a[i][1], a[i][0]);
|
627
|
-
assert.ok(m.isValid());
|
628
|
-
assert.equal(m.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
629
|
-
}
|
630
|
-
});
|
631
|
-
|
632
|
-
test('2 digit year with YYYY format', function (assert) {
|
633
|
-
assert.equal(
|
634
|
-
moment('9/2/99', 'D/M/YYYY').format('DD/MM/YYYY'),
|
635
|
-
'09/02/1999',
|
636
|
-
'D/M/YYYY ---> 9/2/99'
|
637
|
-
);
|
638
|
-
assert.equal(
|
639
|
-
moment('9/2/1999', 'D/M/YYYY').format('DD/MM/YYYY'),
|
640
|
-
'09/02/1999',
|
641
|
-
'D/M/YYYY ---> 9/2/1999'
|
642
|
-
);
|
643
|
-
assert.equal(
|
644
|
-
moment('9/2/68', 'D/M/YYYY').format('DD/MM/YYYY'),
|
645
|
-
'09/02/2068',
|
646
|
-
'D/M/YYYY ---> 9/2/68'
|
647
|
-
);
|
648
|
-
assert.equal(
|
649
|
-
moment('9/2/69', 'D/M/YYYY').format('DD/MM/YYYY'),
|
650
|
-
'09/02/1969',
|
651
|
-
'D/M/YYYY ---> 9/2/69'
|
652
|
-
);
|
653
|
-
});
|
654
|
-
|
655
|
-
test('unix timestamp format', function (assert) {
|
656
|
-
var formats = ['X', 'X.S', 'X.SS', 'X.SSS'],
|
657
|
-
i,
|
658
|
-
format;
|
659
|
-
|
660
|
-
for (i = 0; i < formats.length; i++) {
|
661
|
-
format = formats[i];
|
662
|
-
assert.equal(
|
663
|
-
moment('1234567890', format).valueOf(),
|
664
|
-
1234567890 * 1000,
|
665
|
-
format + ' matches timestamp without milliseconds'
|
666
|
-
);
|
667
|
-
assert.equal(
|
668
|
-
moment('1234567890.1', format).valueOf(),
|
669
|
-
1234567890 * 1000 + 100,
|
670
|
-
format + ' matches timestamp with deciseconds'
|
671
|
-
);
|
672
|
-
assert.equal(
|
673
|
-
moment('1234567890.12', format).valueOf(),
|
674
|
-
1234567890 * 1000 + 120,
|
675
|
-
format + ' matches timestamp with centiseconds'
|
676
|
-
);
|
677
|
-
assert.equal(
|
678
|
-
moment('1234567890.123', format).valueOf(),
|
679
|
-
1234567890 * 1000 + 123,
|
680
|
-
format + ' matches timestamp with milliseconds'
|
681
|
-
);
|
682
|
-
}
|
683
|
-
});
|
684
|
-
|
685
|
-
test('unix offset milliseconds', function (assert) {
|
686
|
-
assert.equal(
|
687
|
-
moment('1234567890123', 'x').valueOf(),
|
688
|
-
1234567890123,
|
689
|
-
'x matches unix offset in milliseconds'
|
690
|
-
);
|
691
|
-
});
|
692
|
-
|
693
|
-
test('milliseconds format', function (assert) {
|
694
|
-
assert.equal(moment('1', 'S').get('ms'), 100, 'deciseconds');
|
695
|
-
// assert.equal(moment('10', 'S', true).isValid(), false, 'deciseconds with two digits');
|
696
|
-
// assert.equal(moment('1', 'SS', true).isValid(), false, 'centiseconds with one digits');
|
697
|
-
assert.equal(moment('12', 'SS').get('ms'), 120, 'centiseconds');
|
698
|
-
// assert.equal(moment('123', 'SS', true).isValid(), false, 'centiseconds with three digits');
|
699
|
-
assert.equal(moment('123', 'SSS').get('ms'), 123, 'milliseconds');
|
700
|
-
assert.equal(
|
701
|
-
moment('1234', 'SSSS').get('ms'),
|
702
|
-
123,
|
703
|
-
'milliseconds with SSSS'
|
704
|
-
);
|
705
|
-
assert.equal(
|
706
|
-
moment('123456789101112', 'SSSS').get('ms'),
|
707
|
-
123,
|
708
|
-
'milliseconds with SSSS'
|
709
|
-
);
|
710
|
-
});
|
711
|
-
|
712
|
-
test('string with format no separators', function (assert) {
|
713
|
-
moment.locale('en');
|
714
|
-
var a = [
|
715
|
-
['MMDDYYYY', '12021999'],
|
716
|
-
['DDMMYYYY', '12021999'],
|
717
|
-
['YYYYMMDD', '19991202'],
|
718
|
-
['DDMMMYYYY', '10Sep2001'],
|
719
|
-
],
|
720
|
-
i;
|
721
|
-
|
722
|
-
for (i = 0; i < a.length; i++) {
|
723
|
-
assert.equal(
|
724
|
-
moment(a[i][1], a[i][0]).format(a[i][0]),
|
725
|
-
a[i][1],
|
726
|
-
a[i][0] + ' ---> ' + a[i][1]
|
727
|
-
);
|
728
|
-
}
|
729
|
-
});
|
730
|
-
|
731
|
-
test('string with format (timezone)', function (assert) {
|
732
|
-
assert.equal(
|
733
|
-
moment('5 -0700', 'H ZZ').toDate().getUTCHours(),
|
734
|
-
12,
|
735
|
-
"parse hours '5 -0700' ---> 'H ZZ'"
|
736
|
-
);
|
737
|
-
assert.equal(
|
738
|
-
moment('5 -07:00', 'H Z').toDate().getUTCHours(),
|
739
|
-
12,
|
740
|
-
"parse hours '5 -07:00' ---> 'H Z'"
|
741
|
-
);
|
742
|
-
assert.equal(
|
743
|
-
moment('5 -0730', 'H ZZ').toDate().getUTCMinutes(),
|
744
|
-
30,
|
745
|
-
"parse hours '5 -0730' ---> 'H ZZ'"
|
746
|
-
);
|
747
|
-
assert.equal(
|
748
|
-
moment('5 -07:30', 'H Z').toDate().getUTCMinutes(),
|
749
|
-
30,
|
750
|
-
"parse hours '5 -07:0' ---> 'H Z'"
|
751
|
-
);
|
752
|
-
assert.equal(
|
753
|
-
moment('5 +0100', 'H ZZ').toDate().getUTCHours(),
|
754
|
-
4,
|
755
|
-
"parse hours '5 +0100' ---> 'H ZZ'"
|
756
|
-
);
|
757
|
-
assert.equal(
|
758
|
-
moment('5 +01:00', 'H Z').toDate().getUTCHours(),
|
759
|
-
4,
|
760
|
-
"parse hours '5 +01:00' ---> 'H Z'"
|
761
|
-
);
|
762
|
-
assert.equal(
|
763
|
-
moment('5 +0130', 'H ZZ').toDate().getUTCMinutes(),
|
764
|
-
30,
|
765
|
-
"parse hours '5 +0130' ---> 'H ZZ'"
|
766
|
-
);
|
767
|
-
assert.equal(
|
768
|
-
moment('5 +01:30', 'H Z').toDate().getUTCMinutes(),
|
769
|
-
30,
|
770
|
-
"parse hours '5 +01:30' ---> 'H Z'"
|
771
|
-
);
|
772
|
-
});
|
773
|
-
|
774
|
-
test('string with format (timezone offset)', function (assert) {
|
775
|
-
var a, b, c, d, e, f;
|
776
|
-
a = new Date(Date.UTC(2011, 0, 1, 1));
|
777
|
-
b = moment('2011 1 1 0 -01:00', 'YYYY MM DD HH Z');
|
778
|
-
assert.equal(
|
779
|
-
a.getHours(),
|
780
|
-
b.hours(),
|
781
|
-
'date created with utc == parsed string with timezone offset'
|
782
|
-
);
|
783
|
-
assert.equal(
|
784
|
-
+a,
|
785
|
-
+b,
|
786
|
-
'date created with utc == parsed string with timezone offset'
|
787
|
-
);
|
788
|
-
c = moment('2011 2 1 10 -05:00', 'YYYY MM DD HH Z');
|
789
|
-
d = moment('2011 2 1 8 -07:00', 'YYYY MM DD HH Z');
|
790
|
-
assert.equal(
|
791
|
-
c.hours(),
|
792
|
-
d.hours(),
|
793
|
-
'10 am central time == 8 am pacific time'
|
794
|
-
);
|
795
|
-
e = moment.utc('20 07 2012 17:15:00', 'DD MM YYYY HH:mm:ss');
|
796
|
-
f = moment.utc('20 07 2012 10:15:00 -0700', 'DD MM YYYY HH:mm:ss ZZ');
|
797
|
-
assert.equal(e.hours(), f.hours(), 'parse timezone offset in utc');
|
798
|
-
});
|
799
|
-
|
800
|
-
test('string with timezone around start of year', function (assert) {
|
801
|
-
assert.equal(
|
802
|
-
moment('2000-01-01T00:00:00.000+01:00').toISOString(),
|
803
|
-
'1999-12-31T23:00:00.000Z',
|
804
|
-
'+1:00 around 2000'
|
805
|
-
);
|
806
|
-
assert.equal(
|
807
|
-
moment('2000-01-01T00:00:00.000-01:00').toISOString(),
|
808
|
-
'2000-01-01T01:00:00.000Z',
|
809
|
-
'-1:00 around 2000'
|
810
|
-
);
|
811
|
-
assert.equal(
|
812
|
-
moment('1970-01-01T00:00:00.000+01:00').toISOString(),
|
813
|
-
'1969-12-31T23:00:00.000Z',
|
814
|
-
'+1:00 around 1970'
|
815
|
-
);
|
816
|
-
assert.equal(
|
817
|
-
moment('1970-01-01T00:00:00.000-01:00').toISOString(),
|
818
|
-
'1970-01-01T01:00:00.000Z',
|
819
|
-
'-1:00 around 1970'
|
820
|
-
);
|
821
|
-
assert.equal(
|
822
|
-
moment('1200-01-01T00:00:00.000+01:00').toISOString(),
|
823
|
-
'1199-12-31T23:00:00.000Z',
|
824
|
-
'+1:00 around 1200'
|
825
|
-
);
|
826
|
-
assert.equal(
|
827
|
-
moment('1200-01-01T00:00:00.000-01:00').toISOString(),
|
828
|
-
'1200-01-01T01:00:00.000Z',
|
829
|
-
'-1:00 around 1200'
|
830
|
-
);
|
831
|
-
});
|
832
|
-
|
833
|
-
test('string with array of formats', function (assert) {
|
834
|
-
var thursdayForCurrentWeek = moment().day(4).format('YYYY MM DD');
|
835
|
-
|
836
|
-
assert.equal(
|
837
|
-
moment('11-02-1999', ['MM-DD-YYYY', 'DD-MM-YYYY']).format('MM DD YYYY'),
|
838
|
-
'11 02 1999',
|
839
|
-
'switching month and day'
|
840
|
-
);
|
841
|
-
assert.equal(
|
842
|
-
moment('02-11-1999', ['MM/DD/YYYY', 'YYYY MM DD', 'MM-DD-YYYY']).format(
|
843
|
-
'MM DD YYYY'
|
844
|
-
),
|
845
|
-
'02 11 1999',
|
846
|
-
'year last'
|
847
|
-
);
|
848
|
-
assert.equal(
|
849
|
-
moment('1999-02-11', ['MM/DD/YYYY', 'YYYY MM DD', 'MM-DD-YYYY']).format(
|
850
|
-
'MM DD YYYY'
|
851
|
-
),
|
852
|
-
'02 11 1999',
|
853
|
-
'year first'
|
854
|
-
);
|
855
|
-
|
856
|
-
assert.equal(
|
857
|
-
moment('02-11-1999', ['MM/DD/YYYY', 'YYYY MM DD']).format('MM DD YYYY'),
|
858
|
-
'02 11 1999',
|
859
|
-
'year last'
|
860
|
-
);
|
861
|
-
assert.equal(
|
862
|
-
moment('1999-02-11', ['MM/DD/YYYY', 'YYYY MM DD']).format('MM DD YYYY'),
|
863
|
-
'02 11 1999',
|
864
|
-
'year first'
|
865
|
-
);
|
866
|
-
assert.equal(
|
867
|
-
moment('02-11-1999', ['YYYY MM DD', 'MM/DD/YYYY']).format('MM DD YYYY'),
|
868
|
-
'02 11 1999',
|
869
|
-
'year last'
|
870
|
-
);
|
871
|
-
assert.equal(
|
872
|
-
moment('1999-02-11', ['YYYY MM DD', 'MM/DD/YYYY']).format('MM DD YYYY'),
|
873
|
-
'02 11 1999',
|
874
|
-
'year first'
|
875
|
-
);
|
876
|
-
|
877
|
-
assert.equal(
|
878
|
-
moment('13-11-1999', ['MM/DD/YYYY', 'DD/MM/YYYY']).format('MM DD YYYY'),
|
879
|
-
'11 13 1999',
|
880
|
-
'second must be month'
|
881
|
-
);
|
882
|
-
assert.equal(
|
883
|
-
moment('11-13-1999', ['MM/DD/YYYY', 'DD/MM/YYYY']).format('MM DD YYYY'),
|
884
|
-
'11 13 1999',
|
885
|
-
'first must be month'
|
886
|
-
);
|
887
|
-
assert.equal(
|
888
|
-
moment('01-02-2000', ['MM/DD/YYYY', 'DD/MM/YYYY']).format('MM DD YYYY'),
|
889
|
-
'01 02 2000',
|
890
|
-
'either can be a month, month first format'
|
891
|
-
);
|
892
|
-
assert.equal(
|
893
|
-
moment('02-01-2000', ['DD/MM/YYYY', 'MM/DD/YYYY']).format('MM DD YYYY'),
|
894
|
-
'01 02 2000',
|
895
|
-
'either can be a month, day first format'
|
896
|
-
);
|
897
|
-
|
898
|
-
assert.equal(
|
899
|
-
moment('11-02-10', ['MM/DD/YY', 'YY MM DD', 'DD-MM-YY']).format(
|
900
|
-
'MM DD YYYY'
|
901
|
-
),
|
902
|
-
'02 11 2010',
|
903
|
-
'all unparsed substrings have influence on format penalty'
|
904
|
-
);
|
905
|
-
assert.equal(
|
906
|
-
moment('11-02-10', ['MM-DD-YY HH:mm', 'YY MM DD']).format('MM DD YYYY'),
|
907
|
-
'02 10 2011',
|
908
|
-
'prefer formats without extra tokens'
|
909
|
-
);
|
910
|
-
assert.equal(
|
911
|
-
moment('11-02-10 junk', ['MM-DD-YY', 'YY.MM.DD [junk]']).format(
|
912
|
-
'MM DD YYYY'
|
913
|
-
),
|
914
|
-
'02 10 2011',
|
915
|
-
'prefer formats that dont result in extra characters'
|
916
|
-
);
|
917
|
-
assert.equal(
|
918
|
-
moment('11-22-10', ['YY-MM-DD', 'YY-DD-MM']).format('MM DD YYYY'),
|
919
|
-
'10 22 2011',
|
920
|
-
'prefer valid results'
|
921
|
-
);
|
922
|
-
|
923
|
-
assert.equal(
|
924
|
-
moment('gibberish', ['YY-MM-DD', 'YY-DD-MM']).format('MM DD YYYY'),
|
925
|
-
'Invalid date',
|
926
|
-
'doest throw for invalid strings'
|
927
|
-
);
|
928
|
-
assert.equal(
|
929
|
-
moment('gibberish', []).format('MM DD YYYY'),
|
930
|
-
'Invalid date',
|
931
|
-
'doest throw for an empty array'
|
932
|
-
);
|
933
|
-
|
934
|
-
// https://github.com/moment/moment/issues/1143
|
935
|
-
assert.equal(
|
936
|
-
moment(
|
937
|
-
'System Administrator and Database Assistant (7/1/2011), System Administrator and Database Assistant (7/1/2011), Database Coordinator (7/1/2011), Vice President (7/1/2011), System Administrator and Database Assistant (5/31/2012), Database Coordinator (7/1/2012), System Administrator and Database Assistant (7/1/2013)',
|
938
|
-
['MM/DD/YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD', 'YYYY-MM-DDTHH:mm:ssZ']
|
939
|
-
).format('YYYY-MM-DD'),
|
940
|
-
'2011-07-01',
|
941
|
-
'Works for long strings'
|
942
|
-
);
|
943
|
-
|
944
|
-
assert.equal(
|
945
|
-
moment('11-02-10', ['MM.DD.YY', 'DD-MM-YY']).format('MM DD YYYY'),
|
946
|
-
'02 11 2010',
|
947
|
-
'escape RegExp special characters on comparing'
|
948
|
-
);
|
949
|
-
|
950
|
-
assert.equal(
|
951
|
-
moment('13-10-98', ['DD MM YY', 'DD MM YYYY'])._f,
|
952
|
-
'DD MM YY',
|
953
|
-
'use two digit year'
|
954
|
-
);
|
955
|
-
assert.equal(
|
956
|
-
moment('13-10-1998', ['DD MM YY', 'DD MM YYYY'])._f,
|
957
|
-
'DD MM YYYY',
|
958
|
-
'use four digit year'
|
959
|
-
);
|
960
|
-
|
961
|
-
assert.equal(
|
962
|
-
moment('01', ['MM', 'DD'])._f,
|
963
|
-
'MM',
|
964
|
-
'Should use first valid format'
|
965
|
-
);
|
966
|
-
|
967
|
-
assert.equal(
|
968
|
-
moment('Thursday 8:30pm', ['dddd h:mma']).format(
|
969
|
-
'YYYY MM DD dddd h:mma'
|
970
|
-
),
|
971
|
-
thursdayForCurrentWeek + ' Thursday 8:30pm',
|
972
|
-
'Default to current week'
|
973
|
-
);
|
974
|
-
});
|
975
|
-
|
976
|
-
test('string with array of formats + ISO', function (assert) {
|
977
|
-
assert.equal(
|
978
|
-
moment('1994', [moment.ISO_8601, 'MM', 'HH:mm', 'YYYY']).year(),
|
979
|
-
1994,
|
980
|
-
'iso: assert parse YYYY'
|
981
|
-
);
|
982
|
-
assert.equal(
|
983
|
-
moment('17:15', [moment.ISO_8601, 'MM', 'HH:mm', 'YYYY']).hour(),
|
984
|
-
17,
|
985
|
-
'iso: assert parse HH:mm (1)'
|
986
|
-
);
|
987
|
-
assert.equal(
|
988
|
-
moment('24:15', [moment.ISO_8601, 'MM', 'kk:mm', 'YYYY']).hour(),
|
989
|
-
0,
|
990
|
-
'iso: assert parse kk:mm'
|
991
|
-
);
|
992
|
-
assert.equal(
|
993
|
-
moment('17:15', [moment.ISO_8601, 'MM', 'HH:mm', 'YYYY']).minutes(),
|
994
|
-
15,
|
995
|
-
'iso: assert parse HH:mm (2)'
|
996
|
-
);
|
997
|
-
assert.equal(
|
998
|
-
moment('06', [moment.ISO_8601, 'MM', 'HH:mm', 'YYYY']).month(),
|
999
|
-
6 - 1,
|
1000
|
-
'iso: assert parse MM'
|
1001
|
-
);
|
1002
|
-
assert.equal(
|
1003
|
-
moment('2012-06-01', [
|
1004
|
-
moment.ISO_8601,
|
1005
|
-
'MM',
|
1006
|
-
'HH:mm',
|
1007
|
-
'YYYY',
|
1008
|
-
]).parsingFlags().iso,
|
1009
|
-
true,
|
1010
|
-
'iso: assert parse iso'
|
1011
|
-
);
|
1012
|
-
assert.equal(
|
1013
|
-
moment('2014-05-05', [moment.ISO_8601, 'YYYY-MM-DD']).parsingFlags()
|
1014
|
-
.iso,
|
1015
|
-
true,
|
1016
|
-
'iso: edge case array precedence iso'
|
1017
|
-
);
|
1018
|
-
assert.equal(
|
1019
|
-
moment('2014-05-05', ['YYYY-MM-DD', moment.ISO_8601]).parsingFlags()
|
1020
|
-
.iso,
|
1021
|
-
false,
|
1022
|
-
'iso: edge case array precedence not iso'
|
1023
|
-
);
|
1024
|
-
});
|
1025
|
-
|
1026
|
-
test('strict parsing invalid date against array of formats', function (assert) {
|
1027
|
-
var b = moment(
|
1028
|
-
'2/30/2019 7:00pm',
|
1029
|
-
[
|
1030
|
-
'M/DD/YYYY h:mma", "MM/DD/YYYY h:mma", "M-D-YYYY h:mma", "MM-D-YYYY h:mma',
|
1031
|
-
],
|
1032
|
-
true
|
1033
|
-
);
|
1034
|
-
assert.deepEqual(
|
1035
|
-
b.parsingFlags().parsedDateParts,
|
1036
|
-
[2019, 1, 30, 7, 0],
|
1037
|
-
'strict parsing multiple formats should still select the best format even if the date is invalid'
|
1038
|
-
);
|
1039
|
-
});
|
1040
|
-
|
1041
|
-
test('string with format - years', function (assert) {
|
1042
|
-
assert.equal(moment('67', 'YY').format('YYYY'), '2067', '67 > 2067');
|
1043
|
-
assert.equal(moment('68', 'YY').format('YYYY'), '2068', '68 > 2068');
|
1044
|
-
assert.equal(moment('69', 'YY').format('YYYY'), '1969', '69 > 1969');
|
1045
|
-
assert.equal(moment('70', 'YY').format('YYYY'), '1970', '70 > 1970');
|
1046
|
-
});
|
1047
|
-
|
1048
|
-
test('implicit cloning', function (assert) {
|
1049
|
-
var momentA = moment([2011, 10, 10]),
|
1050
|
-
momentB = moment(momentA);
|
1051
|
-
momentA.month(5);
|
1052
|
-
assert.notEqual(
|
1053
|
-
momentA.month(),
|
1054
|
-
momentB.month(),
|
1055
|
-
'Calling moment() on a moment will create a clone'
|
1056
|
-
);
|
1057
|
-
});
|
1058
|
-
|
1059
|
-
test('explicit cloning', function (assert) {
|
1060
|
-
var momentA = moment([2011, 10, 10]),
|
1061
|
-
momentB = momentA.clone();
|
1062
|
-
momentA.month(5);
|
1063
|
-
assert.notEqual(
|
1064
|
-
momentA.month(),
|
1065
|
-
momentB.month(),
|
1066
|
-
'Calling clone() on a moment will create a clone'
|
1067
|
-
);
|
1068
|
-
});
|
1069
|
-
|
1070
|
-
test('cloning carrying over utc mode', function (assert) {
|
1071
|
-
assert.equal(
|
1072
|
-
moment().local().clone()._isUTC,
|
1073
|
-
false,
|
1074
|
-
'An explicit cloned local moment should have _isUTC == false'
|
1075
|
-
);
|
1076
|
-
assert.equal(
|
1077
|
-
moment().utc().clone()._isUTC,
|
1078
|
-
true,
|
1079
|
-
'An cloned utc moment should have _isUTC == true'
|
1080
|
-
);
|
1081
|
-
assert.equal(
|
1082
|
-
moment().clone()._isUTC,
|
1083
|
-
false,
|
1084
|
-
'An explicit cloned local moment should have _isUTC == false'
|
1085
|
-
);
|
1086
|
-
assert.equal(
|
1087
|
-
moment.utc().clone()._isUTC,
|
1088
|
-
true,
|
1089
|
-
'An explicit cloned utc moment should have _isUTC == true'
|
1090
|
-
);
|
1091
|
-
assert.equal(
|
1092
|
-
moment(moment().local())._isUTC,
|
1093
|
-
false,
|
1094
|
-
'An implicit cloned local moment should have _isUTC == false'
|
1095
|
-
);
|
1096
|
-
assert.equal(
|
1097
|
-
moment(moment().utc())._isUTC,
|
1098
|
-
true,
|
1099
|
-
'An implicit cloned utc moment should have _isUTC == true'
|
1100
|
-
);
|
1101
|
-
assert.equal(
|
1102
|
-
moment(moment())._isUTC,
|
1103
|
-
false,
|
1104
|
-
'An implicit cloned local moment should have _isUTC == false'
|
1105
|
-
);
|
1106
|
-
assert.equal(
|
1107
|
-
moment(moment.utc())._isUTC,
|
1108
|
-
true,
|
1109
|
-
'An implicit cloned utc moment should have _isUTC == true'
|
1110
|
-
);
|
1111
|
-
});
|
1112
|
-
|
1113
|
-
test('parsing RFC 2822', function (assert) {
|
1114
|
-
var testCases = {
|
1115
|
-
'Tue, 01 Nov 2016 01:23:45 UT': [2016, 10, 1, 1, 23, 45, 0],
|
1116
|
-
'Sun, 12 Apr 2015 05:06:07 GMT': [2015, 3, 12, 5, 6, 7, 0],
|
1117
|
-
'Tue, 01 Nov 2016 01:23:45 +0000': [2016, 10, 1, 1, 23, 45, 0],
|
1118
|
-
'Tue, 01 Nov 16 04:23:45 Z': [2016, 10, 1, 4, 23, 45, 0],
|
1119
|
-
'01 Nov 2016 05:23:45 z': [2016, 10, 1, 5, 23, 45, 0],
|
1120
|
-
'(Init Comment) Tue,\n 1 Nov 2016 (Split\n Comment) 07:23:45 +0000 (GMT)': [
|
1121
|
-
2016,
|
1122
|
-
10,
|
1123
|
-
1,
|
1124
|
-
7,
|
1125
|
-
23,
|
1126
|
-
45,
|
1127
|
-
0,
|
1128
|
-
],
|
1129
|
-
'Mon, 02 Jan 2017 06:00:00 -0800': [2017, 0, 2, 6, 0, 0, -8 * 60],
|
1130
|
-
'Mon, 02 Jan 2017 06:00:00 +0800': [2017, 0, 2, 6, 0, 0, +8 * 60],
|
1131
|
-
'Mon, 02 Jan 2017 06:00:00 +0330': [
|
1132
|
-
2017,
|
1133
|
-
0,
|
1134
|
-
2,
|
1135
|
-
6,
|
1136
|
-
0,
|
1137
|
-
0,
|
1138
|
-
+(3 * 60 + 30),
|
1139
|
-
],
|
1140
|
-
'Mon, 02 Jan 2017 06:00:00 -0330': [
|
1141
|
-
2017,
|
1142
|
-
0,
|
1143
|
-
2,
|
1144
|
-
6,
|
1145
|
-
0,
|
1146
|
-
0,
|
1147
|
-
-(3 * 60 + 30),
|
1148
|
-
],
|
1149
|
-
'Mon, 02 Jan 2017 06:00:00 PST': [2017, 0, 2, 6, 0, 0, -8 * 60],
|
1150
|
-
'Mon, 02 Jan 2017 06:00:00 PDT': [2017, 0, 2, 6, 0, 0, -7 * 60],
|
1151
|
-
'Mon, 02 Jan 2017 06:00:00 MST': [2017, 0, 2, 6, 0, 0, -7 * 60],
|
1152
|
-
'Mon, 02 Jan 2017 06:00:00 MDT': [2017, 0, 2, 6, 0, 0, -6 * 60],
|
1153
|
-
'Mon, 02 Jan 2017 06:00:00 CST': [2017, 0, 2, 6, 0, 0, -6 * 60],
|
1154
|
-
'Mon, 02 Jan 2017 06:00:00 CDT': [2017, 0, 2, 6, 0, 0, -5 * 60],
|
1155
|
-
'Mon, 02 Jan 2017 06:00:00 EST': [2017, 0, 2, 6, 0, 0, -5 * 60],
|
1156
|
-
'Mon, 02 Jan 2017 06:00:00 EDT': [2017, 0, 2, 6, 0, 0, -4 * 60],
|
1157
|
-
};
|
1158
|
-
|
1159
|
-
eachOwnProp(testCases, function (inp) {
|
1160
|
-
var tokens = testCases[inp],
|
1161
|
-
parseResult = moment(inp, moment.RFC_2822, true).parseZone(),
|
1162
|
-
expResult = moment
|
1163
|
-
.utc(tokens.slice(0, 6))
|
1164
|
-
.utcOffset(tokens[6], true);
|
1165
|
-
assert.ok(parseResult.isValid(), inp);
|
1166
|
-
assert.ok(
|
1167
|
-
parseResult.parsingFlags().rfc2822,
|
1168
|
-
inp + ' - rfc2822 parsingFlag'
|
1169
|
-
);
|
1170
|
-
assert.equal(
|
1171
|
-
parseResult.utcOffset(),
|
1172
|
-
expResult.utcOffset(),
|
1173
|
-
inp + ' - zone'
|
1174
|
-
);
|
1175
|
-
assert.equal(
|
1176
|
-
parseResult.valueOf(),
|
1177
|
-
expResult.valueOf(),
|
1178
|
-
inp + ' - correctness'
|
1179
|
-
);
|
1180
|
-
});
|
1181
|
-
});
|
1182
|
-
|
1183
|
-
test('non RFC 2822 strings', function (assert) {
|
1184
|
-
var testCases = {
|
1185
|
-
'RFC2822 datetime with all options but invalid day delimiter':
|
1186
|
-
'Tue. 01 Nov 2016 01:23:45 GMT',
|
1187
|
-
'RFC2822 datetime with mismatching Day (weekday v date)':
|
1188
|
-
'Mon, 01 Nov 2016 01:23:45 GMT',
|
1189
|
-
};
|
1190
|
-
|
1191
|
-
eachOwnProp(testCases, function (testCase) {
|
1192
|
-
var testResult = moment(testCases[testCase], moment.RFC_2822, true);
|
1193
|
-
assert.ok(
|
1194
|
-
!testResult.isValid(),
|
1195
|
-
testCase + ': ' + testResult + ' - is invalid rfc2822'
|
1196
|
-
);
|
1197
|
-
assert.ok(
|
1198
|
-
!testResult.parsingFlags().rfc2822,
|
1199
|
-
testCase + ': ' + testResult + ' - rfc2822 parsingFlag'
|
1200
|
-
);
|
1201
|
-
});
|
1202
|
-
});
|
1203
|
-
|
1204
|
-
test('parsing RFC 2822 in a different locale', function (assert) {
|
1205
|
-
var testCases = {
|
1206
|
-
'clean RFC2822 datetime with all options':
|
1207
|
-
'Tue, 01 Nov 2016 01:23:45 UT',
|
1208
|
-
'clean RFC2822 datetime without comma': 'Tue 01 Nov 2016 02:23:45 GMT',
|
1209
|
-
'clean RFC2822 datetime without seconds':
|
1210
|
-
'Tue, 01 Nov 2016 03:23 +0000',
|
1211
|
-
'clean RFC2822 datetime without century': 'Tue, 01 Nov 16 04:23:45 Z',
|
1212
|
-
'clean RFC2822 datetime without day': '01 Nov 2016 05:23:45 z',
|
1213
|
-
'clean RFC2822 datetime with single-digit day-of-month':
|
1214
|
-
'Tue, 1 Nov 2016 06:23:45 GMT',
|
1215
|
-
'RFC2822 datetime with CFWSs':
|
1216
|
-
'(Init Comment) Tue,\n 1 Nov 2016 (Split\n Comment) 07:23:45 +0000 (GMT)',
|
1217
|
-
};
|
1218
|
-
|
1219
|
-
try {
|
1220
|
-
moment.locale('ru');
|
1221
|
-
eachOwnProp(testCases, function (testCase) {
|
1222
|
-
var testResult = moment(testCases[testCase], moment.RFC_2822, true);
|
1223
|
-
assert.ok(testResult.isValid(), testResult);
|
1224
|
-
assert.ok(
|
1225
|
-
testResult.parsingFlags().rfc2822,
|
1226
|
-
testResult + ' - rfc2822 parsingFlag'
|
1227
|
-
);
|
1228
|
-
});
|
1229
|
-
} finally {
|
1230
|
-
moment.locale('en');
|
1231
|
-
}
|
1232
|
-
});
|
1233
|
-
|
1234
|
-
test('non RFC 2822 strings in a different locale', function (assert) {
|
1235
|
-
var testCases = {
|
1236
|
-
'RFC2822 datetime with all options but invalid day delimiter':
|
1237
|
-
'Tue. 01 Nov 2016 01:23:45 GMT',
|
1238
|
-
'RFC2822 datetime with mismatching Day (week v date)':
|
1239
|
-
'Mon, 01 Nov 2016 01:23:45 GMT',
|
1240
|
-
};
|
1241
|
-
|
1242
|
-
try {
|
1243
|
-
moment.locale('ru');
|
1244
|
-
eachOwnProp(testCases, function (testCase) {
|
1245
|
-
var testResult = moment(testCases[testCase], moment.RFC_2822, true);
|
1246
|
-
assert.ok(!testResult.isValid(), testResult);
|
1247
|
-
assert.ok(
|
1248
|
-
!testResult.parsingFlags().rfc2822,
|
1249
|
-
testResult + ' - rfc2822 parsingFlag'
|
1250
|
-
);
|
1251
|
-
});
|
1252
|
-
} finally {
|
1253
|
-
moment.locale('en');
|
1254
|
-
}
|
1255
|
-
});
|
1256
|
-
|
1257
|
-
test('parsing iso', function (assert) {
|
1258
|
-
var offset = moment([2011, 9, 8]).utcOffset(),
|
1259
|
-
pad = function (input) {
|
1260
|
-
if (input < 10) {
|
1261
|
-
return '0' + input;
|
1262
|
-
}
|
1263
|
-
return '' + input;
|
1264
|
-
},
|
1265
|
-
offStr = function (offset) {
|
1266
|
-
var hourOffset =
|
1267
|
-
offset > 0
|
1268
|
-
? Math.floor(offset / 60)
|
1269
|
-
: Math.ceil(offset / 60),
|
1270
|
-
minOffset = offset - hourOffset * 60;
|
1271
|
-
return offset >= 0
|
1272
|
-
? '+' + pad(hourOffset) + ':' + pad(minOffset)
|
1273
|
-
: '-' + pad(-hourOffset) + ':' + pad(-minOffset);
|
1274
|
-
},
|
1275
|
-
tz = offStr(offset),
|
1276
|
-
tz0 = offStr(moment([2011, 0, 1]).utcOffset()),
|
1277
|
-
tz2 = tz.replace(':', ''),
|
1278
|
-
tz3 = tz2.slice(0, 3),
|
1279
|
-
//Tz3 removes minutes digit so will break the tests when parsed if they all use the same minutes digit
|
1280
|
-
hourOffset =
|
1281
|
-
offset > 0 ? Math.floor(offset / 60) : Math.ceil(offset / 60),
|
1282
|
-
minOffset = offset - hourOffset * 60,
|
1283
|
-
minutesForTz3 = pad((4 + minOffset) % 60),
|
1284
|
-
// minute = pad(4 + minOffset),
|
1285
|
-
|
1286
|
-
formats = [
|
1287
|
-
['2011', '2011-01-01T00:00:00.000' + tz0],
|
1288
|
-
['2011-10', '2011-10-01T00:00:00.000' + tz],
|
1289
|
-
['2011-10-08', '2011-10-08T00:00:00.000' + tz],
|
1290
|
-
['2011-10-08T18', '2011-10-08T18:00:00.000' + tz],
|
1291
|
-
['2011-10-08T18:04', '2011-10-08T18:04:00.000' + tz],
|
1292
|
-
['2011-10-08T18:04:20', '2011-10-08T18:04:20.000' + tz],
|
1293
|
-
['2011-10-08T18:04' + tz, '2011-10-08T18:04:00.000' + tz],
|
1294
|
-
['2011-10-08T18:04:20' + tz, '2011-10-08T18:04:20.000' + tz],
|
1295
|
-
['2011-10-08T18:04' + tz2, '2011-10-08T18:04:00.000' + tz],
|
1296
|
-
['2011-10-08T18:04:20' + tz2, '2011-10-08T18:04:20.000' + tz],
|
1297
|
-
[
|
1298
|
-
'2011-10-08T18:04' + tz3,
|
1299
|
-
'2011-10-08T18:' + minutesForTz3 + ':00.000' + tz,
|
1300
|
-
],
|
1301
|
-
[
|
1302
|
-
'2011-10-08T18:04:20' + tz3,
|
1303
|
-
'2011-10-08T18:' + minutesForTz3 + ':20.000' + tz,
|
1304
|
-
],
|
1305
|
-
['2011-10-08T18:04:20.1' + tz2, '2011-10-08T18:04:20.100' + tz],
|
1306
|
-
['2011-10-08T18:04:20.11' + tz2, '2011-10-08T18:04:20.110' + tz],
|
1307
|
-
['2011-10-08T18:04:20.111' + tz2, '2011-10-08T18:04:20.111' + tz],
|
1308
|
-
['2011-10-08 18', '2011-10-08T18:00:00.000' + tz],
|
1309
|
-
['2011-10-08 18:04', '2011-10-08T18:04:00.000' + tz],
|
1310
|
-
['2011-10-08 18:04:20', '2011-10-08T18:04:20.000' + tz],
|
1311
|
-
['2011-10-08 18:04' + tz, '2011-10-08T18:04:00.000' + tz],
|
1312
|
-
['2011-10-08 18:04:20' + tz, '2011-10-08T18:04:20.000' + tz],
|
1313
|
-
['2011-10-08 18:04' + tz2, '2011-10-08T18:04:00.000' + tz],
|
1314
|
-
['2011-10-08 18:04:20' + tz2, '2011-10-08T18:04:20.000' + tz],
|
1315
|
-
[
|
1316
|
-
'2011-10-08 18:04' + tz3,
|
1317
|
-
'2011-10-08T18:' + minutesForTz3 + ':00.000' + tz,
|
1318
|
-
],
|
1319
|
-
[
|
1320
|
-
'2011-10-08 18:04:20' + tz3,
|
1321
|
-
'2011-10-08T18:' + minutesForTz3 + ':20.000' + tz,
|
1322
|
-
],
|
1323
|
-
['2011-10-08 18:04:20.1' + tz2, '2011-10-08T18:04:20.100' + tz],
|
1324
|
-
['2011-10-08 18:04:20.11' + tz2, '2011-10-08T18:04:20.110' + tz],
|
1325
|
-
['2011-10-08 18:04:20.111' + tz2, '2011-10-08T18:04:20.111' + tz],
|
1326
|
-
['2011-W40', '2011-10-03T00:00:00.000' + tz],
|
1327
|
-
['2011-W40-6', '2011-10-08T00:00:00.000' + tz],
|
1328
|
-
['2011-W40-6T18', '2011-10-08T18:00:00.000' + tz],
|
1329
|
-
['2011-W40-6T18:04', '2011-10-08T18:04:00.000' + tz],
|
1330
|
-
['2011-W40-6T18:04:20', '2011-10-08T18:04:20.000' + tz],
|
1331
|
-
['2011-W40-6T18:04' + tz, '2011-10-08T18:04:00.000' + tz],
|
1332
|
-
['2011-W40-6T18:04:20' + tz, '2011-10-08T18:04:20.000' + tz],
|
1333
|
-
['2011-W40-6T18:04' + tz2, '2011-10-08T18:04:00.000' + tz],
|
1334
|
-
['2011-W40-6T18:04:20' + tz2, '2011-10-08T18:04:20.000' + tz],
|
1335
|
-
[
|
1336
|
-
'2011-W40-6T18:04' + tz3,
|
1337
|
-
'2011-10-08T18:' + minutesForTz3 + ':00.000' + tz,
|
1338
|
-
],
|
1339
|
-
[
|
1340
|
-
'2011-W40-6T18:04:20' + tz3,
|
1341
|
-
'2011-10-08T18:' + minutesForTz3 + ':20.000' + tz,
|
1342
|
-
],
|
1343
|
-
['2011-W40-6T18:04:20.1' + tz2, '2011-10-08T18:04:20.100' + tz],
|
1344
|
-
['2011-W40-6T18:04:20.11' + tz2, '2011-10-08T18:04:20.110' + tz],
|
1345
|
-
['2011-W40-6T18:04:20.111' + tz2, '2011-10-08T18:04:20.111' + tz],
|
1346
|
-
['2011-W40-6 18', '2011-10-08T18:00:00.000' + tz],
|
1347
|
-
['2011-W40-6 18:04', '2011-10-08T18:04:00.000' + tz],
|
1348
|
-
['2011-W40-6 18:04:20', '2011-10-08T18:04:20.000' + tz],
|
1349
|
-
['2011-W40-6 18:04' + tz, '2011-10-08T18:04:00.000' + tz],
|
1350
|
-
['2011-W40-6 18:04:20' + tz, '2011-10-08T18:04:20.000' + tz],
|
1351
|
-
['2011-W40-6 18:04' + tz2, '2011-10-08T18:04:00.000' + tz],
|
1352
|
-
['2011-W40-6 18:04:20' + tz2, '2011-10-08T18:04:20.000' + tz],
|
1353
|
-
[
|
1354
|
-
'2011-W40-6 18:04' + tz3,
|
1355
|
-
'2011-10-08T18:' + minutesForTz3 + ':00.000' + tz,
|
1356
|
-
],
|
1357
|
-
[
|
1358
|
-
'2011-W40-6 18:04:20' + tz3,
|
1359
|
-
'2011-10-08T18:' + minutesForTz3 + ':20.000' + tz,
|
1360
|
-
],
|
1361
|
-
['2011-W40-6 18:04:20.1' + tz2, '2011-10-08T18:04:20.100' + tz],
|
1362
|
-
['2011-W40-6 18:04:20.11' + tz2, '2011-10-08T18:04:20.110' + tz],
|
1363
|
-
['2011-W40-6 18:04:20.111' + tz2, '2011-10-08T18:04:20.111' + tz],
|
1364
|
-
['2011-281', '2011-10-08T00:00:00.000' + tz],
|
1365
|
-
['2011-281T18', '2011-10-08T18:00:00.000' + tz],
|
1366
|
-
['2011-281T18:04', '2011-10-08T18:04:00.000' + tz],
|
1367
|
-
['2011-281T18:04:20', '2011-10-08T18:04:20.000' + tz],
|
1368
|
-
['2011-281T18:04' + tz, '2011-10-08T18:04:00.000' + tz],
|
1369
|
-
['2011-281T18:04:20' + tz, '2011-10-08T18:04:20.000' + tz],
|
1370
|
-
['2011-281T18:04' + tz2, '2011-10-08T18:04:00.000' + tz],
|
1371
|
-
['2011-281T18:04:20' + tz2, '2011-10-08T18:04:20.000' + tz],
|
1372
|
-
[
|
1373
|
-
'2011-281T18:04' + tz3,
|
1374
|
-
'2011-10-08T18:' + minutesForTz3 + ':00.000' + tz,
|
1375
|
-
],
|
1376
|
-
[
|
1377
|
-
'2011-281T18:04:20' + tz3,
|
1378
|
-
'2011-10-08T18:' + minutesForTz3 + ':20.000' + tz,
|
1379
|
-
],
|
1380
|
-
['2011-281T18:04:20.1' + tz2, '2011-10-08T18:04:20.100' + tz],
|
1381
|
-
['2011-281T18:04:20.11' + tz2, '2011-10-08T18:04:20.110' + tz],
|
1382
|
-
['2011-281T18:04:20.111' + tz2, '2011-10-08T18:04:20.111' + tz],
|
1383
|
-
['2011-281 18', '2011-10-08T18:00:00.000' + tz],
|
1384
|
-
['2011-281 18:04', '2011-10-08T18:04:00.000' + tz],
|
1385
|
-
['2011-281 18:04:20', '2011-10-08T18:04:20.000' + tz],
|
1386
|
-
['2011-281 18:04' + tz, '2011-10-08T18:04:00.000' + tz],
|
1387
|
-
['2011-281 18:04:20' + tz, '2011-10-08T18:04:20.000' + tz],
|
1388
|
-
['2011-281 18:04' + tz2, '2011-10-08T18:04:00.000' + tz],
|
1389
|
-
['2011-281 18:04:20' + tz2, '2011-10-08T18:04:20.000' + tz],
|
1390
|
-
[
|
1391
|
-
'2011-281 18:04' + tz3,
|
1392
|
-
'2011-10-08T18:' + minutesForTz3 + ':00.000' + tz,
|
1393
|
-
],
|
1394
|
-
[
|
1395
|
-
'2011-281 18:04:20' + tz3,
|
1396
|
-
'2011-10-08T18:' + minutesForTz3 + ':20.000' + tz,
|
1397
|
-
],
|
1398
|
-
['2011-281 18:04:20.1' + tz2, '2011-10-08T18:04:20.100' + tz],
|
1399
|
-
['2011-281 18:04:20.11' + tz2, '2011-10-08T18:04:20.110' + tz],
|
1400
|
-
['2011-281 18:04:20.111' + tz2, '2011-10-08T18:04:20.111' + tz],
|
1401
|
-
['20111008T18', '2011-10-08T18:00:00.000' + tz],
|
1402
|
-
['20111008T1804', '2011-10-08T18:04:00.000' + tz],
|
1403
|
-
['20111008T180420', '2011-10-08T18:04:20.000' + tz],
|
1404
|
-
['20111008T1804' + tz, '2011-10-08T18:04:00.000' + tz],
|
1405
|
-
['20111008T180420' + tz, '2011-10-08T18:04:20.000' + tz],
|
1406
|
-
['20111008T1804' + tz2, '2011-10-08T18:04:00.000' + tz],
|
1407
|
-
['20111008T180420' + tz2, '2011-10-08T18:04:20.000' + tz],
|
1408
|
-
[
|
1409
|
-
'20111008T1804' + tz3,
|
1410
|
-
'2011-10-08T18:' + minutesForTz3 + ':00.000' + tz,
|
1411
|
-
],
|
1412
|
-
[
|
1413
|
-
'20111008T180420' + tz3,
|
1414
|
-
'2011-10-08T18:' + minutesForTz3 + ':20.000' + tz,
|
1415
|
-
],
|
1416
|
-
['20111008T180420,1' + tz2, '2011-10-08T18:04:20.100' + tz],
|
1417
|
-
['20111008T180420,11' + tz2, '2011-10-08T18:04:20.110' + tz],
|
1418
|
-
['20111008T180420,111' + tz2, '2011-10-08T18:04:20.111' + tz],
|
1419
|
-
['20111008 18', '2011-10-08T18:00:00.000' + tz],
|
1420
|
-
['20111008 1804', '2011-10-08T18:04:00.000' + tz],
|
1421
|
-
['20111008 180420', '2011-10-08T18:04:20.000' + tz],
|
1422
|
-
['20111008 1804' + tz, '2011-10-08T18:04:00.000' + tz],
|
1423
|
-
['20111008 180420' + tz, '2011-10-08T18:04:20.000' + tz],
|
1424
|
-
['20111008 1804' + tz2, '2011-10-08T18:04:00.000' + tz],
|
1425
|
-
['20111008 180420' + tz2, '2011-10-08T18:04:20.000' + tz],
|
1426
|
-
[
|
1427
|
-
'20111008 1804' + tz3,
|
1428
|
-
'2011-10-08T18:' + minutesForTz3 + ':00.000' + tz,
|
1429
|
-
],
|
1430
|
-
[
|
1431
|
-
'20111008 180420' + tz3,
|
1432
|
-
'2011-10-08T18:' + minutesForTz3 + ':20.000' + tz,
|
1433
|
-
],
|
1434
|
-
['20111008 180420,1' + tz2, '2011-10-08T18:04:20.100' + tz],
|
1435
|
-
['20111008 180420,11' + tz2, '2011-10-08T18:04:20.110' + tz],
|
1436
|
-
['20111008 180420,111' + tz2, '2011-10-08T18:04:20.111' + tz],
|
1437
|
-
['2011W40', '2011-10-03T00:00:00.000' + tz],
|
1438
|
-
['2011W406', '2011-10-08T00:00:00.000' + tz],
|
1439
|
-
['2011W406T18', '2011-10-08T18:00:00.000' + tz],
|
1440
|
-
['2011W406T1804', '2011-10-08T18:04:00.000' + tz],
|
1441
|
-
['2011W406T180420', '2011-10-08T18:04:20.000' + tz],
|
1442
|
-
['2011W406 1804' + tz2, '2011-10-08T18:04:00.000' + tz],
|
1443
|
-
['2011W406T1804' + tz, '2011-10-08T18:04:00.000' + tz],
|
1444
|
-
['2011W406T180420' + tz, '2011-10-08T18:04:20.000' + tz],
|
1445
|
-
['2011W406T1804' + tz2, '2011-10-08T18:04:00.000' + tz],
|
1446
|
-
['2011W406T180420' + tz2, '2011-10-08T18:04:20.000' + tz],
|
1447
|
-
[
|
1448
|
-
'2011W406T1804' + tz3,
|
1449
|
-
'2011-10-08T18:' + minutesForTz3 + ':00.000' + tz,
|
1450
|
-
],
|
1451
|
-
[
|
1452
|
-
'2011W406T180420' + tz3,
|
1453
|
-
'2011-10-08T18:' + minutesForTz3 + ':20.000' + tz,
|
1454
|
-
],
|
1455
|
-
['2011W406T180420,1' + tz2, '2011-10-08T18:04:20.100' + tz],
|
1456
|
-
['2011W406T180420,11' + tz2, '2011-10-08T18:04:20.110' + tz],
|
1457
|
-
['2011W406T180420,111' + tz2, '2011-10-08T18:04:20.111' + tz],
|
1458
|
-
['2011W406 18', '2011-10-08T18:00:00.000' + tz],
|
1459
|
-
['2011W406 1804', '2011-10-08T18:04:00.000' + tz],
|
1460
|
-
['2011W406 180420', '2011-10-08T18:04:20.000' + tz],
|
1461
|
-
['2011W406 1804' + tz, '2011-10-08T18:04:00.000' + tz],
|
1462
|
-
['2011W406 180420' + tz, '2011-10-08T18:04:20.000' + tz],
|
1463
|
-
['2011W406 180420' + tz2, '2011-10-08T18:04:20.000' + tz],
|
1464
|
-
[
|
1465
|
-
'2011W406 1804' + tz3,
|
1466
|
-
'2011-10-08T18:' + minutesForTz3 + ':00.000' + tz,
|
1467
|
-
],
|
1468
|
-
[
|
1469
|
-
'2011W406 180420' + tz3,
|
1470
|
-
'2011-10-08T18:' + minutesForTz3 + ':20.000' + tz,
|
1471
|
-
],
|
1472
|
-
['2011W406 180420,1' + tz2, '2011-10-08T18:04:20.100' + tz],
|
1473
|
-
['2011W406 180420,11' + tz2, '2011-10-08T18:04:20.110' + tz],
|
1474
|
-
['2011W406 180420,111' + tz2, '2011-10-08T18:04:20.111' + tz],
|
1475
|
-
['2011281', '2011-10-08T00:00:00.000' + tz],
|
1476
|
-
['2011281T18', '2011-10-08T18:00:00.000' + tz],
|
1477
|
-
['2011281T1804', '2011-10-08T18:04:00.000' + tz],
|
1478
|
-
['2011281T180420', '2011-10-08T18:04:20.000' + tz],
|
1479
|
-
['2011281T1804' + tz, '2011-10-08T18:04:00.000' + tz],
|
1480
|
-
['2011281T180420' + tz, '2011-10-08T18:04:20.000' + tz],
|
1481
|
-
['2011281T1804' + tz2, '2011-10-08T18:04:00.000' + tz],
|
1482
|
-
['2011281T180420' + tz2, '2011-10-08T18:04:20.000' + tz],
|
1483
|
-
[
|
1484
|
-
'2011281T1804' + tz3,
|
1485
|
-
'2011-10-08T18:' + minutesForTz3 + ':00.000' + tz,
|
1486
|
-
],
|
1487
|
-
[
|
1488
|
-
'2011281T180420' + tz3,
|
1489
|
-
'2011-10-08T18:' + minutesForTz3 + ':20.000' + tz,
|
1490
|
-
],
|
1491
|
-
['2011281T180420,1' + tz2, '2011-10-08T18:04:20.100' + tz],
|
1492
|
-
['2011281T180420,11' + tz2, '2011-10-08T18:04:20.110' + tz],
|
1493
|
-
['2011281T180420,111' + tz2, '2011-10-08T18:04:20.111' + tz],
|
1494
|
-
['2011281 18', '2011-10-08T18:00:00.000' + tz],
|
1495
|
-
['2011281 1804', '2011-10-08T18:04:00.000' + tz],
|
1496
|
-
['2011281 180420', '2011-10-08T18:04:20.000' + tz],
|
1497
|
-
['2011281 1804' + tz, '2011-10-08T18:04:00.000' + tz],
|
1498
|
-
['2011281 180420' + tz, '2011-10-08T18:04:20.000' + tz],
|
1499
|
-
['2011281 1804' + tz2, '2011-10-08T18:04:00.000' + tz],
|
1500
|
-
['2011281 180420' + tz2, '2011-10-08T18:04:20.000' + tz],
|
1501
|
-
[
|
1502
|
-
'2011281 1804' + tz3,
|
1503
|
-
'2011-10-08T18:' + minutesForTz3 + ':00.000' + tz,
|
1504
|
-
],
|
1505
|
-
[
|
1506
|
-
'2011281 180420' + tz3,
|
1507
|
-
'2011-10-08T18:' + minutesForTz3 + ':20.000' + tz,
|
1508
|
-
],
|
1509
|
-
['2011281 180420,1' + tz2, '2011-10-08T18:04:20.100' + tz],
|
1510
|
-
['2011281 180420,11' + tz2, '2011-10-08T18:04:20.110' + tz],
|
1511
|
-
['2011281 180420,111' + tz2, '2011-10-08T18:04:20.111' + tz],
|
1512
|
-
],
|
1513
|
-
i;
|
1514
|
-
for (i = 0; i < formats.length; i++) {
|
1515
|
-
assert.equal(
|
1516
|
-
moment(formats[i][0]).format('YYYY-MM-DDTHH:mm:ss.SSSZ'),
|
1517
|
-
formats[i][1],
|
1518
|
-
'moment should be able to parse ISO ' + formats[i][0]
|
1519
|
-
);
|
1520
|
-
assert.equal(
|
1521
|
-
moment(formats[i][0], moment.ISO_8601).format(
|
1522
|
-
'YYYY-MM-DDTHH:mm:ss.SSSZ'
|
1523
|
-
),
|
1524
|
-
formats[i][1],
|
1525
|
-
'moment should be able to parse specified ISO ' + formats[i][0]
|
1526
|
-
);
|
1527
|
-
assert.equal(
|
1528
|
-
moment(formats[i][0], moment.ISO_8601, true).format(
|
1529
|
-
'YYYY-MM-DDTHH:mm:ss.SSSZ'
|
1530
|
-
),
|
1531
|
-
formats[i][1],
|
1532
|
-
'moment should be able to parse specified strict ISO ' +
|
1533
|
-
formats[i][0]
|
1534
|
-
);
|
1535
|
-
}
|
1536
|
-
});
|
1537
|
-
|
1538
|
-
test('non iso 8601 strings', function (assert) {
|
1539
|
-
assert.ok(
|
1540
|
-
!moment('2015-10T10:15', moment.ISO_8601, true).isValid(),
|
1541
|
-
'incomplete date with time'
|
1542
|
-
);
|
1543
|
-
assert.ok(
|
1544
|
-
!moment('2015-W10T10:15', moment.ISO_8601, true).isValid(),
|
1545
|
-
'incomplete week date with time'
|
1546
|
-
);
|
1547
|
-
assert.ok(
|
1548
|
-
!moment('2015W10T1015', moment.ISO_8601, true).isValid(),
|
1549
|
-
'incomplete week date with time (basic)'
|
1550
|
-
);
|
1551
|
-
assert.ok(
|
1552
|
-
!moment('2015-10-08T1015', moment.ISO_8601, true).isValid(),
|
1553
|
-
'mixing extended and basic format'
|
1554
|
-
);
|
1555
|
-
assert.ok(
|
1556
|
-
!moment('20151008T10:15', moment.ISO_8601, true).isValid(),
|
1557
|
-
'mixing basic and extended format'
|
1558
|
-
);
|
1559
|
-
assert.ok(
|
1560
|
-
!moment('2015-10-1', moment.ISO_8601, true).isValid(),
|
1561
|
-
'missing zero padding for day'
|
1562
|
-
);
|
1563
|
-
});
|
1564
|
-
|
1565
|
-
test('parsing iso week year/week/weekday', function (assert) {
|
1566
|
-
assert.equal(
|
1567
|
-
moment.utc('2007-W01').format(),
|
1568
|
-
'2007-01-01T00:00:00Z',
|
1569
|
-
'2008 week 1 (1st Jan Mon)'
|
1570
|
-
);
|
1571
|
-
assert.equal(
|
1572
|
-
moment.utc('2008-W01').format(),
|
1573
|
-
'2007-12-31T00:00:00Z',
|
1574
|
-
'2008 week 1 (1st Jan Tue)'
|
1575
|
-
);
|
1576
|
-
assert.equal(
|
1577
|
-
moment.utc('2003-W01').format(),
|
1578
|
-
'2002-12-30T00:00:00Z',
|
1579
|
-
'2008 week 1 (1st Jan Wed)'
|
1580
|
-
);
|
1581
|
-
assert.equal(
|
1582
|
-
moment.utc('2009-W01').format(),
|
1583
|
-
'2008-12-29T00:00:00Z',
|
1584
|
-
'2009 week 1 (1st Jan Thu)'
|
1585
|
-
);
|
1586
|
-
assert.equal(
|
1587
|
-
moment.utc('2010-W01').format(),
|
1588
|
-
'2010-01-04T00:00:00Z',
|
1589
|
-
'2010 week 1 (1st Jan Fri)'
|
1590
|
-
);
|
1591
|
-
assert.equal(
|
1592
|
-
moment.utc('2011-W01').format(),
|
1593
|
-
'2011-01-03T00:00:00Z',
|
1594
|
-
'2011 week 1 (1st Jan Sat)'
|
1595
|
-
);
|
1596
|
-
assert.equal(
|
1597
|
-
moment.utc('2012-W01').format(),
|
1598
|
-
'2012-01-02T00:00:00Z',
|
1599
|
-
'2012 week 1 (1st Jan Sun)'
|
1600
|
-
);
|
1601
|
-
});
|
1602
|
-
|
1603
|
-
test('parsing weekdays verifies the day', function (assert) {
|
1604
|
-
// string with format
|
1605
|
-
assert.ok(
|
1606
|
-
!moment('Wed 08-10-2017', 'ddd MM-DD-YYYY').isValid(),
|
1607
|
-
'because day of week is incorrect for the date'
|
1608
|
-
);
|
1609
|
-
assert.ok(
|
1610
|
-
moment('Thu 08-10-2017', 'ddd MM-DD-YYYY').isValid(),
|
1611
|
-
'because day of week is correct for the date'
|
1612
|
-
);
|
1613
|
-
});
|
1614
|
-
|
1615
|
-
test('parsing weekday on utc dates verifies day according to utc time', function (assert) {
|
1616
|
-
assert.ok(moment.utc('Mon 03:59', 'ddd HH:mm').isValid(), 'Monday 03:59');
|
1617
|
-
});
|
1618
|
-
|
1619
|
-
test('parsing weekday on local dates verifies day according to local time', function (assert) {
|
1620
|
-
// this doesn't do much useful if you're not in the US or at least close to it
|
1621
|
-
assert.ok(moment('Mon 03:59', 'ddd HH:mm').isValid(), 'Monday 03:59');
|
1622
|
-
});
|
1623
|
-
|
1624
|
-
test('parsing weekday on utc dates with specified offsets verifies day according to that offset', function (assert) {
|
1625
|
-
assert.ok(
|
1626
|
-
moment.utc('Mon 03:59 +12:00', 'ddd HH:mm Z', true).isValid(),
|
1627
|
-
'Monday 03:59'
|
1628
|
-
);
|
1629
|
-
});
|
1630
|
-
|
1631
|
-
test('parsing weekday on local dates with specified offsets verifies day according to that offset', function (assert) {
|
1632
|
-
// if you're in the US, these times will all be sometime Sunday, but they should parse as Monday
|
1633
|
-
assert.ok(
|
1634
|
-
moment('Mon 03:59 +12:00', 'ddd HH:mm Z', true).isValid(),
|
1635
|
-
'Monday 03:59'
|
1636
|
-
);
|
1637
|
-
});
|
1638
|
-
|
1639
|
-
test('parsing week year/week/weekday (dow 1, doy 4)', function (assert) {
|
1640
|
-
moment.locale('dow:1,doy:4', { week: { dow: 1, doy: 4 } });
|
1641
|
-
|
1642
|
-
assert.equal(
|
1643
|
-
moment.utc('2007-01', 'gggg-ww').format(),
|
1644
|
-
'2007-01-01T00:00:00Z',
|
1645
|
-
'2007 week 1 (1st Jan Mon)'
|
1646
|
-
);
|
1647
|
-
assert.equal(
|
1648
|
-
moment.utc('2008-01', 'gggg-ww').format(),
|
1649
|
-
'2007-12-31T00:00:00Z',
|
1650
|
-
'2008 week 1 (1st Jan Tue)'
|
1651
|
-
);
|
1652
|
-
assert.equal(
|
1653
|
-
moment.utc('2003-01', 'gggg-ww').format(),
|
1654
|
-
'2002-12-30T00:00:00Z',
|
1655
|
-
'2003 week 1 (1st Jan Wed)'
|
1656
|
-
);
|
1657
|
-
assert.equal(
|
1658
|
-
moment.utc('2009-01', 'gggg-ww').format(),
|
1659
|
-
'2008-12-29T00:00:00Z',
|
1660
|
-
'2009 week 1 (1st Jan Thu)'
|
1661
|
-
);
|
1662
|
-
assert.equal(
|
1663
|
-
moment.utc('2010-01', 'gggg-ww').format(),
|
1664
|
-
'2010-01-04T00:00:00Z',
|
1665
|
-
'2010 week 1 (1st Jan Fri)'
|
1666
|
-
);
|
1667
|
-
assert.equal(
|
1668
|
-
moment.utc('2011-01', 'gggg-ww').format(),
|
1669
|
-
'2011-01-03T00:00:00Z',
|
1670
|
-
'2011 week 1 (1st Jan Sat)'
|
1671
|
-
);
|
1672
|
-
assert.equal(
|
1673
|
-
moment.utc('2012-01', 'gggg-ww').format(),
|
1674
|
-
'2012-01-02T00:00:00Z',
|
1675
|
-
'2012 week 1 (1st Jan Sun)'
|
1676
|
-
);
|
1677
|
-
|
1678
|
-
moment.defineLocale('dow:1,doy:4', null);
|
1679
|
-
});
|
1680
|
-
|
1681
|
-
test('parsing week year/week/weekday (dow 1, doy 7)', function (assert) {
|
1682
|
-
moment.locale('dow:1,doy:7', { week: { dow: 1, doy: 7 } });
|
1683
|
-
|
1684
|
-
assert.equal(
|
1685
|
-
moment.utc('2007-01', 'gggg-ww').format(),
|
1686
|
-
'2007-01-01T00:00:00Z',
|
1687
|
-
'2007 week 1 (1st Jan Mon)'
|
1688
|
-
);
|
1689
|
-
assert.equal(
|
1690
|
-
moment.utc('2008-01', 'gggg-ww').format(),
|
1691
|
-
'2007-12-31T00:00:00Z',
|
1692
|
-
'2008 week 1 (1st Jan Tue)'
|
1693
|
-
);
|
1694
|
-
assert.equal(
|
1695
|
-
moment.utc('2003-01', 'gggg-ww').format(),
|
1696
|
-
'2002-12-30T00:00:00Z',
|
1697
|
-
'2003 week 1 (1st Jan Wed)'
|
1698
|
-
);
|
1699
|
-
assert.equal(
|
1700
|
-
moment.utc('2009-01', 'gggg-ww').format(),
|
1701
|
-
'2008-12-29T00:00:00Z',
|
1702
|
-
'2009 week 1 (1st Jan Thu)'
|
1703
|
-
);
|
1704
|
-
assert.equal(
|
1705
|
-
moment.utc('2010-01', 'gggg-ww').format(),
|
1706
|
-
'2009-12-28T00:00:00Z',
|
1707
|
-
'2010 week 1 (1st Jan Fri)'
|
1708
|
-
);
|
1709
|
-
assert.equal(
|
1710
|
-
moment.utc('2011-01', 'gggg-ww').format(),
|
1711
|
-
'2010-12-27T00:00:00Z',
|
1712
|
-
'2011 week 1 (1st Jan Sat)'
|
1713
|
-
);
|
1714
|
-
assert.equal(
|
1715
|
-
moment.utc('2012-01', 'gggg-ww').format(),
|
1716
|
-
'2011-12-26T00:00:00Z',
|
1717
|
-
'2012 week 1 (1st Jan Sun)'
|
1718
|
-
);
|
1719
|
-
moment.defineLocale('dow:1,doy:7', null);
|
1720
|
-
});
|
1721
|
-
|
1722
|
-
test('parsing week year/week/weekday (dow 0, doy 6)', function (assert) {
|
1723
|
-
moment.locale('dow:0,doy:6', { week: { dow: 0, doy: 6 } });
|
1724
|
-
|
1725
|
-
assert.equal(
|
1726
|
-
moment.utc('2007-01', 'gggg-ww').format(),
|
1727
|
-
'2006-12-31T00:00:00Z',
|
1728
|
-
'2007 week 1 (1st Jan Mon)'
|
1729
|
-
);
|
1730
|
-
assert.equal(
|
1731
|
-
moment.utc('2008-01', 'gggg-ww').format(),
|
1732
|
-
'2007-12-30T00:00:00Z',
|
1733
|
-
'2008 week 1 (1st Jan Tue)'
|
1734
|
-
);
|
1735
|
-
assert.equal(
|
1736
|
-
moment.utc('2003-01', 'gggg-ww').format(),
|
1737
|
-
'2002-12-29T00:00:00Z',
|
1738
|
-
'2003 week 1 (1st Jan Wed)'
|
1739
|
-
);
|
1740
|
-
assert.equal(
|
1741
|
-
moment.utc('2009-01', 'gggg-ww').format(),
|
1742
|
-
'2008-12-28T00:00:00Z',
|
1743
|
-
'2009 week 1 (1st Jan Thu)'
|
1744
|
-
);
|
1745
|
-
assert.equal(
|
1746
|
-
moment.utc('2010-01', 'gggg-ww').format(),
|
1747
|
-
'2009-12-27T00:00:00Z',
|
1748
|
-
'2010 week 1 (1st Jan Fri)'
|
1749
|
-
);
|
1750
|
-
assert.equal(
|
1751
|
-
moment.utc('2011-01', 'gggg-ww').format(),
|
1752
|
-
'2010-12-26T00:00:00Z',
|
1753
|
-
'2011 week 1 (1st Jan Sat)'
|
1754
|
-
);
|
1755
|
-
assert.equal(
|
1756
|
-
moment.utc('2012-01', 'gggg-ww').format(),
|
1757
|
-
'2012-01-01T00:00:00Z',
|
1758
|
-
'2012 week 1 (1st Jan Sun)'
|
1759
|
-
);
|
1760
|
-
moment.defineLocale('dow:0,doy:6', null);
|
1761
|
-
});
|
1762
|
-
|
1763
|
-
test('parsing week year/week/weekday (dow 6, doy 12)', function (assert) {
|
1764
|
-
moment.locale('dow:6,doy:12', { week: { dow: 6, doy: 12 } });
|
1765
|
-
|
1766
|
-
assert.equal(
|
1767
|
-
moment.utc('2007-01', 'gggg-ww').format(),
|
1768
|
-
'2006-12-30T00:00:00Z',
|
1769
|
-
'2007 week 1 (1st Jan Mon)'
|
1770
|
-
);
|
1771
|
-
assert.equal(
|
1772
|
-
moment.utc('2008-01', 'gggg-ww').format(),
|
1773
|
-
'2007-12-29T00:00:00Z',
|
1774
|
-
'2008 week 1 (1st Jan Tue)'
|
1775
|
-
);
|
1776
|
-
assert.equal(
|
1777
|
-
moment.utc('2003-01', 'gggg-ww').format(),
|
1778
|
-
'2002-12-28T00:00:00Z',
|
1779
|
-
'2003 week 1 (1st Jan Wed)'
|
1780
|
-
);
|
1781
|
-
assert.equal(
|
1782
|
-
moment.utc('2009-01', 'gggg-ww').format(),
|
1783
|
-
'2008-12-27T00:00:00Z',
|
1784
|
-
'2009 week 1 (1st Jan Thu)'
|
1785
|
-
);
|
1786
|
-
assert.equal(
|
1787
|
-
moment.utc('2010-01', 'gggg-ww').format(),
|
1788
|
-
'2009-12-26T00:00:00Z',
|
1789
|
-
'2010 week 1 (1st Jan Fri)'
|
1790
|
-
);
|
1791
|
-
assert.equal(
|
1792
|
-
moment.utc('2011-01', 'gggg-ww').format(),
|
1793
|
-
'2011-01-01T00:00:00Z',
|
1794
|
-
'2011 week 1 (1st Jan Sat)'
|
1795
|
-
);
|
1796
|
-
assert.equal(
|
1797
|
-
moment.utc('2012-01', 'gggg-ww').format(),
|
1798
|
-
'2011-12-31T00:00:00Z',
|
1799
|
-
'2012 week 1 (1st Jan Sun)'
|
1800
|
-
);
|
1801
|
-
moment.defineLocale('dow:6,doy:12', null);
|
1802
|
-
});
|
1803
|
-
|
1804
|
-
test('parsing ISO with Z', function (assert) {
|
1805
|
-
var i,
|
1806
|
-
mom,
|
1807
|
-
formats = [
|
1808
|
-
['2011-10-08T18:04', '2011-10-08T18:04:00.000'],
|
1809
|
-
['2011-10-08T18:04:20', '2011-10-08T18:04:20.000'],
|
1810
|
-
['2011-10-08T18:04:20.1', '2011-10-08T18:04:20.100'],
|
1811
|
-
['2011-10-08T18:04:20.11', '2011-10-08T18:04:20.110'],
|
1812
|
-
['2011-10-08T18:04:20.111', '2011-10-08T18:04:20.111'],
|
1813
|
-
['2011-W40-6T18', '2011-10-08T18:00:00.000'],
|
1814
|
-
['2011-W40-6T18:04', '2011-10-08T18:04:00.000'],
|
1815
|
-
['2011-W40-6T18:04:20', '2011-10-08T18:04:20.000'],
|
1816
|
-
['2011-W40-6T18:04:20.1', '2011-10-08T18:04:20.100'],
|
1817
|
-
['2011-W40-6T18:04:20.11', '2011-10-08T18:04:20.110'],
|
1818
|
-
['2011-W40-6T18:04:20.111', '2011-10-08T18:04:20.111'],
|
1819
|
-
['2011-281T18', '2011-10-08T18:00:00.000'],
|
1820
|
-
['2011-281T18:04', '2011-10-08T18:04:00.000'],
|
1821
|
-
['2011-281T18:04:20', '2011-10-08T18:04:20.000'],
|
1822
|
-
['2011-281T18:04:20', '2011-10-08T18:04:20.000'],
|
1823
|
-
['2011-281T18:04:20.1', '2011-10-08T18:04:20.100'],
|
1824
|
-
['2011-281T18:04:20.11', '2011-10-08T18:04:20.110'],
|
1825
|
-
['2011-281T18:04:20.111', '2011-10-08T18:04:20.111'],
|
1826
|
-
];
|
1827
|
-
|
1828
|
-
for (i = 0; i < formats.length; i++) {
|
1829
|
-
mom = moment(formats[i][0] + 'Z').utc();
|
1830
|
-
assert.equal(
|
1831
|
-
mom.format('YYYY-MM-DDTHH:mm:ss.SSS'),
|
1832
|
-
formats[i][1],
|
1833
|
-
'moment should be able to parse ISO in UTC ' + formats[i][0] + 'Z'
|
1834
|
-
);
|
1835
|
-
|
1836
|
-
mom = moment(formats[i][0] + ' Z').utc();
|
1837
|
-
assert.equal(
|
1838
|
-
mom.format('YYYY-MM-DDTHH:mm:ss.SSS'),
|
1839
|
-
formats[i][1],
|
1840
|
-
'moment should be able to parse ISO in UTC ' + formats[i][0] + ' Z'
|
1841
|
-
);
|
1842
|
-
}
|
1843
|
-
});
|
1844
|
-
|
1845
|
-
test('parsing iso with T', function (assert) {
|
1846
|
-
assert.equal(
|
1847
|
-
moment('2011-10-08T18')._f,
|
1848
|
-
'YYYY-MM-DDTHH',
|
1849
|
-
"should include 'T' in the format"
|
1850
|
-
);
|
1851
|
-
assert.equal(
|
1852
|
-
moment('2011-10-08T18:20')._f,
|
1853
|
-
'YYYY-MM-DDTHH:mm',
|
1854
|
-
"should include 'T' in the format"
|
1855
|
-
);
|
1856
|
-
assert.equal(
|
1857
|
-
moment('2011-10-08T18:20:13')._f,
|
1858
|
-
'YYYY-MM-DDTHH:mm:ss',
|
1859
|
-
"should include 'T' in the format"
|
1860
|
-
);
|
1861
|
-
assert.equal(
|
1862
|
-
moment('2011-10-08T18:20:13.321')._f,
|
1863
|
-
'YYYY-MM-DDTHH:mm:ss.SSSS',
|
1864
|
-
"should include 'T' in the format"
|
1865
|
-
);
|
1866
|
-
|
1867
|
-
assert.equal(
|
1868
|
-
moment('2011-10-08 18')._f,
|
1869
|
-
'YYYY-MM-DD HH',
|
1870
|
-
"should not include 'T' in the format"
|
1871
|
-
);
|
1872
|
-
assert.equal(
|
1873
|
-
moment('2011-10-08 18:20')._f,
|
1874
|
-
'YYYY-MM-DD HH:mm',
|
1875
|
-
"should not include 'T' in the format"
|
1876
|
-
);
|
1877
|
-
assert.equal(
|
1878
|
-
moment('2011-10-08 18:20:13')._f,
|
1879
|
-
'YYYY-MM-DD HH:mm:ss',
|
1880
|
-
"should not include 'T' in the format"
|
1881
|
-
);
|
1882
|
-
assert.equal(
|
1883
|
-
moment('2011-10-08 18:20:13.321')._f,
|
1884
|
-
'YYYY-MM-DD HH:mm:ss.SSSS',
|
1885
|
-
"should not include 'T' in the format"
|
1886
|
-
);
|
1887
|
-
});
|
1888
|
-
|
1889
|
-
test('parsing iso Z timezone', function (assert) {
|
1890
|
-
var i,
|
1891
|
-
formats = [
|
1892
|
-
['2011-10-08T18:04Z', '2011-10-08T18:04:00.000+00:00'],
|
1893
|
-
['2011-10-08T18:04:20Z', '2011-10-08T18:04:20.000+00:00'],
|
1894
|
-
['2011-10-08T18:04:20.111Z', '2011-10-08T18:04:20.111+00:00'],
|
1895
|
-
];
|
1896
|
-
for (i = 0; i < formats.length; i++) {
|
1897
|
-
assert.equal(
|
1898
|
-
moment.utc(formats[i][0]).format('YYYY-MM-DDTHH:mm:ss.SSSZ'),
|
1899
|
-
formats[i][1],
|
1900
|
-
'moment should be able to parse ISO ' + formats[i][0]
|
1901
|
-
);
|
1902
|
-
}
|
1903
|
-
});
|
1904
|
-
|
1905
|
-
test('parsing iso Z timezone into local', function (assert) {
|
1906
|
-
var m = moment('2011-10-08T18:04:20.111Z');
|
1907
|
-
|
1908
|
-
assert.equal(
|
1909
|
-
m.utc().format('YYYY-MM-DDTHH:mm:ss.SSS'),
|
1910
|
-
'2011-10-08T18:04:20.111',
|
1911
|
-
'moment should be able to parse ISO 2011-10-08T18:04:20.111Z'
|
1912
|
-
);
|
1913
|
-
});
|
1914
|
-
|
1915
|
-
test('parsing iso with more subsecond precision digits', function (assert) {
|
1916
|
-
assert.equal(
|
1917
|
-
moment.utc('2013-07-31T22:00:00.0000000Z').format(),
|
1918
|
-
'2013-07-31T22:00:00Z',
|
1919
|
-
'more than 3 subsecond digits'
|
1920
|
-
);
|
1921
|
-
});
|
1922
|
-
|
1923
|
-
test('null or empty', function (assert) {
|
1924
|
-
assert.equal(moment('').isValid(), false, "moment('') is not valid");
|
1925
|
-
assert.equal(moment(null).isValid(), false, 'moment(null) is not valid');
|
1926
|
-
assert.equal(
|
1927
|
-
moment(null, 'YYYY-MM-DD').isValid(),
|
1928
|
-
false,
|
1929
|
-
"moment('', 'format') is not valid"
|
1930
|
-
);
|
1931
|
-
assert.equal(
|
1932
|
-
moment('', 'YYYY-MM-DD').isValid(),
|
1933
|
-
false,
|
1934
|
-
"moment('', 'format') is not valid"
|
1935
|
-
);
|
1936
|
-
assert.equal(
|
1937
|
-
moment.utc('').isValid(),
|
1938
|
-
false,
|
1939
|
-
"moment.utc('') is not valid"
|
1940
|
-
);
|
1941
|
-
assert.equal(
|
1942
|
-
moment.utc(null).isValid(),
|
1943
|
-
false,
|
1944
|
-
'moment.utc(null) is not valid'
|
1945
|
-
);
|
1946
|
-
assert.equal(
|
1947
|
-
moment.utc(null, 'YYYY-MM-DD').isValid(),
|
1948
|
-
false,
|
1949
|
-
'moment.utc(null) is not valid'
|
1950
|
-
);
|
1951
|
-
assert.equal(
|
1952
|
-
moment.utc('', 'YYYY-MM-DD').isValid(),
|
1953
|
-
false,
|
1954
|
-
"moment.utc('', 'YYYY-MM-DD') is not valid"
|
1955
|
-
);
|
1956
|
-
});
|
1957
|
-
|
1958
|
-
test('first century', function (assert) {
|
1959
|
-
assert.equal(
|
1960
|
-
moment([0, 0, 1]).format('YYYY-MM-DD'),
|
1961
|
-
'0000-01-01',
|
1962
|
-
'Year AD 0'
|
1963
|
-
);
|
1964
|
-
assert.equal(
|
1965
|
-
moment([99, 0, 1]).format('YYYY-MM-DD'),
|
1966
|
-
'0099-01-01',
|
1967
|
-
'Year AD 99'
|
1968
|
-
);
|
1969
|
-
assert.equal(
|
1970
|
-
moment([999, 0, 1]).format('YYYY-MM-DD'),
|
1971
|
-
'0999-01-01',
|
1972
|
-
'Year AD 999'
|
1973
|
-
);
|
1974
|
-
assert.equal(
|
1975
|
-
moment('0 1 1', 'YYYY MM DD').format('YYYY-MM-DD'),
|
1976
|
-
'0000-01-01',
|
1977
|
-
'Year AD 0'
|
1978
|
-
);
|
1979
|
-
assert.equal(
|
1980
|
-
moment('999 1 1', 'YYYY MM DD').format('YYYY-MM-DD'),
|
1981
|
-
'0999-01-01',
|
1982
|
-
'Year AD 999'
|
1983
|
-
);
|
1984
|
-
assert.equal(
|
1985
|
-
moment('0 1 1', 'YYYYY MM DD').format('YYYYY-MM-DD'),
|
1986
|
-
'00000-01-01',
|
1987
|
-
'Year AD 0'
|
1988
|
-
);
|
1989
|
-
assert.equal(
|
1990
|
-
moment('99 1 1', 'YYYYY MM DD').format('YYYYY-MM-DD'),
|
1991
|
-
'00099-01-01',
|
1992
|
-
'Year AD 99'
|
1993
|
-
);
|
1994
|
-
assert.equal(
|
1995
|
-
moment('999 1 1', 'YYYYY MM DD').format('YYYYY-MM-DD'),
|
1996
|
-
'00999-01-01',
|
1997
|
-
'Year AD 999'
|
1998
|
-
);
|
1999
|
-
});
|
2000
|
-
|
2001
|
-
test('six digit years', function (assert) {
|
2002
|
-
assert.equal(
|
2003
|
-
moment([-270000, 0, 1]).format('YYYYY-MM-DD'),
|
2004
|
-
'-270000-01-01',
|
2005
|
-
'format BC 270,001'
|
2006
|
-
);
|
2007
|
-
assert.equal(
|
2008
|
-
moment([270000, 0, 1]).format('YYYYY-MM-DD'),
|
2009
|
-
'270000-01-01',
|
2010
|
-
'format AD 270,000'
|
2011
|
-
);
|
2012
|
-
assert.equal(
|
2013
|
-
moment('-270000-01-01', 'YYYYY-MM-DD').toDate().getFullYear(),
|
2014
|
-
-270000,
|
2015
|
-
'parse BC 270,001'
|
2016
|
-
);
|
2017
|
-
assert.equal(
|
2018
|
-
moment('270000-01-01', 'YYYYY-MM-DD').toDate().getFullYear(),
|
2019
|
-
270000,
|
2020
|
-
'parse AD 270,000'
|
2021
|
-
);
|
2022
|
-
assert.equal(
|
2023
|
-
moment('+270000-01-01', 'YYYYY-MM-DD').toDate().getFullYear(),
|
2024
|
-
270000,
|
2025
|
-
'parse AD +270,000'
|
2026
|
-
);
|
2027
|
-
assert.equal(
|
2028
|
-
moment.utc('-270000-01-01', 'YYYYY-MM-DD').toDate().getUTCFullYear(),
|
2029
|
-
-270000,
|
2030
|
-
'parse utc BC 270,001'
|
2031
|
-
);
|
2032
|
-
assert.equal(
|
2033
|
-
moment.utc('270000-01-01', 'YYYYY-MM-DD').toDate().getUTCFullYear(),
|
2034
|
-
270000,
|
2035
|
-
'parse utc AD 270,000'
|
2036
|
-
);
|
2037
|
-
assert.equal(
|
2038
|
-
moment.utc('+270000-01-01', 'YYYYY-MM-DD').toDate().getUTCFullYear(),
|
2039
|
-
270000,
|
2040
|
-
'parse utc AD +270,000'
|
2041
|
-
);
|
2042
|
-
});
|
2043
|
-
|
2044
|
-
test('negative four digit years', function (assert) {
|
2045
|
-
assert.equal(
|
2046
|
-
moment('-1000-01-01', 'YYYYY-MM-DD').toDate().getFullYear(),
|
2047
|
-
-1000,
|
2048
|
-
'parse BC 1,001'
|
2049
|
-
);
|
2050
|
-
assert.equal(
|
2051
|
-
moment.utc('-1000-01-01', 'YYYYY-MM-DD').toDate().getUTCFullYear(),
|
2052
|
-
-1000,
|
2053
|
-
'parse utc BC 1,001'
|
2054
|
-
);
|
2055
|
-
});
|
2056
|
-
|
2057
|
-
test('strict parsing', function (assert) {
|
2058
|
-
assert.equal(
|
2059
|
-
moment('2014-', 'YYYY-Q', true).isValid(),
|
2060
|
-
false,
|
2061
|
-
'fail missing quarter'
|
2062
|
-
);
|
2063
|
-
|
2064
|
-
assert.equal(
|
2065
|
-
moment('2012-05', 'YYYY-MM', true).format('YYYY-MM'),
|
2066
|
-
'2012-05',
|
2067
|
-
'parse correct string'
|
2068
|
-
);
|
2069
|
-
assert.equal(
|
2070
|
-
moment(' 2012-05', 'YYYY-MM', true).isValid(),
|
2071
|
-
false,
|
2072
|
-
'fail on extra whitespace'
|
2073
|
-
);
|
2074
|
-
assert.equal(
|
2075
|
-
moment('foo 2012-05', '[foo] YYYY-MM', true).format('YYYY-MM'),
|
2076
|
-
'2012-05',
|
2077
|
-
'handle fixed text'
|
2078
|
-
);
|
2079
|
-
assert.equal(
|
2080
|
-
moment('2012 05', 'YYYY-MM', true).isValid(),
|
2081
|
-
false,
|
2082
|
-
'fail on different separator'
|
2083
|
-
);
|
2084
|
-
assert.equal(
|
2085
|
-
moment('2012 05', 'YYYY MM DD', true).isValid(),
|
2086
|
-
false,
|
2087
|
-
'fail on too many tokens'
|
2088
|
-
);
|
2089
|
-
|
2090
|
-
assert.equal(
|
2091
|
-
moment('05 30 2010', ['DD MM YYYY', 'MM DD YYYY'], true).format(
|
2092
|
-
'MM DD YYYY'
|
2093
|
-
),
|
2094
|
-
'05 30 2010',
|
2095
|
-
'array with bad date'
|
2096
|
-
);
|
2097
|
-
assert.equal(
|
2098
|
-
moment('05 30 2010', ['', 'MM DD YYYY'], true).format('MM DD YYYY'),
|
2099
|
-
'05 30 2010',
|
2100
|
-
'array with invalid format'
|
2101
|
-
);
|
2102
|
-
assert.equal(
|
2103
|
-
moment('05 30 2010', [' DD MM YYYY', 'MM DD YYYY'], true).format(
|
2104
|
-
'MM DD YYYY'
|
2105
|
-
),
|
2106
|
-
'05 30 2010',
|
2107
|
-
'array with non-matching format'
|
2108
|
-
);
|
2109
|
-
|
2110
|
-
assert.equal(
|
2111
|
-
moment('2010.*...', 'YYYY.*', true).isValid(),
|
2112
|
-
false,
|
2113
|
-
'invalid format with regex chars'
|
2114
|
-
);
|
2115
|
-
assert.equal(
|
2116
|
-
moment('2010.*', 'YYYY.*', true).year(),
|
2117
|
-
2010,
|
2118
|
-
'valid format with regex chars'
|
2119
|
-
);
|
2120
|
-
assert.equal(
|
2121
|
-
moment('.*2010.*', '.*YYYY.*', true).year(),
|
2122
|
-
2010,
|
2123
|
-
'valid format with regex chars on both sides'
|
2124
|
-
);
|
2125
|
-
|
2126
|
-
//strict tokens
|
2127
|
-
assert.equal(
|
2128
|
-
moment('-5-05-25', 'YYYY-MM-DD', true).isValid(),
|
2129
|
-
false,
|
2130
|
-
'invalid negative year'
|
2131
|
-
);
|
2132
|
-
assert.equal(
|
2133
|
-
moment('2-05-25', 'YYYY-MM-DD', true).isValid(),
|
2134
|
-
false,
|
2135
|
-
'invalid one-digit year'
|
2136
|
-
);
|
2137
|
-
assert.equal(
|
2138
|
-
moment('20-05-25', 'YYYY-MM-DD', true).isValid(),
|
2139
|
-
false,
|
2140
|
-
'invalid two-digit year'
|
2141
|
-
);
|
2142
|
-
assert.equal(
|
2143
|
-
moment('201-05-25', 'YYYY-MM-DD', true).isValid(),
|
2144
|
-
false,
|
2145
|
-
'invalid three-digit year'
|
2146
|
-
);
|
2147
|
-
assert.equal(
|
2148
|
-
moment('2010-05-25', 'YYYY-MM-DD', true).isValid(),
|
2149
|
-
true,
|
2150
|
-
'valid four-digit year'
|
2151
|
-
);
|
2152
|
-
assert.equal(
|
2153
|
-
moment('22010-05-25', 'YYYY-MM-DD', true).isValid(),
|
2154
|
-
false,
|
2155
|
-
'invalid five-digit year'
|
2156
|
-
);
|
2157
|
-
|
2158
|
-
assert.equal(
|
2159
|
-
moment('12-05-25', 'YY-MM-DD', true).isValid(),
|
2160
|
-
true,
|
2161
|
-
'valid two-digit year'
|
2162
|
-
);
|
2163
|
-
assert.equal(
|
2164
|
-
moment('2012-05-25', 'YY-MM-DD', true).isValid(),
|
2165
|
-
false,
|
2166
|
-
'invalid four-digit year'
|
2167
|
-
);
|
2168
|
-
|
2169
|
-
assert.equal(
|
2170
|
-
moment('-5-05-25', 'Y-MM-DD', true).isValid(),
|
2171
|
-
true,
|
2172
|
-
'valid negative year'
|
2173
|
-
);
|
2174
|
-
assert.equal(
|
2175
|
-
moment('2-05-25', 'Y-MM-DD', true).isValid(),
|
2176
|
-
true,
|
2177
|
-
'valid one-digit year'
|
2178
|
-
);
|
2179
|
-
assert.equal(
|
2180
|
-
moment('20-05-25', 'Y-MM-DD', true).isValid(),
|
2181
|
-
true,
|
2182
|
-
'valid two-digit year'
|
2183
|
-
);
|
2184
|
-
assert.equal(
|
2185
|
-
moment('201-05-25', 'Y-MM-DD', true).isValid(),
|
2186
|
-
true,
|
2187
|
-
'valid three-digit year'
|
2188
|
-
);
|
2189
|
-
|
2190
|
-
assert.equal(
|
2191
|
-
moment('2012-5-25', 'YYYY-M-DD', true).isValid(),
|
2192
|
-
true,
|
2193
|
-
'valid one-digit month'
|
2194
|
-
);
|
2195
|
-
assert.equal(
|
2196
|
-
moment('2012-5-25', 'YYYY-MM-DD', true).isValid(),
|
2197
|
-
false,
|
2198
|
-
'invalid one-digit month'
|
2199
|
-
);
|
2200
|
-
assert.equal(
|
2201
|
-
moment('2012-05-25', 'YYYY-M-DD', true).isValid(),
|
2202
|
-
true,
|
2203
|
-
'valid one-digit month'
|
2204
|
-
);
|
2205
|
-
assert.equal(
|
2206
|
-
moment('2012-05-25', 'YYYY-MM-DD', true).isValid(),
|
2207
|
-
true,
|
2208
|
-
'valid one-digit month'
|
2209
|
-
);
|
2210
|
-
|
2211
|
-
assert.equal(
|
2212
|
-
moment('2012-05-2', 'YYYY-MM-D', true).isValid(),
|
2213
|
-
true,
|
2214
|
-
'valid one-digit day'
|
2215
|
-
);
|
2216
|
-
assert.equal(
|
2217
|
-
moment('2012-05-2', 'YYYY-MM-DD', true).isValid(),
|
2218
|
-
false,
|
2219
|
-
'invalid one-digit day'
|
2220
|
-
);
|
2221
|
-
assert.equal(
|
2222
|
-
moment('2012-05-02', 'YYYY-MM-D', true).isValid(),
|
2223
|
-
true,
|
2224
|
-
'valid two-digit day'
|
2225
|
-
);
|
2226
|
-
assert.equal(
|
2227
|
-
moment('2012-05-02', 'YYYY-MM-DD', true).isValid(),
|
2228
|
-
true,
|
2229
|
-
'valid two-digit day'
|
2230
|
-
);
|
2231
|
-
|
2232
|
-
assert.equal(
|
2233
|
-
moment('+002012-05-25', 'YYYYY-MM-DD', true).isValid(),
|
2234
|
-
true,
|
2235
|
-
'valid six-digit year'
|
2236
|
-
);
|
2237
|
-
assert.equal(
|
2238
|
-
moment('+2012-05-25', 'YYYYY-MM-DD', true).isValid(),
|
2239
|
-
false,
|
2240
|
-
'invalid four-digit year'
|
2241
|
-
);
|
2242
|
-
|
2243
|
-
//thse are kinda pointless, but they should work as expected
|
2244
|
-
assert.equal(
|
2245
|
-
moment('1', 'S', true).isValid(),
|
2246
|
-
true,
|
2247
|
-
'valid one-digit milisecond'
|
2248
|
-
);
|
2249
|
-
assert.equal(
|
2250
|
-
moment('12', 'S', true).isValid(),
|
2251
|
-
false,
|
2252
|
-
'invalid two-digit milisecond'
|
2253
|
-
);
|
2254
|
-
assert.equal(
|
2255
|
-
moment('123', 'S', true).isValid(),
|
2256
|
-
false,
|
2257
|
-
'invalid three-digit milisecond'
|
2258
|
-
);
|
2259
|
-
|
2260
|
-
assert.equal(
|
2261
|
-
moment('1', 'SS', true).isValid(),
|
2262
|
-
false,
|
2263
|
-
'invalid one-digit milisecond'
|
2264
|
-
);
|
2265
|
-
assert.equal(
|
2266
|
-
moment('12', 'SS', true).isValid(),
|
2267
|
-
true,
|
2268
|
-
'valid two-digit milisecond'
|
2269
|
-
);
|
2270
|
-
assert.equal(
|
2271
|
-
moment('123', 'SS', true).isValid(),
|
2272
|
-
false,
|
2273
|
-
'invalid three-digit milisecond'
|
2274
|
-
);
|
2275
|
-
|
2276
|
-
assert.equal(
|
2277
|
-
moment('1', 'SSS', true).isValid(),
|
2278
|
-
false,
|
2279
|
-
'invalid one-digit milisecond'
|
2280
|
-
);
|
2281
|
-
assert.equal(
|
2282
|
-
moment('12', 'SSS', true).isValid(),
|
2283
|
-
false,
|
2284
|
-
'invalid two-digit milisecond'
|
2285
|
-
);
|
2286
|
-
assert.equal(
|
2287
|
-
moment('123', 'SSS', true).isValid(),
|
2288
|
-
true,
|
2289
|
-
'valid three-digit milisecond'
|
2290
|
-
);
|
2291
|
-
|
2292
|
-
// strict parsing respects month length
|
2293
|
-
assert.ok(
|
2294
|
-
moment('1 January 2000', 'D MMMM YYYY', true).isValid(),
|
2295
|
-
'capital long-month + MMMM'
|
2296
|
-
);
|
2297
|
-
assert.ok(
|
2298
|
-
!moment('1 January 2000', 'D MMM YYYY', true).isValid(),
|
2299
|
-
'capital long-month + MMM'
|
2300
|
-
);
|
2301
|
-
assert.ok(
|
2302
|
-
!moment('1 Jan 2000', 'D MMMM YYYY', true).isValid(),
|
2303
|
-
'capital short-month + MMMM'
|
2304
|
-
);
|
2305
|
-
assert.ok(
|
2306
|
-
moment('1 Jan 2000', 'D MMM YYYY', true).isValid(),
|
2307
|
-
'capital short-month + MMM'
|
2308
|
-
);
|
2309
|
-
assert.ok(
|
2310
|
-
moment('1 january 2000', 'D MMMM YYYY', true).isValid(),
|
2311
|
-
'lower long-month + MMMM'
|
2312
|
-
);
|
2313
|
-
assert.ok(
|
2314
|
-
!moment('1 january 2000', 'D MMM YYYY', true).isValid(),
|
2315
|
-
'lower long-month + MMM'
|
2316
|
-
);
|
2317
|
-
assert.ok(
|
2318
|
-
!moment('1 jan 2000', 'D MMMM YYYY', true).isValid(),
|
2319
|
-
'lower short-month + MMMM'
|
2320
|
-
);
|
2321
|
-
assert.ok(
|
2322
|
-
moment('1 jan 2000', 'D MMM YYYY', true).isValid(),
|
2323
|
-
'lower short-month + MMM'
|
2324
|
-
);
|
2325
|
-
});
|
2326
|
-
|
2327
|
-
test('parsing into a locale', function (assert) {
|
2328
|
-
moment.defineLocale('parselocale', {
|
2329
|
-
months: 'one_two_three_four_five_six_seven_eight_nine_ten_eleven_twelve'.split(
|
2330
|
-
'_'
|
2331
|
-
),
|
2332
|
-
monthsShort: 'one_two_three_four_five_six_seven_eight_nine_ten_eleven_twelve'.split(
|
2333
|
-
'_'
|
2334
|
-
),
|
2335
|
-
});
|
2336
|
-
|
2337
|
-
moment.locale('en');
|
2338
|
-
|
2339
|
-
assert.equal(
|
2340
|
-
moment('2012 seven', 'YYYY MMM', 'parselocale').month(),
|
2341
|
-
6,
|
2342
|
-
'should be able to parse in a specific locale'
|
2343
|
-
);
|
2344
|
-
|
2345
|
-
moment.locale('parselocale');
|
2346
|
-
|
2347
|
-
assert.equal(
|
2348
|
-
moment('2012 july', 'YYYY MMM', 'en').month(),
|
2349
|
-
6,
|
2350
|
-
'should be able to parse in a specific locale'
|
2351
|
-
);
|
2352
|
-
|
2353
|
-
moment.defineLocale('parselocale', null);
|
2354
|
-
});
|
2355
|
-
|
2356
|
-
function getVerifier(test) {
|
2357
|
-
return function (input, format, expected, description, asymetrical) {
|
2358
|
-
var m = moment(input, format);
|
2359
|
-
test.equal(m.format('YYYY MM DD'), expected, 'compare: ' + description);
|
2360
|
-
|
2361
|
-
//test round trip
|
2362
|
-
if (!asymetrical) {
|
2363
|
-
test.equal(m.format(format), input, 'round trip: ' + description);
|
2364
|
-
}
|
2365
|
-
};
|
2366
|
-
}
|
2367
|
-
|
2368
|
-
test('parsing week and weekday information', function (assert) {
|
2369
|
-
var ver = getVerifier(assert),
|
2370
|
-
currentWeekOfYear = moment().weeks(),
|
2371
|
-
expectedDate2012 = moment([2012, 0, 1])
|
2372
|
-
.day(0)
|
2373
|
-
.add(currentWeekOfYear - 1, 'weeks')
|
2374
|
-
.format('YYYY MM DD'),
|
2375
|
-
expectedDate1999 = moment([1999, 0, 1])
|
2376
|
-
.day(0)
|
2377
|
-
.add(currentWeekOfYear - 1, 'weeks')
|
2378
|
-
.format('YYYY MM DD');
|
2379
|
-
|
2380
|
-
// year
|
2381
|
-
ver('12', 'gg', expectedDate2012, 'week-year two digits');
|
2382
|
-
ver('2012', 'gggg', expectedDate2012, 'week-year four digits');
|
2383
|
-
ver('99', 'gg', expectedDate1999, 'week-year two digits previous year');
|
2384
|
-
ver(
|
2385
|
-
'1999',
|
2386
|
-
'gggg',
|
2387
|
-
expectedDate1999,
|
2388
|
-
'week-year four digits previous year'
|
2389
|
-
);
|
2390
|
-
|
2391
|
-
ver('99', 'GG', '1999 01 04', 'iso week-year two digits');
|
2392
|
-
ver('1999', 'GGGG', '1999 01 04', 'iso week-year four digits');
|
2393
|
-
|
2394
|
-
ver('13', 'GG', '2012 12 31', 'iso week-year two digits previous year');
|
2395
|
-
ver(
|
2396
|
-
'2013',
|
2397
|
-
'GGGG',
|
2398
|
-
'2012 12 31',
|
2399
|
-
'iso week-year four digits previous year'
|
2400
|
-
);
|
2401
|
-
|
2402
|
-
// year + week
|
2403
|
-
ver('1999 37', 'gggg w', '1999 09 05', 'week');
|
2404
|
-
ver('1999 37', 'gggg ww', '1999 09 05', 'week double');
|
2405
|
-
ver('1999 37', 'GGGG W', '1999 09 13', 'iso week');
|
2406
|
-
ver('1999 37', 'GGGG WW', '1999 09 13', 'iso week double');
|
2407
|
-
|
2408
|
-
ver('1999 37 4', 'GGGG WW E', '1999 09 16', 'iso day');
|
2409
|
-
ver('1999 37 04', 'GGGG WW E', '1999 09 16', 'iso day wide', true);
|
2410
|
-
|
2411
|
-
ver('1999 37 4', 'gggg ww e', '1999 09 09', 'day');
|
2412
|
-
ver('1999 37 04', 'gggg ww e', '1999 09 09', 'day wide', true);
|
2413
|
-
|
2414
|
-
// year + week + day
|
2415
|
-
ver('1999 37 4', 'gggg ww d', '1999 09 09', 'd');
|
2416
|
-
ver('1999 37 Th', 'gggg ww dd', '1999 09 09', 'dd');
|
2417
|
-
ver('1999 37 Thu', 'gggg ww ddd', '1999 09 09', 'ddd');
|
2418
|
-
ver('1999 37 Thursday', 'gggg ww dddd', '1999 09 09', 'dddd');
|
2419
|
-
|
2420
|
-
// lower-order only
|
2421
|
-
assert.equal(moment('22', 'ww').week(), 22, 'week sets the week by itself');
|
2422
|
-
assert.equal(
|
2423
|
-
moment('22', 'ww').weekYear(),
|
2424
|
-
moment().weekYear(),
|
2425
|
-
'week keeps this year'
|
2426
|
-
);
|
2427
|
-
assert.equal(
|
2428
|
-
moment('2012 22', 'YYYY ww').weekYear(),
|
2429
|
-
2012,
|
2430
|
-
'week keeps parsed year'
|
2431
|
-
);
|
2432
|
-
|
2433
|
-
assert.equal(
|
2434
|
-
moment('22', 'WW').isoWeek(),
|
2435
|
-
22,
|
2436
|
-
'iso week sets the week by itself'
|
2437
|
-
);
|
2438
|
-
assert.equal(
|
2439
|
-
moment('2012 22', 'YYYY WW').weekYear(),
|
2440
|
-
2012,
|
2441
|
-
'iso week keeps parsed year'
|
2442
|
-
);
|
2443
|
-
assert.equal(
|
2444
|
-
moment('22', 'WW').isoWeekYear(),
|
2445
|
-
moment().isoWeekYear(),
|
2446
|
-
'iso week keeps this year'
|
2447
|
-
);
|
2448
|
-
|
2449
|
-
// order
|
2450
|
-
ver('6 2013 2', 'e gggg w', '2013 01 12', "order doesn't matter");
|
2451
|
-
ver('6 2013 2', 'E GGGG W', '2013 01 12', "iso order doesn't matter");
|
2452
|
-
|
2453
|
-
//can parse other stuff too
|
2454
|
-
assert.equal(
|
2455
|
-
moment('1999-W37-4 3:30', 'GGGG-[W]WW-E HH:mm').format(
|
2456
|
-
'YYYY MM DD HH:mm'
|
2457
|
-
),
|
2458
|
-
'1999 09 16 03:30',
|
2459
|
-
'parsing weeks and hours'
|
2460
|
-
);
|
2461
|
-
|
2462
|
-
// In safari, all years before 1300 are shifted back with one day.
|
2463
|
-
// http://stackoverflow.com/questions/20768975/safari-subtracts-1-day-from-dates-before-1300
|
2464
|
-
if (new Date('1300-01-01').getUTCFullYear() === 1300) {
|
2465
|
-
// Years less than 100
|
2466
|
-
ver('0098-06', 'GGGG-WW', '0098 02 03', 'small years work', true);
|
2467
|
-
}
|
2468
|
-
});
|
2469
|
-
|
2470
|
-
test('parsing localized weekdays', function (assert) {
|
2471
|
-
var ver = getVerifier(assert);
|
2472
|
-
try {
|
2473
|
-
moment.locale('dow:1,doy:4', {
|
2474
|
-
weekdays: 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split(
|
2475
|
-
'_'
|
2476
|
-
),
|
2477
|
-
weekdaysShort: 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'),
|
2478
|
-
weekdaysMin: 'Di_Lu_Ma_Me_Je_Ve_Sa'.split('_'),
|
2479
|
-
week: { dow: 1, doy: 4 },
|
2480
|
-
});
|
2481
|
-
ver('1999 37 4', 'GGGG WW E', '1999 09 16', 'iso ignores locale');
|
2482
|
-
ver('1999 37 7', 'GGGG WW E', '1999 09 19', 'iso ignores locale');
|
2483
|
-
|
2484
|
-
ver(
|
2485
|
-
'1999 37 0',
|
2486
|
-
'gggg ww e',
|
2487
|
-
'1999 09 13',
|
2488
|
-
'localized e uses local doy and dow: 0 = monday'
|
2489
|
-
);
|
2490
|
-
ver(
|
2491
|
-
'1999 37 4',
|
2492
|
-
'gggg ww e',
|
2493
|
-
'1999 09 17',
|
2494
|
-
'localized e uses local doy and dow: 4 = friday'
|
2495
|
-
);
|
2496
|
-
|
2497
|
-
ver(
|
2498
|
-
'1999 37 1',
|
2499
|
-
'gggg ww d',
|
2500
|
-
'1999 09 13',
|
2501
|
-
'localized d uses 0-indexed days: 1 = monday'
|
2502
|
-
);
|
2503
|
-
ver(
|
2504
|
-
'1999 37 Lu',
|
2505
|
-
'gggg ww dd',
|
2506
|
-
'1999 09 13',
|
2507
|
-
'localized d uses 0-indexed days: Mo'
|
2508
|
-
);
|
2509
|
-
ver(
|
2510
|
-
'1999 37 lun.',
|
2511
|
-
'gggg ww ddd',
|
2512
|
-
'1999 09 13',
|
2513
|
-
'localized d uses 0-indexed days: Mon'
|
2514
|
-
);
|
2515
|
-
ver(
|
2516
|
-
'1999 37 lundi',
|
2517
|
-
'gggg ww dddd',
|
2518
|
-
'1999 09 13',
|
2519
|
-
'localized d uses 0-indexed days: Monday'
|
2520
|
-
);
|
2521
|
-
ver(
|
2522
|
-
'1999 37 4',
|
2523
|
-
'gggg ww d',
|
2524
|
-
'1999 09 16',
|
2525
|
-
'localized d uses 0-indexed days: 4'
|
2526
|
-
);
|
2527
|
-
|
2528
|
-
//sunday goes at the end of the week
|
2529
|
-
ver(
|
2530
|
-
'1999 37 0',
|
2531
|
-
'gggg ww d',
|
2532
|
-
'1999 09 19',
|
2533
|
-
'localized d uses 0-indexed days: 0 = sund'
|
2534
|
-
);
|
2535
|
-
ver(
|
2536
|
-
'1999 37 Di',
|
2537
|
-
'gggg ww dd',
|
2538
|
-
'1999 09 19',
|
2539
|
-
'localized d uses 0-indexed days: 0 = sund'
|
2540
|
-
);
|
2541
|
-
} finally {
|
2542
|
-
moment.defineLocale('dow:1,doy:4', null);
|
2543
|
-
moment.locale('en');
|
2544
|
-
}
|
2545
|
-
});
|
2546
|
-
|
2547
|
-
test('parsing with customized two-digit year', function (assert) {
|
2548
|
-
var original = moment.parseTwoDigitYear;
|
2549
|
-
try {
|
2550
|
-
assert.equal(moment('68', 'YY').year(), 2068);
|
2551
|
-
assert.equal(moment('69', 'YY').year(), 1969);
|
2552
|
-
moment.parseTwoDigitYear = function (input) {
|
2553
|
-
return +input + (+input > 30 ? 1900 : 2000);
|
2554
|
-
};
|
2555
|
-
assert.equal(moment('68', 'YY').year(), 1968);
|
2556
|
-
assert.equal(moment('67', 'YY').year(), 1967);
|
2557
|
-
assert.equal(moment('31', 'YY').year(), 1931);
|
2558
|
-
assert.equal(moment('30', 'YY').year(), 2030);
|
2559
|
-
} finally {
|
2560
|
-
moment.parseTwoDigitYear = original;
|
2561
|
-
}
|
2562
|
-
});
|
2563
|
-
|
2564
|
-
test('array with strings', function (assert) {
|
2565
|
-
assert.equal(
|
2566
|
-
moment(['2014', '7', '31']).isValid(),
|
2567
|
-
true,
|
2568
|
-
'string array + isValid'
|
2569
|
-
);
|
2570
|
-
});
|
2571
|
-
|
2572
|
-
test('object with strings', function (assert) {
|
2573
|
-
assert.equal(
|
2574
|
-
moment({ year: '2014', month: '7', day: '31' }).isValid(),
|
2575
|
-
true,
|
2576
|
-
'string object + isValid'
|
2577
|
-
);
|
2578
|
-
});
|
2579
|
-
|
2580
|
-
test('utc with array of formats', function (assert) {
|
2581
|
-
assert.equal(
|
2582
|
-
moment.utc('2014-01-01', ['YYYY-MM-DD', 'YYYY-MM']).format(),
|
2583
|
-
'2014-01-01T00:00:00Z',
|
2584
|
-
'moment.utc works with array of formats'
|
2585
|
-
);
|
2586
|
-
});
|
2587
|
-
|
2588
|
-
test('parsing invalid string weekdays', function (assert) {
|
2589
|
-
assert.equal(
|
2590
|
-
false,
|
2591
|
-
moment('a', 'dd').isValid(),
|
2592
|
-
'dd with invalid weekday, non-strict'
|
2593
|
-
);
|
2594
|
-
assert.equal(
|
2595
|
-
false,
|
2596
|
-
moment('a', 'dd', true).isValid(),
|
2597
|
-
'dd with invalid weekday, strict'
|
2598
|
-
);
|
2599
|
-
assert.equal(
|
2600
|
-
false,
|
2601
|
-
moment('a', 'ddd').isValid(),
|
2602
|
-
'ddd with invalid weekday, non-strict'
|
2603
|
-
);
|
2604
|
-
assert.equal(
|
2605
|
-
false,
|
2606
|
-
moment('a', 'ddd', true).isValid(),
|
2607
|
-
'ddd with invalid weekday, strict'
|
2608
|
-
);
|
2609
|
-
assert.equal(
|
2610
|
-
false,
|
2611
|
-
moment('a', 'dddd').isValid(),
|
2612
|
-
'dddd with invalid weekday, non-strict'
|
2613
|
-
);
|
2614
|
-
assert.equal(
|
2615
|
-
false,
|
2616
|
-
moment('a', 'dddd', true).isValid(),
|
2617
|
-
'dddd with invalid weekday, strict'
|
2618
|
-
);
|
2619
|
-
});
|
2620
|
-
|
2621
|
-
test('milliseconds', function (assert) {
|
2622
|
-
assert.equal(moment('1', 'S').millisecond(), 100);
|
2623
|
-
assert.equal(moment('12', 'SS').millisecond(), 120);
|
2624
|
-
assert.equal(moment('123', 'SSS').millisecond(), 123);
|
2625
|
-
assert.equal(moment('1234', 'SSSS').millisecond(), 123);
|
2626
|
-
assert.equal(moment('12345', 'SSSSS').millisecond(), 123);
|
2627
|
-
assert.equal(moment('123456', 'SSSSSS').millisecond(), 123);
|
2628
|
-
assert.equal(moment('1234567', 'SSSSSSS').millisecond(), 123);
|
2629
|
-
assert.equal(moment('12345678', 'SSSSSSSS').millisecond(), 123);
|
2630
|
-
assert.equal(moment('123456789', 'SSSSSSSSS').millisecond(), 123);
|
2631
|
-
});
|
2632
|
-
|
2633
|
-
test('hmm', function (assert) {
|
2634
|
-
assert.equal(
|
2635
|
-
moment('123', 'hmm', true).format('HH:mm:ss'),
|
2636
|
-
'01:23:00',
|
2637
|
-
'123 with hmm'
|
2638
|
-
);
|
2639
|
-
assert.equal(
|
2640
|
-
moment('123a', 'hmmA', true).format('HH:mm:ss'),
|
2641
|
-
'01:23:00',
|
2642
|
-
'123a with hmmA'
|
2643
|
-
);
|
2644
|
-
assert.equal(
|
2645
|
-
moment('123p', 'hmmA', true).format('HH:mm:ss'),
|
2646
|
-
'13:23:00',
|
2647
|
-
'123p with hmmA'
|
2648
|
-
);
|
2649
|
-
|
2650
|
-
assert.equal(
|
2651
|
-
moment('1234', 'hmm', true).format('HH:mm:ss'),
|
2652
|
-
'12:34:00',
|
2653
|
-
'1234 with hmm'
|
2654
|
-
);
|
2655
|
-
assert.equal(
|
2656
|
-
moment('1234a', 'hmmA', true).format('HH:mm:ss'),
|
2657
|
-
'00:34:00',
|
2658
|
-
'1234a with hmmA'
|
2659
|
-
);
|
2660
|
-
assert.equal(
|
2661
|
-
moment('1234p', 'hmmA', true).format('HH:mm:ss'),
|
2662
|
-
'12:34:00',
|
2663
|
-
'1234p with hmmA'
|
2664
|
-
);
|
2665
|
-
|
2666
|
-
assert.equal(
|
2667
|
-
moment('12345', 'hmmss', true).format('HH:mm:ss'),
|
2668
|
-
'01:23:45',
|
2669
|
-
'12345 with hmmss'
|
2670
|
-
);
|
2671
|
-
assert.equal(
|
2672
|
-
moment('12345a', 'hmmssA', true).format('HH:mm:ss'),
|
2673
|
-
'01:23:45',
|
2674
|
-
'12345a with hmmssA'
|
2675
|
-
);
|
2676
|
-
assert.equal(
|
2677
|
-
moment('12345p', 'hmmssA', true).format('HH:mm:ss'),
|
2678
|
-
'13:23:45',
|
2679
|
-
'12345p with hmmssA'
|
2680
|
-
);
|
2681
|
-
assert.equal(
|
2682
|
-
moment('112345', 'hmmss', true).format('HH:mm:ss'),
|
2683
|
-
'11:23:45',
|
2684
|
-
'112345 with hmmss'
|
2685
|
-
);
|
2686
|
-
assert.equal(
|
2687
|
-
moment('112345a', 'hmmssA', true).format('HH:mm:ss'),
|
2688
|
-
'11:23:45',
|
2689
|
-
'112345a with hmmssA'
|
2690
|
-
);
|
2691
|
-
assert.equal(
|
2692
|
-
moment('112345p', 'hmmssA', true).format('HH:mm:ss'),
|
2693
|
-
'23:23:45',
|
2694
|
-
'112345p with hmmssA'
|
2695
|
-
);
|
2696
|
-
|
2697
|
-
assert.equal(
|
2698
|
-
moment('023', 'Hmm', true).format('HH:mm:ss'),
|
2699
|
-
'00:23:00',
|
2700
|
-
'023 with Hmm'
|
2701
|
-
);
|
2702
|
-
assert.equal(
|
2703
|
-
moment('123', 'Hmm', true).format('HH:mm:ss'),
|
2704
|
-
'01:23:00',
|
2705
|
-
'123 with Hmm'
|
2706
|
-
);
|
2707
|
-
assert.equal(
|
2708
|
-
moment('1234', 'Hmm', true).format('HH:mm:ss'),
|
2709
|
-
'12:34:00',
|
2710
|
-
'1234 with Hmm'
|
2711
|
-
);
|
2712
|
-
assert.equal(
|
2713
|
-
moment('1534', 'Hmm', true).format('HH:mm:ss'),
|
2714
|
-
'15:34:00',
|
2715
|
-
'1234 with Hmm'
|
2716
|
-
);
|
2717
|
-
assert.equal(
|
2718
|
-
moment('12345', 'Hmmss', true).format('HH:mm:ss'),
|
2719
|
-
'01:23:45',
|
2720
|
-
'12345 with Hmmss'
|
2721
|
-
);
|
2722
|
-
assert.equal(
|
2723
|
-
moment('112345', 'Hmmss', true).format('HH:mm:ss'),
|
2724
|
-
'11:23:45',
|
2725
|
-
'112345 with Hmmss'
|
2726
|
-
);
|
2727
|
-
assert.equal(
|
2728
|
-
moment('172345', 'Hmmss', true).format('HH:mm:ss'),
|
2729
|
-
'17:23:45',
|
2730
|
-
'112345 with Hmmss'
|
2731
|
-
);
|
2732
|
-
});
|
2733
|
-
|
2734
|
-
test('Y token', function (assert) {
|
2735
|
-
assert.equal(moment('1-1-2010', 'M-D-Y', true).year(), 2010, 'parsing Y');
|
2736
|
-
});
|
2737
|
-
|
2738
|
-
test('parsing flags retain parsed date parts', function (assert) {
|
2739
|
-
var a = moment('10 p', 'hh:mm a'),
|
2740
|
-
b;
|
2741
|
-
assert.equal(
|
2742
|
-
a.parsingFlags().parsedDateParts[3],
|
2743
|
-
10,
|
2744
|
-
'parsed 10 as the hour'
|
2745
|
-
);
|
2746
|
-
assert.equal(
|
2747
|
-
a.parsingFlags().parsedDateParts[0],
|
2748
|
-
undefined,
|
2749
|
-
'year was not parsed'
|
2750
|
-
);
|
2751
|
-
assert.equal(a.parsingFlags().meridiem, 'p', 'meridiem flag was added');
|
2752
|
-
b = moment('10:30', ['MMDDYY', 'HH:mm']);
|
2753
|
-
assert.equal(
|
2754
|
-
b.parsingFlags().parsedDateParts[3],
|
2755
|
-
10,
|
2756
|
-
'multiple format parshing matched hour'
|
2757
|
-
);
|
2758
|
-
assert.equal(
|
2759
|
-
b.parsingFlags().parsedDateParts[0],
|
2760
|
-
undefined,
|
2761
|
-
'array is properly copied, no residual data from first token parse'
|
2762
|
-
);
|
2763
|
-
});
|
2764
|
-
|
2765
|
-
test('parsing only meridiem results in invalid date', function (assert) {
|
2766
|
-
assert.ok(
|
2767
|
-
!moment('alkj', 'hh:mm a').isValid(),
|
2768
|
-
'because an a token is used, a meridiem will be parsed but nothing else was so invalid'
|
2769
|
-
);
|
2770
|
-
assert.ok(
|
2771
|
-
moment('02:30 p more extra stuff', 'hh:mm a').isValid(),
|
2772
|
-
'because other tokens were parsed, date is valid'
|
2773
|
-
);
|
2774
|
-
assert.ok(
|
2775
|
-
moment('1/1/2016 extra data', ['a', 'M/D/YYYY']).isValid(),
|
2776
|
-
'took second format, does not pick up on meridiem parsed from first format (good copy)'
|
2777
|
-
);
|
2778
|
-
});
|
2779
|
-
|
2780
|
-
test('invalid dates return invalid for methods that access the _d prop', function (assert) {
|
2781
|
-
var momentAsDate = moment(['2015', '12', '1']).toDate();
|
2782
|
-
assert.ok(momentAsDate instanceof Date, 'toDate returns a Date object');
|
2783
|
-
assert.ok(
|
2784
|
-
isNaN(momentAsDate.getTime()),
|
2785
|
-
'toDate returns an invalid Date invalid'
|
2786
|
-
);
|
2787
|
-
});
|
2788
|
-
|
2789
|
-
test('k, kk', function (assert) {
|
2790
|
-
var i, kVal, kkVal;
|
2791
|
-
for (i = -1; i <= 24; i++) {
|
2792
|
-
kVal = i + ':15:59';
|
2793
|
-
kkVal = (i < 10 ? '0' : '') + i + ':15:59';
|
2794
|
-
if (i !== 24) {
|
2795
|
-
assert.ok(
|
2796
|
-
moment(kVal, 'k:mm:ss').isSame(moment(kVal, 'H:mm:ss')),
|
2797
|
-
kVal + ' k parsing'
|
2798
|
-
);
|
2799
|
-
assert.ok(
|
2800
|
-
moment(kkVal, 'kk:mm:ss').isSame(moment(kkVal, 'HH:mm:ss')),
|
2801
|
-
kkVal + ' kk parsing'
|
2802
|
-
);
|
2803
|
-
} else {
|
2804
|
-
assert.equal(
|
2805
|
-
moment(kVal, 'k:mm:ss').format('k:mm:ss'),
|
2806
|
-
kVal,
|
2807
|
-
kVal + ' k parsing'
|
2808
|
-
);
|
2809
|
-
assert.equal(
|
2810
|
-
moment(kkVal, 'kk:mm:ss').format('kk:mm:ss'),
|
2811
|
-
kkVal,
|
2812
|
-
kkVal + ' skk parsing'
|
2813
|
-
);
|
2814
|
-
}
|
2815
|
-
}
|
2816
|
-
});
|