Comparing version 2.2.1 to 2.3.0
{ | ||
"name": "moment", | ||
"version": "2.2.1", | ||
"version": "2.3.0", | ||
"main": "moment.js", | ||
@@ -5,0 +5,0 @@ "ignore": [ |
{ | ||
"name": "moment", | ||
"version": "2.1.0", | ||
"scripts": ["moment.js"], | ||
"version": "2.3.0", | ||
"main": "moment.js", | ||
"description": "Parse, validate, manipulate, and display dates in javascript.", | ||
"ignore": [ | ||
".gitignore", | ||
".travis.yml", | ||
"composer.json", | ||
"CONTRIBUTING.md", | ||
"ender.js", | ||
"Gruntfile.js", | ||
"package.js", | ||
"package.json", | ||
"test", | ||
"tasks" | ||
"files": [ | ||
"moment.js", | ||
"lang/ar-ma.js", | ||
"lang/ar.js", | ||
"lang/bg.js", | ||
"lang/br.js", | ||
"lang/bs.js", | ||
"lang/ca.js", | ||
"lang/cs.js", | ||
"lang/cv.js", | ||
"lang/da.js", | ||
"lang/de.js", | ||
"lang/el.js", | ||
"lang/en-au.js", | ||
"lang/en-ca.js", | ||
"lang/en-gb.js", | ||
"lang/eo.js", | ||
"lang/es.js", | ||
"lang/et.js", | ||
"lang/eu.js", | ||
"lang/fa.js", | ||
"lang/fi.js", | ||
"lang/fr-ca.js", | ||
"lang/fr.js", | ||
"lang/gl.js", | ||
"lang/he.js", | ||
"lang/hi.js", | ||
"lang/hr.js", | ||
"lang/hu.js", | ||
"lang/id.js", | ||
"lang/is.js", | ||
"lang/it.js", | ||
"lang/ja.js", | ||
"lang/ka.js", | ||
"lang/ko.js", | ||
"lang/lt.js", | ||
"lang/lv.js", | ||
"lang/ml.js", | ||
"lang/mr.js", | ||
"lang/ms-my.js", | ||
"lang/nb.js", | ||
"lang/ne.js", | ||
"lang/nl.js", | ||
"lang/nn.js", | ||
"lang/pl.js", | ||
"lang/pt-br.js", | ||
"lang/pt.js", | ||
"lang/ro.js", | ||
"lang/ru.js", | ||
"lang/sk.js", | ||
"lang/sl.js", | ||
"lang/sq.js", | ||
"lang/sv.js", | ||
"lang/th.js", | ||
"lang/tr.js", | ||
"lang/tzm-la.js", | ||
"lang/tzm.js", | ||
"lang/uk.js", | ||
"lang/uz.js", | ||
"lang/vn.js", | ||
"lang/zh-cn.js", | ||
"lang/zh-tw.js" | ||
] | ||
} | ||
} |
@@ -9,3 +9,3 @@ All pull requests to the `master` branch will be closed. | ||
See [the english unit tests](https://github.com/timrwood/moment/blob/develop/test/lang/en.js) for an example. | ||
See [the British english unit tests](https://github.com/moment/moment/blob/develop/test/lang/en-gb.js) for an example. | ||
@@ -12,0 +12,0 @@ Submitting Issues |
module.exports = function (grunt) { | ||
var embedOption = grunt.option('embed_languages'), | ||
embedLanguageDest = embedOption ? | ||
'min/moment-with-customlangs.js' : | ||
'min/moment-with-langs.js', | ||
embedLanguageLangs = 'lang/*.js'; | ||
if (embedOption && embedOption.match(/,/)) { | ||
embedLanguageLangs = 'lang/{' + embedOption + '}.js'; | ||
} | ||
else if (embedOption) { | ||
embedLanguageLangs = 'lang/' + embedOption + '.js'; | ||
} | ||
grunt.initConfig({ | ||
@@ -13,6 +27,6 @@ pkg: grunt.file.readJSON('package.json'), | ||
files: { | ||
'min/moment+langs.min.js' : 'min/moment+langs.js', | ||
'min/moment+customlangs.min.js' : 'min/moment+customlangs.js', | ||
'min/langs.min.js' : 'min/langs.js', | ||
'min/moment.min.js' : 'moment.js' | ||
'min/moment-with-langs.min.js' : 'min/moment-with-langs.js', | ||
'min/moment-with-customlangs.min.js' : 'min/moment-with-customlangs.js', | ||
'min/langs.min.js' : 'min/langs.js', | ||
'min/moment.min.js' : 'moment.js' | ||
} | ||
@@ -82,8 +96,4 @@ }, | ||
moment: 'moment.js', | ||
dest: grunt.option('embed_languages') ? | ||
'min/moment+customlangs.js' : | ||
'min/moment+langs.js', | ||
targetLangs: grunt.option('embed_languages') ? | ||
'lang/{' + grunt.option('embed_languages') + '}.js': | ||
'lang/*.js' | ||
dest: embedLanguageDest, | ||
targetLangs: embedLanguageLangs | ||
} | ||
@@ -106,3 +116,4 @@ }); | ||
// Task to be run when releasing a new version | ||
grunt.registerTask('release', ['jshint', 'nodeunit', 'concat', 'embed_languages', 'uglify']); | ||
grunt.registerTask('release', ['jshint', 'nodeunit', 'concat', | ||
'embed_languages', 'component', 'uglify']); | ||
}; |
@@ -10,3 +10,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -16,3 +16,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('ar-ma', { | ||
return moment.lang('ar-ma', { | ||
months : "يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"), | ||
@@ -19,0 +19,0 @@ monthsShort : "يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"), |
@@ -10,3 +10,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -16,3 +16,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('ar', { | ||
return moment.lang('ar', { | ||
months : "يناير/ كانون الثاني_فبراير/ شباط_مارس/ آذار_أبريل/ نيسان_مايو/ أيار_يونيو/ حزيران_يوليو/ تموز_أغسطس/ آب_سبتمبر/ أيلول_أكتوبر/ تشرين الأول_نوفمبر/ تشرين الثاني_ديسمبر/ كانون الأول".split("_"), | ||
@@ -19,0 +19,0 @@ monthsShort : "يناير/ كانون الثاني_فبراير/ شباط_مارس/ آذار_أبريل/ نيسان_مايو/ أيار_يونيو/ حزيران_يوليو/ تموز_أغسطس/ آب_سبتمبر/ أيلول_أكتوبر/ تشرين الأول_نوفمبر/ تشرين الثاني_ديسمبر/ كانون الأول".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('bg', { | ||
return moment.lang('bg', { | ||
months : "януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември".split("_"), | ||
@@ -23,3 +23,3 @@ monthsShort : "янр_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек".split("_"), | ||
longDateFormat : { | ||
LT : "h:mm", | ||
LT : "H:mm", | ||
L : "D.MM.YYYY", | ||
@@ -26,0 +26,0 @@ LL : "D MMMM YYYY", |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -63,3 +63,3 @@ factory(window.moment); // Browser global | ||
moment.lang('br', { | ||
return moment.lang('br', { | ||
months : "Genver_C'hwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu".split("_"), | ||
@@ -66,0 +66,0 @@ monthsShort : "Gen_C'hwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('ca', { | ||
return moment.lang('ca', { | ||
months : "Gener_Febrer_Març_Abril_Maig_Juny_Juliol_Agost_Setembre_Octubre_Novembre_Desembre".split("_"), | ||
@@ -18,0 +18,0 @@ monthsShort : "Gen._Febr._Mar._Abr._Mai._Jun._Jul._Ag._Set._Oct._Nov._Des.".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -75,3 +75,3 @@ factory(window.moment); // Browser global | ||
moment.lang('cs', { | ||
return moment.lang('cs', { | ||
months : months, | ||
@@ -78,0 +78,0 @@ monthsShort : monthsShort, |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('cv', { | ||
return moment.lang('cv', { | ||
months : "кăрлач_нарăс_пуш_ака_май_çĕртме_утă_çурла_авăн_юпа_чӳк_раштав".split("_"), | ||
@@ -18,0 +18,0 @@ monthsShort : "кăр_нар_пуш_ака_май_çĕр_утă_çур_ав_юпа_чӳк_раш".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('da', { | ||
return moment.lang('da', { | ||
months : "januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december".split("_"), | ||
@@ -18,0 +18,0 @@ monthsShort : "jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"), |
@@ -10,3 +10,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -30,3 +30,3 @@ factory(window.moment); // Browser global | ||
moment.lang('de', { | ||
return moment.lang('de', { | ||
months : "Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"), | ||
@@ -33,0 +33,0 @@ monthsShort : "Jan._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('el', { | ||
return moment.lang('el', { | ||
monthsNominativeEl : "Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος".split("_"), | ||
@@ -18,0 +18,0 @@ monthsGenitiveEl : "Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('en-ca', { | ||
return moment.lang('en-ca', { | ||
months : "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), | ||
@@ -18,0 +18,0 @@ monthsShort : "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('en-gb', { | ||
return moment.lang('en-gb', { | ||
months : "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), | ||
@@ -18,0 +18,0 @@ monthsShort : "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"), |
@@ -11,3 +11,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -17,3 +17,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('eo', { | ||
return moment.lang('eo', { | ||
months : "januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro".split("_"), | ||
@@ -20,0 +20,0 @@ monthsShort : "jan_feb_mar_apr_maj_jun_jul_aŭg_sep_okt_nov_dec".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('es', { | ||
return moment.lang('es', { | ||
months : "enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"), | ||
@@ -18,0 +18,0 @@ monthsShort : "ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -19,3 +19,3 @@ factory(window.moment); // Browser global | ||
moment.lang('et', { | ||
return moment.lang('et', { | ||
months : "jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember".split("_"), | ||
@@ -22,0 +22,0 @@ monthsShort : "jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('eu', { | ||
return moment.lang('eu', { | ||
months : "urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua".split("_"), | ||
@@ -18,0 +18,0 @@ monthsShort : "urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -39,3 +39,3 @@ factory(window.moment); // Browser global | ||
moment.lang('fa', { | ||
return moment.lang('fa', { | ||
months : 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), | ||
@@ -42,0 +42,0 @@ monthsShort : 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -58,3 +58,3 @@ factory(window.moment); // Browser global | ||
moment.lang('fi', { | ||
return moment.lang('fi', { | ||
months : "tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu".split("_"), | ||
@@ -61,0 +61,0 @@ monthsShort : "tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('fr-ca', { | ||
return moment.lang('fr-ca', { | ||
months : "janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"), | ||
@@ -18,0 +18,0 @@ monthsShort : "janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('fr', { | ||
return moment.lang('fr', { | ||
months : "janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"), | ||
@@ -18,0 +18,0 @@ monthsShort : "janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('gl', { | ||
return moment.lang('gl', { | ||
months : "Xaneiro_Febreiro_Marzo_Abril_Maio_Xuño_Xullo_Agosto_Setembro_Outubro_Novembro_Decembro".split("_"), | ||
@@ -18,0 +18,0 @@ monthsShort : "Xan._Feb._Mar._Abr._Mai._Xuñ._Xul._Ago._Set._Out._Nov._Dec.".split("_"), |
@@ -11,3 +11,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -17,3 +17,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('he', { | ||
return moment.lang('he', { | ||
months : "ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר".split("_"), | ||
@@ -20,0 +20,0 @@ monthsShort : "ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -40,3 +40,3 @@ factory(window.moment); // Browser global | ||
moment.lang('hi', { | ||
return moment.lang('hi', { | ||
months : 'जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर'.split("_"), | ||
@@ -43,0 +43,0 @@ monthsShort : 'जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.'.split("_"), |
@@ -11,3 +11,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -71,3 +71,3 @@ factory(window.moment); // Browser global | ||
moment.lang('hr', { | ||
return moment.lang('hr', { | ||
months : "sječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac".split("_"), | ||
@@ -74,0 +74,0 @@ monthsShort : "sje._vel._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -53,7 +53,8 @@ factory(window.moment); // Browser global | ||
moment.lang('hu', { | ||
return moment.lang('hu', { | ||
months : "január_február_március_április_május_június_július_augusztus_szeptember_október_november_december".split("_"), | ||
monthsShort : "jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec".split("_"), | ||
weekdays : "vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat".split("_"), | ||
weekdaysShort : "v_h_k_sze_cs_p_szo".split("_"), | ||
weekdaysShort : "vas_hét_kedd_sze_csüt_pén_szo".split("_"), | ||
weekdaysMin : "v_h_k_sze_cs_p_szo".split("_"), | ||
longDateFormat : { | ||
@@ -60,0 +61,0 @@ LT : "H:mm", |
@@ -10,3 +10,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -16,3 +16,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('id', { | ||
return moment.lang('id', { | ||
months : "Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember".split("_"), | ||
@@ -19,0 +19,0 @@ monthsShort : "Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nov_Des".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -83,3 +83,3 @@ factory(window.moment); // Browser global | ||
moment.lang('is', { | ||
return moment.lang('is', { | ||
months : "janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember".split("_"), | ||
@@ -86,0 +86,0 @@ monthsShort : "jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des".split("_"), |
@@ -10,3 +10,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -16,3 +16,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('it', { | ||
return moment.lang('it', { | ||
months : "Gennaio_Febbraio_Marzo_Aprile_Maggio_Giugno_Luglio_Agosto_Settembre_Ottobre_Novembre_Dicembre".split("_"), | ||
@@ -19,0 +19,0 @@ monthsShort : "Gen_Feb_Mar_Apr_Mag_Giu_Lug_Ago_Set_Ott_Nov_Dic".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('ja', { | ||
return moment.lang('ja', { | ||
months : "1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"), | ||
@@ -18,0 +18,0 @@ monthsShort : "1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -42,3 +42,3 @@ factory(window.moment); // Browser global | ||
moment.lang('ka', { | ||
return moment.lang('ka', { | ||
months : monthsCaseReplace, | ||
@@ -45,0 +45,0 @@ monthsShort : "იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('ko', { | ||
return moment.lang('ko', { | ||
months : "1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"), | ||
@@ -18,0 +18,0 @@ monthsShort : "1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -36,3 +36,3 @@ factory(window.moment); // Browser global | ||
moment.lang('lv', { | ||
return moment.lang('lv', { | ||
months : "janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris".split("_"), | ||
@@ -39,0 +39,0 @@ monthsShort : "jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('ml', { | ||
return moment.lang('ml', { | ||
months : 'ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ'.split("_"), | ||
@@ -18,0 +18,0 @@ monthsShort : 'ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.'.split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -40,3 +40,3 @@ factory(window.moment); // Browser global | ||
moment.lang('mr', { | ||
return moment.lang('mr', { | ||
months : 'जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर'.split("_"), | ||
@@ -43,0 +43,0 @@ monthsShort: 'जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.'.split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('ms-my', { | ||
return moment.lang('ms-my', { | ||
months : "Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"), | ||
@@ -18,0 +18,0 @@ monthsShort : "Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"), |
@@ -10,3 +10,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -16,3 +16,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('nb', { | ||
return moment.lang('nb', { | ||
months : "januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"), | ||
@@ -19,0 +19,0 @@ monthsShort : "jan._feb._mars_april_mai_juni_juli_aug._sep._okt._nov._des.".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -40,3 +40,3 @@ factory(window.moment); // Browser global | ||
moment.lang('ne', { | ||
return moment.lang('ne', { | ||
months : 'जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर'.split("_"), | ||
@@ -43,0 +43,0 @@ monthsShort : 'जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.'.split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -18,3 +18,3 @@ factory(window.moment); // Browser global | ||
moment.lang('nl', { | ||
return moment.lang('nl', { | ||
months : "januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"), | ||
@@ -39,6 +39,6 @@ monthsShort : function (m, format) { | ||
calendar : { | ||
sameDay: '[Vandaag om] LT', | ||
nextDay: '[Morgen om] LT', | ||
sameDay: '[vandaag om] LT', | ||
nextDay: '[morgen om] LT', | ||
nextWeek: 'dddd [om] LT', | ||
lastDay: '[Gisteren om] LT', | ||
lastDay: '[gisteren om] LT', | ||
lastWeek: '[afgelopen] dddd [om] LT', | ||
@@ -45,0 +45,0 @@ sameElse: 'L' |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('nn', { | ||
return moment.lang('nn', { | ||
months : "januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"), | ||
@@ -18,0 +18,0 @@ monthsShort : "jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -40,3 +40,3 @@ factory(window.moment); // Browser global | ||
moment.lang('pl', { | ||
return moment.lang('pl', { | ||
months : function (momentToFormat, format) { | ||
@@ -43,0 +43,0 @@ if (/D MMMM/.test(format)) { |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('pt-br', { | ||
return moment.lang('pt-br', { | ||
months : "Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro".split("_"), | ||
@@ -18,0 +18,0 @@ monthsShort : "Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('pt', { | ||
return moment.lang('pt', { | ||
months : "Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro".split("_"), | ||
@@ -18,0 +18,0 @@ monthsShort : "Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"), |
@@ -10,3 +10,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -16,3 +16,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('ro', { | ||
return moment.lang('ro', { | ||
months : "Ianuarie_Februarie_Martie_Aprilie_Mai_Iunie_Iulie_August_Septembrie_Octombrie_Noiembrie_Decembrie".split("_"), | ||
@@ -19,0 +19,0 @@ monthsShort : "Ian_Feb_Mar_Apr_Mai_Iun_Iul_Aug_Sep_Oct_Noi_Dec".split("_"), |
@@ -10,3 +10,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -76,8 +76,9 @@ factory(window.moment); // Browser global | ||
moment.lang('ru', { | ||
return moment.lang('ru', { | ||
months : monthsCaseReplace, | ||
monthsShort : monthsShortCaseReplace, | ||
weekdays : weekdaysCaseReplace, | ||
weekdaysShort : "вск_пнд_втр_срд_чтв_птн_сбт".split("_"), | ||
weekdaysShort : "вс_пн_вт_ср_чт_пт_сб".split("_"), | ||
weekdaysMin : "вс_пн_вт_ср_чт_пт_сб".split("_"), | ||
monthsParse : [/^янв/i, /^фев/i, /^мар/i, /^апр/i, /^ма[й|я]/i, /^июн/i, /^июл/i, /^авг/i, /^сен/i, /^окт/i, /^ноя/i, /^дек/i], | ||
longDateFormat : { | ||
@@ -129,2 +130,16 @@ LT : "HH:mm", | ||
// M. E.: those two are virtually unused but a user might want to implement them for his/her website for some reason | ||
meridiem : function (hour, minute, isLower) { | ||
if (hour < 4) { | ||
return "ночи"; | ||
} else if (hour < 12) { | ||
return "утра"; | ||
} else if (hour < 17) { | ||
return "дня"; | ||
} else { | ||
return "вечера"; | ||
} | ||
}, | ||
ordinal: function (number, period) { | ||
@@ -131,0 +146,0 @@ switch (period) { |
@@ -10,3 +10,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -76,3 +76,3 @@ factory(window.moment); // Browser global | ||
moment.lang('sk', { | ||
return moment.lang('sk', { | ||
months : months, | ||
@@ -79,0 +79,0 @@ monthsShort : monthsShort, |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -76,3 +76,3 @@ factory(window.moment); // Browser global | ||
moment.lang('sl', { | ||
return moment.lang('sl', { | ||
months : "januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december".split("_"), | ||
@@ -79,0 +79,0 @@ monthsShort : "jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.".split("_"), |
@@ -10,3 +10,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -16,3 +16,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('sq', { | ||
return moment.lang('sq', { | ||
months : "Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor".split("_"), | ||
@@ -19,0 +19,0 @@ monthsShort : "Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('sv', { | ||
return moment.lang('sv', { | ||
months : "januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december".split("_"), | ||
@@ -18,0 +18,0 @@ monthsShort : "jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('th', { | ||
return moment.lang('th', { | ||
months : "มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม".split("_"), | ||
@@ -18,0 +18,0 @@ monthsShort : "มกรา_กุมภา_มีนา_เมษา_พฤษภา_มิถุนา_กรกฎา_สิงหา_กันยา_ตุลา_พฤศจิกา_ธันวา".split("_"), |
@@ -10,3 +10,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -43,3 +43,3 @@ factory(window.moment); // Browser global | ||
moment.lang('tr', { | ||
return moment.lang('tr', { | ||
months : "Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık".split("_"), | ||
@@ -46,0 +46,0 @@ monthsShort : "Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('tzm-la', { | ||
return moment.lang('tzm-la', { | ||
months : "innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"), | ||
@@ -18,0 +18,0 @@ monthsShort : "innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"), |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('tzm', { | ||
return moment.lang('tzm', { | ||
months : "ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"), | ||
@@ -18,0 +18,0 @@ monthsShort : "ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"), |
@@ -10,3 +10,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -75,7 +75,7 @@ factory(window.moment); // Browser global | ||
moment.lang('uk', { | ||
return moment.lang('uk', { | ||
months : monthsCaseReplace, | ||
monthsShort : "січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд".split("_"), | ||
weekdays : weekdaysCaseReplace, | ||
weekdaysShort : "нед_пон_вів_сер_чет_п’ят_суб".split("_"), | ||
weekdaysShort : "нд_пн_вт_ср_чт_пт_сб".split("_"), | ||
weekdaysMin : "нд_пн_вт_ср_чт_пт_сб".split("_"), | ||
@@ -124,2 +124,17 @@ longDateFormat : { | ||
}, | ||
// M. E.: those two are virtually unused but a user might want to implement them for his/her website for some reason | ||
meridiem : function (hour, minute, isLower) { | ||
if (hour < 4) { | ||
return "ночі"; | ||
} else if (hour < 12) { | ||
return "ранку"; | ||
} else if (hour < 17) { | ||
return "дня"; | ||
} else { | ||
return "вечора"; | ||
} | ||
}, | ||
ordinal: function (number, period) { | ||
@@ -126,0 +141,0 @@ switch (period) { |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('zh-cn', { | ||
return moment.lang('zh-cn', { | ||
months : "一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"), | ||
@@ -34,9 +34,10 @@ monthsShort : "1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"), | ||
meridiem : function (hour, minute, isLower) { | ||
if (hour < 9) { | ||
var hm = hour * 100 + minute; | ||
if (hm < 900) { | ||
return "早上"; | ||
} else if (hour < 11 && minute < 30) { | ||
} else if (hm < 1130) { | ||
return "上午"; | ||
} else if (hour < 13 && minute < 30) { | ||
} else if (hm < 1230) { | ||
return "中午"; | ||
} else if (hour < 18) { | ||
} else if (hm < 1800) { | ||
return "下午"; | ||
@@ -43,0 +44,0 @@ } else { |
@@ -9,3 +9,3 @@ // moment.js language configuration | ||
} else if (typeof exports === 'object') { | ||
factory(require('../moment')); // Node | ||
module.exports = factory(require('../moment')); // Node | ||
} else { | ||
@@ -15,3 +15,3 @@ factory(window.moment); // Browser global | ||
}(function (moment) { | ||
moment.lang('zh-tw', { | ||
return moment.lang('zh-tw', { | ||
months : "一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"), | ||
@@ -34,9 +34,10 @@ monthsShort : "1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"), | ||
meridiem : function (hour, minute, isLower) { | ||
if (hour < 9) { | ||
var hm = hour * 100 + minute; | ||
if (hm < 900) { | ||
return "早上"; | ||
} else if (hour < 11 && minute < 30) { | ||
} else if (hm < 1130) { | ||
return "上午"; | ||
} else if (hour < 13 && minute < 30) { | ||
} else if (hm < 1230) { | ||
return "中午"; | ||
} else if (hour < 18) { | ||
} else if (hm < 1800) { | ||
return "下午"; | ||
@@ -43,0 +44,0 @@ } else { |
//! moment.js | ||
//! version : 2.2.1 | ||
//! version : 2.3.0 | ||
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors | ||
//! license : MIT | ||
//! momentjs.com | ||
(function(a){function b(a,b){return function(c){return i(a.call(this,c),b)}}function c(a,b){return function(c){return this.lang().ordinal(a.call(this,c),b)}}function d(){}function e(a){g(this,a)}function f(a){var b=a.years||a.year||a.y||0,c=a.months||a.month||a.M||0,d=a.weeks||a.week||a.w||0,e=a.days||a.day||a.d||0,f=a.hours||a.hour||a.h||0,g=a.minutes||a.minute||a.m||0,h=a.seconds||a.second||a.s||0,i=a.milliseconds||a.millisecond||a.ms||0;this._input=a,this._milliseconds=+i+1e3*h+6e4*g+36e5*f,this._days=+e+7*d,this._months=+c+12*b,this._data={},this._bubble()}function g(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function h(a){return 0>a?Math.ceil(a):Math.floor(a)}function i(a,b){for(var c=a+"";c.length<b;)c="0"+c;return c}function j(a,b,c,d){var e,f,g=b._milliseconds,h=b._days,i=b._months;g&&a._d.setTime(+a._d+g*c),(h||i)&&(e=a.minute(),f=a.hour()),h&&a.date(a.date()+h*c),i&&a.month(a.month()+i*c),g&&!d&&L.updateOffset(a),(h||i)&&(a.minute(e),a.hour(f))}function k(a){return"[object Array]"===Object.prototype.toString.call(a)}function l(a,b){var c,d=Math.min(a.length,b.length),e=Math.abs(a.length-b.length),f=0;for(c=0;d>c;c++)~~a[c]!==~~b[c]&&f++;return f+e}function m(a){return a?ib[a]||a.toLowerCase().replace(/(.)s$/,"$1"):a}function n(a,b){return b.abbr=a,P[a]||(P[a]=new d),P[a].set(b),P[a]}function o(a){delete P[a]}function p(a){if(!a)return L.fn._lang;if(!P[a]&&Q)try{require("./lang/"+a)}catch(b){return L.fn._lang}return P[a]||L.fn._lang}function q(a){return a.match(/\[.*\]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function r(a){var b,c,d=a.match(T);for(b=0,c=d.length;c>b;b++)d[b]=mb[d[b]]?mb[d[b]]:q(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function s(a,b){return b=t(b,a.lang()),jb[b]||(jb[b]=r(b)),jb[b](a)}function t(a,b){function c(a){return b.longDateFormat(a)||a}for(var d=5;d--&&(U.lastIndex=0,U.test(a));)a=a.replace(U,c);return a}function u(a,b){switch(a){case"DDDD":return X;case"YYYY":return Y;case"YYYYY":return Z;case"S":case"SS":case"SSS":case"DDD":return W;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return $;case"a":case"A":return p(b._l)._meridiemParse;case"X":return bb;case"Z":case"ZZ":return _;case"T":return ab;case"MM":case"DD":case"YY":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":return V;default:return new RegExp(a.replace("\\",""))}}function v(a){var b=(_.exec(a)||[])[0],c=(b+"").match(fb)||["-",0,0],d=+(60*c[1])+~~c[2];return"+"===c[0]?-d:d}function w(a,b,c){var d,e=c._a;switch(a){case"M":case"MM":null!=b&&(e[1]=~~b-1);break;case"MMM":case"MMMM":d=p(c._l).monthsParse(b),null!=d?e[1]=d:c._isValid=!1;break;case"D":case"DD":null!=b&&(e[2]=~~b);break;case"DDD":case"DDDD":null!=b&&(e[1]=0,e[2]=~~b);break;case"YY":e[0]=~~b+(~~b>68?1900:2e3);break;case"YYYY":case"YYYYY":e[0]=~~b;break;case"a":case"A":c._isPm=p(c._l).isPM(b);break;case"H":case"HH":case"h":case"hh":e[3]=~~b;break;case"m":case"mm":e[4]=~~b;break;case"s":case"ss":e[5]=~~b;break;case"S":case"SS":case"SSS":e[6]=~~(1e3*("0."+b));break;case"X":c._d=new Date(1e3*parseFloat(b));break;case"Z":case"ZZ":c._useUTC=!0,c._tzm=v(b)}null==b&&(c._isValid=!1)}function x(a){var b,c,d,e=[];if(!a._d){for(d=z(a),b=0;3>b&&null==a._a[b];++b)a._a[b]=e[b]=d[b];for(;7>b;b++)a._a[b]=e[b]=null==a._a[b]?2===b?1:0:a._a[b];e[3]+=~~((a._tzm||0)/60),e[4]+=~~((a._tzm||0)%60),c=new Date(0),a._useUTC?(c.setUTCFullYear(e[0],e[1],e[2]),c.setUTCHours(e[3],e[4],e[5],e[6])):(c.setFullYear(e[0],e[1],e[2]),c.setHours(e[3],e[4],e[5],e[6])),a._d=c}}function y(a){var b=a._i;a._d||(a._a=[b.years||b.year||b.y,b.months||b.month||b.M,b.days||b.day||b.d,b.hours||b.hour||b.h,b.minutes||b.minute||b.m,b.seconds||b.second||b.s,b.milliseconds||b.millisecond||b.ms],x(a))}function z(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function A(a){var b,c,d,e=p(a._l),f=""+a._i;for(d=t(a._f,e).match(T),a._a=[],b=0;b<d.length;b++)c=(u(d[b],a).exec(f)||[])[0],c&&(f=f.slice(f.indexOf(c)+c.length)),mb[d[b]]&&w(d[b],c,a);f&&(a._il=f),a._isPm&&a._a[3]<12&&(a._a[3]+=12),a._isPm===!1&&12===a._a[3]&&(a._a[3]=0),x(a)}function B(a){var b,c,d,f,h,i=99;for(f=0;f<a._f.length;f++)b=g({},a),b._f=a._f[f],A(b),c=new e(b),h=l(b._a,c.toArray()),c._il&&(h+=c._il.length),i>h&&(i=h,d=c);g(a,d)}function C(a){var b,c=a._i,d=cb.exec(c);if(d){for(a._f="YYYY-MM-DD"+(d[2]||" "),b=0;4>b;b++)if(eb[b][1].exec(c)){a._f+=eb[b][0];break}_.exec(c)&&(a._f+=" Z"),A(a)}else a._d=new Date(c)}function D(b){var c=b._i,d=R.exec(c);c===a?b._d=new Date:d?b._d=new Date(+d[1]):"string"==typeof c?C(b):k(c)?(b._a=c.slice(0),x(b)):c instanceof Date?b._d=new Date(+c):"object"==typeof c?y(b):b._d=new Date(c)}function E(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function F(a,b,c){var d=O(Math.abs(a)/1e3),e=O(d/60),f=O(e/60),g=O(f/24),h=O(g/365),i=45>d&&["s",d]||1===e&&["m"]||45>e&&["mm",e]||1===f&&["h"]||22>f&&["hh",f]||1===g&&["d"]||25>=g&&["dd",g]||45>=g&&["M"]||345>g&&["MM",O(g/30)]||1===h&&["y"]||["yy",h];return i[2]=b,i[3]=a>0,i[4]=c,E.apply({},i)}function G(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=L(a).add("d",f),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function H(a){var b=a._i,c=a._f;return null===b||""===b?null:("string"==typeof b&&(a._i=b=p().preparse(b)),L.isMoment(b)?(a=g({},b),a._d=new Date(+b._d)):c?k(c)?B(a):A(a):D(a),new e(a))}function I(a,b){L.fn[a]=L.fn[a+"s"]=function(a){var c=this._isUTC?"UTC":"";return null!=a?(this._d["set"+c+b](a),L.updateOffset(this),this):this._d["get"+c+b]()}}function J(a){L.duration.fn[a]=function(){return this._data[a]}}function K(a,b){L.duration.fn["as"+a]=function(){return+this/b}}for(var L,M,N="2.2.1",O=Math.round,P={},Q="undefined"!=typeof module&&module.exports,R=/^\/?Date\((\-?\d+)/i,S=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)\:(\d+)\.?(\d{3})?/,T=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g,U=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,V=/\d\d?/,W=/\d{1,3}/,X=/\d{3}/,Y=/\d{1,4}/,Z=/[+\-]?\d{1,6}/,$=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,_=/Z|[\+\-]\d\d:?\d\d/i,ab=/T/i,bb=/[\+\-]?\d+(\.\d{1,3})?/,cb=/^\s*\d{4}-\d\d-\d\d((T| )(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/,db="YYYY-MM-DDTHH:mm:ssZ",eb=[["HH:mm:ss.S",/(T| )\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],fb=/([\+\-]|\d\d)/gi,gb="Date|Hours|Minutes|Seconds|Milliseconds".split("|"),hb={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},ib={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",w:"week",W:"isoweek",M:"month",y:"year"},jb={},kb="DDD w W M D d".split(" "),lb="M D H h m s w W".split(" "),mb={M:function(){return this.month()+1},MMM:function(a){return this.lang().monthsShort(this,a)},MMMM:function(a){return this.lang().months(this,a)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(a){return this.lang().weekdaysMin(this,a)},ddd:function(a){return this.lang().weekdaysShort(this,a)},dddd:function(a){return this.lang().weekdays(this,a)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return i(this.year()%100,2)},YYYY:function(){return i(this.year(),4)},YYYYY:function(){return i(this.year(),5)},gg:function(){return i(this.weekYear()%100,2)},gggg:function(){return this.weekYear()},ggggg:function(){return i(this.weekYear(),5)},GG:function(){return i(this.isoWeekYear()%100,2)},GGGG:function(){return this.isoWeekYear()},GGGGG:function(){return i(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return~~(this.milliseconds()/100)},SS:function(){return i(~~(this.milliseconds()/10),2)},SSS:function(){return i(this.milliseconds(),3)},Z:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+i(~~(a/60),2)+":"+i(~~a%60,2)},ZZ:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+i(~~(10*a/6),4)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()}};kb.length;)M=kb.pop(),mb[M+"o"]=c(mb[M],M);for(;lb.length;)M=lb.pop(),mb[M+M]=b(mb[M],2);for(mb.DDDD=b(mb.DDD,3),g(d.prototype,{set:function(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(a){return this._months[a.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(a){return this._monthsShort[a.month()]},monthsParse:function(a){var b,c,d;for(this._monthsParse||(this._monthsParse=[]),b=0;12>b;b++)if(this._monthsParse[b]||(c=L.utc([2e3,b]),d="^"+this.months(c,"")+"|^"+this.monthsShort(c,""),this._monthsParse[b]=new RegExp(d.replace(".",""),"i")),this._monthsParse[b].test(a))return b},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(a){return this._weekdays[a.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(a){return this._weekdaysShort[a.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(a){return this._weekdaysMin[a.day()]},weekdaysParse:function(a){var b,c,d;for(this._weekdaysParse||(this._weekdaysParse=[]),b=0;7>b;b++)if(this._weekdaysParse[b]||(c=L([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(a){var b=this._longDateFormat[a];return!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b),b},isPM:function(a){return"p"===(a+"").toLowerCase().charAt(0)},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(a,b){var c=this._calendar[a];return"function"==typeof c?c.apply(b):c},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)},pastFuture:function(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)},ordinal:function(a){return this._ordinal.replace("%d",a)},_ordinal:"%d",preparse:function(a){return a},postformat:function(a){return a},week:function(a){return G(a,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6}}),L=function(a,b,c){return H({_i:a,_f:b,_l:c,_isUTC:!1})},L.utc=function(a,b,c){return H({_useUTC:!0,_isUTC:!0,_l:c,_i:a,_f:b}).utc()},L.unix=function(a){return L(1e3*a)},L.duration=function(a,b){var c,d,e=L.isDuration(a),g="number"==typeof a,h=e?a._input:g?{}:a,i=S.exec(a);return g?b?h[b]=a:h.milliseconds=a:i&&(c="-"===i[1]?-1:1,h={y:0,d:~~i[2]*c,h:~~i[3]*c,m:~~i[4]*c,s:~~i[5]*c,ms:~~i[6]*c}),d=new f(h),e&&a.hasOwnProperty("_lang")&&(d._lang=a._lang),d},L.version=N,L.defaultFormat=db,L.updateOffset=function(){},L.lang=function(a,b){return a?(a=a.toLowerCase(),a=a.replace("_","-"),b?n(a,b):null===b?(o(a),a="en"):P[a]||p(a),L.duration.fn._lang=L.fn._lang=p(a),void 0):L.fn._lang._abbr},L.langData=function(a){return a&&a._lang&&a._lang._abbr&&(a=a._lang._abbr),p(a)},L.isMoment=function(a){return a instanceof e},L.isDuration=function(a){return a instanceof f},g(L.fn=e.prototype,{clone:function(){return L(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){return s(L(this).utc(),"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var a=this;return[a.year(),a.month(),a.date(),a.hours(),a.minutes(),a.seconds(),a.milliseconds()]},isValid:function(){return null==this._isValid&&(this._isValid=this._a?!l(this._a,(this._isUTC?L.utc(this._a):L(this._a)).toArray()):!isNaN(this._d.getTime())),!!this._isValid},invalidAt:function(){var a,b=this._a,c=(this._isUTC?L.utc(this._a):L(this._a)).toArray();for(a=6;a>=0&&b[a]===c[a];--a);return a},utc:function(){return this.zone(0)},local:function(){return this.zone(0),this._isUTC=!1,this},format:function(a){var b=s(this,a||L.defaultFormat);return this.lang().postformat(b)},add:function(a,b){var c;return c="string"==typeof a?L.duration(+b,a):L.duration(a,b),j(this,c,1),this},subtract:function(a,b){var c;return c="string"==typeof a?L.duration(+b,a):L.duration(a,b),j(this,c,-1),this},diff:function(a,b,c){var d,e,f=this._isUTC?L(a).zone(this._offset||0):L(a).local(),g=6e4*(this.zone()-f.zone());return b=m(b),"year"===b||"month"===b?(d=432e5*(this.daysInMonth()+f.daysInMonth()),e=12*(this.year()-f.year())+(this.month()-f.month()),e+=(this-L(this).startOf("month")-(f-L(f).startOf("month")))/d,e-=6e4*(this.zone()-L(this).startOf("month").zone()-(f.zone()-L(f).startOf("month").zone()))/d,"year"===b&&(e/=12)):(d=this-f,e="second"===b?d/1e3:"minute"===b?d/6e4:"hour"===b?d/36e5:"day"===b?(d-g)/864e5:"week"===b?(d-g)/6048e5:d),c?e:h(e)},from:function(a,b){return L.duration(this.diff(a)).lang(this.lang()._abbr).humanize(!b)},fromNow:function(a){return this.from(L(),a)},calendar:function(){var a=this.diff(L().zone(this.zone()).startOf("day"),"days",!0),b=-6>a?"sameElse":-1>a?"lastWeek":0>a?"lastDay":1>a?"sameDay":2>a?"nextDay":7>a?"nextWeek":"sameElse";return this.format(this.lang().calendar(b,this))},isLeapYear:function(){var a=this.year();return 0===a%4&&0!==a%100||0===a%400},isDST:function(){return this.zone()<this.clone().month(0).zone()||this.zone()<this.clone().month(5).zone()},day:function(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?"string"==typeof a&&(a=this.lang().weekdaysParse(a),"number"!=typeof a)?this:this.add({d:a-b}):b},month:function(a){var b,c=this._isUTC?"UTC":"";return null!=a?"string"==typeof a&&(a=this.lang().monthsParse(a),"number"!=typeof a)?this:(b=this.date(),this.date(1),this._d["set"+c+"Month"](a),this.date(Math.min(b,this.daysInMonth())),L.updateOffset(this),this):this._d["get"+c+"Month"]()},startOf:function(a){switch(a=m(a)){case"year":this.month(0);case"month":this.date(1);case"week":case"isoweek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===a?this.weekday(0):"isoweek"===a&&this.isoWeekday(1),this},endOf:function(a){return a=m(a),this.startOf(a).add("isoweek"===a?"week":a,1).subtract("ms",1)},isAfter:function(a,b){return b="undefined"!=typeof b?b:"millisecond",+this.clone().startOf(b)>+L(a).startOf(b)},isBefore:function(a,b){return b="undefined"!=typeof b?b:"millisecond",+this.clone().startOf(b)<+L(a).startOf(b)},isSame:function(a,b){return b="undefined"!=typeof b?b:"millisecond",+this.clone().startOf(b)===+L(a).startOf(b)},min:function(a){return a=L.apply(null,arguments),this>a?this:a},max:function(a){return a=L.apply(null,arguments),a>this?this:a},zone:function(a){var b=this._offset||0;return null==a?this._isUTC?b:this._d.getTimezoneOffset():("string"==typeof a&&(a=v(a)),Math.abs(a)<16&&(a=60*a),this._offset=a,this._isUTC=!0,b!==a&&j(this,L.duration(b-a,"m"),1,!0),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},hasAlignedHourOffset:function(a){return a=a?L(a).zone():0,0===(this.zone()-a)%60},daysInMonth:function(){return L.utc([this.year(),this.month()+1,0]).date()},dayOfYear:function(a){var b=O((L(this).startOf("day")-L(this).startOf("year"))/864e5)+1;return null==a?b:this.add("d",a-b)},weekYear:function(a){var b=G(this,this.lang()._week.dow,this.lang()._week.doy).year;return null==a?b:this.add("y",a-b)},isoWeekYear:function(a){var b=G(this,1,4).year;return null==a?b:this.add("y",a-b)},week:function(a){var b=this.lang().week(this);return null==a?b:this.add("d",7*(a-b))},isoWeek:function(a){var b=G(this,1,4).week;return null==a?b:this.add("d",7*(a-b))},weekday:function(a){var b=(this._d.getDay()+7-this.lang()._week.dow)%7;return null==a?b:this.add("d",a-b)},isoWeekday:function(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)},get:function(a){return a=m(a),this[a.toLowerCase()]()},set:function(a,b){a=m(a),this[a.toLowerCase()](b)},lang:function(b){return b===a?this._lang:(this._lang=p(b),this)}}),M=0;M<gb.length;M++)I(gb[M].toLowerCase().replace(/s$/,""),gb[M]);I("year","FullYear"),L.fn.days=L.fn.day,L.fn.months=L.fn.month,L.fn.weeks=L.fn.week,L.fn.isoWeeks=L.fn.isoWeek,L.fn.toJSON=L.fn.toISOString,g(L.duration.fn=f.prototype,{_bubble:function(){var a,b,c,d,e=this._milliseconds,f=this._days,g=this._months,i=this._data;i.milliseconds=e%1e3,a=h(e/1e3),i.seconds=a%60,b=h(a/60),i.minutes=b%60,c=h(b/60),i.hours=c%24,f+=h(c/24),i.days=f%30,g+=h(f/30),i.months=g%12,d=h(g/12),i.years=d},weeks:function(){return h(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+2592e6*(this._months%12)+31536e6*~~(this._months/12)},humanize:function(a){var b=+this,c=F(b,!a,this.lang());return a&&(c=this.lang().pastFuture(b,c)),this.lang().postformat(c)},add:function(a,b){var c=L.duration(a,b);return this._milliseconds+=c._milliseconds,this._days+=c._days,this._months+=c._months,this._bubble(),this},subtract:function(a,b){var c=L.duration(a,b);return this._milliseconds-=c._milliseconds,this._days-=c._days,this._months-=c._months,this._bubble(),this},get:function(a){return a=m(a),this[a.toLowerCase()+"s"]()},as:function(a){return a=m(a),this["as"+a.charAt(0).toUpperCase()+a.slice(1)+"s"]()},lang:L.fn.lang});for(M in hb)hb.hasOwnProperty(M)&&(K(M,hb[M]),J(M.toLowerCase()));K("Weeks",6048e5),L.duration.fn.asMonths=function(){return(+this-31536e6*this.years())/2592e6+12*this.years()},L.lang("en",{ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),Q&&(module.exports=L),"undefined"==typeof ender&&(this.moment=L),"function"==typeof define&&define.amd&&define("moment",[],function(){return L})}).call(this); | ||
(function(a){function b(a,b){return function(c){return i(a.call(this,c),b)}}function c(a,b){return function(c){return this.lang().ordinal(a.call(this,c),b)}}function d(){}function e(a){u(a),g(this,a)}function f(a){var b=o(a),c=b.year||0,d=b.month||0,e=b.week||0,f=b.day||0,g=b.hour||0,h=b.minute||0,i=b.second||0,j=b.millisecond||0;this._input=a,this._milliseconds=+j+1e3*i+6e4*h+36e5*g,this._days=+f+7*e,this._months=+d+12*c,this._data={},this._bubble()}function g(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return b.hasOwnProperty("toString")&&(a.toString=b.toString),b.hasOwnProperty("valueOf")&&(a.valueOf=b.valueOf),a}function h(a){return 0>a?Math.ceil(a):Math.floor(a)}function i(a,b){for(var c=a+"";c.length<b;)c="0"+c;return c}function j(a,b,c,d){var e,f,g=b._milliseconds,h=b._days,i=b._months;g&&a._d.setTime(+a._d+g*c),(h||i)&&(e=a.minute(),f=a.hour()),h&&a.date(a.date()+h*c),i&&a.month(a.month()+i*c),g&&!d&&bb.updateOffset(a),(h||i)&&(a.minute(e),a.hour(f))}function k(a){return"[object Array]"===Object.prototype.toString.call(a)}function l(a){return"[object Date]"===Object.prototype.toString.call(a)}function m(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&q(a[d])!==q(b[d]))&&g++;return g+f}function n(a){if(a){var b=a.toLowerCase().replace(/(.)s$/,"$1");a=Jb[a]||Kb[b]||b}return a}function o(a){var b,c,d={};for(c in a)a.hasOwnProperty(c)&&(b=n(c),b&&(d[b]=a[c]));return d}function p(b){var c,d;if(0===b.indexOf("week"))c=7,d="day";else{if(0!==b.indexOf("month"))return;c=12,d="month"}bb[b]=function(e,f){var g,h,i=bb.fn._lang[b],j=[];if("number"==typeof e&&(f=e,e=a),h=function(a){var b=bb().utc().set(d,a);return i.call(bb.fn._lang,b,e||"")},f)return h(f);for(g=0;c>g;g++)j.push(h(g));return j}}function q(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=b>=0?Math.floor(b):Math.ceil(b)),c}function r(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function s(a){return t(a)?366:365}function t(a){return 0===a%4&&0!==a%100||0===a%400}function u(a){var b;a._a&&-2===a._pf.overflow&&(b=a._a[gb]<0||a._a[gb]>11?gb:a._a[hb]<1||a._a[hb]>r(a._a[fb],a._a[gb])?hb:a._a[ib]<0||a._a[ib]>23?ib:a._a[jb]<0||a._a[jb]>59?jb:a._a[kb]<0||a._a[kb]>59?kb:a._a[lb]<0||a._a[lb]>999?lb:-1,a._pf._overflowDayOfYear&&(fb>b||b>hb)&&(b=hb),a._pf.overflow=b)}function v(a){a._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1}}function w(a){return null==a._isValid&&(a._isValid=!isNaN(a._d.getTime())&&a._pf.overflow<0&&!a._pf.empty&&!a._pf.invalidMonth&&!a._pf.nullInput&&!a._pf.invalidFormat&&!a._pf.userInvalidated,a._strict&&(a._isValid=a._isValid&&0===a._pf.charsLeftOver&&0===a._pf.unusedTokens.length)),a._isValid}function x(a){return a?a.toLowerCase().replace("_","-"):a}function y(a,b){return b.abbr=a,mb[a]||(mb[a]=new d),mb[a].set(b),mb[a]}function z(a){delete mb[a]}function A(a){var b,c,d,e,f=0,g=function(a){if(!mb[a]&&nb)try{require("./lang/"+a)}catch(b){}return mb[a]};if(!a)return bb.fn._lang;if(!k(a)){if(c=g(a))return c;a=[a]}for(;f<a.length;){for(e=x(a[f]).split("-"),b=e.length,d=x(a[f+1]),d=d?d.split("-"):null;b>0;){if(c=g(e.slice(0,b).join("-")))return c;if(d&&d.length>=b&&m(e,d,!0)>=b-1)break;b--}f++}return bb.fn._lang}function B(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function C(a){var b,c,d=a.match(rb);for(b=0,c=d.length;c>b;b++)d[b]=Ob[d[b]]?Ob[d[b]]:B(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function D(a,b){return a.isValid()?(b=E(b,a.lang()),Lb[b]||(Lb[b]=C(b)),Lb[b](a)):a.lang().invalidDate()}function E(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(sb.lastIndex=0;d>=0&&sb.test(a);)a=a.replace(sb,c),sb.lastIndex=0,d-=1;return a}function F(a,b){var c;switch(a){case"DDDD":return vb;case"YYYY":case"GGGG":case"gggg":return wb;case"YYYYY":case"GGGGG":case"ggggg":return xb;case"S":case"SS":case"SSS":case"DDD":return ub;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return yb;case"a":case"A":return A(b._l)._meridiemParse;case"X":return Bb;case"Z":case"ZZ":return zb;case"T":return Ab;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"ww":case"W":case"WW":case"e":case"E":return tb;default:return c=new RegExp(N(M(a.replace("\\","")),"i"))}}function G(a){var b=(zb.exec(a)||[])[0],c=(b+"").match(Gb)||["-",0,0],d=+(60*c[1])+q(c[2]);return"+"===c[0]?-d:d}function H(a,b,c){var d,e=c._a;switch(a){case"M":case"MM":null!=b&&(e[gb]=q(b)-1);break;case"MMM":case"MMMM":d=A(c._l).monthsParse(b),null!=d?e[gb]=d:c._pf.invalidMonth=b;break;case"D":case"DD":null!=b&&(e[hb]=q(b));break;case"DDD":case"DDDD":null!=b&&(c._dayOfYear=q(b));break;case"YY":e[fb]=q(b)+(q(b)>68?1900:2e3);break;case"YYYY":case"YYYYY":e[fb]=q(b);break;case"a":case"A":c._isPm=A(c._l).isPM(b);break;case"H":case"HH":case"h":case"hh":e[ib]=q(b);break;case"m":case"mm":e[jb]=q(b);break;case"s":case"ss":e[kb]=q(b);break;case"S":case"SS":case"SSS":e[lb]=q(1e3*("0."+b));break;case"X":c._d=new Date(1e3*parseFloat(b));break;case"Z":case"ZZ":c._useUTC=!0,c._tzm=G(b);break;case"w":case"ww":case"W":case"WW":case"d":case"dd":case"ddd":case"dddd":case"e":case"E":a=a.substr(0,1);case"gg":case"gggg":case"GG":case"GGGG":case"GGGGG":a=a.substr(0,2),b&&(c._w=c._w||{},c._w[a]=b)}}function I(a){var b,c,d,e,f,g,h,i,j,k,l=[];if(!a._d){for(d=K(a),a._w&&null==a._a[hb]&&null==a._a[gb]&&(f=function(b){return b?b.length<3?parseInt(b,10)>68?"19"+b:"20"+b:b:null==a._a[fb]?bb().weekYear():a._a[fb]},g=a._w,null!=g.GG||null!=g.W||null!=g.E?h=X(f(g.GG),g.W||1,g.E,4,1):(i=A(a._l),j=null!=g.d?T(g.d,i):null!=g.e?parseInt(g.e,10)+i._week.dow:0,k=parseInt(g.w,10)||1,null!=g.d&&j<i._week.dow&&k++,h=X(f(g.gg),k,j,i._week.doy,i._week.dow)),a._a[fb]=h.year,a._dayOfYear=h.dayOfYear),a._dayOfYear&&(e=null==a._a[fb]?d[fb]:a._a[fb],a._dayOfYear>s(e)&&(a._pf._overflowDayOfYear=!0),c=S(e,0,a._dayOfYear),a._a[gb]=c.getUTCMonth(),a._a[hb]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=l[b]=d[b];for(;7>b;b++)a._a[b]=l[b]=null==a._a[b]?2===b?1:0:a._a[b];l[ib]+=q((a._tzm||0)/60),l[jb]+=q((a._tzm||0)%60),a._d=(a._useUTC?S:R).apply(null,l)}}function J(a){var b;a._d||(b=o(a._i),a._a=[b.year,b.month,b.day,b.hour,b.minute,b.second,b.millisecond],I(a))}function K(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function L(a){a._a=[],a._pf.empty=!0;var b,c,d,e,f,g=A(a._l),h=""+a._i,i=h.length,j=0;for(d=E(a._f,g).match(rb)||[],b=0;b<d.length;b++)e=d[b],c=(F(e,a).exec(h)||[])[0],c&&(f=h.substr(0,h.indexOf(c)),f.length>0&&a._pf.unusedInput.push(f),h=h.slice(h.indexOf(c)+c.length),j+=c.length),Ob[e]?(c?a._pf.empty=!1:a._pf.unusedTokens.push(e),H(e,c,a)):a._strict&&!c&&a._pf.unusedTokens.push(e);a._pf.charsLeftOver=i-j,h.length>0&&a._pf.unusedInput.push(h),a._isPm&&a._a[ib]<12&&(a._a[ib]+=12),a._isPm===!1&&12===a._a[ib]&&(a._a[ib]=0),I(a),u(a)}function M(a){return a.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e})}function N(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function O(a){var b,c,d,e,f;if(0===a._f.length)return a._pf.invalidFormat=!0,a._d=new Date(0/0),void 0;for(e=0;e<a._f.length;e++)f=0,b=g({},a),v(b),b._f=a._f[e],L(b),w(b)&&(f+=b._pf.charsLeftOver,f+=10*b._pf.unusedTokens.length,b._pf.score=f,(null==d||d>f)&&(d=f,c=b));g(a,c||b)}function P(a){var b,c=a._i,d=Cb.exec(c);if(d){for(b=4;b>0;b--)if(d[b]){a._f=Eb[b-1]+(d[6]||" ");break}for(b=0;4>b;b++)if(Fb[b][1].exec(c)){a._f+=Fb[b][0];break}zb.exec(c)&&(a._f+=" Z"),L(a)}else a._d=new Date(c)}function Q(b){var c=b._i,d=ob.exec(c);c===a?b._d=new Date:d?b._d=new Date(+d[1]):"string"==typeof c?P(b):k(c)?(b._a=c.slice(0),I(b)):l(c)?b._d=new Date(+c):"object"==typeof c?J(b):b._d=new Date(c)}function R(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 1970>a&&h.setFullYear(a),h}function S(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function T(a,b){if("string"==typeof a)if(isNaN(a)){if(a=b.weekdaysParse(a),"number"!=typeof a)return null}else a=parseInt(a,10);return a}function U(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function V(a,b,c){var d=eb(Math.abs(a)/1e3),e=eb(d/60),f=eb(e/60),g=eb(f/24),h=eb(g/365),i=45>d&&["s",d]||1===e&&["m"]||45>e&&["mm",e]||1===f&&["h"]||22>f&&["hh",f]||1===g&&["d"]||25>=g&&["dd",g]||45>=g&&["M"]||345>g&&["MM",eb(g/30)]||1===h&&["y"]||["yy",h];return i[2]=b,i[3]=a>0,i[4]=c,U.apply({},i)}function W(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=bb(a).add("d",f),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function X(a,b,c,d,e){var f,g,h=new Date(Date.UTC(a,0)).getUTCDay();return c=null!=c?c:e,f=e-h+(h>d?7:0),g=7*(b-1)+(c-e)+f+1,{year:g>0?a:a-1,dayOfYear:g>0?g:s(a-1)+g}}function Y(a){var b=a._i,c=a._f;return"undefined"==typeof a._pf&&v(a),null===b?bb.invalid({nullInput:!0}):("string"==typeof b&&(a._i=b=A().preparse(b)),bb.isMoment(b)?(a=g({},b),a._d=new Date(+b._d)):c?k(c)?O(a):L(a):Q(a),new e(a))}function Z(a,b){bb.fn[a]=bb.fn[a+"s"]=function(a){var c=this._isUTC?"UTC":"";return null!=a?(this._d["set"+c+b](a),bb.updateOffset(this),this):this._d["get"+c+b]()}}function $(a){bb.duration.fn[a]=function(){return this._data[a]}}function _(a,b){bb.duration.fn["as"+a]=function(){return+this/b}}function ab(){"undefined"==typeof ender&&(this.moment=bb)}for(var bb,cb,db="2.3.0",eb=Math.round,fb=0,gb=1,hb=2,ib=3,jb=4,kb=5,lb=6,mb={},nb="undefined"!=typeof module&&module.exports,ob=/^\/?Date\((\-?\d+)/i,pb=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,qb=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,rb=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g,sb=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,tb=/\d\d?/,ub=/\d{1,3}/,vb=/\d{3}/,wb=/\d{1,4}/,xb=/[+\-]?\d{1,6}/,yb=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,zb=/Z|[\+\-]\d\d:?\d\d/i,Ab=/T/i,Bb=/[\+\-]?\d+(\.\d{1,3})?/,Cb=/^\s*\d{4}-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?$/,Db="YYYY-MM-DDTHH:mm:ssZ",Eb=["YYYY-MM-DD","GGGG-[W]WW","GGGG-[W]WW-E","YYYY-DDD"],Fb=[["HH:mm:ss.S",/(T| )\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],Gb=/([\+\-]|\d\d)/gi,Hb="Date|Hours|Minutes|Seconds|Milliseconds".split("|"),Ib={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},Jb={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",D:"date",w:"week",W:"isoWeek",M:"month",y:"year",DDD:"dayOfYear",e:"weekday",E:"isoWeekday",gg:"weekYear",GG:"isoWeekYear"},Kb={dayofyear:"dayOfYear",isoweekday:"isoWeekday",isoweek:"isoWeek",weekyear:"weekYear",isoweekyear:"isoWeekYear"},Lb={},Mb="DDD w W M D d".split(" "),Nb="M D H h m s w W".split(" "),Ob={M:function(){return this.month()+1},MMM:function(a){return this.lang().monthsShort(this,a)},MMMM:function(a){return this.lang().months(this,a)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(a){return this.lang().weekdaysMin(this,a)},ddd:function(a){return this.lang().weekdaysShort(this,a)},dddd:function(a){return this.lang().weekdays(this,a)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return i(this.year()%100,2)},YYYY:function(){return i(this.year(),4)},YYYYY:function(){return i(this.year(),5)},gg:function(){return i(this.weekYear()%100,2)},gggg:function(){return this.weekYear()},ggggg:function(){return i(this.weekYear(),5)},GG:function(){return i(this.isoWeekYear()%100,2)},GGGG:function(){return this.isoWeekYear()},GGGGG:function(){return i(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return q(this.milliseconds()/100)},SS:function(){return i(q(this.milliseconds()/10),2)},SSS:function(){return i(this.milliseconds(),3)},Z:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+i(q(a/60),2)+":"+i(q(a)%60,2)},ZZ:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+i(q(10*a/6),4)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()}},Pb=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];Mb.length;)cb=Mb.pop(),Ob[cb+"o"]=c(Ob[cb],cb);for(;Nb.length;)cb=Nb.pop(),Ob[cb+cb]=b(Ob[cb],2);for(Ob.DDDD=b(Ob.DDD,3),g(d.prototype,{set:function(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(a){return this._months[a.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(a){return this._monthsShort[a.month()]},monthsParse:function(a){var b,c,d;for(this._monthsParse||(this._monthsParse=[]),b=0;12>b;b++)if(this._monthsParse[b]||(c=bb.utc([2e3,b]),d="^"+this.months(c,"")+"|^"+this.monthsShort(c,""),this._monthsParse[b]=new RegExp(d.replace(".",""),"i")),this._monthsParse[b].test(a))return b},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(a){return this._weekdays[a.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(a){return this._weekdaysShort[a.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(a){return this._weekdaysMin[a.day()]},weekdaysParse:function(a){var b,c,d;for(this._weekdaysParse||(this._weekdaysParse=[]),b=0;7>b;b++)if(this._weekdaysParse[b]||(c=bb([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(a){var b=this._longDateFormat[a];return!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b),b},isPM:function(a){return"p"===(a+"").toLowerCase().charAt(0)},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(a,b){var c=this._calendar[a];return"function"==typeof c?c.apply(b):c},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)},pastFuture:function(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)},ordinal:function(a){return this._ordinal.replace("%d",a)},_ordinal:"%d",preparse:function(a){return a},postformat:function(a){return a},week:function(a){return W(a,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}}),bb=function(b,c,d,e){return"boolean"==typeof d&&(e=d,d=a),Y({_i:b,_f:c,_l:d,_strict:e,_isUTC:!1})},bb.utc=function(b,c,d,e){var f;return"boolean"==typeof d&&(e=d,d=a),f=Y({_useUTC:!0,_isUTC:!0,_l:d,_i:b,_f:c,_strict:e}).utc()},bb.unix=function(a){return bb(1e3*a)},bb.duration=function(a,b){var c,d,e,g=bb.isDuration(a),h="number"==typeof a,i=g?a._input:h?{}:a,j=null;return h?b?i[b]=a:i.milliseconds=a:(j=pb.exec(a))?(c="-"===j[1]?-1:1,i={y:0,d:q(j[hb])*c,h:q(j[ib])*c,m:q(j[jb])*c,s:q(j[kb])*c,ms:q(j[lb])*c}):(j=qb.exec(a))&&(c="-"===j[1]?-1:1,e=function(a){var b=a&&parseFloat(a.replace(",","."));return(isNaN(b)?0:b)*c},i={y:e(j[2]),M:e(j[3]),d:e(j[4]),h:e(j[5]),m:e(j[6]),s:e(j[7]),w:e(j[8])}),d=new f(i),g&&a.hasOwnProperty("_lang")&&(d._lang=a._lang),d},bb.version=db,bb.defaultFormat=Db,bb.updateOffset=function(){},bb.lang=function(a,b){var c;return a?(b?y(x(a),b):null===b?(z(a),a="en"):mb[a]||A(a),c=bb.duration.fn._lang=bb.fn._lang=A(a),c._abbr):bb.fn._lang._abbr},bb.langData=function(a){return a&&a._lang&&a._lang._abbr&&(a=a._lang._abbr),A(a)},bb.isMoment=function(a){return a instanceof e},bb.isDuration=function(a){return a instanceof f},cb=Pb.length-1;cb>=0;--cb)p(Pb[cb]);for(bb.normalizeUnits=function(a){return n(a)},bb.invalid=function(a){var b=bb.utc(0/0);return null!=a?g(b._pf,a):b._pf.userInvalidated=!0,b},bb.parseZone=function(a){return bb(a).parseZone()},g(bb.fn=e.prototype,{clone:function(){return bb(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().lang("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){return D(bb(this).utc(),"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var a=this;return[a.year(),a.month(),a.date(),a.hours(),a.minutes(),a.seconds(),a.milliseconds()]},isValid:function(){return w(this)},isDSTShifted:function(){return this._a?this.isValid()&&m(this._a,(this._isUTC?bb.utc(this._a):bb(this._a)).toArray())>0:!1},parsingFlags:function(){return g({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(){return this.zone(0)},local:function(){return this.zone(0),this._isUTC=!1,this},format:function(a){var b=D(this,a||bb.defaultFormat);return this.lang().postformat(b)},add:function(a,b){var c;return c="string"==typeof a?bb.duration(+b,a):bb.duration(a,b),j(this,c,1),this},subtract:function(a,b){var c;return c="string"==typeof a?bb.duration(+b,a):bb.duration(a,b),j(this,c,-1),this},diff:function(a,b,c){var d,e,f=this._isUTC?bb(a).zone(this._offset||0):bb(a).local(),g=6e4*(this.zone()-f.zone());return b=n(b),"year"===b||"month"===b?(d=432e5*(this.daysInMonth()+f.daysInMonth()),e=12*(this.year()-f.year())+(this.month()-f.month()),e+=(this-bb(this).startOf("month")-(f-bb(f).startOf("month")))/d,e-=6e4*(this.zone()-bb(this).startOf("month").zone()-(f.zone()-bb(f).startOf("month").zone()))/d,"year"===b&&(e/=12)):(d=this-f,e="second"===b?d/1e3:"minute"===b?d/6e4:"hour"===b?d/36e5:"day"===b?(d-g)/864e5:"week"===b?(d-g)/6048e5:d),c?e:h(e)},from:function(a,b){return bb.duration(this.diff(a)).lang(this.lang()._abbr).humanize(!b)},fromNow:function(a){return this.from(bb(),a)},calendar:function(){var a=this.diff(bb().zone(this.zone()).startOf("day"),"days",!0),b=-6>a?"sameElse":-1>a?"lastWeek":0>a?"lastDay":1>a?"sameDay":2>a?"nextDay":7>a?"nextWeek":"sameElse";return this.format(this.lang().calendar(b,this))},isLeapYear:function(){return t(this.year())},isDST:function(){return this.zone()<this.clone().month(0).zone()||this.zone()<this.clone().month(5).zone()},day:function(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=T(a,this.lang()),this.add({d:a-b})):b},month:function(a){var b,c=this._isUTC?"UTC":"";return null!=a?"string"==typeof a&&(a=this.lang().monthsParse(a),"number"!=typeof a)?this:(b=this.date(),this.date(1),this._d["set"+c+"Month"](a),this.date(Math.min(b,this.daysInMonth())),bb.updateOffset(this),this):this._d["get"+c+"Month"]()},startOf:function(a){switch(a=n(a)){case"year":this.month(0);case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===a?this.weekday(0):"isoWeek"===a&&this.isoWeekday(1),this},endOf:function(a){return a=n(a),this.startOf(a).add("isoWeek"===a?"week":a,1).subtract("ms",1)},isAfter:function(a,b){return b="undefined"!=typeof b?b:"millisecond",+this.clone().startOf(b)>+bb(a).startOf(b)},isBefore:function(a,b){return b="undefined"!=typeof b?b:"millisecond",+this.clone().startOf(b)<+bb(a).startOf(b)},isSame:function(a,b){return b="undefined"!=typeof b?b:"millisecond",+this.clone().startOf(b)===+bb(a).startOf(b)},min:function(a){return a=bb.apply(null,arguments),this>a?this:a},max:function(a){return a=bb.apply(null,arguments),a>this?this:a},zone:function(a){var b=this._offset||0;return null==a?this._isUTC?b:this._d.getTimezoneOffset():("string"==typeof a&&(a=G(a)),Math.abs(a)<16&&(a=60*a),this._offset=a,this._isUTC=!0,b!==a&&j(this,bb.duration(b-a,"m"),1,!0),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return"string"==typeof this._i&&this.zone(this._i),this},hasAlignedHourOffset:function(a){return a=a?bb(a).zone():0,0===(this.zone()-a)%60},daysInMonth:function(){return r(this.year(),this.month())},dayOfYear:function(a){var b=eb((bb(this).startOf("day")-bb(this).startOf("year"))/864e5)+1;return null==a?b:this.add("d",a-b)},weekYear:function(a){var b=W(this,this.lang()._week.dow,this.lang()._week.doy).year;return null==a?b:this.add("y",a-b)},isoWeekYear:function(a){var b=W(this,1,4).year;return null==a?b:this.add("y",a-b)},week:function(a){var b=this.lang().week(this);return null==a?b:this.add("d",7*(a-b))},isoWeek:function(a){var b=W(this,1,4).week;return null==a?b:this.add("d",7*(a-b))},weekday:function(a){var b=(this.day()+7-this.lang()._week.dow)%7;return null==a?b:this.add("d",a-b)},isoWeekday:function(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)},get:function(a){return a=n(a),this[a]()},set:function(a,b){return a=n(a),"function"==typeof this[a]&&this[a](b),this},lang:function(b){return b===a?this._lang:(this._lang=A(b),this)}}),cb=0;cb<Hb.length;cb++)Z(Hb[cb].toLowerCase().replace(/s$/,""),Hb[cb]);Z("year","FullYear"),bb.fn.days=bb.fn.day,bb.fn.months=bb.fn.month,bb.fn.weeks=bb.fn.week,bb.fn.isoWeeks=bb.fn.isoWeek,bb.fn.toJSON=bb.fn.toISOString,g(bb.duration.fn=f.prototype,{_bubble:function(){var a,b,c,d,e=this._milliseconds,f=this._days,g=this._months,i=this._data;i.milliseconds=e%1e3,a=h(e/1e3),i.seconds=a%60,b=h(a/60),i.minutes=b%60,c=h(b/60),i.hours=c%24,f+=h(c/24),i.days=f%30,g+=h(f/30),i.months=g%12,d=h(g/12),i.years=d},weeks:function(){return h(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+2592e6*(this._months%12)+31536e6*q(this._months/12)},humanize:function(a){var b=+this,c=V(b,!a,this.lang());return a&&(c=this.lang().pastFuture(b,c)),this.lang().postformat(c)},add:function(a,b){var c=bb.duration(a,b);return this._milliseconds+=c._milliseconds,this._days+=c._days,this._months+=c._months,this._bubble(),this},subtract:function(a,b){var c=bb.duration(a,b);return this._milliseconds-=c._milliseconds,this._days-=c._days,this._months-=c._months,this._bubble(),this},get:function(a){return a=n(a),this[a.toLowerCase()+"s"]()},as:function(a){return a=n(a),this["as"+a.charAt(0).toUpperCase()+a.slice(1)+"s"]()},lang:bb.fn.lang,toIsoString:function(){var a=Math.abs(this.years()),b=Math.abs(this.months()),c=Math.abs(this.days()),d=Math.abs(this.hours()),e=Math.abs(this.minutes()),f=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||f?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(f?f+"S":""):"P0D"}});for(cb in Ib)Ib.hasOwnProperty(cb)&&(_(cb,Ib[cb]),$(cb.toLowerCase()));_("Weeks",6048e5),bb.duration.fn.asMonths=function(){return(+this-31536e6*this.years())/2592e6+12*this.years()},bb.lang("en",{ordinal:function(a){var b=a%10,c=1===q(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),nb?(module.exports=bb,ab()):"function"==typeof define&&define.amd?define("moment",function(a,b,c){return c.config().noGlobal!==!0&&ab(),bb}):ab()}).call(this); |
{ | ||
"name": "moment", | ||
"version": "2.2.1", | ||
"version": "2.3.0", | ||
"description": "Parse, manipulate, and display dates.", | ||
@@ -5,0 +5,0 @@ "homepage": "http://momentjs.com", |
@@ -34,2 +34,7 @@ A lightweight javascript date library for parsing, validating, manipulating, and formatting dates. | ||
### 2.3.0 [See changelog](https://gist.github.com/ichernev/6864354) | ||
Changed isValid, added strict parsing. | ||
Week tokens parsing. | ||
### 2.2.1 | ||
@@ -44,3 +49,3 @@ | ||
Languge files now use UMD. | ||
Language files now use UMD. | ||
@@ -47,0 +52,0 @@ Creating moment defaults to current date/month/year. |
@@ -41,3 +41,3 @@ | ||
if (!fileContents.match(reTransform)) { | ||
grunt.log.writeln('Warning: all language files must use the common UMD wrapper pattern. Failed language file: ' + file); | ||
grunt.warn('Warning: all language files must use the common UMD wrapper pattern. Failed language file: ' + file); | ||
return ''; | ||
@@ -44,0 +44,0 @@ } |
@@ -344,3 +344,11 @@ // moment.js Moroccan arabic (ar-ma) tests | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/ar-ma'), 'ar-ma', "module should export ar-ma"); | ||
test.done(); | ||
} | ||
}; |
@@ -348,3 +348,11 @@ // moment.js arabic (ar) tests | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/ar'), 'ar', "module should export ar"); | ||
test.done(); | ||
} | ||
}; |
@@ -42,3 +42,3 @@ var moment = require("../../moment"); | ||
var a = [ | ||
['dddd, MMMM Do YYYY, h:mm:ss a', 'неделя, февруари 14-ти 2010, 3:25:50 pm'], | ||
['dddd, MMMM Do YYYY, H:mm:ss', 'неделя, февруари 14-ти 2010, 15:25:50'], | ||
['ddd, hA', 'нед, 3PM'], | ||
@@ -59,8 +59,8 @@ ['M Mo MM MMMM MMM', '2 2-ри 02 февруари фев'], | ||
['LL', '14 февруари 2010'], | ||
['LLL', '14 февруари 2010 3:25'], | ||
['LLLL', 'неделя, 14 февруари 2010 3:25'], | ||
['LLL', '14 февруари 2010 15:25'], | ||
['LLLL', 'неделя, 14 февруари 2010 15:25'], | ||
['l', '14.2.2010'], | ||
['ll', '14 фев 2010'], | ||
['lll', '14 фев 2010 3:25'], | ||
['llll', 'нед, 14 фев 2010 3:25'] | ||
['lll', '14 фев 2010 15:25'], | ||
['llll', 'нед, 14 фев 2010 15:25'] | ||
], | ||
@@ -365,3 +365,11 @@ b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/bg'), 'bg', "module should export bg"); | ||
test.done(); | ||
} | ||
}; |
@@ -270,3 +270,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/br'), 'br', "module should export br"); | ||
test.done(); | ||
} | ||
}; |
@@ -317,3 +317,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/ca'), 'ca', "module should export ca"); | ||
test.done(); | ||
} | ||
}; |
@@ -440,3 +440,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/cs'), 'cs', "module should export cs"); | ||
test.done(); | ||
} | ||
}; |
@@ -356,3 +356,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/cv'), 'cv', "module should export cv"); | ||
test.done(); | ||
} | ||
}; |
@@ -288,3 +288,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/da'), 'da', "module should export da"); | ||
test.done(); | ||
} | ||
}; |
@@ -349,3 +349,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/de'), 'de', "module should export de"); | ||
test.done(); | ||
} | ||
}; |
@@ -380,3 +380,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/el'), 'el', "module should export el"); | ||
test.done(); | ||
} | ||
}; |
@@ -377,3 +377,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/en-ca'), 'en-ca', "module should export en-ca"); | ||
test.done(); | ||
} | ||
}; |
@@ -5,3 +5,3 @@ var moment = require("../../moment"); | ||
/************************************************** | ||
English | ||
British English | ||
*************************************************/ | ||
@@ -352,3 +352,11 @@ | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/en-gb'), 'en-gb', "module should export en-gb"); | ||
test.done(); | ||
} | ||
}; |
@@ -358,3 +358,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/eo'), 'eo', "module should export eo"); | ||
test.done(); | ||
} | ||
}; |
@@ -353,3 +353,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/es'), 'es', "module should export es"); | ||
test.done(); | ||
} | ||
}; |
@@ -359,3 +359,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/et'), 'et', "module should export et"); | ||
test.done(); | ||
} | ||
}; |
@@ -355,3 +355,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/eu'), 'eu', "module should export eu"); | ||
test.done(); | ||
} | ||
}; |
@@ -337,3 +337,11 @@ // moment.js Persian (fa) tests | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/fa'), 'fa', "module should export fa"); | ||
test.done(); | ||
} | ||
}; |
@@ -350,3 +350,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/fi'), 'fi', "module should export fi"); | ||
test.done(); | ||
} | ||
}; |
@@ -370,3 +370,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/fr-ca'), 'fr-ca', "module should export fr-ca"); | ||
test.done(); | ||
} | ||
}; |
@@ -353,3 +353,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/fr'), 'fr', "module should export fr"); | ||
test.done(); | ||
} | ||
}; |
@@ -334,3 +334,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/gl'), 'gl', "module should export gl"); | ||
test.done(); | ||
} | ||
}; |
@@ -313,3 +313,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/he'), 'he', "module should export he"); | ||
test.done(); | ||
} | ||
}; |
@@ -376,3 +376,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/hi'), 'hi', "module should export hi"); | ||
test.done(); | ||
} | ||
}; |
@@ -384,3 +384,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/hr'), 'hr', "module should export hr"); | ||
test.done(); | ||
} | ||
}; |
@@ -45,7 +45,7 @@ var moment = require("../../moment"); | ||
['dddd, MMMM Do YYYY, HH:mm:ss', 'vasárnap, február 14. 2010, 15:25:50'], | ||
['ddd, HH', 'v, 15'], | ||
['ddd, HH', 'vas, 15'], | ||
['M Mo MM MMMM MMM', '2 2. 02 február feb'], | ||
['YYYY YY', '2010 10'], | ||
['D Do DD', '14 14. 14'], | ||
['d do dddd ddd', '0 0. vasárnap v'], | ||
['d do dddd ddd dd', '0 0. vasárnap vas v'], | ||
['DDD DDDo DDDD', '45 45. 045'], | ||
@@ -64,3 +64,3 @@ ['w wo ww', '7 7. 07'], | ||
['lll', '2010. feb 14., 15:25'], | ||
['llll', '2010. feb 14., v 15:25'] | ||
['llll', '2010. feb 14., vas 15:25'] | ||
], | ||
@@ -127,3 +127,3 @@ b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), | ||
test.expect(7); | ||
var expected = 'vasárnap v_hétfő h_kedd k_szerda sze_csütörtök cs_péntek p_szombat szo'.split("_"), | ||
var expected = 'vasárnap vas_hétfő hét_kedd kedd_szerda sze_csütörtök csüt_péntek pén_szombat szo'.split("_"), | ||
i; | ||
@@ -358,3 +358,11 @@ for (i = 0; i < expected.length; i++) { | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/hu'), 'hu', "module should export hu"); | ||
test.done(); | ||
} | ||
}; |
@@ -310,3 +310,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/id'), 'id', "module should export id"); | ||
test.done(); | ||
} | ||
}; |
@@ -363,3 +363,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/is'), 'is', "module should export is"); | ||
test.done(); | ||
} | ||
}; |
@@ -351,3 +351,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/it'), 'it', "module should export it"); | ||
test.done(); | ||
} | ||
}; |
@@ -315,3 +315,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/ja'), 'ja', "module should export ja"); | ||
test.done(); | ||
} | ||
}; |
@@ -116,7 +116,7 @@ // moment.js language configuration | ||
test.equal(moment([2011, 0, 0]).add('days', 40).format('DDDo'), 'მე-40', 'მე-40'); | ||
test.equal(moment([2011, 0, 0]).add('days', 50).format('DDDo'), '50-ე', '50-ე'); | ||
test.equal(moment([2011, 0, 0]).add('days', 60).format('DDDo'), 'მე-60', 'მე-60'); | ||
test.equal(moment([2011, 0, 0]).add('days', 100).format('DDDo'), 'მე-100', 'მე-100'); | ||
test.equal(moment([2011, 0, 0]).add('days', 101).format('DDDo'), '101-ე', '101-ე'); | ||
test.equal(moment("2011 40", "YYYY DDD").format('DDDo'), 'მე-40', 'მე-40'); | ||
test.equal(moment("2011 50", "YYYY DDD").format('DDDo'), '50-ე', '50-ე'); | ||
test.equal(moment("2011 60", "YYYY DDD").format('DDDo'), 'მე-60', 'მე-60'); | ||
test.equal(moment("2011 100", "YYYY DDD").format('DDDo'), 'მე-100', 'მე-100'); | ||
test.equal(moment("2011 101", "YYYY DDD").format('DDDo'), '101-ე', '101-ე'); | ||
test.done(); | ||
@@ -377,3 +377,11 @@ }, | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/ka'), 'ka', "module should export ka"); | ||
test.done(); | ||
} | ||
}; |
@@ -362,3 +362,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/ko'), 'ko', "module should export ko"); | ||
test.done(); | ||
} | ||
}; |
@@ -354,3 +354,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/lv'), 'lv', "module should export lv"); | ||
test.done(); | ||
} | ||
}; |
@@ -376,3 +376,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/ml'), 'ml', "module should export ml"); | ||
test.done(); | ||
} | ||
}; |
@@ -376,3 +376,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/mr'), 'mr', "module should export mr"); | ||
test.done(); | ||
} | ||
}; |
@@ -376,3 +376,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/ms-my'), 'ms-my', "module should export ms-my"); | ||
test.done(); | ||
} | ||
}; |
@@ -355,3 +355,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/nb'), 'nb', "module should export nb"); | ||
test.done(); | ||
} | ||
}; |
@@ -374,3 +374,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/ne'), 'ne', "module should export ne"); | ||
test.done(); | ||
} | ||
}; |
@@ -197,8 +197,8 @@ var moment = require("../../moment"); | ||
test.equal(moment(a).calendar(), "Vandaag om 02:00", "today at the same time"); | ||
test.equal(moment(a).add({ m: 25 }).calendar(), "Vandaag om 02:25", "Now plus 25 min"); | ||
test.equal(moment(a).add({ h: 1 }).calendar(), "Vandaag om 03:00", "Now plus 1 hour"); | ||
test.equal(moment(a).add({ d: 1 }).calendar(), "Morgen om 02:00", "tomorrow at the same time"); | ||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "Vandaag om 01:00", "Now minus 1 hour"); | ||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "Gisteren om 02:00", "yesterday at the same time"); | ||
test.equal(moment(a).calendar(), "vandaag om 02:00", "today at the same time"); | ||
test.equal(moment(a).add({ m: 25 }).calendar(), "vandaag om 02:25", "Now plus 25 min"); | ||
test.equal(moment(a).add({ h: 1 }).calendar(), "vandaag om 03:00", "Now plus 1 hour"); | ||
test.equal(moment(a).add({ d: 1 }).calendar(), "morgen om 02:00", "tomorrow at the same time"); | ||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "vandaag om 01:00", "Now minus 1 hour"); | ||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "gisteren om 02:00", "yesterday at the same time"); | ||
test.done(); | ||
@@ -366,3 +366,11 @@ }, | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/nl'), 'nl', "module should export nl"); | ||
test.done(); | ||
} | ||
}; |
@@ -354,3 +354,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/nn'), 'nn', "module should export nn"); | ||
test.done(); | ||
} | ||
}; |
@@ -373,3 +373,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/pl'), 'pl', "module should export pl"); | ||
test.done(); | ||
} | ||
}; |
@@ -356,3 +356,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/pt-br'), 'pt-br', "module should export pt-br"); | ||
test.done(); | ||
} | ||
}; |
@@ -346,3 +346,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/pt'), 'pt', "module should export pt"); | ||
test.done(); | ||
} | ||
}; |
@@ -355,3 +355,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/ro'), 'ro', "module should export ro"); | ||
test.done(); | ||
} | ||
}; |
@@ -40,2 +40,7 @@ var moment = require("../../moment"); | ||
"parse exceptional case" : function (test) { | ||
test.equal(moment('11 мая 1989', ['DD MMMM YYYY']).format('DD-MM-YYYY'), '11-05-1989'); | ||
test.done(); | ||
}, | ||
"format" : function (test) { | ||
@@ -46,7 +51,7 @@ test.expect(22); | ||
['dddd, Do MMMM YYYY, HH:mm:ss', 'воскресенье, 14-го февраля 2010, 15:25:50'], | ||
['ddd, hA', 'вск, 3PM'], | ||
['ddd, h A', 'вс, 3 дня'], | ||
['M Mo MM MMMM MMM', '2 2-й 02 февраль фев'], | ||
['YYYY YY', '2010 10'], | ||
['D Do DD', '14 14-го 14'], | ||
['d do dddd ddd dd', '0 0-й воскресенье вск вс'], | ||
['d do dddd ddd dd', '0 0-й воскресенье вс вс'], | ||
['DDD DDDo DDDD', '45 45-й 045'], | ||
@@ -58,3 +63,3 @@ ['w wo ww', '7 7-я 07'], | ||
['s ss', '50 50'], | ||
['a A', 'pm PM'], | ||
['a A', 'дня дня'], | ||
['DDDo [день года]', '45-й день года'], | ||
@@ -68,3 +73,3 @@ ['L', '14.02.2010'], | ||
['lll', '14 фев 2010 г., 15:25'], | ||
['llll', 'вск, 14 фев 2010 г., 15:25'] | ||
['llll', 'вс, 14 фев 2010 г., 15:25'] | ||
], | ||
@@ -79,2 +84,17 @@ b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), | ||
"format meridiem" : function (test) { | ||
test.expect(8); | ||
test.equal(moment([2012, 11, 28, 0, 0]).format("A"), "ночи", "night"); | ||
test.equal(moment([2012, 11, 28, 3, 59]).format("A"), "ночи", "night"); | ||
test.equal(moment([2012, 11, 28, 4, 0]).format("A"), "утра", "morning"); | ||
test.equal(moment([2012, 11, 28, 11, 59]).format("A"), "утра", "morning"); | ||
test.equal(moment([2012, 11, 28, 12, 0]).format("A"), "дня", "afternoon"); | ||
test.equal(moment([2012, 11, 28, 16, 59]).format("A"), "дня", "afternoon"); | ||
test.equal(moment([2012, 11, 28, 17, 0]).format("A"), "вечера", "evening"); | ||
test.equal(moment([2012, 11, 28, 23, 59]).format("A"), "вечера", "evening"); | ||
test.done(); | ||
}, | ||
"format ordinal" : function (test) { | ||
@@ -161,3 +181,3 @@ test.expect(31); | ||
var expected = 'воскресенье вск вс_понедельник пнд пн_вторник втр вт_среда срд ср_четверг чтв чт_пятница птн пт_суббота сбт сб'.split("_"), i; | ||
var expected = 'воскресенье вс вс_понедельник пн пн_вторник вт вт_среда ср ср_четверг чт чт_пятница пт пт_суббота сб сб'.split("_"), i; | ||
for (i = 0; i < expected.length; i++) { | ||
@@ -405,3 +425,11 @@ test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/ru'), 'ru', "module should export ru"); | ||
test.done(); | ||
} | ||
}; |
@@ -440,3 +440,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/sk'), 'sk', "module should export sk"); | ||
test.done(); | ||
} | ||
}; |
@@ -383,3 +383,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/sl'), 'sl', "module should export sl"); | ||
test.done(); | ||
} | ||
}; |
@@ -377,3 +377,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/sq'), 'sq', "module should export sq"); | ||
test.done(); | ||
} | ||
}; |
@@ -348,3 +348,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/sv'), 'sv', "module should export sv"); | ||
test.done(); | ||
} | ||
}; |
@@ -315,3 +315,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/th'), 'th', "module should export th"); | ||
test.done(); | ||
} | ||
}; |
@@ -366,3 +366,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/tr'), 'tr', "module should export tr"); | ||
test.done(); | ||
} | ||
}; |
@@ -354,3 +354,11 @@ // moment.js Morocco Central Atlas Tamaziɣt in Latin (tzm-la) tests | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/tzm-la'), 'tzm-la', "module should export tzm-la"); | ||
test.done(); | ||
} | ||
}; |
@@ -345,4 +345,12 @@ // moment.js Morocco Central Atlas Tamaziɣt (tzm) tests | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/tzm'), 'tzm', "module should export tzm"); | ||
test.done(); | ||
} | ||
}; | ||
@@ -43,7 +43,7 @@ var moment = require("../../moment"); | ||
['dddd, Do MMMM YYYY, HH:mm:ss', 'неділя, 14-го лютого 2010, 15:25:50'], | ||
['ddd, hA', 'нед, 3PM'], | ||
['ddd, h A', 'нд, 3 дня'], | ||
['M Mo MM MMMM MMM', '2 2-й 02 лютий лют'], | ||
['YYYY YY', '2010 10'], | ||
['D Do DD', '14 14-го 14'], | ||
['d do dddd ddd dd', '0 0-й неділя нед нд'], | ||
['d do dddd ddd dd', '0 0-й неділя нд нд'], | ||
['DDD DDDo DDDD', '45 45-й 045'], | ||
@@ -55,3 +55,3 @@ ['w wo ww', '7 7-й 07'], | ||
['s ss', '50 50'], | ||
['a A', 'pm PM'], | ||
['a A', 'дня дня'], | ||
['DDDo [день року]', '45-й день року'], | ||
@@ -71,2 +71,17 @@ ['L', '14.02.2010'], | ||
"format meridiem" : function (test) { | ||
test.expect(8); | ||
test.equal(moment([2012, 11, 28, 0, 0]).format("A"), "ночі", "night"); | ||
test.equal(moment([2012, 11, 28, 3, 59]).format("A"), "ночі", "night"); | ||
test.equal(moment([2012, 11, 28, 4, 0]).format("A"), "ранку", "morning"); | ||
test.equal(moment([2012, 11, 28, 11, 59]).format("A"), "ранку", "morning"); | ||
test.equal(moment([2012, 11, 28, 12, 0]).format("A"), "дня", "afternoon"); | ||
test.equal(moment([2012, 11, 28, 16, 59]).format("A"), "дня", "afternoon"); | ||
test.equal(moment([2012, 11, 28, 17, 0]).format("A"), "вечора", "evening"); | ||
test.equal(moment([2012, 11, 28, 23, 59]).format("A"), "вечора", "evening"); | ||
test.done(); | ||
}, | ||
"format ordinal" : function (test) { | ||
@@ -135,3 +150,3 @@ test.expect(31); | ||
test.expect(7); | ||
var expected = 'неділя нед нд_понеділок пон пн_вівторок вів вт_середа сер ср_четвер чет чт_п’ятниця п’ят пт_субота суб сб'.split("_"), i; | ||
var expected = 'неділя нд нд_понеділок пн пн_вівторок вт вт_середа ср ср_четвер чт чт_п’ятниця пт пт_субота сб сб'.split("_"), i; | ||
for (i = 0; i < expected.length; i++) { | ||
@@ -374,3 +389,11 @@ test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/uk'), 'uk', "module should export uk"); | ||
test.done(); | ||
} | ||
}; |
@@ -349,3 +349,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/zh-cn'), 'zh-cn', "module should export zh-cn"); | ||
test.done(); | ||
} | ||
}; |
@@ -350,3 +350,11 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"returns the name of the language" : function (test) { | ||
test.expect(1); | ||
test.equal(require('../../lang/zh-tw'), 'zh-tw', "module should export zh-tw"); | ||
test.done(); | ||
} | ||
}; |
var moment = require("../../moment"); | ||
var getVerifier = function (test) { | ||
return function (input, format, expected, description, asymetrical) { | ||
var m = moment(input, format); | ||
test.equal(m.format('YYYY MM DD'), expected, 'compare: ' + description); | ||
//test round trip | ||
if (!asymetrical) { | ||
test.equal(m.format(format), input, 'round trip: ' + description); | ||
} | ||
}; | ||
}; | ||
exports.create = { | ||
@@ -32,4 +44,4 @@ "array" : function (test) { | ||
test.ok(moment({year: 2010, month: 1, day: 12, hours: 1, minutes: 1}).toDate() instanceof Date, "{year: 2010, month: 1, hours: 12, minutes: 1, seconds: 1}"); | ||
test.ok(moment({year: 2010, month: 1, day: 12, hours: 1, minutes: 1, seconds: 1}).toDate() instanceof Date, "{year: 2010, month: 1, day: 12, hours: 1, minutes: 1, seconds: 1]"); | ||
test.ok(moment({year: 2010, month: 1, day: 12, hours: 1, minutes: 1, seconds: 1, milliseconds: 1}).toDate() instanceof Date, "{year: 2010, month: 1, day: 12, hours: 1, minutes: 1, seconds: 1, milliseconds: 1]"); | ||
test.ok(moment({year: 2010, month: 1, day: 12, hours: 1, minutes: 1, seconds: 1}).toDate() instanceof Date, "{year: 2010, month: 1, day: 12, hours: 1, minutes: 1, seconds: 1}"); | ||
test.ok(moment({year: 2010, month: 1, day: 12, hours: 1, minutes: 1, seconds: 1, milliseconds: 1}).toDate() instanceof Date, "{year: 2010, month: 1, day: 12, hours: 1, minutes: 1, seconds: 1, milliseconds: 1}"); | ||
test.equal(+moment(new Date(2010, 1, 14, 15, 25, 50, 125)), +moment({years: 2010, months: 1, days: 14, hours: 15, minutes: 25, seconds: 50, milliseconds: 125}), "constructing with object (long plural) === constructing with new Date()"); | ||
@@ -104,5 +116,6 @@ test.equal(+moment(new Date(2010, 1, 14, 15, 25, 50, 125)), +moment({year: 2010, month: 1, day: 14, hour: 15, minute: 25, second: 50, millisecond: 125}), "constructing with object (long) === constructing with new Date()"); | ||
"string without format" : function (test) { | ||
test.expect(2); | ||
test.expect(3); | ||
test.ok(moment("Aug 9, 1995").toDate() instanceof Date, "Aug 9, 1995"); | ||
test.ok(moment("Mon, 25 Dec 1995 13:30:00 GMT").toDate() instanceof Date, "Mon, 25 Dec 1995 13:30:00 GMT"); | ||
test.equal(new Date(2013, 8, 13, 7, 26).valueOf(), moment("2013-09-13 7:26 am").valueOf(), "2013-09-13 7:26 am"); | ||
test.done(); | ||
@@ -123,8 +136,12 @@ }, | ||
moment.lang('en'); | ||
test.expect(3); | ||
test.expect(6); | ||
test.equal(moment('05/1/2012', 'MM/DD/YYYY h:m:s a').format('MM/DD/YYYY'), '05/01/2012', 'should not break if am/pm is left off from the parsing tokens'); | ||
test.equal(moment('05/1/2012 12:25:00', 'MM/DD/YYYY h:m:s a').format('MM/DD/YYYY'), '05/01/2012', 'should not break if am/pm is left off from the parsing tokens'); | ||
test.equal(moment('05/1/2012 12:25:00 am', 'MM/DD/YYYY h:m:s a').format('MM/DD/YYYY'), '05/01/2012', 'should not break if am/pm is left off from the parsing tokens'); | ||
test.equal(moment('05/1/2012 12:25:00 pm', 'MM/DD/YYYY h:m:s a').format('MM/DD/YYYY'), '05/01/2012', 'should not break if am/pm is left off from the parsing tokens'); | ||
test.ok(moment('05/1/2012 12:25:00', 'MM/DD/YYYY h:m:s a').isValid()); | ||
test.ok(moment('05/1/2012 12:25:00 am', 'MM/DD/YYYY h:m:s a').isValid()); | ||
test.ok(moment('05/1/2012 12:25:00 pm', 'MM/DD/YYYY h:m:s a').isValid()); | ||
test.done(); | ||
@@ -134,9 +151,14 @@ }, | ||
"empty string with formats" : function (test) { | ||
test.expect(3); | ||
test.expect(8); | ||
var currentDate = moment().startOf('day').format('YYYY-MM-DD HH:mm:ss'); | ||
test.equal(moment(' ', 'MM').format('YYYY-MM-DD HH:mm:ss'), currentDate, 'should not break if input is an empty string'); | ||
test.equal(moment(' ', 'DD').format('YYYY-MM-DD HH:mm:ss'), currentDate, 'should not break if input is an empty string'); | ||
test.equal(moment(' ', ['MM', "DD"]).format('YYYY-MM-DD HH:mm:ss'), currentDate, 'should not break if input is an empty string'); | ||
test.equal(moment('', 'MM').format('YYYY-MM-DD HH:mm:ss'), 'Invalid date'); | ||
test.equal(moment(' ', 'MM').format('YYYY-MM-DD HH:mm:ss'), 'Invalid date'); | ||
test.equal(moment(' ', 'DD').format('YYYY-MM-DD HH:mm:ss'), 'Invalid date'); | ||
test.equal(moment(' ', ['MM', "DD"]).format('YYYY-MM-DD HH:mm:ss'), 'Invalid date'); | ||
test.ok(!moment('', 'MM').isValid()); | ||
test.ok(!moment(' ', 'MM').isValid()); | ||
test.ok(!moment(' ', 'DD').isValid()); | ||
test.ok(!moment(' ', ['MM', "DD"]).isValid()); | ||
test.done(); | ||
@@ -217,3 +239,3 @@ }, | ||
['HH:mm:ss SSS', '00:30:00 789'], | ||
['X.SSS', '1234567890.123'], | ||
['X', '1234567890'], | ||
['LT', '12:30 AM'], | ||
@@ -229,7 +251,10 @@ ['L', '09/02/1999'], | ||
], | ||
m, | ||
i; | ||
test.expect(a.length); | ||
test.expect(2 * a.length); | ||
for (i = 0; i < a.length; i++) { | ||
test.equal(moment(a[i][1], a[i][0]).format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); | ||
m = moment(a[i][1], a[i][0]); | ||
test.ok(m.isValid()); | ||
test.equal(m.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); | ||
} | ||
@@ -302,21 +327,36 @@ test.done(); | ||
"string with array of formats" : function (test) { | ||
test.expect(14); | ||
test.equal(moment('11-02-1999', ['MM-DD-YYYY', 'DD-MM-YYYY']).format('MM DD YYYY'), '11 02 1999', 'switching month and day'); | ||
test.equal(moment('02-11-1999', ['MM/DD/YYYY', 'YYYY-MM-DD', 'MM-DD-YYYY']).format('MM DD YYYY'), '02 11 1999', 'year last'); | ||
test.equal(moment('1999-02-11', ['MM/DD/YYYY', 'YYYY-MM-DD', 'MM-DD-YYYY']).format('MM DD YYYY'), '02 11 1999', 'year first'); | ||
test.equal(moment('02-11-1999', ['MM/DD/YYYY', 'YYYY MM DD', 'MM-DD-YYYY']).format('MM DD YYYY'), '02 11 1999', 'year last'); | ||
test.equal(moment('1999-02-11', ['MM/DD/YYYY', 'YYYY MM DD', 'MM-DD-YYYY']).format('MM DD YYYY'), '02 11 1999', 'year first'); | ||
test.equal(moment('02-11-1999', ['MM/DD/YYYY', 'YYYY-MM-DD']).format('MM DD YYYY'), '02 11 1999', 'year last'); | ||
test.equal(moment('1999-02-11', ['MM/DD/YYYY', 'YYYY-MM-DD']).format('MM DD YYYY'), '02 11 1999', 'year first'); | ||
test.equal(moment('02-11-1999', ['YYYY-MM-DD', 'MM/DD/YYYY']).format('MM DD YYYY'), '02 11 1999', 'year last'); | ||
test.equal(moment('1999-02-11', ['YYYY-MM-DD', 'MM/DD/YYYY']).format('MM DD YYYY'), '02 11 1999', 'year first'); | ||
test.equal(moment('02-11-1999', ['MM/DD/YYYY', 'YYYY MM DD']).format('MM DD YYYY'), '02 11 1999', 'year last'); | ||
test.equal(moment('1999-02-11', ['MM/DD/YYYY', 'YYYY MM DD']).format('MM DD YYYY'), '02 11 1999', 'year first'); | ||
test.equal(moment('02-11-1999', ['YYYY MM DD', 'MM/DD/YYYY']).format('MM DD YYYY'), '02 11 1999', 'year last'); | ||
test.equal(moment('1999-02-11', ['YYYY MM DD', 'MM/DD/YYYY']).format('MM DD YYYY'), '02 11 1999', 'year first'); | ||
test.equal(moment('13-11-1999', ['MM/DD/YYYY', 'DD/MM/YYYY']).format('MM DD YYYY'), '11 13 1999', 'second must be month'); | ||
test.equal(moment('11-13-1999', ['MM/DD/YYYY', 'DD/MM/YYYY']).format('MM DD YYYY'), '11 13 1999', 'first must be month'); | ||
test.equal(moment('13-14-1999', ['MM/DD/YYYY', 'DD/MM/YYYY']).format('MM DD YYYY'), '01 14 2000', 'either can be a month, month first format'); | ||
test.equal(moment('13-14-1999', ['DD/MM/YYYY', 'MM/DD/YYYY']).format('MM DD YYYY'), '02 13 2000', 'either can be a month, day first format'); | ||
test.equal(moment('01-02-2000', ['MM/DD/YYYY', 'DD/MM/YYYY']).format('MM DD YYYY'), '01 02 2000', 'either can be a month, month first format'); | ||
test.equal(moment('02-01-2000', ['DD/MM/YYYY', 'MM/DD/YYYY']).format('MM DD YYYY'), '01 02 2000', 'either can be a month, day first format'); | ||
test.equal(moment('13-14-98', ['DD MM YY', 'DD MM YYYY'])._f, 'DD MM YY', 'use two digit year'); | ||
test.equal(moment('13-14-1998', ['DD MM YY', 'DD MM YYYY'])._f, 'DD MM YYYY', 'use four digit year'); | ||
test.equal(moment('11-02-10', ['MM/DD/YY', 'YY MM DD', 'DD-MM-YY']).format('MM DD YYYY'), '02 11 2010', 'all unparsed substrings have influence on format penalty'); | ||
test.equal(moment('11-02-10', ['MM-DD-YY HH:mm', 'YY MM DD']).format('MM DD YYYY'), '02 10 2011', 'prefer formats without extra tokens'); | ||
test.equal(moment('11-02-10 junk', ['MM-DD-YY', 'YY.MM.DD junk']).format('MM DD YYYY'), '02 10 2011', 'prefer formats that dont result in extra characters'); | ||
test.equal(moment('11-22-10', ['YY-MM-DD', 'YY-DD-MM']).format('MM DD YYYY'), '10 22 2011', 'prefer valid results'); | ||
test.equal(moment('gibberish', ['YY-MM-DD', 'YY-DD-MM']).format('MM DD YYYY'), 'Invalid date', 'doest throw for invalid strings'); | ||
test.equal(moment('gibberish', []).format('MM DD YYYY'), 'Invalid date', 'doest throw for an empty array'); | ||
//https://github.com/moment/moment/issues/1143 | ||
test.equal(moment( | ||
"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)", | ||
["MM/DD/YYYY", "MM-DD-YYYY", "YYYY-MM-DD", "YYYY-MM-DDTHH:mm:ssZ"]) | ||
.format('YYYY-MM-DD'), '2011-07-01', 'Works for long strings'); | ||
test.equal(moment('11-02-10', ['MM.DD.YY', 'DD-MM-YY']).format('MM DD YYYY'), '02 11 2010', 'escape RegExp special characters on comparing'); | ||
test.equal(moment('13-10-98', ['DD MM YY', 'DD MM YYYY'])._f, 'DD MM YY', 'use two digit year'); | ||
test.equal(moment('13-10-1998', ['DD MM YY', 'DD MM YYYY'])._f, 'DD MM YYYY', 'use four digit year'); | ||
test.equal(moment('01', ["MM", "DD"])._f, "MM", "Should use first valid format"); | ||
@@ -404,7 +444,50 @@ | ||
['2011-10-08 18:04:20.11' + tz2, '2011-10-08T18:04:20.110' + tz], | ||
['2011-10-08 18:04:20.111' + tz2, '2011-10-08T18:04:20.111' + tz] | ||
['2011-10-08 18:04:20.111' + tz2, '2011-10-08T18:04:20.111' + tz], | ||
['2011-W40', '2011-10-03T00:00:00.000' + tz], | ||
['2011-W40-6', '2011-10-08T00:00:00.000' + tz], | ||
['2011-W40-6T18', '2011-10-08T18:00:00.000' + tz], | ||
['2011-W40-6T18:04', '2011-10-08T18:04:00.000' + tz], | ||
['2011-W40-6T18:04:20', '2011-10-08T18:04:20.000' + tz], | ||
['2011-W40-6T18:04' + tz, '2011-10-08T18:04:00.000' + tz], | ||
['2011-W40-6T18:04:20' + tz, '2011-10-08T18:04:20.000' + tz], | ||
['2011-W40-6T18:04' + tz2, '2011-10-08T18:04:00.000' + tz], | ||
['2011-W40-6T18:04:20' + tz2, '2011-10-08T18:04:20.000' + tz], | ||
['2011-W40-6T18:04:20.1' + tz2, '2011-10-08T18:04:20.100' + tz], | ||
['2011-W40-6T18:04:20.11' + tz2, '2011-10-08T18:04:20.110' + tz], | ||
['2011-W40-6T18:04:20.111' + tz2, '2011-10-08T18:04:20.111' + tz], | ||
['2011-W40-6 18', '2011-10-08T18:00:00.000' + tz], | ||
['2011-W40-6 18:04', '2011-10-08T18:04:00.000' + tz], | ||
['2011-W40-6 18:04:20', '2011-10-08T18:04:20.000' + tz], | ||
['2011-W40-6 18:04' + tz, '2011-10-08T18:04:00.000' + tz], | ||
['2011-W40-6 18:04:20' + tz, '2011-10-08T18:04:20.000' + tz], | ||
['2011-W40-6 18:04' + tz2, '2011-10-08T18:04:00.000' + tz], | ||
['2011-W40-6 18:04:20' + tz2, '2011-10-08T18:04:20.000' + tz], | ||
['2011-W40-6 18:04:20.1' + tz2, '2011-10-08T18:04:20.100' + tz], | ||
['2011-W40-6 18:04:20.11' + tz2, '2011-10-08T18:04:20.110' + tz], | ||
['2011-W40-6 18:04:20.111' + tz2, '2011-10-08T18:04:20.111' + tz], | ||
['2011-281', '2011-10-08T00:00:00.000' + tz], | ||
['2011-281T18', '2011-10-08T18:00:00.000' + tz], | ||
['2011-281T18:04', '2011-10-08T18:04:00.000' + tz], | ||
['2011-281T18:04:20', '2011-10-08T18:04:20.000' + tz], | ||
['2011-281T18:04' + tz, '2011-10-08T18:04:00.000' + tz], | ||
['2011-281T18:04:20' + tz, '2011-10-08T18:04:20.000' + tz], | ||
['2011-281T18:04' + tz2, '2011-10-08T18:04:00.000' + tz], | ||
['2011-281T18:04:20' + tz2, '2011-10-08T18:04:20.000' + tz], | ||
['2011-281T18:04:20.1' + tz2, '2011-10-08T18:04:20.100' + tz], | ||
['2011-281T18:04:20.11' + tz2, '2011-10-08T18:04:20.110' + tz], | ||
['2011-281T18:04:20.111' + tz2, '2011-10-08T18:04:20.111' + tz], | ||
['2011-281 18', '2011-10-08T18:00:00.000' + tz], | ||
['2011-281 18:04', '2011-10-08T18:04:00.000' + tz], | ||
['2011-281 18:04:20', '2011-10-08T18:04:20.000' + tz], | ||
['2011-281 18:04' + tz, '2011-10-08T18:04:00.000' + tz], | ||
['2011-281 18:04:20' + tz, '2011-10-08T18:04:20.000' + tz], | ||
['2011-281 18:04' + tz2, '2011-10-08T18:04:00.000' + tz], | ||
['2011-281 18:04:20' + tz2, '2011-10-08T18:04:20.000' + tz], | ||
['2011-281 18:04:20.1' + tz2, '2011-10-08T18:04:20.100' + tz], | ||
['2011-281 18:04:20.11' + tz2, '2011-10-08T18:04:20.110' + tz], | ||
['2011-281 18:04:20.111' + tz2, '2011-10-08T18:04:20.111' + tz] | ||
], i; | ||
test.expect(formats.length); | ||
for (i = 0; i < formats.length; i++) { | ||
test.equal(formats[i][1], moment(formats[i][0]).format('YYYY-MM-DDTHH:mm:ss.SSSZ'), "moment should be able to parse ISO " + formats[i][0]); | ||
test.equal(moment(formats[i][0]).format('YYYY-MM-DDTHH:mm:ss.SSSZ'), formats[i][1], "moment should be able to parse ISO " + formats[i][0]); | ||
} | ||
@@ -456,7 +539,12 @@ test.done(); | ||
"null" : function (test) { | ||
test.expect(3); | ||
test.equal(moment(''), null, "Calling moment('')"); | ||
test.equal(moment(null), null, "Calling moment(null)"); | ||
test.equal(moment('', 'YYYY-MM-DD'), null, "Calling moment('', 'YYYY-MM-DD')"); | ||
"null or empty" : function (test) { | ||
test.expect(8); | ||
test.equal(moment('').isValid(), false, "moment('') is not valid"); | ||
test.equal(moment(null).isValid(), false, "moment(null) is not valid"); | ||
test.equal(moment(null, 'YYYY-MM-DD').isValid(), false, "moment('', 'format') is not valid"); | ||
test.equal(moment('', 'YYYY-MM-DD').isValid(), false, "moment('', 'format') is not valid"); | ||
test.equal(moment.utc('').isValid(), false, "moment.utc('') is not valid"); | ||
test.equal(moment.utc(null).isValid(), false, "moment.utc(null) is not valid"); | ||
test.equal(moment.utc(null, 'YYYY-MM-DD').isValid(), false, "moment.utc(null) is not valid"); | ||
test.equal(moment.utc('', 'YYYY-MM-DD').isValid(), false, "moment.utc('', 'YYYY-MM-DD') is not valid"); | ||
test.done(); | ||
@@ -499,2 +587,21 @@ }, | ||
"strict parsing" : function (test) { | ||
test.expect(11); | ||
test.equal(moment("2012-05", "YYYY-MM", true).format("YYYY-MM"), "2012-05", "parse correct string"); | ||
test.equal(moment(" 2012-05", "YYYY-MM", true).isValid(), false, "fail on extra whitespace"); | ||
test.equal(moment("foo 2012-05", "[foo] YYYY-MM", true).format('YYYY-MM'), "2012-05", "handle fixed text"); | ||
test.equal(moment("2012 05", "YYYY-MM", true).isValid(), false, "fail on different separator"); | ||
test.equal(moment("2012 05", "YYYY MM DD", true).isValid(), false, "fail on too many tokens"); | ||
test.equal(moment("05 30 2010", ["DD MM YYYY", "MM DD YYYY"], true).format("MM DD YYYY"), "05 30 2010", "array with bad date"); | ||
test.equal(moment("05 30 2010", ["", "MM DD YYYY"], true).format("MM DD YYYY"), "05 30 2010", "array with invalid format"); | ||
test.equal(moment("05 30 2010", [" DD MM YYYY", "MM DD YYYY"], true).format("MM DD YYYY"), "05 30 2010", "array with non-matching format"); | ||
test.equal(moment("2010.*...", "YYYY.*", true).isValid(), false, "invalid format with regex chars"); | ||
test.equal(moment("2010.*", "YYYY.*", true).year(), 2010, "valid format with regex chars"); | ||
test.equal(moment(".*2010.*", ".*YYYY.*", true).year(), 2010, "valid format with regex chars on both sides"); | ||
test.done(); | ||
}, | ||
"parsing into a language" : function (test) { | ||
@@ -518,3 +625,82 @@ test.expect(2); | ||
test.done(); | ||
}, | ||
"parsing week and weekday information" : function (test) { | ||
var ver = getVerifier(test); | ||
//year | ||
ver('12', 'gg', "2012 01 01", 'week-year two digits'); | ||
ver('2012', 'gggg', "2012 01 01", 'week-year four digits'); | ||
ver('99', 'gg', "1998 12 27", 'week-year two digits previous year'); | ||
ver('1999', 'gggg', "1998 12 27", 'week-year four digits previous year'); | ||
ver('99', 'GG', "1999 01 04", 'iso week-year two digits'); | ||
ver('1999', 'GGGG', "1999 01 04", 'iso week-year four digits'); | ||
ver('13', 'GG', "2012 12 31", 'iso week-year two digits previous year'); | ||
ver('2013', 'GGGG', "2012 12 31", 'iso week-year four digits previous year'); | ||
//yer + week | ||
ver('1999 37', 'gggg w', "1999 09 05", 'week'); | ||
ver('1999 37', 'gggg ww', "1999 09 05", 'week double'); | ||
ver('1999 37', 'GGGG W', "1999 09 13", 'iso week'); | ||
ver('1999 37', 'GGGG WW', "1999 09 13", 'iso week double'); | ||
ver('1999 37 4', 'GGGG WW E', "1999 09 16", 'iso day'); | ||
ver('1999 37 04', 'GGGG WW E', "1999 09 16", 'iso day wide', true); | ||
ver('1999 37 4', 'gggg ww e', "1999 09 09", 'day'); | ||
ver('1999 37 04', 'gggg ww e', "1999 09 09", 'day wide', true); | ||
//yer + week + day | ||
ver('1999 37 4', 'gggg ww d', "1999 09 09", 'd'); | ||
ver('1999 37 Th', 'gggg ww dd', "1999 09 09", 'dd'); | ||
ver('1999 37 Thu', 'gggg ww ddd', "1999 09 09", 'ddd'); | ||
ver('1999 37 Thursday', 'gggg ww dddd', "1999 09 09", 'dddd'); | ||
//lower-order only | ||
test.equal(moment('22', 'ww').week(), 22, "week sets the week by itself"); | ||
test.equal(moment('22', 'ww').weekYear(), moment().weekYear(), "week keeps this year"); | ||
test.equal(moment('2012 22', 'YYYY ww').weekYear(), 2012, "week keeps parsed year"); | ||
test.equal(moment('22', 'WW').isoWeek(), 22, "iso week sets the week by itself"); | ||
test.equal(moment('2012 22', 'YYYY WW').weekYear(), 2012, "iso week keeps parsed year"); | ||
test.equal(moment('22', 'WW').weekYear(), moment().weekYear(), "iso week keeps this year"); | ||
//order | ||
ver('6 2013 2', 'e gggg w', "2013 01 12", "order doesn't matter"); | ||
ver('6 2013 2', 'E GGGG W', "2013 01 12", "iso order doesn't matter"); | ||
//can parse other stuff too | ||
test.equal(moment('1999-W37-4 3:30', 'GGGG-[W]WW-E HH:mm').format('YYYY MM DD HH:mm'), '1999 09 16 03:30', "parsing weeks and hours"); | ||
test.done(); | ||
}, | ||
'parsing localized weekdays' : function (test) { | ||
var ver = getVerifier(test); | ||
try { | ||
moment.lang('fr'); //french uses doy = 4, dow = 1 | ||
ver('1999 37 4', 'GGGG WW E', "1999 09 16", 'iso ignores language'); | ||
ver('1999 37 7', 'GGGG WW E', "1999 09 19", 'iso ignores language'); | ||
ver('1999 37 0', 'gggg ww e', "1999 09 13", 'localized e uses local doy and dow: 0 = monday'); | ||
ver('1999 37 4', 'gggg ww e', "1999 09 17", 'localized e uses local doy and dow: 4 = friday'); | ||
ver('1999 37 1', 'gggg ww d', "1999 09 13", 'localized d uses 0-indexed days: 1 = monday'); | ||
ver('1999 37 Lu', 'gggg ww dd', "1999 09 13", 'localized d uses 0-indexed days: Mo'); | ||
ver('1999 37 lun.', 'gggg ww ddd', "1999 09 13", 'localized d uses 0-indexed days: Mon'); | ||
ver('1999 37 lundi', 'gggg ww dddd', "1999 09 13", 'localized d uses 0-indexed days: Monday'); | ||
ver('1999 37 4', 'gggg ww d', "1999 09 16", 'localized d uses 0-indexed days: 4'); | ||
//sunday goes at the end of the week | ||
ver('1999 37 0', 'gggg ww d', "1999 09 19", 'localized d uses 0-indexed days: 0 = sund'); | ||
ver('1999 37 Di', 'gggg ww dd', "1999 09 19", 'localized d uses 0-indexed days: 0 = sund'); | ||
} | ||
finally { | ||
moment.lang('en'); | ||
test.done(); | ||
} | ||
} | ||
}; |
@@ -142,2 +142,35 @@ var moment = require("../../moment"); | ||
"instantiation from 24-hour time zero" : function (test) { | ||
test.expect(6); | ||
test.equal(moment.duration("00:00").years(), 0, "0 years"); | ||
test.equal(moment.duration("00:00").days(), 0, "0 days"); | ||
test.equal(moment.duration("00:00").hours(), 0, "0 hours"); | ||
test.equal(moment.duration("00:00").minutes(), 0, "0 minutes"); | ||
test.equal(moment.duration("00:00").seconds(), 0, "0 seconds"); | ||
test.equal(moment.duration("00:00").milliseconds(), 0, "0 milliseconds"); | ||
test.done(); | ||
}, | ||
"instantiation from 24-hour time <24 hours" : function (test) { | ||
test.expect(6); | ||
test.equal(moment.duration("06:45").years(), 0, "0 years"); | ||
test.equal(moment.duration("06:45").days(), 0, "0 days"); | ||
test.equal(moment.duration("06:45").hours(), 6, "6 hours"); | ||
test.equal(moment.duration("06:45").minutes(), 45, "45 minutes"); | ||
test.equal(moment.duration("06:45").seconds(), 0, "0 seconds"); | ||
test.equal(moment.duration("06:45").milliseconds(), 0, "0 milliseconds"); | ||
test.done(); | ||
}, | ||
"instantiation from 24-hour time >24 hours" : function (test) { | ||
test.expect(6); | ||
test.equal(moment.duration("26:45").years(), 0, "0 years"); | ||
test.equal(moment.duration("26:45").days(), 1, "0 days"); | ||
test.equal(moment.duration("26:45").hours(), 2, "2 hours"); | ||
test.equal(moment.duration("26:45").minutes(), 45, "45 minutes"); | ||
test.equal(moment.duration("26:45").seconds(), 0, "0 seconds"); | ||
test.equal(moment.duration("26:45").milliseconds(), 0, "0 milliseconds"); | ||
test.done(); | ||
}, | ||
"instatiation from serialized C# TimeSpan zero" : function (test) { | ||
@@ -226,2 +259,67 @@ test.expect(6); | ||
"instantiation from ISO 8601 duration" : function (test) { | ||
test.expect(7); | ||
test.equal(moment.duration("P1Y2M3DT4H5M6S").asSeconds(), moment.duration({y: 1, M: 2, d: 3, h: 4, m: 5, s: 6}).asSeconds(), "all fields"); | ||
test.equal(moment.duration("P1M").asSeconds(), moment.duration({M: 1}).asSeconds(), "single month field"); | ||
test.equal(moment.duration("PT1M").asSeconds(), moment.duration({m: 1}).asSeconds(), "single minute field"); | ||
test.equal(moment.duration("P1MT2H").asSeconds(), moment.duration({M: 1, h: 2}).asSeconds(), "random fields missing"); | ||
test.equal(moment.duration("-P60D").asSeconds(), moment.duration({d: -60}).asSeconds(), "negative days"); | ||
test.equal(moment.duration("PT0.5S").asSeconds(), moment.duration({s: 0.5}).asSeconds(), "fractional seconds"); | ||
test.equal(moment.duration("PT0,5S").asSeconds(), moment.duration({s: 0.5}).asSeconds(), "fractional seconds (comma)"); | ||
test.done(); | ||
}, | ||
"serialization to ISO 8601 duration strings" : function (test) { | ||
test.expect(6); | ||
test.equal(moment.duration({y: 1, M: 2, d: 3, h: 4, m: 5, s: 6}).toIsoString(), "P1Y2M3DT4H5M6S", "all fields"); | ||
test.equal(moment.duration({M: -1}).toIsoString(), "-P1M", "one month ago"); | ||
test.equal(moment.duration({m: -1}).toIsoString(), "-PT1M", "one minute ago"); | ||
test.equal(moment.duration({s: -0.5}).toIsoString(), "-PT0.5S", "one half second ago"); | ||
test.equal(moment.duration({y: -0.5, M: 1}).toIsoString(), "-P5M", "a month after half a year ago"); | ||
test.equal(moment.duration({}).toIsoString(), "P0D", "zero duration"); | ||
test.done(); | ||
}, | ||
"`isodate` (python) test cases" : function (test) { | ||
test.expect(24); | ||
test.equal(moment.duration("P18Y9M4DT11H9M8S").asSeconds(), moment.duration({y: 18, M: 9, d: 4, h: 11, m: 9, s: 8}).asSeconds(), "python isodate 1"); | ||
test.equal(moment.duration("P2W").asSeconds(), moment.duration({w: 2}).asSeconds(), "python isodate 2"); | ||
test.equal(moment.duration("P3Y6M4DT12H30M5S").asSeconds(), moment.duration({y: 3, M: 6, d: 4, h: 12, m: 30, s: 5}).asSeconds(), "python isodate 3"); | ||
test.equal(moment.duration("P23DT23H").asSeconds(), moment.duration({d: 23, h: 23}).asSeconds(), "python isodate 4"); | ||
test.equal(moment.duration("P4Y").asSeconds(), moment.duration({y: 4}).asSeconds(), "python isodate 5"); | ||
test.equal(moment.duration("P1M").asSeconds(), moment.duration({M: 1}).asSeconds(), "python isodate 6"); | ||
test.equal(moment.duration("PT1M").asSeconds(), moment.duration({m: 1}).asSeconds(), "python isodate 7"); | ||
test.equal(moment.duration("P0.5Y").asSeconds(), moment.duration({y: 0.5}).asSeconds(), "python isodate 8"); | ||
test.equal(moment.duration("PT36H").asSeconds(), moment.duration({h: 36}).asSeconds(), "python isodate 9"); | ||
test.equal(moment.duration("P1DT12H").asSeconds(), moment.duration({d: 1, h: 12}).asSeconds(), "python isodate 10"); | ||
test.equal(moment.duration("-P2W").asSeconds(), moment.duration({w: -2}).asSeconds(), "python isodate 11"); | ||
test.equal(moment.duration("-P2.2W").asSeconds(), moment.duration({w: -2.2}).asSeconds(), "python isodate 12"); | ||
test.equal(moment.duration("P1DT2H3M4S").asSeconds(), moment.duration({d: 1, h: 2, m: 3, s: 4}).asSeconds(), "python isodate 13"); | ||
test.equal(moment.duration("P1DT2H3M").asSeconds(), moment.duration({d: 1, h: 2, m: 3}).asSeconds(), "python isodate 14"); | ||
test.equal(moment.duration("P1DT2H").asSeconds(), moment.duration({d: 1, h: 2}).asSeconds(), "python isodate 15"); | ||
test.equal(moment.duration("PT2H").asSeconds(), moment.duration({h: 2}).asSeconds(), "python isodate 16"); | ||
test.equal(moment.duration("PT2.3H").asSeconds(), moment.duration({h: 2.3}).asSeconds(), "python isodate 17"); | ||
test.equal(moment.duration("PT2H3M4S").asSeconds(), moment.duration({h: 2, m: 3, s: 4}).asSeconds(), "python isodate 18"); | ||
test.equal(moment.duration("PT3M4S").asSeconds(), moment.duration({m: 3, s: 4}).asSeconds(), "python isodate 19"); | ||
test.equal(moment.duration("PT22S").asSeconds(), moment.duration({s: 22}).asSeconds(), "python isodate 20"); | ||
test.equal(moment.duration("PT22.22S").asSeconds(), moment.duration({s: 22.22}).asSeconds(), "python isodate 21"); | ||
test.equal(moment.duration("-P2Y").asSeconds(), moment.duration({y: -2}).asSeconds(), "python isodate 22"); | ||
test.equal(moment.duration("-P3Y6M4DT12H30M5S").asSeconds(), moment.duration({y: -3, M: -6, d: -4, h: -12, m: -30, s: -5}).asSeconds(), "python isodate 23"); | ||
test.equal(moment.duration("-P1DT2H3M4S").asSeconds(), moment.duration({d: -1, h: -2, m: -3, s: -4}).asSeconds(), "python isodate 24"); | ||
test.done(); | ||
}, | ||
"ISO 8601 misuse cases" : function (test) { | ||
test.expect(8); | ||
test.equal(moment.duration("P").asSeconds(), 0, "lonely P"); | ||
test.equal(moment.duration("PT").asSeconds(), 0, "just P and T"); | ||
test.equal(moment.duration("P1H").asSeconds(), 0, "missing T"); | ||
test.equal(moment.duration("P1D1Y").asSeconds(), 0, "out of order"); | ||
test.equal(moment.duration("PT.5S").asSeconds(), 0.5, "accept no leading zero for decimal"); | ||
test.equal(moment.duration("PT1,S").asSeconds(), 1, "accept trailing decimal separator"); | ||
test.equal(moment.duration("PT1M0,,5S").asSeconds(), 60, "extra decimal separators are ignored as 0"); | ||
test.equal(moment.duration("P-1DS").asSeconds(), 0, "wrong position of negative"); | ||
test.done(); | ||
}, | ||
"humanize" : function (test) { | ||
@@ -228,0 +326,0 @@ test.expect(32); |
@@ -13,3 +13,3 @@ var moment = require("../../moment"); | ||
"format escape brackets" : function (test) { | ||
test.expect(9); | ||
test.expect(10); | ||
@@ -28,2 +28,3 @@ moment.lang('en'); | ||
test.equal(b.format('[LLL] LLL'), 'LLL February 14 2009 3:25 PM', 'localized tokens with escaped localized tokens (recursion)'); | ||
test.equal(b.format('YYYY[\n]DD[\n]'), '2009\n14\n', 'Newlines'); | ||
test.done(); | ||
@@ -103,3 +104,3 @@ }, | ||
test.equals(m.format('X'), '1234567890', 'unix timestamp as integer'); | ||
test.done(); | ||
@@ -332,3 +333,12 @@ }, | ||
test.done(); | ||
}, | ||
"invalid" : function (test) { | ||
moment.lang('en'); | ||
test.equal(moment.invalid().format(), "Invalid date"); | ||
test.equal(moment.invalid().format('YYYY-MM-DD'), "Invalid date"); | ||
test.done(); | ||
} | ||
}; |
@@ -20,4 +20,2 @@ var moment = require("../../moment"); | ||
"getters programmatic" : function (test) { | ||
test.expect(8); | ||
var a = moment([2011, 9, 12, 6, 7, 8, 9]); | ||
@@ -32,2 +30,9 @@ test.equal(a.get('year'), 2011, 'year'); | ||
test.equal(a.get('milliseconds'), 9, 'milliseconds'); | ||
//actual getters tested elsewhere | ||
test.equal(a.get('weekday'), a.weekday(), 'weekday'); | ||
test.equal(a.get('isoWeekday'), a.isoWeekday(), 'isoWeekday'); | ||
test.equal(a.get('week'), a.week(), 'week'); | ||
test.equal(a.get('isoWeek'), a.isoWeek(), 'isoWeek'); | ||
test.equal(a.get('dayOfYear'), a.dayOfYear(), 'dayOfYear'); | ||
test.done(); | ||
@@ -109,4 +114,2 @@ }, | ||
"setter programmatic" : function (test) { | ||
test.expect(9); | ||
var a = moment(); | ||
@@ -137,2 +140,30 @@ a.set('year', 2011); | ||
"setters programatic with weeks" : function (test) { | ||
var a = moment(); | ||
a.set('weekYear', 2001); | ||
a.set('week', 49); | ||
a.set('day', 4); | ||
test.equals(a.weekYear(), 2001); | ||
test.equals(a.week(), 49); | ||
test.equals(a.day(), 4); | ||
a.set('weekday', 1); | ||
test.equals(a.weekday(), 1); | ||
test.done(); | ||
}, | ||
"setters programatic with weeks ISO" : function (test) { | ||
var a = moment(); | ||
a.set('isoWeekYear', 2001); | ||
a.set('isoWeek', 49); | ||
a.set('isoWeekday', 4); | ||
test.equals(a.weekYear(), 2001); | ||
test.equals(a.week(), 49); | ||
test.equals(a.day(), 4); | ||
test.done(); | ||
}, | ||
"setters strings" : function (test) { | ||
@@ -139,0 +170,0 @@ test.expect(7); |
@@ -6,6 +6,5 @@ var moment = require("../../moment"); | ||
test.expect(2); | ||
test.equal(moment([2010, -1]).isValid(), false, 'month -1 invalid'); | ||
test.equal(moment([2100, 12]).isValid(), false, 'month 12 invalid'); | ||
test.equal(moment([2010, -1]).isValid(), false, 'month -1'); | ||
test.equal(moment([2100, 12]).isValid(), false, 'month 12'); | ||
test.done(); | ||
@@ -15,3 +14,3 @@ }, | ||
"array good month" : function (test) { | ||
test.expect(24); | ||
test.expect(12 * 2); | ||
@@ -27,9 +26,16 @@ for (var i = 0; i < 12; i++) { | ||
"array bad date" : function (test) { | ||
test.expect(4); | ||
var tests = [ | ||
moment([2010, 0, 0]), | ||
moment([2100, 0, 32]), | ||
moment.utc([2010, 0, 0]), | ||
moment.utc([2100, 0, 32]) | ||
], | ||
i, m; | ||
test.equal(moment([2010, 0, 0]).isValid(), false, 'date 0'); | ||
test.equal(moment([2100, 0, 32]).isValid(), false, 'date 32'); | ||
test.expect(tests.length); | ||
test.equal(moment.utc([2010, 0, 0]).isValid(), false, 'utc date 0'); | ||
test.equal(moment.utc([2100, 0, 32]).isValid(), false, 'utc date 32'); | ||
for (i in tests) { | ||
m = tests[i]; | ||
test.equal(m.isValid(), false); | ||
} | ||
@@ -56,4 +62,3 @@ test.done(); | ||
"string + formats bad date" : function (test) { | ||
test.expect(9); | ||
test.equal(moment('2020-00-00', []).isValid(), false, 'invalid on empty array'); | ||
test.equal(moment('2020-00-00', ['YYYY-MM-DD', 'DD-MM-YYYY']).isValid(), false, 'invalid on all in array'); | ||
@@ -84,3 +89,3 @@ test.equal(moment('2020-00-00', ['DD-MM-YYYY', 'YYYY-MM-DD']).isValid(), false, 'invalid on all in array'); | ||
test.equal(moment('fail', "MM-DD-YYYY").isValid(), false, 'string "fail" with format "MM-DD-YYYY"'); | ||
test.equal(moment("xx-xx-2001", 'DD-MM-YYY').isValid(), false, 'string "xx-xx-2001" with format "MM-DD-YYYY"'); | ||
test.equal(moment("xx-xx-2001", 'DD-MM-YYY').isValid(), true, 'string "xx-xx-2001" with format "MM-DD-YYYY"'); | ||
test.done(); | ||
@@ -180,4 +185,84 @@ }, | ||
test.done(); | ||
} | ||
}, | ||
"valid Unix timestamp" : function (test) { | ||
test.expect(21); | ||
test.equal(moment(1371065286, "X").isValid(), true, 'number integer'); | ||
test.equal(moment(1379066897.0, "X").isValid(), true, 'number whole 1dp'); | ||
test.equal(moment(1379066897.7, "X").isValid(), true, 'number 1dp'); | ||
test.equal(moment(1379066897.00, "X").isValid(), true, 'number whole 2dp'); | ||
test.equal(moment(1379066897.07, "X").isValid(), true, 'number 2dp'); | ||
test.equal(moment(1379066897.17, "X").isValid(), true, 'number 2dp'); | ||
test.equal(moment(1379066897.000, "X").isValid(), true, 'number whole 3dp'); | ||
test.equal(moment(1379066897.007, "X").isValid(), true, 'number 3dp'); | ||
test.equal(moment(1379066897.017, "X").isValid(), true, 'number 3dp'); | ||
test.equal(moment(1379066897.157, "X").isValid(), true, 'number 3dp'); | ||
test.equal(moment("1371065286", "X").isValid(), true, 'string integer'); | ||
test.equal(moment("1379066897.", "X").isValid(), true, 'string trailing .'); | ||
test.equal(moment("1379066897.0", "X").isValid(), true, 'string whole 1dp'); | ||
test.equal(moment("1379066897.7", "X").isValid(), true, 'string 1dp'); | ||
test.equal(moment("1379066897.00", "X").isValid(), true, 'string whole 2dp'); | ||
test.equal(moment("1379066897.07", "X").isValid(), true, 'string 2dp'); | ||
test.equal(moment("1379066897.17", "X").isValid(), true, 'string 2dp'); | ||
test.equal(moment("1379066897.000", "X").isValid(), true, 'string whole 3dp'); | ||
test.equal(moment("1379066897.007", "X").isValid(), true, 'string 3dp'); | ||
test.equal(moment("1379066897.017", "X").isValid(), true, 'string 3dp'); | ||
test.equal(moment("1379066897.157", "X").isValid(), true, 'string 3dp'); | ||
test.done(); | ||
}, | ||
"invalid Unix timestamp" : function (test) { | ||
test.expect(8); | ||
test.equal(moment(undefined, "X").isValid(), false, 'undefined'); | ||
test.equal(moment("undefined", "X").isValid(), false, 'string undefined'); | ||
try { | ||
test.equal(moment(null, "X").isValid(), false, 'null'); | ||
} catch (e) { | ||
test.ok(true, 'null'); | ||
} | ||
test.equal(moment("null", "X").isValid(), false, 'string null'); | ||
test.equal(moment([], "X").isValid(), false, 'array'); | ||
test.equal(moment("{}", "X").isValid(), false, 'object'); | ||
try { | ||
test.equal(moment("", "X").isValid(), false, 'string empty'); | ||
} catch (e) { | ||
test.ok(true, 'string empty'); | ||
} | ||
test.equal(moment(" ", "X").isValid(), false, 'string space'); | ||
test.done(); | ||
}, | ||
"empty" : function (test) { | ||
test.equal(moment(null).isValid(), false, 'null'); | ||
test.equal(moment('').isValid(), false, 'empty string'); | ||
test.equal(moment(' ').isValid(), false, 'empty when trimmed'); | ||
test.equal(moment(null, 'YYYY').isValid(), false, 'format + null'); | ||
test.equal(moment('', 'YYYY').isValid(), false, 'format + empty string'); | ||
test.equal(moment(' ', 'YYYY').isValid(), false, 'format + empty when trimmed'); | ||
test.done(); | ||
}, | ||
"days of the year" : function (test) { | ||
test.equal(moment('2010 300', 'YYYY DDDD').isValid(), true, 'day 300 of year valid'); | ||
test.equal(moment('2010 365', 'YYYY DDDD').isValid(), true, 'day 365 of year valid'); | ||
test.equal(moment('2010 366', 'YYYY DDDD').isValid(), false, 'day 366 of year invalid'); | ||
test.equal(moment('2012 365', 'YYYY DDDD').isValid(), true, 'day 365 of leap year valid'); | ||
test.equal(moment('2012 366', 'YYYY DDDD').isValid(), true, 'day 366 of leap year valid'); | ||
test.equal(moment('2012 367', 'YYYY DDDD').isValid(), false, 'day 367 of leap year invalid'); | ||
test.done(); | ||
}, | ||
"oddball permissiveness" : function (test) { | ||
//https://github.com/moment/moment/issues/1128 | ||
test.ok(moment("2010-10-3199", ["MM/DD/YYYY", "MM-DD-YYYY", "YYYY-MM-DD"]).isValid()); | ||
//https://github.com/moment/moment/issues/1122 | ||
test.ok(moment("3:25", ["h:mma", "hh:mma", "H:mm", "HH:mm"]).isValid()); | ||
test.done(); | ||
}, | ||
}; |
@@ -5,5 +5,7 @@ var moment = require("../../moment"); | ||
"library getter" : function (test) { | ||
test.expect(7); | ||
var r; | ||
test.expect(8); | ||
moment.lang('en'); | ||
r = moment.lang('en'); | ||
test.equal(r, 'en', 'Lang should return en by default'); | ||
test.equal(moment.lang(), 'en', 'Lang should return en by default'); | ||
@@ -32,2 +34,27 @@ | ||
"library getter array of langs" : function (test) { | ||
test.equal(moment.lang(['non-existent', 'fr', 'also-non-existent']), 'fr', "passing an array uses the first valid language"); | ||
test.equal(moment.lang(['es', 'fr', 'also-non-existent']), 'es', "passing an array uses the first valid language"); | ||
test.done(); | ||
}, | ||
"library getter language substrings" : function (test) { | ||
test.equal(moment.lang('fr-crap'), 'fr', "use substrings"); | ||
test.equal(moment.lang('fr-does-not-exist'), 'fr', "uses deep substrings"); | ||
test.equal(moment.lang('fr-CA-does-not-exist'), 'fr-ca', "uses deepest substring"); | ||
test.done(); | ||
}, | ||
"library getter language array and substrings" : function (test) { | ||
test.equal(moment.lang(['en-CH', 'fr']), 'en', "prefer root languages to shallower ones"); | ||
test.equal(moment.lang(['en-gb-leeds', 'en-CA']), 'en-gb', "prefer root languages to shallower ones"); | ||
test.equal(moment.lang(['en-fake', 'en-CA']), 'en-ca', "prefer alternatives with shared roots"); | ||
test.equal(moment.lang(['en-fake', 'en-fake2', 'en-ca']), 'en-ca', "prefer alternatives with shared roots"); | ||
test.equals(moment.lang(['fake-CA', 'fake-MX', 'fr']), 'fr', "always find something if possible"); | ||
test.equals(moment.lang(['fake-CA', 'fake-MX', 'fr']), 'fr', "always find something if possible"); | ||
test.equals(moment.lang(['fake-CA', 'fake-MX', 'fr-fake-fake-fake']), 'fr', "always find something if possible"); | ||
test.equals(moment.lang(['en', 'en-CA']), 'en', "prefer earlier if it works"); | ||
test.done(); | ||
}, | ||
"library ensure inheritance" : function (test) { | ||
@@ -106,2 +133,22 @@ test.expect(2); | ||
"instance lang method with array" : function (test) { | ||
var m = moment().lang(['non-existent', 'fr', 'also-non-existent']); | ||
test.equal(m.lang()._abbr, 'fr', "passing an array uses the first valid language"); | ||
m = moment().lang(['es', 'fr', 'also-non-existent']); | ||
test.equal(m.lang()._abbr, 'es', "passing an array uses the first valid language"); | ||
test.done(); | ||
}, | ||
"instance getter language substrings" : function (test) { | ||
var m = moment(); | ||
m.lang('fr-crap'); | ||
test.equal(m.lang()._abbr, 'fr', "use substrings"); | ||
m.lang('fr-does-not-exist'); | ||
test.equal(m.lang()._abbr, 'fr', "uses deep substrings"); | ||
test.done(); | ||
}, | ||
"instance lang persists with manipulation" : function (test) { | ||
@@ -244,3 +291,24 @@ test.expect(3); | ||
test.done(); | ||
}, | ||
"invalid date formatting" : function (test) { | ||
moment.lang('has-invalid', { | ||
invalidDate: 'KHAAAAAAAAAAAN!' | ||
}); | ||
test.equal(moment.invalid().format(), "KHAAAAAAAAAAAN!"); | ||
test.equal(moment.invalid().format('YYYY-MM-DD'), "KHAAAAAAAAAAAN!"); | ||
test.done(); | ||
}, | ||
"return lang name" : function (test) { | ||
test.expect(1); | ||
var registered = moment.lang('return-this', {}); | ||
test.equal(registered, 'return-this', 'returns the language configured'); | ||
test.done(); | ||
} | ||
}; |
var moment = require("../../moment"); | ||
var equalMoment = function (test, a, b, msg) { | ||
test.equal(a.valueOf(), b.valueOf(), msg); | ||
}; | ||
exports.min_max = { | ||
@@ -15,23 +19,17 @@ setUp : function (cb) { | ||
"min" : function (test) { | ||
test.expect(8); | ||
test.expect(6); | ||
var now = moment(), | ||
future = now.clone().add(1, 'month'), | ||
past = now.clone().subtract(1, 'month'), | ||
eps = 10; | ||
past = now.clone().subtract(1, 'month'); | ||
// we use Math.abs(a.diff(b)) < eps to prevent issues where | ||
// two moments are off by a millisecond. | ||
equalMoment(test, past.min(now), now, "A past date with the minimum of now should be now"); | ||
equalMoment(test, past.min(future), future, "A past date with the minimum of the future should be the future date"); | ||
test.ok(Math.abs(past.min(now).diff(now)) < eps, "A past date with the minimum of now should be now"); | ||
test.ok(Math.abs(past.min().diff(now)) < eps, "A past date with the minimum of implied now should be now"); | ||
test.ok(Math.abs(past.min(future).diff(future)) < eps, "A past date with the minimum of the future should be the future date"); | ||
equalMoment(test, future.min(now), future, "A future date with the minimum of now should be the future"); | ||
equalMoment(test, future.min(past), future, "A future date with the minimum of the past should be the future"); | ||
test.ok(Math.abs(future.min(now).diff(future)) < eps, "A future date with the minimum of now should be the future"); | ||
test.ok(Math.abs(future.min().diff(future)) < eps, "A future date with the minimum of implied now should be the future"); | ||
test.ok(Math.abs(future.min(past).diff(future)) < eps, "A future date with the minimum of the past should be the future"); | ||
equalMoment(test, now.min(past), now, "Now with the minimum of the past should be now"); | ||
equalMoment(test, now.min(future), future, "Now with the minimum of the future should be the future"); | ||
test.ok(Math.abs(now.min(past).diff(now)) < eps, "Now with the minimum of the past should be now"); | ||
test.ok(Math.abs(now.min(future).diff(future)) < eps, "Now with the minimum of the future should be the future"); | ||
test.done(); | ||
@@ -41,23 +39,17 @@ }, | ||
"max" : function (test) { | ||
test.expect(8); | ||
test.expect(6); | ||
var now = moment(), | ||
future = now.clone().add(1, 'month'), | ||
past = now.clone().subtract(1, 'month'), | ||
eps = 10; | ||
past = now.clone().subtract(1, 'month'); | ||
// we use Math.abs(a.diff(b)) < eps to prevent issues where | ||
// two moments are off by a millisecond. | ||
equalMoment(test, past.max(now), past, "A past date with the maximum of now should be the past"); | ||
equalMoment(test, past.max(future), past, "A past date with the maximum of the future should be the past"); | ||
test.ok(Math.abs(past.max(now).diff(past)) < eps, "A past date with the maximum of now should be the past"); | ||
test.ok(Math.abs(past.max().diff(past)) < eps, "A past date with the maximum of implied now should be the past"); | ||
test.ok(Math.abs(past.max(future).diff(past)) < eps, "A past date with the maximum of the future should be the past"); | ||
equalMoment(test, future.max(now), now, "A future date with the maximum of now should be now"); | ||
equalMoment(test, future.max(past), past, "A future date with the maximum of the past should be the past"); | ||
test.ok(Math.abs(future.max(now).diff(now)) < eps, "A future date with the maximum of now should be now"); | ||
test.ok(Math.abs(future.max().diff(now)) < eps, "A future date with the maximum of implied now should be now"); | ||
test.ok(Math.abs(future.max(past).diff(past)) < eps, "A future date with the maximum of the past should be the past"); | ||
equalMoment(test, now.max(past), past, "Now with the maximum of the past should be the past"); | ||
equalMoment(test, now.max(future), now, "Now with the maximum of the future should be now"); | ||
test.ok(Math.abs(now.max(past).diff(past)) < eps, "Now with the maximum of the past should be the past"); | ||
test.ok(Math.abs(now.max(future).diff(now)) < eps, "Now with the maximum of the future should be now"); | ||
test.done(); | ||
@@ -64,0 +56,0 @@ } |
@@ -90,3 +90,15 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"weekday with utc" : function (test) { | ||
test.expect(1); | ||
test.equal( | ||
moment('2013-09-15T00:00:00Z').utc().weekday(), // first minute of the day | ||
moment('2013-09-15T23:59:00Z').utc().weekday(), // last minute of the day | ||
"a UTC-moment's .weekday() should not be affected by the local timezone" | ||
); | ||
test.done(); | ||
} | ||
}; |
@@ -464,3 +464,19 @@ var moment = require("../../moment"); | ||
test.done(); | ||
}, | ||
"parse zone" : function (test) { | ||
test.expect(2); | ||
var m = moment("2013-01-01T00:00:00-13:00").parseZone(); | ||
test.equal(m.zone(), 13 * 60); | ||
test.equal(m.hours(), 0); | ||
test.done(); | ||
}, | ||
"parse zone static" : function (test) { | ||
test.expect(2); | ||
var m = moment.parseZone("2013-01-01T00:00:00-13:00"); | ||
test.equal(m.zone(), 13 * 60); | ||
test.equal(m.hours(), 0); | ||
test.done(); | ||
} | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
2360811
173
42048
280
2