diff --git a/component.json b/component.json index 8d83c1615a..3101237836 100644 --- a/component.json +++ b/component.json @@ -31,6 +31,7 @@ "locale/de.js", "locale/dv.js", "locale/el.js", + "locale/en-SG.js", "locale/en-au.js", "locale/en-ca.js", "locale/en-gb.js", @@ -50,6 +51,7 @@ "locale/fr-ch.js", "locale/fr.js", "locale/fy.js", + "locale/ga.js", "locale/gd.js", "locale/gl.js", "locale/gom-latn.js", @@ -61,6 +63,7 @@ "locale/hy-am.js", "locale/id.js", "locale/is.js", + "locale/it-ch.js", "locale/it.js", "locale/ja.js", "locale/jv.js", diff --git a/locale/cs.js b/locale/cs.js index 5ae9b627b8..bb9e3572d2 100644 --- a/locale/cs.js +++ b/locale/cs.js @@ -10,6 +10,12 @@ var months = 'leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec'.split('_'), monthsShort = 'led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro'.split('_'); + + var monthsParse = [/^led/i, /^úno/i, /^bře/i, /^dub/i, /^kvě/i, /^(čvn|červen$|června)/i, /^(čvc|červenec|července)/i, /^srp/i, /^zář/i, /^říj/i, /^lis/i, /^pro/i]; + // NOTE: 'červen' is substring of 'červenec'; therefore 'červenec' must precede 'červen' in the regex to be fully matched. + // Otherwise parser matches '1. červenec' as '1. červen' + 'ec'. + var monthsRegex = /^(leden|únor|březen|duben|květen|červenec|července|červen|června|srpen|září|říjen|listopad|prosinec|led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i; + function plural(n) { return (n > 1) && (n < 5) && (~~(n / 10) !== 1); } @@ -76,28 +82,15 @@ var cs = moment.defineLocale('cs', { months : months, monthsShort : monthsShort, - monthsParse : (function (months, monthsShort) { - var i, _monthsParse = []; - for (i = 0; i < 12; i++) { - // use custom parser to solve problem with July (červenec) - _monthsParse[i] = new RegExp('^' + months[i] + '$|^' + monthsShort[i] + '$', 'i'); - } - return _monthsParse; - }(months, monthsShort)), - shortMonthsParse : (function (monthsShort) { - var i, _shortMonthsParse = []; - for (i = 0; i < 12; i++) { - _shortMonthsParse[i] = new RegExp('^' + monthsShort[i] + '$', 'i'); - } - return _shortMonthsParse; - }(monthsShort)), - longMonthsParse : (function (months) { - var i, _longMonthsParse = []; - for (i = 0; i < 12; i++) { - _longMonthsParse[i] = new RegExp('^' + months[i] + '$', 'i'); - } - return _longMonthsParse; - }(months)), + monthsRegex : monthsRegex, + monthsShortRegex : monthsRegex, + // NOTE: 'červen' is substring of 'červenec'; therefore 'červenec' must precede 'červen' in the regex to be fully matched. + // Otherwise parser matches '1. červenec' as '1. červen' + 'ec'. + monthsStrictRegex : /^(leden|ledna|února|únor|březen|března|duben|dubna|květen|května|červenec|července|červen|června|srpen|srpna|září|říjen|října|listopadu|listopad|prosinec|prosince)/i, + monthsShortStrictRegex : /^(led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i, + monthsParse : monthsParse, + longMonthsParse : monthsParse, + shortMonthsParse : monthsParse, weekdays : 'neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota'.split('_'), weekdaysShort : 'ne_po_út_st_čt_pá_so'.split('_'), weekdaysMin : 'ne_po_út_st_čt_pá_so'.split('_'), diff --git a/locale/en-SG.js b/locale/en-SG.js new file mode 100644 index 0000000000..4c69f117d5 --- /dev/null +++ b/locale/en-SG.js @@ -0,0 +1,66 @@ +//! moment.js locale configuration + +;(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' + && typeof require === 'function' ? factory(require('../moment')) : + typeof define === 'function' && define.amd ? define(['../moment'], factory) : + factory(global.moment) +}(this, (function (moment) { 'use strict'; + + + var enSG = moment.defineLocale('en-SG', { + months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), + monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), + weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), + weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + longDateFormat : { + LT : 'HH:mm', + LTS : 'HH:mm:ss', + L : 'DD/MM/YYYY', + LL : 'D MMMM YYYY', + LLL : 'D MMMM YYYY HH:mm', + LLLL : 'dddd, D MMMM YYYY HH:mm' + }, + calendar : { + sameDay : '[Today at] LT', + nextDay : '[Tomorrow at] LT', + nextWeek : 'dddd [at] LT', + lastDay : '[Yesterday at] LT', + lastWeek : '[Last] dddd [at] LT', + sameElse : 'L' + }, + relativeTime : { + future : 'in %s', + past : '%s ago', + s : 'a few seconds', + ss : '%d 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' + }, + dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, + ordinal : function (number) { + var b = number % 10, + output = (~~(number % 100 / 10) === 1) ? 'th' : + (b === 1) ? 'st' : + (b === 2) ? 'nd' : + (b === 3) ? 'rd' : 'th'; + return number + output; + }, + week : { + dow : 1, // Monday is the first day of the week. + doy : 4 // The week that contains Jan 4th is the first week of the year. + } + }); + + return enSG; + +}))); diff --git a/locale/en-ie.js b/locale/en-ie.js index ede6c671a6..de0984cff1 100644 --- a/locale/en-ie.js +++ b/locale/en-ie.js @@ -17,7 +17,7 @@ longDateFormat : { LT : 'HH:mm', LTS : 'HH:mm:ss', - L : 'DD-MM-YYYY', + L : 'DD/MM/YYYY', LL : 'D MMMM YYYY', LLL : 'D MMMM YYYY HH:mm', LLLL : 'dddd D MMMM YYYY HH:mm' diff --git a/locale/es-us.js b/locale/es-us.js index 3a59ccbf98..8e07d077dd 100644 --- a/locale/es-us.js +++ b/locale/es-us.js @@ -11,6 +11,9 @@ var monthsShortDot = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split('_'), monthsShort = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'); + var monthsParse = [/^ene/i, /^feb/i, /^mar/i, /^abr/i, /^may/i, /^jun/i, /^jul/i, /^ago/i, /^sep/i, /^oct/i, /^nov/i, /^dic/i]; + var monthsRegex = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i; + var esUs = moment.defineLocale('es-us', { months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'), monthsShort : function (m, format) { @@ -22,7 +25,13 @@ return monthsShortDot[m.month()]; } }, - monthsParseExact : true, + monthsRegex: monthsRegex, + monthsShortRegex: monthsRegex, + monthsStrictRegex: /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i, + monthsShortStrictRegex: /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i, + monthsParse: monthsParse, + longMonthsParse: monthsParse, + shortMonthsParse: monthsParse, weekdays : 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'), weekdaysShort : 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'), weekdaysMin : 'do_lu_ma_mi_ju_vi_sá'.split('_'), @@ -31,9 +40,9 @@ LT : 'h:mm A', LTS : 'h:mm:ss A', L : 'MM/DD/YYYY', - LL : 'MMMM [de] D [de] YYYY', - LLL : 'MMMM [de] D [de] YYYY h:mm A', - LLLL : 'dddd, MMMM [de] D [de] YYYY h:mm A' + LL : 'D [de] MMMM [de] YYYY', + LLL : 'D [de] MMMM [de] YYYY h:mm A', + LLLL : 'dddd, D [de] MMMM [de] YYYY h:mm A' }, calendar : { sameDay : function () { diff --git a/locale/fo.js b/locale/fo.js index eac46d2be5..8e81cfe681 100644 --- a/locale/fo.js +++ b/locale/fo.js @@ -35,13 +35,13 @@ past : '%s síðani', s : 'fá sekund', ss : '%d sekundir', - m : 'ein minutt', + m : 'ein minuttur', mm : '%d minuttir', h : 'ein tími', hh : '%d tímar', d : 'ein dagur', dd : '%d dagar', - M : 'ein mánaði', + M : 'ein mánaður', MM : '%d mánaðir', y : 'eitt ár', yy : '%d ár' diff --git a/locale/ga.js b/locale/ga.js new file mode 100644 index 0000000000..a5b92de489 --- /dev/null +++ b/locale/ga.js @@ -0,0 +1,76 @@ +//! moment.js locale configuration + +;(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' + && typeof require === 'function' ? factory(require('../moment')) : + typeof define === 'function' && define.amd ? define(['../moment'], factory) : + factory(global.moment) +}(this, (function (moment) { 'use strict'; + + + + var months = [ + 'Eanáir', 'Feabhra', 'Márta', 'Aibreán', 'Bealtaine', 'Méitheamh', 'Iúil', 'Lúnasa', 'Meán Fómhair', 'Deaireadh Fómhair', 'Samhain', 'Nollaig' + ]; + + var monthsShort = ['Eaná', 'Feab', 'Márt', 'Aibr', 'Beal', 'Méit', 'Iúil', 'Lúna', 'Meán', 'Deai', 'Samh', 'Noll']; + + var weekdays = ['Dé Domhnaigh', 'Dé Luain', 'Dé Máirt', 'Dé Céadaoin', 'Déardaoin', 'Dé hAoine', 'Dé Satharn']; + + var weekdaysShort = ['Dom', 'Lua', 'Mái', 'Céa', 'Déa', 'hAo', 'Sat']; + + var weekdaysMin = ['Do', 'Lu', 'Má', 'Ce', 'Dé', 'hA', 'Sa']; + + var ga = moment.defineLocale('ga', { + months: months, + monthsShort: monthsShort, + monthsParseExact: true, + weekdays: weekdays, + weekdaysShort: weekdaysShort, + weekdaysMin: weekdaysMin, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm' + }, + calendar: { + sameDay: '[Inniu ag] LT', + nextDay: '[Amárach ag] LT', + nextWeek: 'dddd [ag] LT', + lastDay: '[Inné aig] LT', + lastWeek: 'dddd [seo caite] [ag] LT', + sameElse: 'L' + }, + relativeTime: { + future: 'i %s', + past: '%s ó shin', + s: 'cúpla soicind', + ss: '%d soicind', + m: 'nóiméad', + mm: '%d nóiméad', + h: 'uair an chloig', + hh: '%d uair an chloig', + d: 'lá', + dd: '%d lá', + M: 'mí', + MM: '%d mí', + y: 'bliain', + yy: '%d bliain' + }, + dayOfMonthOrdinalParse: /\d{1,2}(d|na|mh)/, + ordinal: function (number) { + var output = number === 1 ? 'd' : number % 10 === 2 ? 'na' : 'mh'; + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4 // The week that contains Jan 4th is the first week of the year. + } + }); + + return ga; + +}))); diff --git a/locale/gom-latn.js b/locale/gom-latn.js index f26f8f9cfb..bfad12e739 100644 --- a/locale/gom-latn.js +++ b/locale/gom-latn.js @@ -14,8 +14,8 @@ 'ss': [number + ' secondanim', number + ' second'], 'm': ['eka mintan', 'ek minute'], 'mm': [number + ' mintanim', number + ' mintam'], - 'h': ['eka horan', 'ek hor'], - 'hh': [number + ' horanim', number + ' horam'], + 'h': ['eka voran', 'ek vor'], + 'hh': [number + ' voranim', number + ' voram'], 'd': ['eka disan', 'ek dis'], 'dd': [number + ' disanim', number + ' dis'], 'M': ['eka mhoinean', 'ek mhoino'], diff --git a/locale/it-ch.js b/locale/it-ch.js new file mode 100644 index 0000000000..fcf2d4b03f --- /dev/null +++ b/locale/it-ch.js @@ -0,0 +1,68 @@ +//! moment.js locale configuration + +;(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' + && typeof require === 'function' ? factory(require('../moment')) : + typeof define === 'function' && define.amd ? define(['../moment'], factory) : + factory(global.moment) +}(this, (function (moment) { 'use strict'; + + + var itCh = moment.defineLocale('it-ch', { + months : 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'.split('_'), + monthsShort : 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'.split('_'), + weekdays : 'domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato'.split('_'), + weekdaysShort : 'dom_lun_mar_mer_gio_ven_sab'.split('_'), + weekdaysMin : 'do_lu_ma_me_gi_ve_sa'.split('_'), + longDateFormat : { + LT : 'HH:mm', + LTS : 'HH:mm:ss', + L : 'DD.MM.YYYY', + LL : 'D MMMM YYYY', + LLL : 'D MMMM YYYY HH:mm', + LLLL : 'dddd D MMMM YYYY HH:mm' + }, + calendar : { + sameDay: '[Oggi alle] LT', + nextDay: '[Domani alle] LT', + nextWeek: 'dddd [alle] LT', + lastDay: '[Ieri alle] LT', + lastWeek: function () { + switch (this.day()) { + case 0: + return '[la scorsa] dddd [alle] LT'; + default: + return '[lo scorso] dddd [alle] LT'; + } + }, + sameElse: 'L' + }, + relativeTime : { + future : function (s) { + return ((/^[0-9].+$/).test(s) ? 'tra' : 'in') + ' ' + s; + }, + past : '%s fa', + s : 'alcuni secondi', + ss : '%d secondi', + m : 'un minuto', + mm : '%d minuti', + h : 'un\'ora', + hh : '%d ore', + d : 'un giorno', + dd : '%d giorni', + M : 'un mese', + MM : '%d mesi', + y : 'un anno', + yy : '%d anni' + }, + dayOfMonthOrdinalParse : /\d{1,2}º/, + ordinal: '%dº', + week : { + dow : 1, // Monday is the first day of the week. + doy : 4 // The week that contains Jan 4th is the first week of the year. + } + }); + + return itCh; + +}))); diff --git a/locale/ja.js b/locale/ja.js index 5ec1be53b5..4e4efd6ae4 100644 --- a/locale/ja.js +++ b/locale/ja.js @@ -9,7 +9,7 @@ var ja = moment.defineLocale('ja', { - months : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), + months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), weekdays : '日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日'.split('_'), weekdaysShort : '日_月_火_水_木_金_土'.split('_'), diff --git a/locale/pt-br.js b/locale/pt-br.js index 64e0d01e7d..6cad5911c9 100644 --- a/locale/pt-br.js +++ b/locale/pt-br.js @@ -9,8 +9,8 @@ var ptBr = moment.defineLocale('pt-br', { - months : 'janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro'.split('_'), - monthsShort : 'jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez'.split('_'), + months : 'Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro'.split('_'), + monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'), weekdays : 'Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado'.split('_'), weekdaysShort : 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'), weekdaysMin : 'Do_2ª_3ª_4ª_5ª_6ª_Sá'.split('_'), diff --git a/locale/pt.js b/locale/pt.js index b21ac45b61..534f1c86f4 100644 --- a/locale/pt.js +++ b/locale/pt.js @@ -9,8 +9,8 @@ var pt = moment.defineLocale('pt', { - months : 'janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro'.split('_'), - monthsShort : 'jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez'.split('_'), + months : 'Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro'.split('_'), + monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'), weekdays : 'Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado'.split('_'), weekdaysShort : 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'), weekdaysMin : 'Do_2ª_3ª_4ª_5ª_6ª_Sá'.split('_'), diff --git a/locale/te.js b/locale/te.js index 824c873df5..abb40bf1f9 100644 --- a/locale/te.js +++ b/locale/te.js @@ -9,8 +9,8 @@ var te = moment.defineLocale('te', { - months : 'జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జూలై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్'.split('_'), - monthsShort : 'జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జూలై_ఆగ._సెప్._అక్టో._నవ._డిసె.'.split('_'), + months : 'జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జులై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్'.split('_'), + monthsShort : 'జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జులై_ఆగ._సెప్._అక్టో._నవ._డిసె.'.split('_'), monthsParseExact : true, weekdays : 'ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం'.split('_'), weekdaysShort : 'ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని'.split('_'), diff --git a/locale/uk.js b/locale/uk.js index 9072731193..70761a180a 100644 --- a/locale/uk.js +++ b/locale/uk.js @@ -38,6 +38,9 @@ 'genitive': 'неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи'.split('_') }; + if (m === true) { + return weekdays['nominative'].slice(1, 7).concat(weekdays['nominative'].slice(0, 1)); + } if (!m) { return weekdays['nominative']; } diff --git a/min/locales.js b/min/locales.js index cfedad1c6c..9b8b20617c 100644 --- a/min/locales.js +++ b/min/locales.js @@ -1445,6 +1445,12 @@ var months$2 = 'leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec'.split('_'), monthsShort = 'led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro'.split('_'); + + var monthsParse = [/^led/i, /^úno/i, /^bře/i, /^dub/i, /^kvě/i, /^(čvn|červen$|června)/i, /^(čvc|červenec|července)/i, /^srp/i, /^zář/i, /^říj/i, /^lis/i, /^pro/i]; + // NOTE: 'červen' is substring of 'červenec'; therefore 'červenec' must precede 'červen' in the regex to be fully matched. + // Otherwise parser matches '1. červenec' as '1. červen' + 'ec'. + var monthsRegex = /^(leden|únor|březen|duben|květen|červenec|července|červen|června|srpen|září|říjen|listopad|prosinec|led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i; + function plural$1(n) { return (n > 1) && (n < 5) && (~~(n / 10) !== 1); } @@ -1511,28 +1517,15 @@ moment.defineLocale('cs', { months : months$2, monthsShort : monthsShort, - monthsParse : (function (months, monthsShort) { - var i, _monthsParse = []; - for (i = 0; i < 12; i++) { - // use custom parser to solve problem with July (červenec) - _monthsParse[i] = new RegExp('^' + months[i] + '$|^' + monthsShort[i] + '$', 'i'); - } - return _monthsParse; - }(months$2, monthsShort)), - shortMonthsParse : (function (monthsShort) { - var i, _shortMonthsParse = []; - for (i = 0; i < 12; i++) { - _shortMonthsParse[i] = new RegExp('^' + monthsShort[i] + '$', 'i'); - } - return _shortMonthsParse; - }(monthsShort)), - longMonthsParse : (function (months) { - var i, _longMonthsParse = []; - for (i = 0; i < 12; i++) { - _longMonthsParse[i] = new RegExp('^' + months[i] + '$', 'i'); - } - return _longMonthsParse; - }(months$2)), + monthsRegex : monthsRegex, + monthsShortRegex : monthsRegex, + // NOTE: 'červen' is substring of 'červenec'; therefore 'červenec' must precede 'červen' in the regex to be fully matched. + // Otherwise parser matches '1. červenec' as '1. červen' + 'ec'. + monthsStrictRegex : /^(leden|ledna|února|únor|březen|března|duben|dubna|květen|května|červenec|července|červen|června|srpen|srpna|září|říjen|října|listopadu|listopad|prosinec|prosince)/i, + monthsShortStrictRegex : /^(led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i, + monthsParse : monthsParse, + longMonthsParse : monthsParse, + shortMonthsParse : monthsParse, weekdays : 'neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota'.split('_'), weekdaysShort : 'ne_po_út_st_čt_pá_so'.split('_'), weekdaysMin : 'ne_po_út_st_čt_pá_so'.split('_'), @@ -2144,6 +2137,61 @@ //! moment.js locale configuration + moment.defineLocale('en-SG', { + months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), + monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), + weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), + weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + longDateFormat : { + LT : 'HH:mm', + LTS : 'HH:mm:ss', + L : 'DD/MM/YYYY', + LL : 'D MMMM YYYY', + LLL : 'D MMMM YYYY HH:mm', + LLLL : 'dddd, D MMMM YYYY HH:mm' + }, + calendar : { + sameDay : '[Today at] LT', + nextDay : '[Tomorrow at] LT', + nextWeek : 'dddd [at] LT', + lastDay : '[Yesterday at] LT', + lastWeek : '[Last] dddd [at] LT', + sameElse : 'L' + }, + relativeTime : { + future : 'in %s', + past : '%s ago', + s : 'a few seconds', + ss : '%d 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' + }, + dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, + ordinal : function (number) { + var b = number % 10, + output = (~~(number % 100 / 10) === 1) ? 'th' : + (b === 1) ? 'st' : + (b === 2) ? 'nd' : + (b === 3) ? 'rd' : 'th'; + return number + output; + }, + week : { + dow : 1, // Monday is the first day of the week. + doy : 4 // The week that contains Jan 4th is the first week of the year. + } + }); + + //! moment.js locale configuration + moment.defineLocale('en-au', { months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), @@ -2314,7 +2362,7 @@ longDateFormat : { LT : 'HH:mm', LTS : 'HH:mm:ss', - L : 'DD-MM-YYYY', + L : 'DD/MM/YYYY', LL : 'D MMMM YYYY', LLL : 'D MMMM YYYY HH:mm', LLLL : 'dddd D MMMM YYYY HH:mm' @@ -2527,8 +2575,8 @@ var monthsShortDot = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split('_'), monthsShort$1 = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'); - var monthsParse = [/^ene/i, /^feb/i, /^mar/i, /^abr/i, /^may/i, /^jun/i, /^jul/i, /^ago/i, /^sep/i, /^oct/i, /^nov/i, /^dic/i]; - var monthsRegex = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i; + var monthsParse$1 = [/^ene/i, /^feb/i, /^mar/i, /^abr/i, /^may/i, /^jun/i, /^jul/i, /^ago/i, /^sep/i, /^oct/i, /^nov/i, /^dic/i]; + var monthsRegex$1 = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i; moment.defineLocale('es-do', { months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'), @@ -2541,13 +2589,13 @@ return monthsShortDot[m.month()]; } }, - monthsRegex: monthsRegex, - monthsShortRegex: monthsRegex, + monthsRegex: monthsRegex$1, + monthsShortRegex: monthsRegex$1, monthsStrictRegex: /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i, monthsShortStrictRegex: /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i, - monthsParse: monthsParse, - longMonthsParse: monthsParse, - shortMonthsParse: monthsParse, + monthsParse: monthsParse$1, + longMonthsParse: monthsParse$1, + shortMonthsParse: monthsParse$1, weekdays : 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'), weekdaysShort : 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'), weekdaysMin : 'do_lu_ma_mi_ju_vi_sá'.split('_'), @@ -2607,6 +2655,9 @@ var monthsShortDot$1 = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split('_'), monthsShort$2 = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'); + var monthsParse$2 = [/^ene/i, /^feb/i, /^mar/i, /^abr/i, /^may/i, /^jun/i, /^jul/i, /^ago/i, /^sep/i, /^oct/i, /^nov/i, /^dic/i]; + var monthsRegex$2 = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i; + moment.defineLocale('es-us', { months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'), monthsShort : function (m, format) { @@ -2618,7 +2669,13 @@ return monthsShortDot$1[m.month()]; } }, - monthsParseExact : true, + monthsRegex: monthsRegex$2, + monthsShortRegex: monthsRegex$2, + monthsStrictRegex: /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i, + monthsShortStrictRegex: /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i, + monthsParse: monthsParse$2, + longMonthsParse: monthsParse$2, + shortMonthsParse: monthsParse$2, weekdays : 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'), weekdaysShort : 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'), weekdaysMin : 'do_lu_ma_mi_ju_vi_sá'.split('_'), @@ -2627,9 +2684,9 @@ LT : 'h:mm A', LTS : 'h:mm:ss A', L : 'MM/DD/YYYY', - LL : 'MMMM [de] D [de] YYYY', - LLL : 'MMMM [de] D [de] YYYY h:mm A', - LLLL : 'dddd, MMMM [de] D [de] YYYY h:mm A' + LL : 'D [de] MMMM [de] YYYY', + LLL : 'D [de] MMMM [de] YYYY h:mm A', + LLLL : 'dddd, D [de] MMMM [de] YYYY h:mm A' }, calendar : { sameDay : function () { @@ -2678,8 +2735,8 @@ var monthsShortDot$2 = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split('_'), monthsShort$3 = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'); - var monthsParse$1 = [/^ene/i, /^feb/i, /^mar/i, /^abr/i, /^may/i, /^jun/i, /^jul/i, /^ago/i, /^sep/i, /^oct/i, /^nov/i, /^dic/i]; - var monthsRegex$1 = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i; + var monthsParse$3 = [/^ene/i, /^feb/i, /^mar/i, /^abr/i, /^may/i, /^jun/i, /^jul/i, /^ago/i, /^sep/i, /^oct/i, /^nov/i, /^dic/i]; + var monthsRegex$3 = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i; moment.defineLocale('es', { months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'), @@ -2692,13 +2749,13 @@ return monthsShortDot$2[m.month()]; } }, - monthsRegex : monthsRegex$1, - monthsShortRegex : monthsRegex$1, + monthsRegex : monthsRegex$3, + monthsShortRegex : monthsRegex$3, monthsStrictRegex : /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i, monthsShortStrictRegex : /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i, - monthsParse : monthsParse$1, - longMonthsParse : monthsParse$1, - shortMonthsParse : monthsParse$1, + monthsParse : monthsParse$3, + longMonthsParse : monthsParse$3, + shortMonthsParse : monthsParse$3, weekdays : 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'), weekdaysShort : 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'), weekdaysMin : 'do_lu_ma_mi_ju_vi_sá'.split('_'), @@ -3095,13 +3152,13 @@ past : '%s síðani', s : 'fá sekund', ss : '%d sekundir', - m : 'ein minutt', + m : 'ein minuttur', mm : '%d minuttir', h : 'ein tími', hh : '%d tímar', d : 'ein dagur', dd : '%d dagar', - M : 'ein mánaði', + M : 'ein mánaður', MM : '%d mánaðir', y : 'eitt ár', yy : '%d ár' @@ -3378,25 +3435,90 @@ //! moment.js locale configuration + var months$4 = [ + 'Eanáir', 'Feabhra', 'Márta', 'Aibreán', 'Bealtaine', 'Méitheamh', 'Iúil', 'Lúnasa', 'Meán Fómhair', 'Deaireadh Fómhair', 'Samhain', 'Nollaig' + ]; + + var monthsShort$4 = ['Eaná', 'Feab', 'Márt', 'Aibr', 'Beal', 'Méit', 'Iúil', 'Lúna', 'Meán', 'Deai', 'Samh', 'Noll']; + + var weekdays$1 = ['Dé Domhnaigh', 'Dé Luain', 'Dé Máirt', 'Dé Céadaoin', 'Déardaoin', 'Dé hAoine', 'Dé Satharn']; + + var weekdaysShort = ['Dom', 'Lua', 'Mái', 'Céa', 'Déa', 'hAo', 'Sat']; + + var weekdaysMin = ['Do', 'Lu', 'Má', 'Ce', 'Dé', 'hA', 'Sa']; + + moment.defineLocale('ga', { + months: months$4, + monthsShort: monthsShort$4, + monthsParseExact: true, + weekdays: weekdays$1, + weekdaysShort: weekdaysShort, + weekdaysMin: weekdaysMin, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm' + }, + calendar: { + sameDay: '[Inniu ag] LT', + nextDay: '[Amárach ag] LT', + nextWeek: 'dddd [ag] LT', + lastDay: '[Inné aig] LT', + lastWeek: 'dddd [seo caite] [ag] LT', + sameElse: 'L' + }, + relativeTime: { + future: 'i %s', + past: '%s ó shin', + s: 'cúpla soicind', + ss: '%d soicind', + m: 'nóiméad', + mm: '%d nóiméad', + h: 'uair an chloig', + hh: '%d uair an chloig', + d: 'lá', + dd: '%d lá', + M: 'mí', + MM: '%d mí', + y: 'bliain', + yy: '%d bliain' + }, + dayOfMonthOrdinalParse: /\d{1,2}(d|na|mh)/, + ordinal: function (number) { + var output = number === 1 ? 'd' : number % 10 === 2 ? 'na' : 'mh'; + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4 // The week that contains Jan 4th is the first week of the year. + } + }); + + //! moment.js locale configuration + + var months$5 = [ 'Am Faoilleach', 'An Gearran', 'Am Màrt', 'An Giblean', 'An Cèitean', 'An t-Ògmhios', 'An t-Iuchar', 'An Lùnastal', 'An t-Sultain', 'An Dàmhair', 'An t-Samhain', 'An Dùbhlachd' ]; - var monthsShort$4 = ['Faoi', 'Gear', 'Màrt', 'Gibl', 'Cèit', 'Ògmh', 'Iuch', 'Lùn', 'Sult', 'Dàmh', 'Samh', 'Dùbh']; + var monthsShort$5 = ['Faoi', 'Gear', 'Màrt', 'Gibl', 'Cèit', 'Ògmh', 'Iuch', 'Lùn', 'Sult', 'Dàmh', 'Samh', 'Dùbh']; - var weekdays$1 = ['Didòmhnaich', 'Diluain', 'Dimàirt', 'Diciadain', 'Diardaoin', 'Dihaoine', 'Disathairne']; + var weekdays$2 = ['Didòmhnaich', 'Diluain', 'Dimàirt', 'Diciadain', 'Diardaoin', 'Dihaoine', 'Disathairne']; - var weekdaysShort = ['Did', 'Dil', 'Dim', 'Dic', 'Dia', 'Dih', 'Dis']; + var weekdaysShort$1 = ['Did', 'Dil', 'Dim', 'Dic', 'Dia', 'Dih', 'Dis']; - var weekdaysMin = ['Dò', 'Lu', 'Mà', 'Ci', 'Ar', 'Ha', 'Sa']; + var weekdaysMin$1 = ['Dò', 'Lu', 'Mà', 'Ci', 'Ar', 'Ha', 'Sa']; moment.defineLocale('gd', { - months : months$4, - monthsShort : monthsShort$4, + months : months$5, + monthsShort : monthsShort$5, monthsParseExact : true, - weekdays : weekdays$1, - weekdaysShort : weekdaysShort, - weekdaysMin : weekdaysMin, + weekdays : weekdays$2, + weekdaysShort : weekdaysShort$1, + weekdaysMin : weekdaysMin$1, longDateFormat : { LT : 'HH:mm', LTS : 'HH:mm:ss', @@ -3513,8 +3635,8 @@ 'ss': [number + ' secondanim', number + ' second'], 'm': ['eka mintan', 'ek minute'], 'mm': [number + ' mintanim', number + ' mintam'], - 'h': ['eka horan', 'ek hor'], - 'hh': [number + ' horanim', number + ' horam'], + 'h': ['eka voran', 'ek vor'], + 'hh': [number + ' voranim', number + ' voram'], 'd': ['eka disan', 'ek dis'], 'dd': [number + ' disanim', number + ' dis'], 'M': ['eka mhoinean', 'ek mhoino'], @@ -4440,6 +4562,63 @@ //! moment.js locale configuration + moment.defineLocale('it-ch', { + months : 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'.split('_'), + monthsShort : 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'.split('_'), + weekdays : 'domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato'.split('_'), + weekdaysShort : 'dom_lun_mar_mer_gio_ven_sab'.split('_'), + weekdaysMin : 'do_lu_ma_me_gi_ve_sa'.split('_'), + longDateFormat : { + LT : 'HH:mm', + LTS : 'HH:mm:ss', + L : 'DD.MM.YYYY', + LL : 'D MMMM YYYY', + LLL : 'D MMMM YYYY HH:mm', + LLLL : 'dddd D MMMM YYYY HH:mm' + }, + calendar : { + sameDay: '[Oggi alle] LT', + nextDay: '[Domani alle] LT', + nextWeek: 'dddd [alle] LT', + lastDay: '[Ieri alle] LT', + lastWeek: function () { + switch (this.day()) { + case 0: + return '[la scorsa] dddd [alle] LT'; + default: + return '[lo scorso] dddd [alle] LT'; + } + }, + sameElse: 'L' + }, + relativeTime : { + future : function (s) { + return ((/^[0-9].+$/).test(s) ? 'tra' : 'in') + ' ' + s; + }, + past : '%s fa', + s : 'alcuni secondi', + ss : '%d secondi', + m : 'un minuto', + mm : '%d minuti', + h : 'un\'ora', + hh : '%d ore', + d : 'un giorno', + dd : '%d giorni', + M : 'un mese', + MM : '%d mesi', + y : 'un anno', + yy : '%d anni' + }, + dayOfMonthOrdinalParse : /\d{1,2}º/, + ordinal: '%dº', + week : { + dow : 1, // Monday is the first day of the week. + doy : 4 // The week that contains Jan 4th is the first week of the year. + } + }); + + //! moment.js locale configuration + moment.defineLocale('it', { months : 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'.split('_'), monthsShort : 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'.split('_'), @@ -4498,7 +4677,7 @@ //! moment.js locale configuration moment.defineLocale('ja', { - months : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), + months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), weekdays : '日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日'.split('_'), weekdaysShort : '日_月_火_水_木_金_土'.split('_'), @@ -5103,7 +5282,7 @@ '٩': '9', '٠': '0' }, - months$5 = [ + months$6 = [ 'کانونی دووەم', 'شوبات', 'ئازار', @@ -5120,8 +5299,8 @@ moment.defineLocale('ku', { - months : months$5, - monthsShort : months$5, + months : months$6, + monthsShort : months$6, weekdays : 'یه‌كشه‌ممه‌_دووشه‌ممه‌_سێشه‌ممه‌_چوارشه‌ممه‌_پێنجشه‌ممه‌_هه‌ینی_شه‌ممه‌'.split('_'), weekdaysShort : 'یه‌كشه‌م_دووشه‌م_سێشه‌م_چوارشه‌م_پێنجشه‌م_هه‌ینی_شه‌ممه‌'.split('_'), weekdaysMin : 'ی_د_س_چ_پ_ه_ش'.split('_'), @@ -6607,8 +6786,8 @@ var monthsShortWithDots$1 = 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'), monthsShortWithoutDots$1 = 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_'); - var monthsParse$2 = [/^jan/i, /^feb/i, /^maart|mrt.?$/i, /^apr/i, /^mei$/i, /^jun[i.]?$/i, /^jul[i.]?$/i, /^aug/i, /^sep/i, /^okt/i, /^nov/i, /^dec/i]; - var monthsRegex$2 = /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i; + var monthsParse$4 = [/^jan/i, /^feb/i, /^maart|mrt.?$/i, /^apr/i, /^mei$/i, /^jun[i.]?$/i, /^jul[i.]?$/i, /^aug/i, /^sep/i, /^okt/i, /^nov/i, /^dec/i]; + var monthsRegex$4 = /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i; moment.defineLocale('nl-be', { months : 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split('_'), @@ -6622,14 +6801,14 @@ } }, - monthsRegex: monthsRegex$2, - monthsShortRegex: monthsRegex$2, + monthsRegex: monthsRegex$4, + monthsShortRegex: monthsRegex$4, monthsStrictRegex: /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i, monthsShortStrictRegex: /^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i, - monthsParse : monthsParse$2, - longMonthsParse : monthsParse$2, - shortMonthsParse : monthsParse$2, + monthsParse : monthsParse$4, + longMonthsParse : monthsParse$4, + shortMonthsParse : monthsParse$4, weekdays : 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split('_'), weekdaysShort : 'zo._ma._di._wo._do._vr._za.'.split('_'), @@ -6682,8 +6861,8 @@ var monthsShortWithDots$2 = 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'), monthsShortWithoutDots$2 = 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_'); - var monthsParse$3 = [/^jan/i, /^feb/i, /^maart|mrt.?$/i, /^apr/i, /^mei$/i, /^jun[i.]?$/i, /^jul[i.]?$/i, /^aug/i, /^sep/i, /^okt/i, /^nov/i, /^dec/i]; - var monthsRegex$3 = /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i; + var monthsParse$5 = [/^jan/i, /^feb/i, /^maart|mrt.?$/i, /^apr/i, /^mei$/i, /^jun[i.]?$/i, /^jul[i.]?$/i, /^aug/i, /^sep/i, /^okt/i, /^nov/i, /^dec/i]; + var monthsRegex$5 = /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i; moment.defineLocale('nl', { months : 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split('_'), @@ -6697,14 +6876,14 @@ } }, - monthsRegex: monthsRegex$3, - monthsShortRegex: monthsRegex$3, + monthsRegex: monthsRegex$5, + monthsShortRegex: monthsRegex$5, monthsStrictRegex: /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i, monthsShortStrictRegex: /^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i, - monthsParse : monthsParse$3, - longMonthsParse : monthsParse$3, - shortMonthsParse : monthsParse$3, + monthsParse : monthsParse$5, + longMonthsParse : monthsParse$5, + shortMonthsParse : monthsParse$5, weekdays : 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split('_'), weekdaysShort : 'zo._ma._di._wo._do._vr._za.'.split('_'), @@ -7029,8 +7208,8 @@ //! moment.js locale configuration moment.defineLocale('pt-br', { - months : 'janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro'.split('_'), - monthsShort : 'jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez'.split('_'), + months : 'Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro'.split('_'), + monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'), weekdays : 'Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado'.split('_'), weekdaysShort : 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'), weekdaysMin : 'Do_2ª_3ª_4ª_5ª_6ª_Sá'.split('_'), @@ -7078,8 +7257,8 @@ //! moment.js locale configuration moment.defineLocale('pt', { - months : 'janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro'.split('_'), - monthsShort : 'jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez'.split('_'), + months : 'Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro'.split('_'), + monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'), weekdays : 'Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado'.split('_'), weekdaysShort : 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'), weekdaysMin : 'Do_2ª_3ª_4ª_5ª_6ª_Sá'.split('_'), @@ -7213,7 +7392,7 @@ return number + ' ' + plural$4(format[key], +number); } } - var monthsParse$4 = [/^янв/i, /^фев/i, /^мар/i, /^апр/i, /^ма[йя]/i, /^июн/i, /^июл/i, /^авг/i, /^сен/i, /^окт/i, /^ноя/i, /^дек/i]; + var monthsParse$6 = [/^янв/i, /^фев/i, /^мар/i, /^апр/i, /^ма[йя]/i, /^июн/i, /^июл/i, /^авг/i, /^сен/i, /^окт/i, /^ноя/i, /^дек/i]; // http://new.gramota.ru/spravka/rules/139-prop : § 103 // Сокращения месяцев: http://new.gramota.ru/spravka/buro/search-answer?s=242637 @@ -7235,9 +7414,9 @@ }, weekdaysShort : 'вс_пн_вт_ср_чт_пт_сб'.split('_'), weekdaysMin : 'вс_пн_вт_ср_чт_пт_сб'.split('_'), - monthsParse : monthsParse$4, - longMonthsParse : monthsParse$4, - shortMonthsParse : monthsParse$4, + monthsParse : monthsParse$6, + longMonthsParse : monthsParse$6, + shortMonthsParse : monthsParse$6, // полные названия с падежами, по три буквы, для некоторых, по 4 буквы, сокращения с точкой и без точки monthsRegex: /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i, @@ -7363,7 +7542,7 @@ //! moment.js locale configuration - var months$6 = [ + var months$7 = [ 'جنوري', 'فيبروري', 'مارچ', @@ -7388,8 +7567,8 @@ ]; moment.defineLocale('sd', { - months : months$6, - monthsShort : months$6, + months : months$7, + monthsShort : months$7, weekdays : days, weekdaysShort : days, weekdaysMin : days, @@ -7556,8 +7735,8 @@ //! moment.js locale configuration - var months$7 = 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split('_'), - monthsShort$5 = 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_'); + var months$8 = 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split('_'), + monthsShort$6 = 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_'); function plural$5(n) { return (n > 1) && (n < 5); } @@ -7622,8 +7801,8 @@ } moment.defineLocale('sk', { - months : months$7, - monthsShort : monthsShort$5, + months : months$8, + monthsShort : monthsShort$6, weekdays : 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'), weekdaysShort : 'ne_po_ut_st_št_pi_so'.split('_'), weekdaysMin : 'ne_po_ut_st_št_pi_so'.split('_'), @@ -8413,8 +8592,8 @@ //! moment.js locale configuration moment.defineLocale('te', { - months : 'జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జూలై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్'.split('_'), - monthsShort : 'జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జూలై_ఆగ._సెప్._అక్టో._నవ._డిసె.'.split('_'), + months : 'జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జులై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్'.split('_'), + monthsShort : 'జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జులై_ఆగ._సెప్._అక్టో._నవ._డిసె.'.split('_'), monthsParseExact : true, weekdays : 'ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం'.split('_'), weekdaysShort : 'ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని'.split('_'), @@ -9253,6 +9432,9 @@ 'genitive': 'неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи'.split('_') }; + if (m === true) { + return weekdays['nominative'].slice(1, 7).concat(weekdays['nominative'].slice(0, 1)); + } if (!m) { return weekdays['nominative']; } @@ -9362,7 +9544,7 @@ //! moment.js locale configuration - var months$8 = [ + var months$9 = [ 'جنوری', 'فروری', 'مارچ', @@ -9387,8 +9569,8 @@ ]; moment.defineLocale('ur', { - months : months$8, - monthsShort : months$8, + months : months$9, + monthsShort : months$9, weekdays : days$1, weekdaysShort : days$1, weekdaysMin : days$1, diff --git a/min/locales.min.js b/min/locales.min.js index 740681c58a..c5c3475987 100644 --- a/min/locales.min.js +++ b/min/locales.min.js @@ -1 +1 @@ -!function(e,a){"object"==typeof exports&&"undefined"!=typeof module&&"function"==typeof require?a(require("../moment")):"function"==typeof define&&define.amd?define(["../moment"],a):a(e.moment)}(this,function(e){"use strict";e.defineLocale("af",{months:"Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mrt_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des".split("_"),weekdays:"Sondag_Maandag_Dinsdag_Woensdag_Donderdag_Vrydag_Saterdag".split("_"),weekdaysShort:"Son_Maa_Din_Woe_Don_Vry_Sat".split("_"),weekdaysMin:"So_Ma_Di_Wo_Do_Vr_Sa".split("_"),meridiemParse:/vm|nm/i,isPM:function(e){return/^nm$/i.test(e)},meridiem:function(e,a,_){return e<12?_?"vm":"VM":_?"nm":"NM"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Vandag om] LT",nextDay:"[M\xf4re om] LT",nextWeek:"dddd [om] LT",lastDay:"[Gister om] LT",lastWeek:"[Laas] dddd [om] LT",sameElse:"L"},relativeTime:{future:"oor %s",past:"%s gelede",s:"'n paar sekondes",ss:"%d sekondes",m:"'n minuut",mm:"%d minute",h:"'n uur",hh:"%d ure",d:"'n dag",dd:"%d dae",M:"'n maand",MM:"%d maande",y:"'n jaar",yy:"%d jaar"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(e){return e+(1===e||8===e||20<=e?"ste":"de")},week:{dow:1,doy:4}}),e.defineLocale("ar-dz",{months:"\u062c\u0627\u0646\u0641\u064a_\u0641\u064a\u0641\u0631\u064a_\u0645\u0627\u0631\u0633_\u0623\u0641\u0631\u064a\u0644_\u0645\u0627\u064a_\u062c\u0648\u0627\u0646_\u062c\u0648\u064a\u0644\u064a\u0629_\u0623\u0648\u062a_\u0633\u0628\u062a\u0645\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0641\u0645\u0628\u0631_\u062f\u064a\u0633\u0645\u0628\u0631".split("_"),monthsShort:"\u062c\u0627\u0646\u0641\u064a_\u0641\u064a\u0641\u0631\u064a_\u0645\u0627\u0631\u0633_\u0623\u0641\u0631\u064a\u0644_\u0645\u0627\u064a_\u062c\u0648\u0627\u0646_\u062c\u0648\u064a\u0644\u064a\u0629_\u0623\u0648\u062a_\u0633\u0628\u062a\u0645\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0641\u0645\u0628\u0631_\u062f\u064a\u0633\u0645\u0628\u0631".split("_"),weekdays:"\u0627\u0644\u0623\u062d\u062f_\u0627\u0644\u0625\u062b\u0646\u064a\u0646_\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621_\u0627\u0644\u062e\u0645\u064a\u0633_\u0627\u0644\u062c\u0645\u0639\u0629_\u0627\u0644\u0633\u0628\u062a".split("_"),weekdaysShort:"\u0627\u062d\u062f_\u0627\u062b\u0646\u064a\u0646_\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0631\u0628\u0639\u0627\u0621_\u062e\u0645\u064a\u0633_\u062c\u0645\u0639\u0629_\u0633\u0628\u062a".split("_"),weekdaysMin:"\u0623\u062d_\u0625\u062b_\u062b\u0644\u0627_\u0623\u0631_\u062e\u0645_\u062c\u0645_\u0633\u0628".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[\u0627\u0644\u064a\u0648\u0645 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextDay:"[\u063a\u062f\u0627 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastDay:"[\u0623\u0645\u0633 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",sameElse:"L"},relativeTime:{future:"\u0641\u064a %s",past:"\u0645\u0646\u0630 %s",s:"\u062b\u0648\u0627\u0646",ss:"%d \u062b\u0627\u0646\u064a\u0629",m:"\u062f\u0642\u064a\u0642\u0629",mm:"%d \u062f\u0642\u0627\u0626\u0642",h:"\u0633\u0627\u0639\u0629",hh:"%d \u0633\u0627\u0639\u0627\u062a",d:"\u064a\u0648\u0645",dd:"%d \u0623\u064a\u0627\u0645",M:"\u0634\u0647\u0631",MM:"%d \u0623\u0634\u0647\u0631",y:"\u0633\u0646\u0629",yy:"%d \u0633\u0646\u0648\u0627\u062a"},week:{dow:0,doy:4}}),e.defineLocale("ar-kw",{months:"\u064a\u0646\u0627\u064a\u0631_\u0641\u0628\u0631\u0627\u064a\u0631_\u0645\u0627\u0631\u0633_\u0623\u0628\u0631\u064a\u0644_\u0645\u0627\u064a_\u064a\u0648\u0646\u064a\u0648_\u064a\u0648\u0644\u064a\u0648\u0632_\u063a\u0634\u062a_\u0634\u062a\u0646\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0646\u0628\u0631_\u062f\u062c\u0646\u0628\u0631".split("_"),monthsShort:"\u064a\u0646\u0627\u064a\u0631_\u0641\u0628\u0631\u0627\u064a\u0631_\u0645\u0627\u0631\u0633_\u0623\u0628\u0631\u064a\u0644_\u0645\u0627\u064a_\u064a\u0648\u0646\u064a\u0648_\u064a\u0648\u0644\u064a\u0648\u0632_\u063a\u0634\u062a_\u0634\u062a\u0646\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0646\u0628\u0631_\u062f\u062c\u0646\u0628\u0631".split("_"),weekdays:"\u0627\u0644\u0623\u062d\u062f_\u0627\u0644\u0625\u062a\u0646\u064a\u0646_\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621_\u0627\u0644\u062e\u0645\u064a\u0633_\u0627\u0644\u062c\u0645\u0639\u0629_\u0627\u0644\u0633\u0628\u062a".split("_"),weekdaysShort:"\u0627\u062d\u062f_\u0627\u062a\u0646\u064a\u0646_\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0631\u0628\u0639\u0627\u0621_\u062e\u0645\u064a\u0633_\u062c\u0645\u0639\u0629_\u0633\u0628\u062a".split("_"),weekdaysMin:"\u062d_\u0646_\u062b_\u0631_\u062e_\u062c_\u0633".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[\u0627\u0644\u064a\u0648\u0645 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextDay:"[\u063a\u062f\u0627 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastDay:"[\u0623\u0645\u0633 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",sameElse:"L"},relativeTime:{future:"\u0641\u064a %s",past:"\u0645\u0646\u0630 %s",s:"\u062b\u0648\u0627\u0646",ss:"%d \u062b\u0627\u0646\u064a\u0629",m:"\u062f\u0642\u064a\u0642\u0629",mm:"%d \u062f\u0642\u0627\u0626\u0642",h:"\u0633\u0627\u0639\u0629",hh:"%d \u0633\u0627\u0639\u0627\u062a",d:"\u064a\u0648\u0645",dd:"%d \u0623\u064a\u0627\u0645",M:"\u0634\u0647\u0631",MM:"%d \u0623\u0634\u0647\u0631",y:"\u0633\u0646\u0629",yy:"%d \u0633\u0646\u0648\u0627\u062a"},week:{dow:0,doy:12}});var a={1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",0:"0"},r=function(e){return 0===e?0:1===e?1:2===e?2:3<=e%100&&e%100<=10?3:11<=e%100?4:5},i={s:["\u0623\u0642\u0644 \u0645\u0646 \u062b\u0627\u0646\u064a\u0629","\u062b\u0627\u0646\u064a\u0629 \u0648\u0627\u062d\u062f\u0629",["\u062b\u0627\u0646\u064a\u062a\u0627\u0646","\u062b\u0627\u0646\u064a\u062a\u064a\u0646"],"%d \u062b\u0648\u0627\u0646","%d \u062b\u0627\u0646\u064a\u0629","%d \u062b\u0627\u0646\u064a\u0629"],m:["\u0623\u0642\u0644 \u0645\u0646 \u062f\u0642\u064a\u0642\u0629","\u062f\u0642\u064a\u0642\u0629 \u0648\u0627\u062d\u062f\u0629",["\u062f\u0642\u064a\u0642\u062a\u0627\u0646","\u062f\u0642\u064a\u0642\u062a\u064a\u0646"],"%d \u062f\u0642\u0627\u0626\u0642","%d \u062f\u0642\u064a\u0642\u0629","%d \u062f\u0642\u064a\u0642\u0629"],h:["\u0623\u0642\u0644 \u0645\u0646 \u0633\u0627\u0639\u0629","\u0633\u0627\u0639\u0629 \u0648\u0627\u062d\u062f\u0629",["\u0633\u0627\u0639\u062a\u0627\u0646","\u0633\u0627\u0639\u062a\u064a\u0646"],"%d \u0633\u0627\u0639\u0627\u062a","%d \u0633\u0627\u0639\u0629","%d \u0633\u0627\u0639\u0629"],d:["\u0623\u0642\u0644 \u0645\u0646 \u064a\u0648\u0645","\u064a\u0648\u0645 \u0648\u0627\u062d\u062f",["\u064a\u0648\u0645\u0627\u0646","\u064a\u0648\u0645\u064a\u0646"],"%d \u0623\u064a\u0627\u0645","%d \u064a\u0648\u0645\u064b\u0627","%d \u064a\u0648\u0645"],M:["\u0623\u0642\u0644 \u0645\u0646 \u0634\u0647\u0631","\u0634\u0647\u0631 \u0648\u0627\u062d\u062f",["\u0634\u0647\u0631\u0627\u0646","\u0634\u0647\u0631\u064a\u0646"],"%d \u0623\u0634\u0647\u0631","%d \u0634\u0647\u0631\u0627","%d \u0634\u0647\u0631"],y:["\u0623\u0642\u0644 \u0645\u0646 \u0639\u0627\u0645","\u0639\u0627\u0645 \u0648\u0627\u062d\u062f",["\u0639\u0627\u0645\u0627\u0646","\u0639\u0627\u0645\u064a\u0646"],"%d \u0623\u0639\u0648\u0627\u0645","%d \u0639\u0627\u0645\u064b\u0627","%d \u0639\u0627\u0645"]},_=function(n){return function(e,a,_,s){var d=r(e),t=i[n][r(e)];return 2===d&&(t=t[a?0:1]),t.replace(/%d/i,e)}},s=["\u064a\u0646\u0627\u064a\u0631","\u0641\u0628\u0631\u0627\u064a\u0631","\u0645\u0627\u0631\u0633","\u0623\u0628\u0631\u064a\u0644","\u0645\u0627\u064a\u0648","\u064a\u0648\u0646\u064a\u0648","\u064a\u0648\u0644\u064a\u0648","\u0623\u063a\u0633\u0637\u0633","\u0633\u0628\u062a\u0645\u0628\u0631","\u0623\u0643\u062a\u0648\u0628\u0631","\u0646\u0648\u0641\u0645\u0628\u0631","\u062f\u064a\u0633\u0645\u0628\u0631"];e.defineLocale("ar-ly",{months:s,monthsShort:s,weekdays:"\u0627\u0644\u0623\u062d\u062f_\u0627\u0644\u0625\u062b\u0646\u064a\u0646_\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621_\u0627\u0644\u062e\u0645\u064a\u0633_\u0627\u0644\u062c\u0645\u0639\u0629_\u0627\u0644\u0633\u0628\u062a".split("_"),weekdaysShort:"\u0623\u062d\u062f_\u0625\u062b\u0646\u064a\u0646_\u062b\u0644\u0627\u062b\u0627\u0621_\u0623\u0631\u0628\u0639\u0627\u0621_\u062e\u0645\u064a\u0633_\u062c\u0645\u0639\u0629_\u0633\u0628\u062a".split("_"),weekdaysMin:"\u062d_\u0646_\u062b_\u0631_\u062e_\u062c_\u0633".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/\u200fM/\u200fYYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/\u0635|\u0645/,isPM:function(e){return"\u0645"===e},meridiem:function(e,a,_){return e<12?"\u0635":"\u0645"},calendar:{sameDay:"[\u0627\u0644\u064a\u0648\u0645 \u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextDay:"[\u063a\u062f\u064b\u0627 \u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextWeek:"dddd [\u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastDay:"[\u0623\u0645\u0633 \u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastWeek:"dddd [\u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",sameElse:"L"},relativeTime:{future:"\u0628\u0639\u062f %s",past:"\u0645\u0646\u0630 %s",s:_("s"),ss:_("s"),m:_("m"),mm:_("m"),h:_("h"),hh:_("h"),d:_("d"),dd:_("d"),M:_("M"),MM:_("M"),y:_("y"),yy:_("y")},preparse:function(e){return e.replace(/\u060c/g,",")},postformat:function(e){return e.replace(/\d/g,function(e){return a[e]}).replace(/,/g,"\u060c")},week:{dow:6,doy:12}}),e.defineLocale("ar-ma",{months:"\u064a\u0646\u0627\u064a\u0631_\u0641\u0628\u0631\u0627\u064a\u0631_\u0645\u0627\u0631\u0633_\u0623\u0628\u0631\u064a\u0644_\u0645\u0627\u064a_\u064a\u0648\u0646\u064a\u0648_\u064a\u0648\u0644\u064a\u0648\u0632_\u063a\u0634\u062a_\u0634\u062a\u0646\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0646\u0628\u0631_\u062f\u062c\u0646\u0628\u0631".split("_"),monthsShort:"\u064a\u0646\u0627\u064a\u0631_\u0641\u0628\u0631\u0627\u064a\u0631_\u0645\u0627\u0631\u0633_\u0623\u0628\u0631\u064a\u0644_\u0645\u0627\u064a_\u064a\u0648\u0646\u064a\u0648_\u064a\u0648\u0644\u064a\u0648\u0632_\u063a\u0634\u062a_\u0634\u062a\u0646\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0646\u0628\u0631_\u062f\u062c\u0646\u0628\u0631".split("_"),weekdays:"\u0627\u0644\u0623\u062d\u062f_\u0627\u0644\u0625\u062a\u0646\u064a\u0646_\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621_\u0627\u0644\u062e\u0645\u064a\u0633_\u0627\u0644\u062c\u0645\u0639\u0629_\u0627\u0644\u0633\u0628\u062a".split("_"),weekdaysShort:"\u0627\u062d\u062f_\u0627\u062a\u0646\u064a\u0646_\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0631\u0628\u0639\u0627\u0621_\u062e\u0645\u064a\u0633_\u062c\u0645\u0639\u0629_\u0633\u0628\u062a".split("_"),weekdaysMin:"\u062d_\u0646_\u062b_\u0631_\u062e_\u062c_\u0633".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[\u0627\u0644\u064a\u0648\u0645 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextDay:"[\u063a\u062f\u0627 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastDay:"[\u0623\u0645\u0633 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",sameElse:"L"},relativeTime:{future:"\u0641\u064a %s",past:"\u0645\u0646\u0630 %s",s:"\u062b\u0648\u0627\u0646",ss:"%d \u062b\u0627\u0646\u064a\u0629",m:"\u062f\u0642\u064a\u0642\u0629",mm:"%d \u062f\u0642\u0627\u0626\u0642",h:"\u0633\u0627\u0639\u0629",hh:"%d \u0633\u0627\u0639\u0627\u062a",d:"\u064a\u0648\u0645",dd:"%d \u0623\u064a\u0627\u0645",M:"\u0634\u0647\u0631",MM:"%d \u0623\u0634\u0647\u0631",y:"\u0633\u0646\u0629",yy:"%d \u0633\u0646\u0648\u0627\u062a"},week:{dow:6,doy:12}});var d={1:"\u0661",2:"\u0662",3:"\u0663",4:"\u0664",5:"\u0665",6:"\u0666",7:"\u0667",8:"\u0668",9:"\u0669",0:"\u0660"},t={"\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u0660":"0"};e.defineLocale("ar-sa",{months:"\u064a\u0646\u0627\u064a\u0631_\u0641\u0628\u0631\u0627\u064a\u0631_\u0645\u0627\u0631\u0633_\u0623\u0628\u0631\u064a\u0644_\u0645\u0627\u064a\u0648_\u064a\u0648\u0646\u064a\u0648_\u064a\u0648\u0644\u064a\u0648_\u0623\u063a\u0633\u0637\u0633_\u0633\u0628\u062a\u0645\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0641\u0645\u0628\u0631_\u062f\u064a\u0633\u0645\u0628\u0631".split("_"),monthsShort:"\u064a\u0646\u0627\u064a\u0631_\u0641\u0628\u0631\u0627\u064a\u0631_\u0645\u0627\u0631\u0633_\u0623\u0628\u0631\u064a\u0644_\u0645\u0627\u064a\u0648_\u064a\u0648\u0646\u064a\u0648_\u064a\u0648\u0644\u064a\u0648_\u0623\u063a\u0633\u0637\u0633_\u0633\u0628\u062a\u0645\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0641\u0645\u0628\u0631_\u062f\u064a\u0633\u0645\u0628\u0631".split("_"),weekdays:"\u0627\u0644\u0623\u062d\u062f_\u0627\u0644\u0625\u062b\u0646\u064a\u0646_\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621_\u0627\u0644\u062e\u0645\u064a\u0633_\u0627\u0644\u062c\u0645\u0639\u0629_\u0627\u0644\u0633\u0628\u062a".split("_"),weekdaysShort:"\u0623\u062d\u062f_\u0625\u062b\u0646\u064a\u0646_\u062b\u0644\u0627\u062b\u0627\u0621_\u0623\u0631\u0628\u0639\u0627\u0621_\u062e\u0645\u064a\u0633_\u062c\u0645\u0639\u0629_\u0633\u0628\u062a".split("_"),weekdaysMin:"\u062d_\u0646_\u062b_\u0631_\u062e_\u062c_\u0633".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/\u0635|\u0645/,isPM:function(e){return"\u0645"===e},meridiem:function(e,a,_){return e<12?"\u0635":"\u0645"},calendar:{sameDay:"[\u0627\u0644\u064a\u0648\u0645 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextDay:"[\u063a\u062f\u0627 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastDay:"[\u0623\u0645\u0633 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",sameElse:"L"},relativeTime:{future:"\u0641\u064a %s",past:"\u0645\u0646\u0630 %s",s:"\u062b\u0648\u0627\u0646",ss:"%d \u062b\u0627\u0646\u064a\u0629",m:"\u062f\u0642\u064a\u0642\u0629",mm:"%d \u062f\u0642\u0627\u0626\u0642",h:"\u0633\u0627\u0639\u0629",hh:"%d \u0633\u0627\u0639\u0627\u062a",d:"\u064a\u0648\u0645",dd:"%d \u0623\u064a\u0627\u0645",M:"\u0634\u0647\u0631",MM:"%d \u0623\u0634\u0647\u0631",y:"\u0633\u0646\u0629",yy:"%d \u0633\u0646\u0648\u0627\u062a"},preparse:function(e){return e.replace(/[\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\u0660]/g,function(e){return t[e]}).replace(/\u060c/g,",")},postformat:function(e){return e.replace(/\d/g,function(e){return d[e]}).replace(/,/g,"\u060c")},week:{dow:0,doy:6}}),e.defineLocale("ar-tn",{months:"\u062c\u0627\u0646\u0641\u064a_\u0641\u064a\u0641\u0631\u064a_\u0645\u0627\u0631\u0633_\u0623\u0641\u0631\u064a\u0644_\u0645\u0627\u064a_\u062c\u0648\u0627\u0646_\u062c\u0648\u064a\u0644\u064a\u0629_\u0623\u0648\u062a_\u0633\u0628\u062a\u0645\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0641\u0645\u0628\u0631_\u062f\u064a\u0633\u0645\u0628\u0631".split("_"),monthsShort:"\u062c\u0627\u0646\u0641\u064a_\u0641\u064a\u0641\u0631\u064a_\u0645\u0627\u0631\u0633_\u0623\u0641\u0631\u064a\u0644_\u0645\u0627\u064a_\u062c\u0648\u0627\u0646_\u062c\u0648\u064a\u0644\u064a\u0629_\u0623\u0648\u062a_\u0633\u0628\u062a\u0645\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0641\u0645\u0628\u0631_\u062f\u064a\u0633\u0645\u0628\u0631".split("_"),weekdays:"\u0627\u0644\u0623\u062d\u062f_\u0627\u0644\u0625\u062b\u0646\u064a\u0646_\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621_\u0627\u0644\u062e\u0645\u064a\u0633_\u0627\u0644\u062c\u0645\u0639\u0629_\u0627\u0644\u0633\u0628\u062a".split("_"),weekdaysShort:"\u0623\u062d\u062f_\u0625\u062b\u0646\u064a\u0646_\u062b\u0644\u0627\u062b\u0627\u0621_\u0623\u0631\u0628\u0639\u0627\u0621_\u062e\u0645\u064a\u0633_\u062c\u0645\u0639\u0629_\u0633\u0628\u062a".split("_"),weekdaysMin:"\u062d_\u0646_\u062b_\u0631_\u062e_\u062c_\u0633".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[\u0627\u0644\u064a\u0648\u0645 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextDay:"[\u063a\u062f\u0627 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastDay:"[\u0623\u0645\u0633 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",sameElse:"L"},relativeTime:{future:"\u0641\u064a %s",past:"\u0645\u0646\u0630 %s",s:"\u062b\u0648\u0627\u0646",ss:"%d \u062b\u0627\u0646\u064a\u0629",m:"\u062f\u0642\u064a\u0642\u0629",mm:"%d \u062f\u0642\u0627\u0626\u0642",h:"\u0633\u0627\u0639\u0629",hh:"%d \u0633\u0627\u0639\u0627\u062a",d:"\u064a\u0648\u0645",dd:"%d \u0623\u064a\u0627\u0645",M:"\u0634\u0647\u0631",MM:"%d \u0623\u0634\u0647\u0631",y:"\u0633\u0646\u0629",yy:"%d \u0633\u0646\u0648\u0627\u062a"},week:{dow:1,doy:4}});var n={1:"\u0661",2:"\u0662",3:"\u0663",4:"\u0664",5:"\u0665",6:"\u0666",7:"\u0667",8:"\u0668",9:"\u0669",0:"\u0660"},m={"\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u0660":"0"},o=function(e){return 0===e?0:1===e?1:2===e?2:3<=e%100&&e%100<=10?3:11<=e%100?4:5},u={s:["\u0623\u0642\u0644 \u0645\u0646 \u062b\u0627\u0646\u064a\u0629","\u062b\u0627\u0646\u064a\u0629 \u0648\u0627\u062d\u062f\u0629",["\u062b\u0627\u0646\u064a\u062a\u0627\u0646","\u062b\u0627\u0646\u064a\u062a\u064a\u0646"],"%d \u062b\u0648\u0627\u0646","%d \u062b\u0627\u0646\u064a\u0629","%d \u062b\u0627\u0646\u064a\u0629"],m:["\u0623\u0642\u0644 \u0645\u0646 \u062f\u0642\u064a\u0642\u0629","\u062f\u0642\u064a\u0642\u0629 \u0648\u0627\u062d\u062f\u0629",["\u062f\u0642\u064a\u0642\u062a\u0627\u0646","\u062f\u0642\u064a\u0642\u062a\u064a\u0646"],"%d \u062f\u0642\u0627\u0626\u0642","%d \u062f\u0642\u064a\u0642\u0629","%d \u062f\u0642\u064a\u0642\u0629"],h:["\u0623\u0642\u0644 \u0645\u0646 \u0633\u0627\u0639\u0629","\u0633\u0627\u0639\u0629 \u0648\u0627\u062d\u062f\u0629",["\u0633\u0627\u0639\u062a\u0627\u0646","\u0633\u0627\u0639\u062a\u064a\u0646"],"%d \u0633\u0627\u0639\u0627\u062a","%d \u0633\u0627\u0639\u0629","%d \u0633\u0627\u0639\u0629"],d:["\u0623\u0642\u0644 \u0645\u0646 \u064a\u0648\u0645","\u064a\u0648\u0645 \u0648\u0627\u062d\u062f",["\u064a\u0648\u0645\u0627\u0646","\u064a\u0648\u0645\u064a\u0646"],"%d \u0623\u064a\u0627\u0645","%d \u064a\u0648\u0645\u064b\u0627","%d \u064a\u0648\u0645"],M:["\u0623\u0642\u0644 \u0645\u0646 \u0634\u0647\u0631","\u0634\u0647\u0631 \u0648\u0627\u062d\u062f",["\u0634\u0647\u0631\u0627\u0646","\u0634\u0647\u0631\u064a\u0646"],"%d \u0623\u0634\u0647\u0631","%d \u0634\u0647\u0631\u0627","%d \u0634\u0647\u0631"],y:["\u0623\u0642\u0644 \u0645\u0646 \u0639\u0627\u0645","\u0639\u0627\u0645 \u0648\u0627\u062d\u062f",["\u0639\u0627\u0645\u0627\u0646","\u0639\u0627\u0645\u064a\u0646"],"%d \u0623\u0639\u0648\u0627\u0645","%d \u0639\u0627\u0645\u064b\u0627","%d \u0639\u0627\u0645"]},l=function(n){return function(e,a,_,s){var d=o(e),t=u[n][o(e)];return 2===d&&(t=t[a?0:1]),t.replace(/%d/i,e)}},M=["\u064a\u0646\u0627\u064a\u0631","\u0641\u0628\u0631\u0627\u064a\u0631","\u0645\u0627\u0631\u0633","\u0623\u0628\u0631\u064a\u0644","\u0645\u0627\u064a\u0648","\u064a\u0648\u0646\u064a\u0648","\u064a\u0648\u0644\u064a\u0648","\u0623\u063a\u0633\u0637\u0633","\u0633\u0628\u062a\u0645\u0628\u0631","\u0623\u0643\u062a\u0648\u0628\u0631","\u0646\u0648\u0641\u0645\u0628\u0631","\u062f\u064a\u0633\u0645\u0628\u0631"];e.defineLocale("ar",{months:M,monthsShort:M,weekdays:"\u0627\u0644\u0623\u062d\u062f_\u0627\u0644\u0625\u062b\u0646\u064a\u0646_\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621_\u0627\u0644\u062e\u0645\u064a\u0633_\u0627\u0644\u062c\u0645\u0639\u0629_\u0627\u0644\u0633\u0628\u062a".split("_"),weekdaysShort:"\u0623\u062d\u062f_\u0625\u062b\u0646\u064a\u0646_\u062b\u0644\u0627\u062b\u0627\u0621_\u0623\u0631\u0628\u0639\u0627\u0621_\u062e\u0645\u064a\u0633_\u062c\u0645\u0639\u0629_\u0633\u0628\u062a".split("_"),weekdaysMin:"\u062d_\u0646_\u062b_\u0631_\u062e_\u062c_\u0633".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/\u200fM/\u200fYYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/\u0635|\u0645/,isPM:function(e){return"\u0645"===e},meridiem:function(e,a,_){return e<12?"\u0635":"\u0645"},calendar:{sameDay:"[\u0627\u0644\u064a\u0648\u0645 \u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextDay:"[\u063a\u062f\u064b\u0627 \u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextWeek:"dddd [\u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastDay:"[\u0623\u0645\u0633 \u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastWeek:"dddd [\u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",sameElse:"L"},relativeTime:{future:"\u0628\u0639\u062f %s",past:"\u0645\u0646\u0630 %s",s:l("s"),ss:l("s"),m:l("m"),mm:l("m"),h:l("h"),hh:l("h"),d:l("d"),dd:l("d"),M:l("M"),MM:l("M"),y:l("y"),yy:l("y")},preparse:function(e){return e.replace(/[\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\u0660]/g,function(e){return m[e]}).replace(/\u060c/g,",")},postformat:function(e){return e.replace(/\d/g,function(e){return n[e]}).replace(/,/g,"\u060c")},week:{dow:6,doy:12}});var L={1:"-inci",5:"-inci",8:"-inci",70:"-inci",80:"-inci",2:"-nci",7:"-nci",20:"-nci",50:"-nci",3:"-\xfcnc\xfc",4:"-\xfcnc\xfc",100:"-\xfcnc\xfc",6:"-nc\u0131",9:"-uncu",10:"-uncu",30:"-uncu",60:"-\u0131nc\u0131",90:"-\u0131nc\u0131"};function Y(e,a,_){var s,d;return"m"===_?a?"\u0445\u0432\u0456\u043b\u0456\u043d\u0430":"\u0445\u0432\u0456\u043b\u0456\u043d\u0443":"h"===_?a?"\u0433\u0430\u0434\u0437\u0456\u043d\u0430":"\u0433\u0430\u0434\u0437\u0456\u043d\u0443":e+" "+(s=+e,d={ss:a?"\u0441\u0435\u043a\u0443\u043d\u0434\u0430_\u0441\u0435\u043a\u0443\u043d\u0434\u044b_\u0441\u0435\u043a\u0443\u043d\u0434":"\u0441\u0435\u043a\u0443\u043d\u0434\u0443_\u0441\u0435\u043a\u0443\u043d\u0434\u044b_\u0441\u0435\u043a\u0443\u043d\u0434",mm:a?"\u0445\u0432\u0456\u043b\u0456\u043d\u0430_\u0445\u0432\u0456\u043b\u0456\u043d\u044b_\u0445\u0432\u0456\u043b\u0456\u043d":"\u0445\u0432\u0456\u043b\u0456\u043d\u0443_\u0445\u0432\u0456\u043b\u0456\u043d\u044b_\u0445\u0432\u0456\u043b\u0456\u043d",hh:a?"\u0433\u0430\u0434\u0437\u0456\u043d\u0430_\u0433\u0430\u0434\u0437\u0456\u043d\u044b_\u0433\u0430\u0434\u0437\u0456\u043d":"\u0433\u0430\u0434\u0437\u0456\u043d\u0443_\u0433\u0430\u0434\u0437\u0456\u043d\u044b_\u0433\u0430\u0434\u0437\u0456\u043d",dd:"\u0434\u0437\u0435\u043d\u044c_\u0434\u043d\u0456_\u0434\u0437\u0451\u043d",MM:"\u043c\u0435\u0441\u044f\u0446_\u043c\u0435\u0441\u044f\u0446\u044b_\u043c\u0435\u0441\u044f\u0446\u0430\u045e",yy:"\u0433\u043e\u0434_\u0433\u0430\u0434\u044b_\u0433\u0430\u0434\u043e\u045e"}[_].split("_"),s%10==1&&s%100!=11?d[0]:2<=s%10&&s%10<=4&&(s%100<10||20<=s%100)?d[1]:d[2])}e.defineLocale("az",{months:"yanvar_fevral_mart_aprel_may_iyun_iyul_avqust_sentyabr_oktyabr_noyabr_dekabr".split("_"),monthsShort:"yan_fev_mar_apr_may_iyn_iyl_avq_sen_okt_noy_dek".split("_"),weekdays:"Bazar_Bazar ert\u0259si_\xc7\u0259r\u015f\u0259nb\u0259 ax\u015fam\u0131_\xc7\u0259r\u015f\u0259nb\u0259_C\xfcm\u0259 ax\u015fam\u0131_C\xfcm\u0259_\u015e\u0259nb\u0259".split("_"),weekdaysShort:"Baz_BzE_\xc7Ax_\xc7\u0259r_CAx_C\xfcm_\u015e\u0259n".split("_"),weekdaysMin:"Bz_BE_\xc7A_\xc7\u0259_CA_C\xfc_\u015e\u0259".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bug\xfcn saat] LT",nextDay:"[sabah saat] LT",nextWeek:"[g\u0259l\u0259n h\u0259ft\u0259] dddd [saat] LT",lastDay:"[d\xfcn\u0259n] LT",lastWeek:"[ke\xe7\u0259n h\u0259ft\u0259] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s \u0259vv\u0259l",s:"birne\xe7\u0259 saniy\u0259",ss:"%d saniy\u0259",m:"bir d\u0259qiq\u0259",mm:"%d d\u0259qiq\u0259",h:"bir saat",hh:"%d saat",d:"bir g\xfcn",dd:"%d g\xfcn",M:"bir ay",MM:"%d ay",y:"bir il",yy:"%d il"},meridiemParse:/gec\u0259|s\u0259h\u0259r|g\xfcnd\xfcz|ax\u015fam/,isPM:function(e){return/^(g\xfcnd\xfcz|ax\u015fam)$/.test(e)},meridiem:function(e,a,_){return e<4?"gec\u0259":e<12?"s\u0259h\u0259r":e<17?"g\xfcnd\xfcz":"ax\u015fam"},dayOfMonthOrdinalParse:/\d{1,2}-(\u0131nc\u0131|inci|nci|\xfcnc\xfc|nc\u0131|uncu)/,ordinal:function(e){if(0===e)return e+"-\u0131nc\u0131";var a=e%10;return e+(L[a]||L[e%100-a]||L[100<=e?100:null])},week:{dow:1,doy:7}}),e.defineLocale("be",{months:{format:"\u0441\u0442\u0443\u0434\u0437\u0435\u043d\u044f_\u043b\u044e\u0442\u0430\u0433\u0430_\u0441\u0430\u043a\u0430\u0432\u0456\u043a\u0430_\u043a\u0440\u0430\u0441\u0430\u0432\u0456\u043a\u0430_\u0442\u0440\u0430\u045e\u043d\u044f_\u0447\u044d\u0440\u0432\u0435\u043d\u044f_\u043b\u0456\u043f\u0435\u043d\u044f_\u0436\u043d\u0456\u045e\u043d\u044f_\u0432\u0435\u0440\u0430\u0441\u043d\u044f_\u043a\u0430\u0441\u0442\u0440\u044b\u0447\u043d\u0456\u043a\u0430_\u043b\u0456\u0441\u0442\u0430\u043f\u0430\u0434\u0430_\u0441\u043d\u0435\u0436\u043d\u044f".split("_"),standalone:"\u0441\u0442\u0443\u0434\u0437\u0435\u043d\u044c_\u043b\u044e\u0442\u044b_\u0441\u0430\u043a\u0430\u0432\u0456\u043a_\u043a\u0440\u0430\u0441\u0430\u0432\u0456\u043a_\u0442\u0440\u0430\u0432\u0435\u043d\u044c_\u0447\u044d\u0440\u0432\u0435\u043d\u044c_\u043b\u0456\u043f\u0435\u043d\u044c_\u0436\u043d\u0456\u0432\u0435\u043d\u044c_\u0432\u0435\u0440\u0430\u0441\u0435\u043d\u044c_\u043a\u0430\u0441\u0442\u0440\u044b\u0447\u043d\u0456\u043a_\u043b\u0456\u0441\u0442\u0430\u043f\u0430\u0434_\u0441\u043d\u0435\u0436\u0430\u043d\u044c".split("_")},monthsShort:"\u0441\u0442\u0443\u0434_\u043b\u044e\u0442_\u0441\u0430\u043a_\u043a\u0440\u0430\u0441_\u0442\u0440\u0430\u0432_\u0447\u044d\u0440\u0432_\u043b\u0456\u043f_\u0436\u043d\u0456\u0432_\u0432\u0435\u0440_\u043a\u0430\u0441\u0442_\u043b\u0456\u0441\u0442_\u0441\u043d\u0435\u0436".split("_"),weekdays:{format:"\u043d\u044f\u0434\u0437\u0435\u043b\u044e_\u043f\u0430\u043d\u044f\u0434\u0437\u0435\u043b\u0430\u043a_\u0430\u045e\u0442\u043e\u0440\u0430\u043a_\u0441\u0435\u0440\u0430\u0434\u0443_\u0447\u0430\u0446\u0432\u0435\u0440_\u043f\u044f\u0442\u043d\u0456\u0446\u0443_\u0441\u0443\u0431\u043e\u0442\u0443".split("_"),standalone:"\u043d\u044f\u0434\u0437\u0435\u043b\u044f_\u043f\u0430\u043d\u044f\u0434\u0437\u0435\u043b\u0430\u043a_\u0430\u045e\u0442\u043e\u0440\u0430\u043a_\u0441\u0435\u0440\u0430\u0434\u0430_\u0447\u0430\u0446\u0432\u0435\u0440_\u043f\u044f\u0442\u043d\u0456\u0446\u0430_\u0441\u0443\u0431\u043e\u0442\u0430".split("_"),isFormat:/\[ ?[\u0423\u0443\u045e] ?(?:\u043c\u0456\u043d\u0443\u043b\u0443\u044e|\u043d\u0430\u0441\u0442\u0443\u043f\u043d\u0443\u044e)? ?\] ?dddd/},weekdaysShort:"\u043d\u0434_\u043f\u043d_\u0430\u0442_\u0441\u0440_\u0447\u0446_\u043f\u0442_\u0441\u0431".split("_"),weekdaysMin:"\u043d\u0434_\u043f\u043d_\u0430\u0442_\u0441\u0440_\u0447\u0446_\u043f\u0442_\u0441\u0431".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY \u0433.",LLL:"D MMMM YYYY \u0433., HH:mm",LLLL:"dddd, D MMMM YYYY \u0433., HH:mm"},calendar:{sameDay:"[\u0421\u0451\u043d\u043d\u044f \u045e] LT",nextDay:"[\u0417\u0430\u045e\u0442\u0440\u0430 \u045e] LT",lastDay:"[\u0423\u0447\u043e\u0440\u0430 \u045e] LT",nextWeek:function(){return"[\u0423] dddd [\u045e] LT"},lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return"[\u0423 \u043c\u0456\u043d\u0443\u043b\u0443\u044e] dddd [\u045e] LT";case 1:case 2:case 4:return"[\u0423 \u043c\u0456\u043d\u0443\u043b\u044b] dddd [\u045e] LT"}},sameElse:"L"},relativeTime:{future:"\u043f\u0440\u0430\u0437 %s",past:"%s \u0442\u0430\u043c\u0443",s:"\u043d\u0435\u043a\u0430\u043b\u044c\u043a\u0456 \u0441\u0435\u043a\u0443\u043d\u0434",m:Y,mm:Y,h:Y,hh:Y,d:"\u0434\u0437\u0435\u043d\u044c",dd:Y,M:"\u043c\u0435\u0441\u044f\u0446",MM:Y,y:"\u0433\u043e\u0434",yy:Y},meridiemParse:/\u043d\u043e\u0447\u044b|\u0440\u0430\u043d\u0456\u0446\u044b|\u0434\u043d\u044f|\u0432\u0435\u0447\u0430\u0440\u0430/,isPM:function(e){return/^(\u0434\u043d\u044f|\u0432\u0435\u0447\u0430\u0440\u0430)$/.test(e)},meridiem:function(e,a,_){return e<4?"\u043d\u043e\u0447\u044b":e<12?"\u0440\u0430\u043d\u0456\u0446\u044b":e<17?"\u0434\u043d\u044f":"\u0432\u0435\u0447\u0430\u0440\u0430"},dayOfMonthOrdinalParse:/\d{1,2}-(\u0456|\u044b|\u0433\u0430)/,ordinal:function(e,a){switch(a){case"M":case"d":case"DDD":case"w":case"W":return e%10!=2&&e%10!=3||e%100==12||e%100==13?e+"-\u044b":e+"-\u0456";case"D":return e+"-\u0433\u0430";default:return e}},week:{dow:1,doy:7}}),e.defineLocale("bg",{months:"\u044f\u043d\u0443\u0430\u0440\u0438_\u0444\u0435\u0432\u0440\u0443\u0430\u0440\u0438_\u043c\u0430\u0440\u0442_\u0430\u043f\u0440\u0438\u043b_\u043c\u0430\u0439_\u044e\u043d\u0438_\u044e\u043b\u0438_\u0430\u0432\u0433\u0443\u0441\u0442_\u0441\u0435\u043f\u0442\u0435\u043c\u0432\u0440\u0438_\u043e\u043a\u0442\u043e\u043c\u0432\u0440\u0438_\u043d\u043e\u0435\u043c\u0432\u0440\u0438_\u0434\u0435\u043a\u0435\u043c\u0432\u0440\u0438".split("_"),monthsShort:"\u044f\u043d\u0440_\u0444\u0435\u0432_\u043c\u0430\u0440_\u0430\u043f\u0440_\u043c\u0430\u0439_\u044e\u043d\u0438_\u044e\u043b\u0438_\u0430\u0432\u0433_\u0441\u0435\u043f_\u043e\u043a\u0442_\u043d\u043e\u0435_\u0434\u0435\u043a".split("_"),weekdays:"\u043d\u0435\u0434\u0435\u043b\u044f_\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u043d\u0438\u043a_\u0432\u0442\u043e\u0440\u043d\u0438\u043a_\u0441\u0440\u044f\u0434\u0430_\u0447\u0435\u0442\u0432\u044a\u0440\u0442\u044a\u043a_\u043f\u0435\u0442\u044a\u043a_\u0441\u044a\u0431\u043e\u0442\u0430".split("_"),weekdaysShort:"\u043d\u0435\u0434_\u043f\u043e\u043d_\u0432\u0442\u043e_\u0441\u0440\u044f_\u0447\u0435\u0442_\u043f\u0435\u0442_\u0441\u044a\u0431".split("_"),weekdaysMin:"\u043d\u0434_\u043f\u043d_\u0432\u0442_\u0441\u0440_\u0447\u0442_\u043f\u0442_\u0441\u0431".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[\u0414\u043d\u0435\u0441 \u0432] LT",nextDay:"[\u0423\u0442\u0440\u0435 \u0432] LT",nextWeek:"dddd [\u0432] LT",lastDay:"[\u0412\u0447\u0435\u0440\u0430 \u0432] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[\u0412 \u0438\u0437\u043c\u0438\u043d\u0430\u043b\u0430\u0442\u0430] dddd [\u0432] LT";case 1:case 2:case 4:case 5:return"[\u0412 \u0438\u0437\u043c\u0438\u043d\u0430\u043b\u0438\u044f] dddd [\u0432] LT"}},sameElse:"L"},relativeTime:{future:"\u0441\u043b\u0435\u0434 %s",past:"\u043f\u0440\u0435\u0434\u0438 %s",s:"\u043d\u044f\u043a\u043e\u043b\u043a\u043e \u0441\u0435\u043a\u0443\u043d\u0434\u0438",ss:"%d \u0441\u0435\u043a\u0443\u043d\u0434\u0438",m:"\u043c\u0438\u043d\u0443\u0442\u0430",mm:"%d \u043c\u0438\u043d\u0443\u0442\u0438",h:"\u0447\u0430\u0441",hh:"%d \u0447\u0430\u0441\u0430",d:"\u0434\u0435\u043d",dd:"%d \u0434\u043d\u0438",M:"\u043c\u0435\u0441\u0435\u0446",MM:"%d \u043c\u0435\u0441\u0435\u0446\u0430",y:"\u0433\u043e\u0434\u0438\u043d\u0430",yy:"%d \u0433\u043e\u0434\u0438\u043d\u0438"},dayOfMonthOrdinalParse:/\d{1,2}-(\u0435\u0432|\u0435\u043d|\u0442\u0438|\u0432\u0438|\u0440\u0438|\u043c\u0438)/,ordinal:function(e){var a=e%10,_=e%100;return 0===e?e+"-\u0435\u0432":0===_?e+"-\u0435\u043d":10<_&&_<20?e+"-\u0442\u0438":1===a?e+"-\u0432\u0438":2===a?e+"-\u0440\u0438":7===a||8===a?e+"-\u043c\u0438":e+"-\u0442\u0438"},week:{dow:1,doy:7}}),e.defineLocale("bm",{months:"Zanwuyekalo_Fewuruyekalo_Marisikalo_Awirilikalo_M\u025bkalo_Zuw\u025bnkalo_Zuluyekalo_Utikalo_S\u025btanburukalo_\u0254kut\u0254burukalo_Nowanburukalo_Desanburukalo".split("_"),monthsShort:"Zan_Few_Mar_Awi_M\u025b_Zuw_Zul_Uti_S\u025bt_\u0254ku_Now_Des".split("_"),weekdays:"Kari_Nt\u025bn\u025bn_Tarata_Araba_Alamisa_Juma_Sibiri".split("_"),weekdaysShort:"Kar_Nt\u025b_Tar_Ara_Ala_Jum_Sib".split("_"),weekdaysMin:"Ka_Nt_Ta_Ar_Al_Ju_Si".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"MMMM [tile] D [san] YYYY",LLL:"MMMM [tile] D [san] YYYY [l\u025br\u025b] HH:mm",LLLL:"dddd MMMM [tile] D [san] YYYY [l\u025br\u025b] HH:mm"},calendar:{sameDay:"[Bi l\u025br\u025b] LT",nextDay:"[Sini l\u025br\u025b] LT",nextWeek:"dddd [don l\u025br\u025b] LT",lastDay:"[Kunu l\u025br\u025b] LT",lastWeek:"dddd [t\u025bm\u025bnen l\u025br\u025b] LT",sameElse:"L"},relativeTime:{future:"%s k\u0254n\u0254",past:"a b\u025b %s b\u0254",s:"sanga dama dama",ss:"sekondi %d",m:"miniti kelen",mm:"miniti %d",h:"l\u025br\u025b kelen",hh:"l\u025br\u025b %d",d:"tile kelen",dd:"tile %d",M:"kalo kelen",MM:"kalo %d",y:"san kelen",yy:"san %d"},week:{dow:1,doy:4}});var h={1:"\u09e7",2:"\u09e8",3:"\u09e9",4:"\u09ea",5:"\u09eb",6:"\u09ec",7:"\u09ed",8:"\u09ee",9:"\u09ef",0:"\u09e6"},y={"\u09e7":"1","\u09e8":"2","\u09e9":"3","\u09ea":"4","\u09eb":"5","\u09ec":"6","\u09ed":"7","\u09ee":"8","\u09ef":"9","\u09e6":"0"};e.defineLocale("bn",{months:"\u099c\u09be\u09a8\u09c1\u09df\u09be\u09b0\u09c0_\u09ab\u09c7\u09ac\u09cd\u09b0\u09c1\u09df\u09be\u09b0\u09bf_\u09ae\u09be\u09b0\u09cd\u099a_\u098f\u09aa\u09cd\u09b0\u09bf\u09b2_\u09ae\u09c7_\u099c\u09c1\u09a8_\u099c\u09c1\u09b2\u09be\u0987_\u0986\u0997\u09b8\u09cd\u099f_\u09b8\u09c7\u09aa\u09cd\u099f\u09c7\u09ae\u09cd\u09ac\u09b0_\u0985\u0995\u09cd\u099f\u09cb\u09ac\u09b0_\u09a8\u09ad\u09c7\u09ae\u09cd\u09ac\u09b0_\u09a1\u09bf\u09b8\u09c7\u09ae\u09cd\u09ac\u09b0".split("_"),monthsShort:"\u099c\u09be\u09a8\u09c1_\u09ab\u09c7\u09ac_\u09ae\u09be\u09b0\u09cd\u099a_\u098f\u09aa\u09cd\u09b0_\u09ae\u09c7_\u099c\u09c1\u09a8_\u099c\u09c1\u09b2_\u0986\u0997_\u09b8\u09c7\u09aa\u09cd\u099f_\u0985\u0995\u09cd\u099f\u09cb_\u09a8\u09ad\u09c7_\u09a1\u09bf\u09b8\u09c7".split("_"),weekdays:"\u09b0\u09ac\u09bf\u09ac\u09be\u09b0_\u09b8\u09cb\u09ae\u09ac\u09be\u09b0_\u09ae\u0999\u09cd\u0997\u09b2\u09ac\u09be\u09b0_\u09ac\u09c1\u09a7\u09ac\u09be\u09b0_\u09ac\u09c3\u09b9\u09b8\u09cd\u09aa\u09a4\u09bf\u09ac\u09be\u09b0_\u09b6\u09c1\u0995\u09cd\u09b0\u09ac\u09be\u09b0_\u09b6\u09a8\u09bf\u09ac\u09be\u09b0".split("_"),weekdaysShort:"\u09b0\u09ac\u09bf_\u09b8\u09cb\u09ae_\u09ae\u0999\u09cd\u0997\u09b2_\u09ac\u09c1\u09a7_\u09ac\u09c3\u09b9\u09b8\u09cd\u09aa\u09a4\u09bf_\u09b6\u09c1\u0995\u09cd\u09b0_\u09b6\u09a8\u09bf".split("_"),weekdaysMin:"\u09b0\u09ac\u09bf_\u09b8\u09cb\u09ae_\u09ae\u0999\u09cd\u0997_\u09ac\u09c1\u09a7_\u09ac\u09c3\u09b9\u0983_\u09b6\u09c1\u0995\u09cd\u09b0_\u09b6\u09a8\u09bf".split("_"),longDateFormat:{LT:"A h:mm \u09b8\u09ae\u09df",LTS:"A h:mm:ss \u09b8\u09ae\u09df",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm \u09b8\u09ae\u09df",LLLL:"dddd, D MMMM YYYY, A h:mm \u09b8\u09ae\u09df"},calendar:{sameDay:"[\u0986\u099c] LT",nextDay:"[\u0986\u0997\u09be\u09ae\u09c0\u0995\u09be\u09b2] LT",nextWeek:"dddd, LT",lastDay:"[\u0997\u09a4\u0995\u09be\u09b2] LT",lastWeek:"[\u0997\u09a4] dddd, LT",sameElse:"L"},relativeTime:{future:"%s \u09aa\u09b0\u09c7",past:"%s \u0986\u0997\u09c7",s:"\u0995\u09df\u09c7\u0995 \u09b8\u09c7\u0995\u09c7\u09a8\u09cd\u09a1",ss:"%d \u09b8\u09c7\u0995\u09c7\u09a8\u09cd\u09a1",m:"\u098f\u0995 \u09ae\u09bf\u09a8\u09bf\u099f",mm:"%d \u09ae\u09bf\u09a8\u09bf\u099f",h:"\u098f\u0995 \u0998\u09a8\u09cd\u099f\u09be",hh:"%d \u0998\u09a8\u09cd\u099f\u09be",d:"\u098f\u0995 \u09a6\u09bf\u09a8",dd:"%d \u09a6\u09bf\u09a8",M:"\u098f\u0995 \u09ae\u09be\u09b8",MM:"%d \u09ae\u09be\u09b8",y:"\u098f\u0995 \u09ac\u099b\u09b0",yy:"%d \u09ac\u099b\u09b0"},preparse:function(e){return e.replace(/[\u09e7\u09e8\u09e9\u09ea\u09eb\u09ec\u09ed\u09ee\u09ef\u09e6]/g,function(e){return y[e]})},postformat:function(e){return e.replace(/\d/g,function(e){return h[e]})},meridiemParse:/\u09b0\u09be\u09a4|\u09b8\u0995\u09be\u09b2|\u09a6\u09c1\u09aa\u09c1\u09b0|\u09ac\u09bf\u0995\u09be\u09b2|\u09b0\u09be\u09a4/,meridiemHour:function(e,a){return 12===e&&(e=0),"\u09b0\u09be\u09a4"===a&&4<=e||"\u09a6\u09c1\u09aa\u09c1\u09b0"===a&&e<5||"\u09ac\u09bf\u0995\u09be\u09b2"===a?e+12:e},meridiem:function(e,a,_){return e<4?"\u09b0\u09be\u09a4":e<10?"\u09b8\u0995\u09be\u09b2":e<17?"\u09a6\u09c1\u09aa\u09c1\u09b0":e<20?"\u09ac\u09bf\u0995\u09be\u09b2":"\u09b0\u09be\u09a4"},week:{dow:0,doy:6}});var c={1:"\u0f21",2:"\u0f22",3:"\u0f23",4:"\u0f24",5:"\u0f25",6:"\u0f26",7:"\u0f27",8:"\u0f28",9:"\u0f29",0:"\u0f20"},k={"\u0f21":"1","\u0f22":"2","\u0f23":"3","\u0f24":"4","\u0f25":"5","\u0f26":"6","\u0f27":"7","\u0f28":"8","\u0f29":"9","\u0f20":"0"};function p(e,a,_){var s,d,t;return e+" "+(s={mm:"munutenn",MM:"miz",dd:"devezh"}[_],2!==e?s:void 0!==(t={m:"v",b:"v",d:"z"})[(d=s).charAt(0)]?t[d.charAt(0)]+d.substring(1):d)}function D(e,a,_){var s=e+" ";switch(_){case"ss":return s+=1===e?"sekunda":2===e||3===e||4===e?"sekunde":"sekundi";case"m":return a?"jedna minuta":"jedne minute";case"mm":return s+=1===e?"minuta":2===e||3===e||4===e?"minute":"minuta";case"h":return a?"jedan sat":"jednog sata";case"hh":return s+=1===e?"sat":2===e||3===e||4===e?"sata":"sati";case"dd":return s+=1===e?"dan":"dana";case"MM":return s+=1===e?"mjesec":2===e||3===e||4===e?"mjeseca":"mjeseci";case"yy":return s+=1===e?"godina":2===e||3===e||4===e?"godine":"godina"}}e.defineLocale("bo",{months:"\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f51\u0f44\u0f0b\u0f54\u0f7c_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f42\u0f49\u0f72\u0f66\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f42\u0f66\u0f74\u0f58\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f56\u0f5e\u0f72\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f63\u0f94\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f51\u0fb2\u0f74\u0f42\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f56\u0f51\u0f74\u0f53\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f56\u0f62\u0f92\u0fb1\u0f51\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f51\u0f42\u0f74\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f56\u0f45\u0f74\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f56\u0f45\u0f74\u0f0b\u0f42\u0f45\u0f72\u0f42\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f56\u0f45\u0f74\u0f0b\u0f42\u0f49\u0f72\u0f66\u0f0b\u0f54".split("_"),monthsShort:"\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f51\u0f44\u0f0b\u0f54\u0f7c_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f42\u0f49\u0f72\u0f66\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f42\u0f66\u0f74\u0f58\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f56\u0f5e\u0f72\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f63\u0f94\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f51\u0fb2\u0f74\u0f42\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f56\u0f51\u0f74\u0f53\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f56\u0f62\u0f92\u0fb1\u0f51\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f51\u0f42\u0f74\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f56\u0f45\u0f74\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f56\u0f45\u0f74\u0f0b\u0f42\u0f45\u0f72\u0f42\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f56\u0f45\u0f74\u0f0b\u0f42\u0f49\u0f72\u0f66\u0f0b\u0f54".split("_"),weekdays:"\u0f42\u0f5f\u0f60\u0f0b\u0f49\u0f72\u0f0b\u0f58\u0f0b_\u0f42\u0f5f\u0f60\u0f0b\u0f5f\u0fb3\u0f0b\u0f56\u0f0b_\u0f42\u0f5f\u0f60\u0f0b\u0f58\u0f72\u0f42\u0f0b\u0f51\u0f58\u0f62\u0f0b_\u0f42\u0f5f\u0f60\u0f0b\u0f63\u0fb7\u0f42\u0f0b\u0f54\u0f0b_\u0f42\u0f5f\u0f60\u0f0b\u0f55\u0f74\u0f62\u0f0b\u0f56\u0f74_\u0f42\u0f5f\u0f60\u0f0b\u0f54\u0f0b\u0f66\u0f44\u0f66\u0f0b_\u0f42\u0f5f\u0f60\u0f0b\u0f66\u0fa4\u0f7a\u0f53\u0f0b\u0f54\u0f0b".split("_"),weekdaysShort:"\u0f49\u0f72\u0f0b\u0f58\u0f0b_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b_\u0f58\u0f72\u0f42\u0f0b\u0f51\u0f58\u0f62\u0f0b_\u0f63\u0fb7\u0f42\u0f0b\u0f54\u0f0b_\u0f55\u0f74\u0f62\u0f0b\u0f56\u0f74_\u0f54\u0f0b\u0f66\u0f44\u0f66\u0f0b_\u0f66\u0fa4\u0f7a\u0f53\u0f0b\u0f54\u0f0b".split("_"),weekdaysMin:"\u0f49\u0f72\u0f0b\u0f58\u0f0b_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b_\u0f58\u0f72\u0f42\u0f0b\u0f51\u0f58\u0f62\u0f0b_\u0f63\u0fb7\u0f42\u0f0b\u0f54\u0f0b_\u0f55\u0f74\u0f62\u0f0b\u0f56\u0f74_\u0f54\u0f0b\u0f66\u0f44\u0f66\u0f0b_\u0f66\u0fa4\u0f7a\u0f53\u0f0b\u0f54\u0f0b".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[\u0f51\u0f72\u0f0b\u0f62\u0f72\u0f44] LT",nextDay:"[\u0f66\u0f44\u0f0b\u0f49\u0f72\u0f53] LT",nextWeek:"[\u0f56\u0f51\u0f74\u0f53\u0f0b\u0f55\u0fb2\u0f42\u0f0b\u0f62\u0f97\u0f7a\u0f66\u0f0b\u0f58], LT",lastDay:"[\u0f41\u0f0b\u0f66\u0f44] LT",lastWeek:"[\u0f56\u0f51\u0f74\u0f53\u0f0b\u0f55\u0fb2\u0f42\u0f0b\u0f58\u0f50\u0f60\u0f0b\u0f58] dddd, LT",sameElse:"L"},relativeTime:{future:"%s \u0f63\u0f0b",past:"%s \u0f66\u0f94\u0f53\u0f0b\u0f63",s:"\u0f63\u0f58\u0f0b\u0f66\u0f44",ss:"%d \u0f66\u0f90\u0f62\u0f0b\u0f46\u0f0d",m:"\u0f66\u0f90\u0f62\u0f0b\u0f58\u0f0b\u0f42\u0f45\u0f72\u0f42",mm:"%d \u0f66\u0f90\u0f62\u0f0b\u0f58",h:"\u0f46\u0f74\u0f0b\u0f5a\u0f7c\u0f51\u0f0b\u0f42\u0f45\u0f72\u0f42",hh:"%d \u0f46\u0f74\u0f0b\u0f5a\u0f7c\u0f51",d:"\u0f49\u0f72\u0f53\u0f0b\u0f42\u0f45\u0f72\u0f42",dd:"%d \u0f49\u0f72\u0f53\u0f0b",M:"\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f42\u0f45\u0f72\u0f42",MM:"%d \u0f5f\u0fb3\u0f0b\u0f56",y:"\u0f63\u0f7c\u0f0b\u0f42\u0f45\u0f72\u0f42",yy:"%d \u0f63\u0f7c"},preparse:function(e){return e.replace(/[\u0f21\u0f22\u0f23\u0f24\u0f25\u0f26\u0f27\u0f28\u0f29\u0f20]/g,function(e){return k[e]})},postformat:function(e){return e.replace(/\d/g,function(e){return c[e]})},meridiemParse:/\u0f58\u0f5a\u0f53\u0f0b\u0f58\u0f7c|\u0f5e\u0f7c\u0f42\u0f66\u0f0b\u0f40\u0f66|\u0f49\u0f72\u0f53\u0f0b\u0f42\u0f74\u0f44|\u0f51\u0f42\u0f7c\u0f44\u0f0b\u0f51\u0f42|\u0f58\u0f5a\u0f53\u0f0b\u0f58\u0f7c/,meridiemHour:function(e,a){return 12===e&&(e=0),"\u0f58\u0f5a\u0f53\u0f0b\u0f58\u0f7c"===a&&4<=e||"\u0f49\u0f72\u0f53\u0f0b\u0f42\u0f74\u0f44"===a&&e<5||"\u0f51\u0f42\u0f7c\u0f44\u0f0b\u0f51\u0f42"===a?e+12:e},meridiem:function(e,a,_){return e<4?"\u0f58\u0f5a\u0f53\u0f0b\u0f58\u0f7c":e<10?"\u0f5e\u0f7c\u0f42\u0f66\u0f0b\u0f40\u0f66":e<17?"\u0f49\u0f72\u0f53\u0f0b\u0f42\u0f74\u0f44":e<20?"\u0f51\u0f42\u0f7c\u0f44\u0f0b\u0f51\u0f42":"\u0f58\u0f5a\u0f53\u0f0b\u0f58\u0f7c"},week:{dow:0,doy:6}}),e.defineLocale("br",{months:"Genver_C'hwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu".split("_"),monthsShort:"Gen_C'hwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker".split("_"),weekdays:"Sul_Lun_Meurzh_Merc'her_Yaou_Gwener_Sadorn".split("_"),weekdaysShort:"Sul_Lun_Meu_Mer_Yao_Gwe_Sad".split("_"),weekdaysMin:"Su_Lu_Me_Mer_Ya_Gw_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"h[e]mm A",LTS:"h[e]mm:ss A",L:"DD/MM/YYYY",LL:"D [a viz] MMMM YYYY",LLL:"D [a viz] MMMM YYYY h[e]mm A",LLLL:"dddd, D [a viz] MMMM YYYY h[e]mm A"},calendar:{sameDay:"[Hiziv da] LT",nextDay:"[Warc'hoazh da] LT",nextWeek:"dddd [da] LT",lastDay:"[Dec'h da] LT",lastWeek:"dddd [paset da] LT",sameElse:"L"},relativeTime:{future:"a-benn %s",past:"%s 'zo",s:"un nebeud segondenno\xf9",ss:"%d eilenn",m:"ur vunutenn",mm:p,h:"un eur",hh:"%d eur",d:"un devezh",dd:p,M:"ur miz",MM:p,y:"ur bloaz",yy:function(e){switch(function e(a){return 9= 0 && isFinite(date.getFullYear())) { - date.setFullYear(y); + if (y < 100 && y >= 0) { + // preserve leap years using a full 400 year cycle, then reset + date = new Date(y + 400, m, d, h, M, s, ms); + if (isFinite(date.getFullYear())) { + date.setFullYear(y); + } + } else { + date = new Date(y, m, d, h, M, s, ms); } + return date; } function createUTCDate (y) { - var date = new Date(Date.UTC.apply(null, arguments)); - + var date; // the Date.UTC function remaps years 0-99 to 1900-1999 - if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) { - date.setUTCFullYear(y); + if (y < 100 && y >= 0) { + var args = Array.prototype.slice.call(arguments); + // preserve leap years using a full 400 year cycle, then reset + args[0] = y + 400; + date = new Date(Date.UTC.apply(null, args)); + if (isFinite(date.getUTCFullYear())) { + date.setUTCFullYear(y); + } + } else { + date = new Date(Date.UTC.apply(null, arguments)); } + return date; } @@ -1366,25 +1380,28 @@ } // LOCALES + function shiftWeekdays (ws, n) { + return ws.slice(n, 7).concat(ws.slice(0, n)); + } var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'); function localeWeekdays (m, format) { - if (!m) { - return isArray(this._weekdays) ? this._weekdays : - this._weekdays['standalone']; - } - return isArray(this._weekdays) ? this._weekdays[m.day()] : - this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()]; + var weekdays = isArray(this._weekdays) ? this._weekdays : + this._weekdays[(m && m !== true && this._weekdays.isFormat.test(format)) ? 'format' : 'standalone']; + return (m === true) ? shiftWeekdays(weekdays, this._week.dow) + : (m) ? weekdays[m.day()] : weekdays; } var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'); function localeWeekdaysShort (m) { - return (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort; + return (m === true) ? shiftWeekdays(this._weekdaysShort, this._week.dow) + : (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort; } var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'); function localeWeekdaysMin (m) { - return (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin; + return (m === true) ? shiftWeekdays(this._weekdaysMin, this._week.dow) + : (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin; } function handleStrictParse$1(weekdayName, format, strict) { @@ -3079,7 +3096,7 @@ } function positiveMomentsDifference(base, other) { - var res = {milliseconds: 0, months: 0}; + var res = {}; res.months = other.month() - base.month() + (other.year() - base.year()) * 12; @@ -3417,62 +3434,130 @@ return this._locale; } + var MS_PER_SECOND = 1000; + var MS_PER_MINUTE = 60 * MS_PER_SECOND; + var MS_PER_HOUR = 60 * MS_PER_MINUTE; + var MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR; + + // actual modulo - handles negative numbers (for dates before 1970): + function mod$1(dividend, divisor) { + return (dividend % divisor + divisor) % divisor; + } + + function localStartOfDate(y, m, d) { + // the date constructor remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0) { + // preserve leap years using a full 400 year cycle, then reset + return new Date(y + 400, m, d) - MS_PER_400_YEARS; + } else { + return new Date(y, m, d).valueOf(); + } + } + + function utcStartOfDate(y, m, d) { + // Date.UTC remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0) { + // preserve leap years using a full 400 year cycle, then reset + return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS; + } else { + return Date.UTC(y, m, d); + } + } + function startOf (units) { + var time; units = normalizeUnits(units); - // the following switch intentionally omits break keywords - // to utilize falling through the cases. + if (units === undefined || units === 'millisecond' || !this.isValid()) { + return this; + } + + var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; + switch (units) { case 'year': - this.month(0); - /* falls through */ + time = startOfDate(this.year(), 0, 1); + break; case 'quarter': + time = startOfDate(this.year(), this.month() - this.month() % 3, 1); + break; case 'month': - this.date(1); - /* falls through */ + time = startOfDate(this.year(), this.month(), 1); + break; case 'week': + time = startOfDate(this.year(), this.month(), this.date() - this.weekday()); + break; case 'isoWeek': + time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1)); + break; case 'day': case 'date': - this.hours(0); - /* falls through */ + time = startOfDate(this.year(), this.month(), this.date()); + break; case 'hour': - this.minutes(0); - /* falls through */ + time = this._d.valueOf(); + time -= mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR); + break; case 'minute': - this.seconds(0); - /* falls through */ + time = this._d.valueOf(); + time -= mod$1(time, MS_PER_MINUTE); + break; case 'second': - this.milliseconds(0); - } - - // weeks are a special case - if (units === 'week') { - this.weekday(0); - } - if (units === 'isoWeek') { - this.isoWeekday(1); - } - - // quarters are also special - if (units === 'quarter') { - this.month(Math.floor(this.month() / 3) * 3); + time = this._d.valueOf(); + time -= mod$1(time, MS_PER_SECOND); + break; } + this._d.setTime(time); + hooks.updateOffset(this, true); return this; } function endOf (units) { + var time; units = normalizeUnits(units); - if (units === undefined || units === 'millisecond') { + if (units === undefined || units === 'millisecond' || !this.isValid()) { return this; } - // 'date' is an alias for 'day', so it should be considered as such. - if (units === 'date') { - units = 'day'; + var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; + + switch (units) { + case 'year': + time = startOfDate(this.year() + 1, 0, 1) - 1; + break; + case 'quarter': + time = startOfDate(this.year(), this.month() - this.month() % 3 + 3, 1) - 1; + break; + case 'month': + time = startOfDate(this.year(), this.month() + 1, 1) - 1; + break; + case 'week': + time = startOfDate(this.year(), this.month(), this.date() - this.weekday() + 7) - 1; + break; + case 'isoWeek': + time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1; + break; + case 'day': + case 'date': + time = startOfDate(this.year(), this.month(), this.date() + 1) - 1; + break; + case 'hour': + time = this._d.valueOf(); + time += MS_PER_HOUR - mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR) - 1; + break; + case 'minute': + time = this._d.valueOf(); + time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1; + break; + case 'second': + time = this._d.valueOf(); + time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1; + break; } - return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms'); + this._d.setTime(time); + hooks.updateOffset(this, true); + return this; } function valueOf () { @@ -4178,10 +4263,14 @@ units = normalizeUnits(units); - if (units === 'month' || units === 'year') { - days = this._days + milliseconds / 864e5; + if (units === 'month' || units === 'quarter' || units === 'year') { + days = this._days + milliseconds / 864e5; months = this._months + daysToMonths(days); - return units === 'month' ? months : months / 12; + switch (units) { + case 'month': return months; + case 'quarter': return months / 3; + case 'year': return months / 12; + } } else { // handle milliseconds separately because of floating point math errors (issue #1867) days = this._days + Math.round(monthsToDays(this._months)); @@ -4224,6 +4313,7 @@ var asDays = makeAs('d'); var asWeeks = makeAs('w'); var asMonths = makeAs('M'); + var asQuarters = makeAs('Q'); var asYears = makeAs('y'); function clone$1 () { @@ -4415,6 +4505,7 @@ proto$2.asDays = asDays; proto$2.asWeeks = asWeeks; proto$2.asMonths = asMonths; + proto$2.asQuarters = asQuarters; proto$2.asYears = asYears; proto$2.valueOf = valueOf$1; proto$2._bubble = bubble; @@ -4460,7 +4551,7 @@ //! moment.js - hooks.version = '2.23.0'; + hooks.version = '2.24.0'; setHookCallback(createLocal); @@ -5945,6 +6036,12 @@ var months$3 = 'leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec'.split('_'), monthsShort = 'led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro'.split('_'); + + var monthsParse = [/^led/i, /^úno/i, /^bře/i, /^dub/i, /^kvě/i, /^(čvn|červen$|června)/i, /^(čvc|červenec|července)/i, /^srp/i, /^zář/i, /^říj/i, /^lis/i, /^pro/i]; + // NOTE: 'červen' is substring of 'červenec'; therefore 'červenec' must precede 'červen' in the regex to be fully matched. + // Otherwise parser matches '1. červenec' as '1. červen' + 'ec'. + var monthsRegex$1 = /^(leden|únor|březen|duben|květen|červenec|července|červen|června|srpen|září|říjen|listopad|prosinec|led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i; + function plural$1(n) { return (n > 1) && (n < 5) && (~~(n / 10) !== 1); } @@ -6011,28 +6108,15 @@ hooks.defineLocale('cs', { months : months$3, monthsShort : monthsShort, - monthsParse : (function (months, monthsShort) { - var i, _monthsParse = []; - for (i = 0; i < 12; i++) { - // use custom parser to solve problem with July (červenec) - _monthsParse[i] = new RegExp('^' + months[i] + '$|^' + monthsShort[i] + '$', 'i'); - } - return _monthsParse; - }(months$3, monthsShort)), - shortMonthsParse : (function (monthsShort) { - var i, _shortMonthsParse = []; - for (i = 0; i < 12; i++) { - _shortMonthsParse[i] = new RegExp('^' + monthsShort[i] + '$', 'i'); - } - return _shortMonthsParse; - }(monthsShort)), - longMonthsParse : (function (months) { - var i, _longMonthsParse = []; - for (i = 0; i < 12; i++) { - _longMonthsParse[i] = new RegExp('^' + months[i] + '$', 'i'); - } - return _longMonthsParse; - }(months$3)), + monthsRegex : monthsRegex$1, + monthsShortRegex : monthsRegex$1, + // NOTE: 'červen' is substring of 'červenec'; therefore 'červenec' must precede 'červen' in the regex to be fully matched. + // Otherwise parser matches '1. červenec' as '1. červen' + 'ec'. + monthsStrictRegex : /^(leden|ledna|února|únor|březen|března|duben|dubna|květen|května|červenec|července|červen|června|srpen|srpna|září|říjen|října|listopadu|listopad|prosinec|prosince)/i, + monthsShortStrictRegex : /^(led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i, + monthsParse : monthsParse, + longMonthsParse : monthsParse, + shortMonthsParse : monthsParse, weekdays : 'neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota'.split('_'), weekdaysShort : 'ne_po_út_st_čt_pá_so'.split('_'), weekdaysMin : 'ne_po_út_st_čt_pá_so'.split('_'), @@ -6640,6 +6724,61 @@ //! moment.js locale configuration + hooks.defineLocale('en-SG', { + months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), + monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), + weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), + weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + longDateFormat : { + LT : 'HH:mm', + LTS : 'HH:mm:ss', + L : 'DD/MM/YYYY', + LL : 'D MMMM YYYY', + LLL : 'D MMMM YYYY HH:mm', + LLLL : 'dddd, D MMMM YYYY HH:mm' + }, + calendar : { + sameDay : '[Today at] LT', + nextDay : '[Tomorrow at] LT', + nextWeek : 'dddd [at] LT', + lastDay : '[Yesterday at] LT', + lastWeek : '[Last] dddd [at] LT', + sameElse : 'L' + }, + relativeTime : { + future : 'in %s', + past : '%s ago', + s : 'a few seconds', + ss : '%d 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' + }, + dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, + ordinal : function (number) { + var b = number % 10, + output = (~~(number % 100 / 10) === 1) ? 'th' : + (b === 1) ? 'st' : + (b === 2) ? 'nd' : + (b === 3) ? 'rd' : 'th'; + return number + output; + }, + week : { + dow : 1, // Monday is the first day of the week. + doy : 4 // The week that contains Jan 4th is the first week of the year. + } + }); + + //! moment.js locale configuration + hooks.defineLocale('en-au', { months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), @@ -6810,7 +6949,7 @@ longDateFormat : { LT : 'HH:mm', LTS : 'HH:mm:ss', - L : 'DD-MM-YYYY', + L : 'DD/MM/YYYY', LL : 'D MMMM YYYY', LLL : 'D MMMM YYYY HH:mm', LLLL : 'dddd D MMMM YYYY HH:mm' @@ -7023,8 +7162,8 @@ var monthsShortDot = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split('_'), monthsShort$1 = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'); - var monthsParse = [/^ene/i, /^feb/i, /^mar/i, /^abr/i, /^may/i, /^jun/i, /^jul/i, /^ago/i, /^sep/i, /^oct/i, /^nov/i, /^dic/i]; - var monthsRegex$1 = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i; + var monthsParse$1 = [/^ene/i, /^feb/i, /^mar/i, /^abr/i, /^may/i, /^jun/i, /^jul/i, /^ago/i, /^sep/i, /^oct/i, /^nov/i, /^dic/i]; + var monthsRegex$2 = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i; hooks.defineLocale('es-do', { months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'), @@ -7037,13 +7176,13 @@ return monthsShortDot[m.month()]; } }, - monthsRegex: monthsRegex$1, - monthsShortRegex: monthsRegex$1, + monthsRegex: monthsRegex$2, + monthsShortRegex: monthsRegex$2, monthsStrictRegex: /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i, monthsShortStrictRegex: /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i, - monthsParse: monthsParse, - longMonthsParse: monthsParse, - shortMonthsParse: monthsParse, + monthsParse: monthsParse$1, + longMonthsParse: monthsParse$1, + shortMonthsParse: monthsParse$1, weekdays : 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'), weekdaysShort : 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'), weekdaysMin : 'do_lu_ma_mi_ju_vi_sá'.split('_'), @@ -7103,6 +7242,9 @@ var monthsShortDot$1 = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split('_'), monthsShort$2 = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'); + var monthsParse$2 = [/^ene/i, /^feb/i, /^mar/i, /^abr/i, /^may/i, /^jun/i, /^jul/i, /^ago/i, /^sep/i, /^oct/i, /^nov/i, /^dic/i]; + var monthsRegex$3 = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i; + hooks.defineLocale('es-us', { months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'), monthsShort : function (m, format) { @@ -7114,7 +7256,13 @@ return monthsShortDot$1[m.month()]; } }, - monthsParseExact : true, + monthsRegex: monthsRegex$3, + monthsShortRegex: monthsRegex$3, + monthsStrictRegex: /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i, + monthsShortStrictRegex: /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i, + monthsParse: monthsParse$2, + longMonthsParse: monthsParse$2, + shortMonthsParse: monthsParse$2, weekdays : 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'), weekdaysShort : 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'), weekdaysMin : 'do_lu_ma_mi_ju_vi_sá'.split('_'), @@ -7123,9 +7271,9 @@ LT : 'h:mm A', LTS : 'h:mm:ss A', L : 'MM/DD/YYYY', - LL : 'MMMM [de] D [de] YYYY', - LLL : 'MMMM [de] D [de] YYYY h:mm A', - LLLL : 'dddd, MMMM [de] D [de] YYYY h:mm A' + LL : 'D [de] MMMM [de] YYYY', + LLL : 'D [de] MMMM [de] YYYY h:mm A', + LLLL : 'dddd, D [de] MMMM [de] YYYY h:mm A' }, calendar : { sameDay : function () { @@ -7174,8 +7322,8 @@ var monthsShortDot$2 = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split('_'), monthsShort$3 = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'); - var monthsParse$1 = [/^ene/i, /^feb/i, /^mar/i, /^abr/i, /^may/i, /^jun/i, /^jul/i, /^ago/i, /^sep/i, /^oct/i, /^nov/i, /^dic/i]; - var monthsRegex$2 = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i; + var monthsParse$3 = [/^ene/i, /^feb/i, /^mar/i, /^abr/i, /^may/i, /^jun/i, /^jul/i, /^ago/i, /^sep/i, /^oct/i, /^nov/i, /^dic/i]; + var monthsRegex$4 = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i; hooks.defineLocale('es', { months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'), @@ -7188,13 +7336,13 @@ return monthsShortDot$2[m.month()]; } }, - monthsRegex : monthsRegex$2, - monthsShortRegex : monthsRegex$2, + monthsRegex : monthsRegex$4, + monthsShortRegex : monthsRegex$4, monthsStrictRegex : /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i, monthsShortStrictRegex : /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i, - monthsParse : monthsParse$1, - longMonthsParse : monthsParse$1, - shortMonthsParse : monthsParse$1, + monthsParse : monthsParse$3, + longMonthsParse : monthsParse$3, + shortMonthsParse : monthsParse$3, weekdays : 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'), weekdaysShort : 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'), weekdaysMin : 'do_lu_ma_mi_ju_vi_sá'.split('_'), @@ -7591,13 +7739,13 @@ past : '%s síðani', s : 'fá sekund', ss : '%d sekundir', - m : 'ein minutt', + m : 'ein minuttur', mm : '%d minuttir', h : 'ein tími', hh : '%d tímar', d : 'ein dagur', dd : '%d dagar', - M : 'ein mánaði', + M : 'ein mánaður', MM : '%d mánaðir', y : 'eitt ár', yy : '%d ár' @@ -7874,25 +8022,90 @@ //! moment.js locale configuration + var months$5 = [ + 'Eanáir', 'Feabhra', 'Márta', 'Aibreán', 'Bealtaine', 'Méitheamh', 'Iúil', 'Lúnasa', 'Meán Fómhair', 'Deaireadh Fómhair', 'Samhain', 'Nollaig' + ]; + + var monthsShort$4 = ['Eaná', 'Feab', 'Márt', 'Aibr', 'Beal', 'Méit', 'Iúil', 'Lúna', 'Meán', 'Deai', 'Samh', 'Noll']; + + var weekdays$1 = ['Dé Domhnaigh', 'Dé Luain', 'Dé Máirt', 'Dé Céadaoin', 'Déardaoin', 'Dé hAoine', 'Dé Satharn']; + + var weekdaysShort = ['Dom', 'Lua', 'Mái', 'Céa', 'Déa', 'hAo', 'Sat']; + + var weekdaysMin = ['Do', 'Lu', 'Má', 'Ce', 'Dé', 'hA', 'Sa']; + + hooks.defineLocale('ga', { + months: months$5, + monthsShort: monthsShort$4, + monthsParseExact: true, + weekdays: weekdays$1, + weekdaysShort: weekdaysShort, + weekdaysMin: weekdaysMin, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm' + }, + calendar: { + sameDay: '[Inniu ag] LT', + nextDay: '[Amárach ag] LT', + nextWeek: 'dddd [ag] LT', + lastDay: '[Inné aig] LT', + lastWeek: 'dddd [seo caite] [ag] LT', + sameElse: 'L' + }, + relativeTime: { + future: 'i %s', + past: '%s ó shin', + s: 'cúpla soicind', + ss: '%d soicind', + m: 'nóiméad', + mm: '%d nóiméad', + h: 'uair an chloig', + hh: '%d uair an chloig', + d: 'lá', + dd: '%d lá', + M: 'mí', + MM: '%d mí', + y: 'bliain', + yy: '%d bliain' + }, + dayOfMonthOrdinalParse: /\d{1,2}(d|na|mh)/, + ordinal: function (number) { + var output = number === 1 ? 'd' : number % 10 === 2 ? 'na' : 'mh'; + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4 // The week that contains Jan 4th is the first week of the year. + } + }); + + //! moment.js locale configuration + + var months$6 = [ 'Am Faoilleach', 'An Gearran', 'Am Màrt', 'An Giblean', 'An Cèitean', 'An t-Ògmhios', 'An t-Iuchar', 'An Lùnastal', 'An t-Sultain', 'An Dàmhair', 'An t-Samhain', 'An Dùbhlachd' ]; - var monthsShort$4 = ['Faoi', 'Gear', 'Màrt', 'Gibl', 'Cèit', 'Ògmh', 'Iuch', 'Lùn', 'Sult', 'Dàmh', 'Samh', 'Dùbh']; + var monthsShort$5 = ['Faoi', 'Gear', 'Màrt', 'Gibl', 'Cèit', 'Ògmh', 'Iuch', 'Lùn', 'Sult', 'Dàmh', 'Samh', 'Dùbh']; - var weekdays$1 = ['Didòmhnaich', 'Diluain', 'Dimàirt', 'Diciadain', 'Diardaoin', 'Dihaoine', 'Disathairne']; + var weekdays$2 = ['Didòmhnaich', 'Diluain', 'Dimàirt', 'Diciadain', 'Diardaoin', 'Dihaoine', 'Disathairne']; - var weekdaysShort = ['Did', 'Dil', 'Dim', 'Dic', 'Dia', 'Dih', 'Dis']; + var weekdaysShort$1 = ['Did', 'Dil', 'Dim', 'Dic', 'Dia', 'Dih', 'Dis']; - var weekdaysMin = ['Dò', 'Lu', 'Mà', 'Ci', 'Ar', 'Ha', 'Sa']; + var weekdaysMin$1 = ['Dò', 'Lu', 'Mà', 'Ci', 'Ar', 'Ha', 'Sa']; hooks.defineLocale('gd', { - months : months$5, - monthsShort : monthsShort$4, + months : months$6, + monthsShort : monthsShort$5, monthsParseExact : true, - weekdays : weekdays$1, - weekdaysShort : weekdaysShort, - weekdaysMin : weekdaysMin, + weekdays : weekdays$2, + weekdaysShort : weekdaysShort$1, + weekdaysMin : weekdaysMin$1, longDateFormat : { LT : 'HH:mm', LTS : 'HH:mm:ss', @@ -8009,8 +8222,8 @@ 'ss': [number + ' secondanim', number + ' second'], 'm': ['eka mintan', 'ek minute'], 'mm': [number + ' mintanim', number + ' mintam'], - 'h': ['eka horan', 'ek hor'], - 'hh': [number + ' horanim', number + ' horam'], + 'h': ['eka voran', 'ek vor'], + 'hh': [number + ' voranim', number + ' voram'], 'd': ['eka disan', 'ek dis'], 'dd': [number + ' disanim', number + ' dis'], 'M': ['eka mhoinean', 'ek mhoino'], @@ -8936,6 +9149,63 @@ //! moment.js locale configuration + hooks.defineLocale('it-ch', { + months : 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'.split('_'), + monthsShort : 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'.split('_'), + weekdays : 'domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato'.split('_'), + weekdaysShort : 'dom_lun_mar_mer_gio_ven_sab'.split('_'), + weekdaysMin : 'do_lu_ma_me_gi_ve_sa'.split('_'), + longDateFormat : { + LT : 'HH:mm', + LTS : 'HH:mm:ss', + L : 'DD.MM.YYYY', + LL : 'D MMMM YYYY', + LLL : 'D MMMM YYYY HH:mm', + LLLL : 'dddd D MMMM YYYY HH:mm' + }, + calendar : { + sameDay: '[Oggi alle] LT', + nextDay: '[Domani alle] LT', + nextWeek: 'dddd [alle] LT', + lastDay: '[Ieri alle] LT', + lastWeek: function () { + switch (this.day()) { + case 0: + return '[la scorsa] dddd [alle] LT'; + default: + return '[lo scorso] dddd [alle] LT'; + } + }, + sameElse: 'L' + }, + relativeTime : { + future : function (s) { + return ((/^[0-9].+$/).test(s) ? 'tra' : 'in') + ' ' + s; + }, + past : '%s fa', + s : 'alcuni secondi', + ss : '%d secondi', + m : 'un minuto', + mm : '%d minuti', + h : 'un\'ora', + hh : '%d ore', + d : 'un giorno', + dd : '%d giorni', + M : 'un mese', + MM : '%d mesi', + y : 'un anno', + yy : '%d anni' + }, + dayOfMonthOrdinalParse : /\d{1,2}º/, + ordinal: '%dº', + week : { + dow : 1, // Monday is the first day of the week. + doy : 4 // The week that contains Jan 4th is the first week of the year. + } + }); + + //! moment.js locale configuration + hooks.defineLocale('it', { months : 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'.split('_'), monthsShort : 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'.split('_'), @@ -8994,7 +9264,7 @@ //! moment.js locale configuration hooks.defineLocale('ja', { - months : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), + months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), weekdays : '日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日'.split('_'), weekdaysShort : '日_月_火_水_木_金_土'.split('_'), @@ -9599,7 +9869,7 @@ '٩': '9', '٠': '0' }, - months$6 = [ + months$7 = [ 'کانونی دووەم', 'شوبات', 'ئازار', @@ -9616,8 +9886,8 @@ hooks.defineLocale('ku', { - months : months$6, - monthsShort : months$6, + months : months$7, + monthsShort : months$7, weekdays : 'یه‌كشه‌ممه‌_دووشه‌ممه‌_سێشه‌ممه‌_چوارشه‌ممه‌_پێنجشه‌ممه‌_هه‌ینی_شه‌ممه‌'.split('_'), weekdaysShort : 'یه‌كشه‌م_دووشه‌م_سێشه‌م_چوارشه‌م_پێنجشه‌م_هه‌ینی_شه‌ممه‌'.split('_'), weekdaysMin : 'ی_د_س_چ_پ_ه_ش'.split('_'), @@ -11103,8 +11373,8 @@ var monthsShortWithDots$1 = 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'), monthsShortWithoutDots$1 = 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_'); - var monthsParse$2 = [/^jan/i, /^feb/i, /^maart|mrt.?$/i, /^apr/i, /^mei$/i, /^jun[i.]?$/i, /^jul[i.]?$/i, /^aug/i, /^sep/i, /^okt/i, /^nov/i, /^dec/i]; - var monthsRegex$3 = /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i; + var monthsParse$4 = [/^jan/i, /^feb/i, /^maart|mrt.?$/i, /^apr/i, /^mei$/i, /^jun[i.]?$/i, /^jul[i.]?$/i, /^aug/i, /^sep/i, /^okt/i, /^nov/i, /^dec/i]; + var monthsRegex$5 = /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i; hooks.defineLocale('nl-be', { months : 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split('_'), @@ -11118,14 +11388,14 @@ } }, - monthsRegex: monthsRegex$3, - monthsShortRegex: monthsRegex$3, + monthsRegex: monthsRegex$5, + monthsShortRegex: monthsRegex$5, monthsStrictRegex: /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i, monthsShortStrictRegex: /^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i, - monthsParse : monthsParse$2, - longMonthsParse : monthsParse$2, - shortMonthsParse : monthsParse$2, + monthsParse : monthsParse$4, + longMonthsParse : monthsParse$4, + shortMonthsParse : monthsParse$4, weekdays : 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split('_'), weekdaysShort : 'zo._ma._di._wo._do._vr._za.'.split('_'), @@ -11178,8 +11448,8 @@ var monthsShortWithDots$2 = 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'), monthsShortWithoutDots$2 = 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_'); - var monthsParse$3 = [/^jan/i, /^feb/i, /^maart|mrt.?$/i, /^apr/i, /^mei$/i, /^jun[i.]?$/i, /^jul[i.]?$/i, /^aug/i, /^sep/i, /^okt/i, /^nov/i, /^dec/i]; - var monthsRegex$4 = /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i; + var monthsParse$5 = [/^jan/i, /^feb/i, /^maart|mrt.?$/i, /^apr/i, /^mei$/i, /^jun[i.]?$/i, /^jul[i.]?$/i, /^aug/i, /^sep/i, /^okt/i, /^nov/i, /^dec/i]; + var monthsRegex$6 = /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i; hooks.defineLocale('nl', { months : 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split('_'), @@ -11193,14 +11463,14 @@ } }, - monthsRegex: monthsRegex$4, - monthsShortRegex: monthsRegex$4, + monthsRegex: monthsRegex$6, + monthsShortRegex: monthsRegex$6, monthsStrictRegex: /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i, monthsShortStrictRegex: /^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i, - monthsParse : monthsParse$3, - longMonthsParse : monthsParse$3, - shortMonthsParse : monthsParse$3, + monthsParse : monthsParse$5, + longMonthsParse : monthsParse$5, + shortMonthsParse : monthsParse$5, weekdays : 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split('_'), weekdaysShort : 'zo._ma._di._wo._do._vr._za.'.split('_'), @@ -11525,8 +11795,8 @@ //! moment.js locale configuration hooks.defineLocale('pt-br', { - months : 'janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro'.split('_'), - monthsShort : 'jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez'.split('_'), + months : 'Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro'.split('_'), + monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'), weekdays : 'Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado'.split('_'), weekdaysShort : 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'), weekdaysMin : 'Do_2ª_3ª_4ª_5ª_6ª_Sá'.split('_'), @@ -11574,8 +11844,8 @@ //! moment.js locale configuration hooks.defineLocale('pt', { - months : 'janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro'.split('_'), - monthsShort : 'jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez'.split('_'), + months : 'Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro'.split('_'), + monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'), weekdays : 'Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado'.split('_'), weekdaysShort : 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'), weekdaysMin : 'Do_2ª_3ª_4ª_5ª_6ª_Sá'.split('_'), @@ -11709,7 +11979,7 @@ return number + ' ' + plural$4(format[key], +number); } } - var monthsParse$4 = [/^янв/i, /^фев/i, /^мар/i, /^апр/i, /^ма[йя]/i, /^июн/i, /^июл/i, /^авг/i, /^сен/i, /^окт/i, /^ноя/i, /^дек/i]; + var monthsParse$6 = [/^янв/i, /^фев/i, /^мар/i, /^апр/i, /^ма[йя]/i, /^июн/i, /^июл/i, /^авг/i, /^сен/i, /^окт/i, /^ноя/i, /^дек/i]; // http://new.gramota.ru/spravka/rules/139-prop : § 103 // Сокращения месяцев: http://new.gramota.ru/spravka/buro/search-answer?s=242637 @@ -11731,9 +12001,9 @@ }, weekdaysShort : 'вс_пн_вт_ср_чт_пт_сб'.split('_'), weekdaysMin : 'вс_пн_вт_ср_чт_пт_сб'.split('_'), - monthsParse : monthsParse$4, - longMonthsParse : monthsParse$4, - shortMonthsParse : monthsParse$4, + monthsParse : monthsParse$6, + longMonthsParse : monthsParse$6, + shortMonthsParse : monthsParse$6, // полные названия с падежами, по три буквы, для некоторых, по 4 буквы, сокращения с точкой и без точки monthsRegex: /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i, @@ -11859,7 +12129,7 @@ //! moment.js locale configuration - var months$7 = [ + var months$8 = [ 'جنوري', 'فيبروري', 'مارچ', @@ -11884,8 +12154,8 @@ ]; hooks.defineLocale('sd', { - months : months$7, - monthsShort : months$7, + months : months$8, + monthsShort : months$8, weekdays : days$1, weekdaysShort : days$1, weekdaysMin : days$1, @@ -12052,8 +12322,8 @@ //! moment.js locale configuration - var months$8 = 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split('_'), - monthsShort$5 = 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_'); + var months$9 = 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split('_'), + monthsShort$6 = 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_'); function plural$5(n) { return (n > 1) && (n < 5); } @@ -12118,8 +12388,8 @@ } hooks.defineLocale('sk', { - months : months$8, - monthsShort : monthsShort$5, + months : months$9, + monthsShort : monthsShort$6, weekdays : 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'), weekdaysShort : 'ne_po_ut_st_št_pi_so'.split('_'), weekdaysMin : 'ne_po_ut_st_št_pi_so'.split('_'), @@ -12909,8 +13179,8 @@ //! moment.js locale configuration hooks.defineLocale('te', { - months : 'జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జూలై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్'.split('_'), - monthsShort : 'జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జూలై_ఆగ._సెప్._అక్టో._నవ._డిసె.'.split('_'), + months : 'జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జులై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్'.split('_'), + monthsShort : 'జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జులై_ఆగ._సెప్._అక్టో._నవ._డిసె.'.split('_'), monthsParseExact : true, weekdays : 'ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం'.split('_'), weekdaysShort : 'ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని'.split('_'), @@ -13749,6 +14019,9 @@ 'genitive': 'неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи'.split('_') }; + if (m === true) { + return weekdays['nominative'].slice(1, 7).concat(weekdays['nominative'].slice(0, 1)); + } if (!m) { return weekdays['nominative']; } @@ -13858,7 +14131,7 @@ //! moment.js locale configuration - var months$9 = [ + var months$a = [ 'جنوری', 'فروری', 'مارچ', @@ -13883,8 +14156,8 @@ ]; hooks.defineLocale('ur', { - months : months$9, - monthsShort : months$9, + months : months$a, + monthsShort : months$a, weekdays : days$2, weekdaysShort : days$2, weekdaysMin : days$2, diff --git a/min/moment-with-locales.min.js b/min/moment-with-locales.min.js index 02cd72b6a0..d81e02ca33 100644 --- a/min/moment-with-locales.min.js +++ b/min/moment-with-locales.min.js @@ -1 +1 @@ -!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?module.exports=a():"function"==typeof define&&define.amd?define(a):e.moment=a()}(this,function(){"use strict";var e,n;function l(){return e.apply(null,arguments)}function _(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function i(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function o(e){return void 0===e}function m(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function u(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function M(e,a){var t,s=[];for(t=0;t>>0,s=0;sTe(e)?(d=e+1,_-Te(e)):(d=e,_),{year:d,dayOfYear:r}}function Ie(e,a,t){var s,n,d=Ne(e.year(),a,t),r=Math.floor((e.dayOfYear()-d-1)/7)+1;return r<1?s=r+Ce(n=e.year()-1,a,t):r>Ce(e.year(),a,t)?(s=r-Ce(e.year(),a,t),n=e.year()+1):(n=e.year(),s=r),{week:s,year:n}}function Ce(e,a,t){var s=Ne(e,a,t),n=Ne(e+1,a,t);return(Te(e)-s+n)/7}I("w",["ww",2],"wo","week"),I("W",["WW",2],"Wo","isoWeek"),P("week","w"),P("isoWeek","W"),A("week",5),A("isoWeek",5),ie("w",B),ie("ww",B,V),ie("W",B),ie("WW",B,V),Me(["w","ww","W","WW"],function(e,a,t,s){a[s.substr(0,1)]=g(e)});I("d",0,"do","day"),I("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),I("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),I("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),I("e",0,0,"weekday"),I("E",0,0,"isoWeekday"),P("day","d"),P("weekday","e"),P("isoWeekday","E"),A("day",11),A("weekday",11),A("isoWeekday",11),ie("d",B),ie("e",B),ie("E",B),ie("dd",function(e,a){return a.weekdaysMinRegex(e)}),ie("ddd",function(e,a){return a.weekdaysShortRegex(e)}),ie("dddd",function(e,a){return a.weekdaysRegex(e)}),Me(["dd","ddd","dddd"],function(e,a,t,s){var n=t._locale.weekdaysParse(e,s,t._strict);null!=n?a.d=n:Y(t).invalidWeekday=e}),Me(["d","e","E"],function(e,a,t,s){a[s]=g(e)});var Ge="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");var Ue="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");var Ve="Su_Mo_Tu_We_Th_Fr_Sa".split("_");var Ke=re;var $e=re;var Ze=re;function Be(){function e(e,a){return a.length-e.length}var a,t,s,n,d,r=[],_=[],i=[],o=[];for(a=0;a<7;a++)t=c([2e3,1]).day(a),s=this.weekdaysMin(t,""),n=this.weekdaysShort(t,""),d=this.weekdays(t,""),r.push(s),_.push(n),i.push(d),o.push(s),o.push(n),o.push(d);for(r.sort(e),_.sort(e),i.sort(e),o.sort(e),a=0;a<7;a++)_[a]=me(_[a]),i[a]=me(i[a]),o[a]=me(o[a]);this._weekdaysRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+_.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+r.join("|")+")","i")}function qe(){return this.hours()%12||12}function Qe(e,a){I(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),a)})}function Xe(e,a){return a._meridiemParse}I("H",["HH",2],0,"hour"),I("h",["hh",2],0,qe),I("k",["kk",2],0,function(){return this.hours()||24}),I("hmm",0,0,function(){return""+qe.apply(this)+F(this.minutes(),2)}),I("hmmss",0,0,function(){return""+qe.apply(this)+F(this.minutes(),2)+F(this.seconds(),2)}),I("Hmm",0,0,function(){return""+this.hours()+F(this.minutes(),2)}),I("Hmmss",0,0,function(){return""+this.hours()+F(this.minutes(),2)+F(this.seconds(),2)}),Qe("a",!0),Qe("A",!1),P("hour","h"),A("hour",13),ie("a",Xe),ie("A",Xe),ie("H",B),ie("h",B),ie("k",B),ie("HH",B,V),ie("hh",B,V),ie("kk",B,V),ie("hmm",q),ie("hmmss",Q),ie("Hmm",q),ie("Hmmss",Q),le(["H","HH"],Ye),le(["k","kk"],function(e,a,t){var s=g(e);a[Ye]=24===s?0:s}),le(["a","A"],function(e,a,t){t._isPm=t._locale.isPM(e),t._meridiem=e}),le(["h","hh"],function(e,a,t){a[Ye]=g(e),Y(t).bigHour=!0}),le("hmm",function(e,a,t){var s=e.length-2;a[Ye]=g(e.substr(0,s)),a[ye]=g(e.substr(s)),Y(t).bigHour=!0}),le("hmmss",function(e,a,t){var s=e.length-4,n=e.length-2;a[Ye]=g(e.substr(0,s)),a[ye]=g(e.substr(s,2)),a[fe]=g(e.substr(n)),Y(t).bigHour=!0}),le("Hmm",function(e,a,t){var s=e.length-2;a[Ye]=g(e.substr(0,s)),a[ye]=g(e.substr(s))}),le("Hmmss",function(e,a,t){var s=e.length-4,n=e.length-2;a[Ye]=g(e.substr(0,s)),a[ye]=g(e.substr(s,2)),a[fe]=g(e.substr(n))});var ea,aa=He("Hours",!0),ta={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d 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"},months:Pe,monthsShort:Oe,week:{dow:0,doy:6},weekdays:Ge,weekdaysMin:Ve,weekdaysShort:Ue,meridiemParse:/[ap]\.?m?\.?/i},sa={},na={};function da(e){return e?e.toLowerCase().replace("_","-"):e}function ra(e){var a=null;if(!sa[e]&&"undefined"!=typeof module&&module&&module.exports)try{a=ea._abbr,require("./locale/"+e),_a(a)}catch(e){}return sa[e]}function _a(e,a){var t;return e&&((t=o(a)?oa(e):ia(e,a))?ea=t:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),ea._abbr}function ia(e,a){if(null===a)return delete sa[e],null;var t,s=ta;if(a.abbr=e,null!=sa[e])H("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=sa[e]._config;else if(null!=a.parentLocale)if(null!=sa[a.parentLocale])s=sa[a.parentLocale]._config;else{if(null==(t=ra(a.parentLocale)))return na[a.parentLocale]||(na[a.parentLocale]=[]),na[a.parentLocale].push({name:e,config:a}),null;s=t._config}return sa[e]=new j(b(s,a)),na[e]&&na[e].forEach(function(e){ia(e.name,e.config)}),_a(e),sa[e]}function oa(e){var a;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return ea;if(!_(e)){if(a=ra(e))return a;e=[e]}return function(e){for(var a,t,s,n,d=0;d=a&&r(n,t,!0)>=a-1)break;a--}d++}return ea}(e)}function ma(e){var a,t=e._a;return t&&-2===Y(e).overflow&&(a=t[Le]<0||11je(t[he],t[Le])?ce:t[Ye]<0||24Ce(t,d,r)?Y(e)._overflowWeeks=!0:null!=i?Y(e)._overflowWeekday=!0:(_=Re(t,s,n,d,r),e._a[he]=_.year,e._dayOfYear=_.dayOfYear)}(e),null!=e._dayOfYear&&(d=ua(e._a[he],s[he]),(e._dayOfYear>Te(d)||0===e._dayOfYear)&&(Y(e)._overflowDayOfYear=!0),t=Je(d,0,e._dayOfYear),e._a[Le]=t.getUTCMonth(),e._a[ce]=t.getUTCDate()),a=0;a<3&&null==e._a[a];++a)e._a[a]=r[a]=s[a];for(;a<7;a++)e._a[a]=r[a]=null==e._a[a]?2===a?1:0:e._a[a];24===e._a[Ye]&&0===e._a[ye]&&0===e._a[fe]&&0===e._a[ke]&&(e._nextDay=!0,e._a[Ye]=0),e._d=(e._useUTC?Je:function(e,a,t,s,n,d,r){var _=new Date(e,a,t,s,n,d,r);return e<100&&0<=e&&isFinite(_.getFullYear())&&_.setFullYear(e),_}).apply(null,r),n=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Ye]=24),e._w&&void 0!==e._w.d&&e._w.d!==n&&(Y(e).weekdayMismatch=!0)}}var Ma=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ha=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,La=/Z|[+-]\d\d(?::?\d\d)?/,ca=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],Ya=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],ya=/^\/?Date\((\-?\d+)/i;function fa(e){var a,t,s,n,d,r,_=e._i,i=Ma.exec(_)||ha.exec(_);if(i){for(Y(e).iso=!0,a=0,t=ca.length;at.valueOf():t.valueOf()this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},it.isLocal=function(){return!!this.isValid()&&!this._isUTC},it.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},it.isUtc=Na,it.isUTC=Na,it.zoneAbbr=function(){return this._isUTC?"UTC":""},it.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},it.dates=t("dates accessor is deprecated. Use date instead.",tt),it.months=t("months accessor is deprecated. Use month instead",Ee),it.years=t("years accessor is deprecated. Use year instead",ve),it.zone=t("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,a){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,a),this):-this.utcOffset()}),it.isDSTShifted=t("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!o(this._isDSTShifted))return this._isDSTShifted;var e={};if(k(e,this),(e=wa(e))._a){var a=e._isUTC?c(e._a):Ha(e._a);this._isDSTShifted=this.isValid()&&0>>0,s=0;sTe(e)?(d=e+1,_-Te(e)):(d=e,_),{year:d,dayOfYear:r}}function Ce(e,a,t){var s,n,d=Ne(e.year(),a,t),r=Math.floor((e.dayOfYear()-d-1)/7)+1;return r<1?s=r+Ie(n=e.year()-1,a,t):r>Ie(e.year(),a,t)?(s=r-Ie(e.year(),a,t),n=e.year()+1):(n=e.year(),s=r),{week:s,year:n}}function Ie(e,a,t){var s=Ne(e,a,t),n=Ne(e+1,a,t);return(Te(e)-s+n)/7}C("w",["ww",2],"wo","week"),C("W",["WW",2],"Wo","isoWeek"),O("week","w"),O("isoWeek","W"),E("week",5),E("isoWeek",5),ie("w",B),ie("ww",B,V),ie("W",B),ie("WW",B,V),Me(["w","ww","W","WW"],function(e,a,t,s){a[s.substr(0,1)]=g(e)});function Ue(e,a){return e.slice(a,7).concat(e.slice(0,a))}C("d",0,"do","day"),C("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),C("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),C("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),C("e",0,0,"weekday"),C("E",0,0,"isoWeekday"),O("day","d"),O("weekday","e"),O("isoWeekday","E"),E("day",11),E("weekday",11),E("isoWeekday",11),ie("d",B),ie("e",B),ie("E",B),ie("dd",function(e,a){return a.weekdaysMinRegex(e)}),ie("ddd",function(e,a){return a.weekdaysShortRegex(e)}),ie("dddd",function(e,a){return a.weekdaysRegex(e)}),Me(["dd","ddd","dddd"],function(e,a,t,s){var n=t._locale.weekdaysParse(e,s,t._strict);null!=n?a.d=n:Y(t).invalidWeekday=e}),Me(["d","e","E"],function(e,a,t,s){a[s]=g(e)});var Ge="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");var Ve="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");var Ke="Su_Mo_Tu_We_Th_Fr_Sa".split("_");var Ze=re;var $e=re;var Be=re;function qe(){function e(e,a){return a.length-e.length}var a,t,s,n,d,r=[],_=[],i=[],o=[];for(a=0;a<7;a++)t=c([2e3,1]).day(a),s=this.weekdaysMin(t,""),n=this.weekdaysShort(t,""),d=this.weekdays(t,""),r.push(s),_.push(n),i.push(d),o.push(s),o.push(n),o.push(d);for(r.sort(e),_.sort(e),i.sort(e),o.sort(e),a=0;a<7;a++)_[a]=me(_[a]),i[a]=me(i[a]),o[a]=me(o[a]);this._weekdaysRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+_.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+r.join("|")+")","i")}function Qe(){return this.hours()%12||12}function Xe(e,a){C(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),a)})}function ea(e,a){return a._meridiemParse}C("H",["HH",2],0,"hour"),C("h",["hh",2],0,Qe),C("k",["kk",2],0,function(){return this.hours()||24}),C("hmm",0,0,function(){return""+Qe.apply(this)+F(this.minutes(),2)}),C("hmmss",0,0,function(){return""+Qe.apply(this)+F(this.minutes(),2)+F(this.seconds(),2)}),C("Hmm",0,0,function(){return""+this.hours()+F(this.minutes(),2)}),C("Hmmss",0,0,function(){return""+this.hours()+F(this.minutes(),2)+F(this.seconds(),2)}),Xe("a",!0),Xe("A",!1),O("hour","h"),E("hour",13),ie("a",ea),ie("A",ea),ie("H",B),ie("h",B),ie("k",B),ie("HH",B,V),ie("hh",B,V),ie("kk",B,V),ie("hmm",q),ie("hmmss",Q),ie("Hmm",q),ie("Hmmss",Q),le(["H","HH"],Ye),le(["k","kk"],function(e,a,t){var s=g(e);a[Ye]=24===s?0:s}),le(["a","A"],function(e,a,t){t._isPm=t._locale.isPM(e),t._meridiem=e}),le(["h","hh"],function(e,a,t){a[Ye]=g(e),Y(t).bigHour=!0}),le("hmm",function(e,a,t){var s=e.length-2;a[Ye]=g(e.substr(0,s)),a[ye]=g(e.substr(s)),Y(t).bigHour=!0}),le("hmmss",function(e,a,t){var s=e.length-4,n=e.length-2;a[Ye]=g(e.substr(0,s)),a[ye]=g(e.substr(s,2)),a[fe]=g(e.substr(n)),Y(t).bigHour=!0}),le("Hmm",function(e,a,t){var s=e.length-2;a[Ye]=g(e.substr(0,s)),a[ye]=g(e.substr(s))}),le("Hmmss",function(e,a,t){var s=e.length-4,n=e.length-2;a[Ye]=g(e.substr(0,s)),a[ye]=g(e.substr(s,2)),a[fe]=g(e.substr(n))});var aa,ta=Se("Hours",!0),sa={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d 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"},months:Oe,monthsShort:Pe,week:{dow:0,doy:6},weekdays:Ge,weekdaysMin:Ke,weekdaysShort:Ve,meridiemParse:/[ap]\.?m?\.?/i},na={},da={};function ra(e){return e?e.toLowerCase().replace("_","-"):e}function _a(e){var a=null;if(!na[e]&&"undefined"!=typeof module&&module&&module.exports)try{a=aa._abbr,require("./locale/"+e),ia(a)}catch(e){}return na[e]}function ia(e,a){var t;return e&&((t=o(a)?ma(e):oa(e,a))?aa=t:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),aa._abbr}function oa(e,a){if(null===a)return delete na[e],null;var t,s=sa;if(a.abbr=e,null!=na[e])S("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=na[e]._config;else if(null!=a.parentLocale)if(null!=na[a.parentLocale])s=na[a.parentLocale]._config;else{if(null==(t=_a(a.parentLocale)))return da[a.parentLocale]||(da[a.parentLocale]=[]),da[a.parentLocale].push({name:e,config:a}),null;s=t._config}return na[e]=new j(b(s,a)),da[e]&&da[e].forEach(function(e){oa(e.name,e.config)}),ia(e),na[e]}function ma(e){var a;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return aa;if(!_(e)){if(a=_a(e))return a;e=[e]}return function(e){for(var a,t,s,n,d=0;d=a&&r(n,t,!0)>=a-1)break;a--}d++}return aa}(e)}function ua(e){var a,t=e._a;return t&&-2===Y(e).overflow&&(a=t[Le]<0||11je(t[he],t[Le])?ce:t[Ye]<0||24Ie(t,d,r)?Y(e)._overflowWeeks=!0:null!=i?Y(e)._overflowWeekday=!0:(_=Re(t,s,n,d,r),e._a[he]=_.year,e._dayOfYear=_.dayOfYear)}(e),null!=e._dayOfYear&&(d=la(e._a[he],s[he]),(e._dayOfYear>Te(d)||0===e._dayOfYear)&&(Y(e)._overflowDayOfYear=!0),t=Je(d,0,e._dayOfYear),e._a[Le]=t.getUTCMonth(),e._a[ce]=t.getUTCDate()),a=0;a<3&&null==e._a[a];++a)e._a[a]=r[a]=s[a];for(;a<7;a++)e._a[a]=r[a]=null==e._a[a]?2===a?1:0:e._a[a];24===e._a[Ye]&&0===e._a[ye]&&0===e._a[fe]&&0===e._a[ke]&&(e._nextDay=!0,e._a[Ye]=0),e._d=(e._useUTC?Je:function(e,a,t,s,n,d,r){var _;return e<100&&0<=e?(_=new Date(e+400,a,t,s,n,d,r),isFinite(_.getFullYear())&&_.setFullYear(e)):_=new Date(e,a,t,s,n,d,r),_}).apply(null,r),n=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Ye]=24),e._w&&void 0!==e._w.d&&e._w.d!==n&&(Y(e).weekdayMismatch=!0)}}var ha=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,La=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ca=/Z|[+-]\d\d(?::?\d\d)?/,Ya=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],ya=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],fa=/^\/?Date\((\-?\d+)/i;function ka(e){var a,t,s,n,d,r,_=e._i,i=ha.exec(_)||La.exec(_);if(i){for(Y(e).iso=!0,a=0,t=Ya.length;at.valueOf():t.valueOf()this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},Mt.isLocal=function(){return!!this.isValid()&&!this._isUTC},Mt.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},Mt.isUtc=Ra,Mt.isUTC=Ra,Mt.zoneAbbr=function(){return this._isUTC?"UTC":""},Mt.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},Mt.dates=t("dates accessor is deprecated. Use date instead.",_t),Mt.months=t("months accessor is deprecated. Use month instead",Ae),Mt.years=t("years accessor is deprecated. Use year instead",ve),Mt.zone=t("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,a){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,a),this):-this.utcOffset()}),Mt.isDSTShifted=t("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!o(this._isDSTShifted))return this._isDSTShifted;var e={};if(k(e,this),(e=va(e))._a){var a=e._isUTC?c(e._a):Ha(e._a);this._isDSTShifted=this.isValid()&&0>>0,s=0;sDe(e)?(r=e+1,o-De(e)):(r=e,o),{year:r,dayOfYear:a}}function Ie(e,t,n){var s,i,r=Ve(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?s=a+Ae(i=e.year()-1,t,n):a>Ae(e.year(),t,n)?(s=a-Ae(e.year(),t,n),i=e.year()+1):(i=e.year(),s=a),{week:s,year:i}}function Ae(e,t,n){var s=Ve(e,t,n),i=Ve(e+1,t,n);return(De(e)-s+i)/7}I("w",["ww",2],"wo","week"),I("W",["WW",2],"Wo","isoWeek"),H("week","w"),H("isoWeek","W"),L("week",5),L("isoWeek",5),ue("w",B),ue("ww",B,z),ue("W",B),ue("WW",B,z),fe(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=k(e)});I("d",0,"do","day"),I("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),I("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),I("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),I("e",0,0,"weekday"),I("E",0,0,"isoWeekday"),H("day","d"),H("weekday","e"),H("isoWeekday","E"),L("day",11),L("weekday",11),L("isoWeekday",11),ue("d",B),ue("e",B),ue("E",B),ue("dd",function(e,t){return t.weekdaysMinRegex(e)}),ue("ddd",function(e,t){return t.weekdaysShortRegex(e)}),ue("dddd",function(e,t){return t.weekdaysRegex(e)}),fe(["dd","ddd","dddd"],function(e,t,n,s){var i=n._locale.weekdaysParse(e,s,n._strict);null!=i?t.d=i:g(n).invalidWeekday=e}),fe(["d","e","E"],function(e,t,n,s){t[s]=k(e)});var je="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");var Ze="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");var ze="Su_Mo_Tu_We_Th_Fr_Sa".split("_");var $e=ae;var qe=ae;var Je=ae;function Be(){function e(e,t){return t.length-e.length}var t,n,s,i,r,a=[],o=[],u=[],l=[];for(t=0;t<7;t++)n=y([2e3,1]).day(t),s=this.weekdaysMin(n,""),i=this.weekdaysShort(n,""),r=this.weekdays(n,""),a.push(s),o.push(i),u.push(r),l.push(s),l.push(i),l.push(r);for(a.sort(e),o.sort(e),u.sort(e),l.sort(e),t=0;t<7;t++)o[t]=de(o[t]),u[t]=de(u[t]),l[t]=de(l[t]);this._weekdaysRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+a.join("|")+")","i")}function Qe(){return this.hours()%12||12}function Xe(e,t){I(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function Ke(e,t){return t._meridiemParse}I("H",["HH",2],0,"hour"),I("h",["hh",2],0,Qe),I("k",["kk",2],0,function(){return this.hours()||24}),I("hmm",0,0,function(){return""+Qe.apply(this)+U(this.minutes(),2)}),I("hmmss",0,0,function(){return""+Qe.apply(this)+U(this.minutes(),2)+U(this.seconds(),2)}),I("Hmm",0,0,function(){return""+this.hours()+U(this.minutes(),2)}),I("Hmmss",0,0,function(){return""+this.hours()+U(this.minutes(),2)+U(this.seconds(),2)}),Xe("a",!0),Xe("A",!1),H("hour","h"),L("hour",13),ue("a",Ke),ue("A",Ke),ue("H",B),ue("h",B),ue("k",B),ue("HH",B,z),ue("hh",B,z),ue("kk",B,z),ue("hmm",Q),ue("hmmss",X),ue("Hmm",Q),ue("Hmmss",X),ce(["H","HH"],ge),ce(["k","kk"],function(e,t,n){var s=k(e);t[ge]=24===s?0:s}),ce(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),ce(["h","hh"],function(e,t,n){t[ge]=k(e),g(n).bigHour=!0}),ce("hmm",function(e,t,n){var s=e.length-2;t[ge]=k(e.substr(0,s)),t[pe]=k(e.substr(s)),g(n).bigHour=!0}),ce("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=k(e.substr(0,s)),t[pe]=k(e.substr(s,2)),t[ve]=k(e.substr(i)),g(n).bigHour=!0}),ce("Hmm",function(e,t,n){var s=e.length-2;t[ge]=k(e.substr(0,s)),t[pe]=k(e.substr(s))}),ce("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=k(e.substr(0,s)),t[pe]=k(e.substr(s,2)),t[ve]=k(e.substr(i))});var et,tt=Te("Hours",!0),nt={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d 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"},months:He,monthsShort:Re,week:{dow:0,doy:6},weekdays:je,weekdaysMin:ze,weekdaysShort:Ze,meridiemParse:/[ap]\.?m?\.?/i},st={},it={};function rt(e){return e?e.toLowerCase().replace("_","-"):e}function at(e){var t=null;if(!st[e]&&"undefined"!=typeof module&&module&&module.exports)try{t=et._abbr,require("./locale/"+e),ot(t)}catch(e){}return st[e]}function ot(e,t){var n;return e&&((n=l(t)?lt(e):ut(e,t))?et=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),et._abbr}function ut(e,t){if(null===t)return delete st[e],null;var n,s=nt;if(t.abbr=e,null!=st[e])T("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=st[e]._config;else if(null!=t.parentLocale)if(null!=st[t.parentLocale])s=st[t.parentLocale]._config;else{if(null==(n=at(t.parentLocale)))return it[t.parentLocale]||(it[t.parentLocale]=[]),it[t.parentLocale].push({name:e,config:t}),null;s=n._config}return st[e]=new P(b(s,t)),it[e]&&it[e].forEach(function(e){ut(e.name,e.config)}),ot(e),st[e]}function lt(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return et;if(!o(e)){if(t=at(e))return t;e=[e]}return function(e){for(var t,n,s,i,r=0;r=t&&a(i,n,!0)>=t-1)break;t--}r++}return et}(e)}function dt(e){var t,n=e._a;return n&&-2===g(e).overflow&&(t=n[_e]<0||11Pe(n[me],n[_e])?ye:n[ge]<0||24Ae(n,r,a)?g(e)._overflowWeeks=!0:null!=u?g(e)._overflowWeekday=!0:(o=Ee(n,s,i,r,a),e._a[me]=o.year,e._dayOfYear=o.dayOfYear)}(e),null!=e._dayOfYear&&(r=ht(e._a[me],s[me]),(e._dayOfYear>De(r)||0===e._dayOfYear)&&(g(e)._overflowDayOfYear=!0),n=Ge(r,0,e._dayOfYear),e._a[_e]=n.getUTCMonth(),e._a[ye]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=a[t]=s[t];for(;t<7;t++)e._a[t]=a[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[ge]&&0===e._a[pe]&&0===e._a[ve]&&0===e._a[we]&&(e._nextDay=!0,e._a[ge]=0),e._d=(e._useUTC?Ge:function(e,t,n,s,i,r,a){var o=new Date(e,t,n,s,i,r,a);return e<100&&0<=e&&isFinite(o.getFullYear())&&o.setFullYear(e),o}).apply(null,a),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[ge]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(g(e).weekdayMismatch=!0)}}var ft=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,mt=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,_t=/Z|[+-]\d\d(?::?\d\d)?/,yt=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],gt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],pt=/^\/?Date\((\-?\d+)/i;function vt(e){var t,n,s,i,r,a,o=e._i,u=ft.exec(o)||mt.exec(o);if(u){for(g(e).iso=!0,t=0,n=yt.length;tn.valueOf():n.valueOf()this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},ln.isLocal=function(){return!!this.isValid()&&!this._isUTC},ln.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},ln.isUtc=Vt,ln.isUTC=Vt,ln.zoneAbbr=function(){return this._isUTC?"UTC":""},ln.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},ln.dates=n("dates accessor is deprecated. Use date instead.",nn),ln.months=n("months accessor is deprecated. Use month instead",Fe),ln.years=n("years accessor is deprecated. Use year instead",Oe),ln.zone=n("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),ln.isDSTShifted=n("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!l(this._isDSTShifted))return this._isDSTShifted;var e={};if(w(e,this),(e=Yt(e))._a){var t=e._isUTC?y(e._a):Tt(e._a);this._isDSTShifted=this.isValid()&&0>>0,s=0;sSe(e)?(r=e+1,o-Se(e)):(r=e,o),{year:r,dayOfYear:a}}function Ie(e,t,n){var s,i,r=Ve(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?s=a+Ae(i=e.year()-1,t,n):a>Ae(e.year(),t,n)?(s=a-Ae(e.year(),t,n),i=e.year()+1):(i=e.year(),s=a),{week:s,year:i}}function Ae(e,t,n){var s=Ve(e,t,n),i=Ve(e+1,t,n);return(Se(e)-s+i)/7}I("w",["ww",2],"wo","week"),I("W",["WW",2],"Wo","isoWeek"),C("week","w"),C("isoWeek","W"),F("week",5),F("isoWeek",5),ue("w",B),ue("ww",B,z),ue("W",B),ue("WW",B,z),fe(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=D(e)});function je(e,t){return e.slice(t,7).concat(e.slice(0,t))}I("d",0,"do","day"),I("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),I("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),I("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),I("e",0,0,"weekday"),I("E",0,0,"isoWeekday"),C("day","d"),C("weekday","e"),C("isoWeekday","E"),F("day",11),F("weekday",11),F("isoWeekday",11),ue("d",B),ue("e",B),ue("E",B),ue("dd",function(e,t){return t.weekdaysMinRegex(e)}),ue("ddd",function(e,t){return t.weekdaysShortRegex(e)}),ue("dddd",function(e,t){return t.weekdaysRegex(e)}),fe(["dd","ddd","dddd"],function(e,t,n,s){var i=n._locale.weekdaysParse(e,s,n._strict);null!=i?t.d=i:g(n).invalidWeekday=e}),fe(["d","e","E"],function(e,t,n,s){t[s]=D(e)});var Ze="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");var ze="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");var $e="Su_Mo_Tu_We_Th_Fr_Sa".split("_");var qe=ae;var Je=ae;var Be=ae;function Qe(){function e(e,t){return t.length-e.length}var t,n,s,i,r,a=[],o=[],u=[],l=[];for(t=0;t<7;t++)n=y([2e3,1]).day(t),s=this.weekdaysMin(n,""),i=this.weekdaysShort(n,""),r=this.weekdays(n,""),a.push(s),o.push(i),u.push(r),l.push(s),l.push(i),l.push(r);for(a.sort(e),o.sort(e),u.sort(e),l.sort(e),t=0;t<7;t++)o[t]=he(o[t]),u[t]=he(u[t]),l[t]=he(l[t]);this._weekdaysRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+a.join("|")+")","i")}function Xe(){return this.hours()%12||12}function Ke(e,t){I(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function et(e,t){return t._meridiemParse}I("H",["HH",2],0,"hour"),I("h",["hh",2],0,Xe),I("k",["kk",2],0,function(){return this.hours()||24}),I("hmm",0,0,function(){return""+Xe.apply(this)+L(this.minutes(),2)}),I("hmmss",0,0,function(){return""+Xe.apply(this)+L(this.minutes(),2)+L(this.seconds(),2)}),I("Hmm",0,0,function(){return""+this.hours()+L(this.minutes(),2)}),I("Hmmss",0,0,function(){return""+this.hours()+L(this.minutes(),2)+L(this.seconds(),2)}),Ke("a",!0),Ke("A",!1),C("hour","h"),F("hour",13),ue("a",et),ue("A",et),ue("H",B),ue("h",B),ue("k",B),ue("HH",B,z),ue("hh",B,z),ue("kk",B,z),ue("hmm",Q),ue("hmmss",X),ue("Hmm",Q),ue("Hmmss",X),ce(["H","HH"],ge),ce(["k","kk"],function(e,t,n){var s=D(e);t[ge]=24===s?0:s}),ce(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),ce(["h","hh"],function(e,t,n){t[ge]=D(e),g(n).bigHour=!0}),ce("hmm",function(e,t,n){var s=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s)),g(n).bigHour=!0}),ce("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s,2)),t[pe]=D(e.substr(i)),g(n).bigHour=!0}),ce("Hmm",function(e,t,n){var s=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s))}),ce("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s,2)),t[pe]=D(e.substr(i))});var tt,nt=Te("Hours",!0),st={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d 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"},months:Ce,monthsShort:He,week:{dow:0,doy:6},weekdays:Ze,weekdaysMin:$e,weekdaysShort:ze,meridiemParse:/[ap]\.?m?\.?/i},it={},rt={};function at(e){return e?e.toLowerCase().replace("_","-"):e}function ot(e){var t=null;if(!it[e]&&"undefined"!=typeof module&&module&&module.exports)try{t=tt._abbr,require("./locale/"+e),ut(t)}catch(e){}return it[e]}function ut(e,t){var n;return e&&((n=l(t)?ht(e):lt(e,t))?tt=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),tt._abbr}function lt(e,t){if(null===t)return delete it[e],null;var n,s=st;if(t.abbr=e,null!=it[e])T("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=it[e]._config;else if(null!=t.parentLocale)if(null!=it[t.parentLocale])s=it[t.parentLocale]._config;else{if(null==(n=ot(t.parentLocale)))return rt[t.parentLocale]||(rt[t.parentLocale]=[]),rt[t.parentLocale].push({name:e,config:t}),null;s=n._config}return it[e]=new P(x(s,t)),rt[e]&&rt[e].forEach(function(e){lt(e.name,e.config)}),ut(e),it[e]}function ht(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return tt;if(!o(e)){if(t=ot(e))return t;e=[e]}return function(e){for(var t,n,s,i,r=0;r=t&&a(i,n,!0)>=t-1)break;t--}r++}return tt}(e)}function dt(e){var t,n=e._a;return n&&-2===g(e).overflow&&(t=n[_e]<0||11Pe(n[me],n[_e])?ye:n[ge]<0||24Ae(n,r,a)?g(e)._overflowWeeks=!0:null!=u?g(e)._overflowWeekday=!0:(o=Ee(n,s,i,r,a),e._a[me]=o.year,e._dayOfYear=o.dayOfYear)}(e),null!=e._dayOfYear&&(r=ct(e._a[me],s[me]),(e._dayOfYear>Se(r)||0===e._dayOfYear)&&(g(e)._overflowDayOfYear=!0),n=Ge(r,0,e._dayOfYear),e._a[_e]=n.getUTCMonth(),e._a[ye]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=a[t]=s[t];for(;t<7;t++)e._a[t]=a[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[ge]&&0===e._a[ve]&&0===e._a[pe]&&0===e._a[we]&&(e._nextDay=!0,e._a[ge]=0),e._d=(e._useUTC?Ge:function(e,t,n,s,i,r,a){var o;return e<100&&0<=e?(o=new Date(e+400,t,n,s,i,r,a),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,n,s,i,r,a),o}).apply(null,a),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[ge]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(g(e).weekdayMismatch=!0)}}var mt=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,_t=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,yt=/Z|[+-]\d\d(?::?\d\d)?/,gt=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],vt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],pt=/^\/?Date\((\-?\d+)/i;function wt(e){var t,n,s,i,r,a,o=e._i,u=mt.exec(o)||_t.exec(o);if(u){for(g(e).iso=!0,t=0,n=gt.length;tn.valueOf():n.valueOf()this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},mn.isLocal=function(){return!!this.isValid()&&!this._isUTC},mn.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},mn.isUtc=Et,mn.isUTC=Et,mn.zoneAbbr=function(){return this._isUTC?"UTC":""},mn.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},mn.dates=n("dates accessor is deprecated. Use date instead.",un),mn.months=n("months accessor is deprecated. Use month instead",Ue),mn.years=n("years accessor is deprecated. Use year instead",Oe),mn.zone=n("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),mn.isDSTShifted=n("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!l(this._isDSTShifted))return this._isDSTShifted;var e={};if(w(e,this),(e=Ot(e))._a){var t=e._isUTC?y(e._a):bt(e._a);this._isDSTShifted=this.isValid()&&0 ' + a[i][1]); } @@ -13574,18 +14137,14 @@ }); test('format month', function (assert) { - var i, - expected = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'); - + var expected = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); test('format week', function (assert) { - var i, - expected = 'Sunday Sun Su_Monday Mon Mo_Tuesday Tue Tu_Wednesday Wed We_Thursday Thu Th_Friday Fri Fr_Saturday Sat Sa'.split('_'); - + var expected = 'Sunday Sun Su_Monday Mon Mo_Tuesday Tue Tu_Wednesday Wed We_Thursday Thu Th_Friday Fri Fr_Saturday Sat Sa'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); } @@ -13650,7 +14209,6 @@ test('calendar next week', function (assert) { var i, m; - for (i = 2; i < 7; i++) { m = moment().add({d: i}); assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days current time'); @@ -13688,12 +14246,40 @@ assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); }); - test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1st', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1st', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2nd', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2nd', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3rd', 'Jan 15 2012 should be week 3'); + test('weeks year starting sunday formatted', function (assert) { + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52nd', 'Jan 1 2012 should be week 52'); + assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1st', 'Jan 2 2012 should be week 1'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1st', 'Jan 8 2012 should be week 1'); + assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2nd', 'Jan 9 2012 should be week 2'); + assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2nd', 'Jan 15 2012 should be week 2'); + }); + + // Concrete test for Locale#weekdaysMin + test('Weekdays sort by locale', function (assert) { + assert.deepEqual( + moment().localeData('en-au').weekdays(), + 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), + 'weekdays start on Sunday'); + assert.deepEqual( + moment().localeData('en-au').weekdays(true), + 'Monday_Tuesday_Wednesday_Thursday_Friday_Saturday_Sunday'.split('_'), + 'locale-sorted weekdays start on Monday'); + assert.deepEqual( + moment().localeData('en-au').weekdaysShort(), + 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + 'weekdaysShort start on Sunday'); + assert.deepEqual( + moment().localeData('en-au').weekdaysShort(true), + 'Mon_Tue_Wed_Thu_Fri_Sat_Sun'.split('_'), + 'locale-sorted weekdaysShort start on Monday'); + assert.deepEqual( + moment().localeData('en-au').weekdaysMin(), + 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + 'weekdaysMin start on Sunday'); + assert.deepEqual( + moment().localeData('en-au').weekdaysMin(true), + 'Mo_Tu_We_Th_Fr_Sa_Su'.split('_'), + 'locale-sorted weekdaysMin start on Monday'); }); }))); @@ -13891,11 +14477,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -13934,6 +14521,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -13961,13 +14567,16 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('en-gb'); + localeModule('en-ca'); test('parse', function (assert) { - var tests = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'), i; + var i, + tests = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'); + function equalTest(input, mmm, i) { assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); } + for (i = 0; i < 12; i++) { tests[i] = tests[i].split(' '); equalTest(tests[i][0], 'MMM', i); @@ -13990,25 +14599,26 @@ ['D Do DD', '14 14th 14'], ['d do dddd ddd dd', '0 0th Sunday Sun Su'], ['DDD DDDo DDDD', '45 45th 045'], - ['w wo ww', '6 6th 06'], + ['w wo ww', '8 8th 08'], ['h hh', '3 03'], ['H HH', '15 15'], ['m mm', '25 25'], ['s ss', '50 50'], ['a A', 'pm PM'], ['[the] DDDo [day of the year]', 'the 45th day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 February 2010'], - ['LLL', '14 February 2010 15:25'], - ['LLLL', 'Sunday, 14 February 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Feb 2010'], - ['lll', '14 Feb 2010 15:25'], - ['llll', 'Sun, 14 Feb 2010 15:25'] + ['L', '2010-02-14'], + ['LTS', '3:25:50 PM'], + ['LL', 'February 14, 2010'], + ['LLL', 'February 14, 2010 3:25 PM'], + ['LLLL', 'Sunday, February 14, 2010 3:25 PM'], + ['l', '2010-2-14'], + ['ll', 'Feb 14, 2010'], + ['lll', 'Feb 14, 2010 3:25 PM'], + ['llll', 'Sun, Feb 14, 2010 3:25 PM'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; + for (i = 0; i < a.length; i++) { assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); } @@ -14052,14 +14662,18 @@ }); test('format month', function (assert) { - var expected = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'), i; + var i, + expected = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'); + for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); test('format week', function (assert) { - var expected = 'Sunday Sun Su_Monday Mon Mo_Tuesday Tue Tu_Wednesday Wed We_Thursday Thu Th_Friday Fri Fr_Saturday Sat Sa'.split('_'), i; + var i, + expected = 'Sunday Sun Su_Monday Mon Mo_Tuesday Tue Tu_Wednesday Wed We_Thursday Thu Th_Friday Fri Fr_Saturday Sat Sa'.split('_'); + for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); } @@ -14114,16 +14728,17 @@ test('calendar day', function (assert) { var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'Today at 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Today at 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Today at 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Tomorrow at 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Today at 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Yesterday at 12:00', 'yesterday at the same time'); + assert.equal(moment(a).calendar(), 'Today at 12:00 PM', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'Today at 12:25 PM', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'Today at 1:00 PM', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'Tomorrow at 12:00 PM', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'Today at 11:00 AM', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'Yesterday at 12:00 PM', 'yesterday at the same time'); }); test('calendar next week', function (assert) { var i, m; + for (i = 2; i < 7; i++) { m = moment().add({d: i}); assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days current time'); @@ -14161,12 +14776,12 @@ assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); }); - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52nd', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1st', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1st', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2nd', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2nd', 'Jan 15 2012 should be week 2'); + test('weeks year starting sunday format', function (assert) { + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1st', 'Jan 1 2012 should be week 1'); + assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1st', 'Jan 7 2012 should be week 1'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2nd', 'Jan 8 2012 should be week 2'); + assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2nd', 'Jan 14 2012 should be week 2'); + assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3rd', 'Jan 15 2012 should be week 3'); }); }))); @@ -14364,11 +14979,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -14407,6 +15023,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -14434,7 +15069,7 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('en-ie'); + localeModule('en-gb'); test('parse', function (assert) { var tests = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'), i; @@ -14471,14 +15106,14 @@ ['a A', 'pm PM'], ['[the] DDDo [day of the year]', 'the 45th day of the year'], ['LTS', '15:25:50'], - ['L', '14-02-2010'], + ['L', '14/02/2010'], ['LL', '14 February 2010'], ['LLL', '14 February 2010 15:25'], - ['LLLL', 'Sunday 14 February 2010 15:25'], - ['l', '14-2-2010'], + ['LLLL', 'Sunday, 14 February 2010 15:25'], + ['l', '14/2/2010'], ['ll', '14 Feb 2010'], ['lll', '14 Feb 2010 15:25'], - ['llll', 'Sun 14 Feb 2010 15:25'] + ['llll', 'Sun, 14 Feb 2010 15:25'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; @@ -14837,11 +15472,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -14880,6 +15516,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -14907,7 +15562,7 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('en-il'); + localeModule('en-ie'); test('parse', function (assert) { var tests = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'), i; @@ -14936,7 +15591,7 @@ ['D Do DD', '14 14th 14'], ['d do dddd ddd dd', '0 0th Sunday Sun Su'], ['DDD DDDo DDDD', '45 45th 045'], - ['w wo ww', '8 8th 08'], + ['w wo ww', '6 6th 06'], ['h hh', '3 03'], ['H HH', '15 15'], ['m mm', '25 25'], @@ -14947,11 +15602,11 @@ ['L', '14/02/2010'], ['LL', '14 February 2010'], ['LLL', '14 February 2010 15:25'], - ['LLLL', 'Sunday, 14 February 2010 15:25'], + ['LLLL', 'Sunday 14 February 2010 15:25'], ['l', '14/2/2010'], ['ll', '14 Feb 2010'], ['lll', '14 Feb 2010 15:25'], - ['llll', 'Sun, 14 Feb 2010 15:25'] + ['llll', 'Sun 14 Feb 2010 15:25'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; @@ -15108,15 +15763,11 @@ }); test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1st', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1st', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2nd', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2nd', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3rd', 'Jan 15 2012 should be week 3'); - }); - - test('days start on sunday', function (assert) { - assert.equal(moment().startOf('week').format('dddd'), 'Sunday', 'First day of the week should be Sunday'); + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52nd', 'Jan 1 2012 should be week 52'); + assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1st', 'Jan 2 2012 should be week 1'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1st', 'Jan 8 2012 should be week 1'); + assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2nd', 'Jan 9 2012 should be week 2'); + assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2nd', 'Jan 15 2012 should be week 2'); }); }))); @@ -15314,11 +15965,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -15357,6 +16009,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -15384,7 +16055,7 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('en-nz'); + localeModule('en-il'); test('parse', function (assert) { var tests = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'), i; @@ -15413,22 +16084,22 @@ ['D Do DD', '14 14th 14'], ['d do dddd ddd dd', '0 0th Sunday Sun Su'], ['DDD DDDo DDDD', '45 45th 045'], - ['w wo ww', '6 6th 06'], + ['w wo ww', '8 8th 08'], ['h hh', '3 03'], ['H HH', '15 15'], ['m mm', '25 25'], ['s ss', '50 50'], ['a A', 'pm PM'], ['[the] DDDo [day of the year]', 'the 45th day of the year'], - ['LTS', '3:25:50 PM'], + ['LTS', '15:25:50'], ['L', '14/02/2010'], ['LL', '14 February 2010'], - ['LLL', '14 February 2010 3:25 PM'], - ['LLLL', 'Sunday, 14 February 2010 3:25 PM'], + ['LLL', '14 February 2010 15:25'], + ['LLLL', 'Sunday, 14 February 2010 15:25'], ['l', '14/2/2010'], ['ll', '14 Feb 2010'], - ['lll', '14 Feb 2010 3:25 PM'], - ['llll', 'Sun, 14 Feb 2010 3:25 PM'] + ['lll', '14 Feb 2010 15:25'], + ['llll', 'Sun, 14 Feb 2010 15:25'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; @@ -15537,12 +16208,12 @@ test('calendar day', function (assert) { var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'Today at 12:00 PM', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Today at 12:25 PM', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Today at 1:00 PM', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Tomorrow at 12:00 PM', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Today at 11:00 AM', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Yesterday at 12:00 PM', 'yesterday at the same time'); + assert.equal(moment(a).calendar(), 'Today at 12:00', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'Today at 12:25', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'Today at 13:00', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'Tomorrow at 12:00', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'Today at 11:00', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'Yesterday at 12:00', 'yesterday at the same time'); }); test('calendar next week', function (assert) { @@ -15585,11 +16256,15 @@ }); test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52nd', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1st', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1st', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2nd', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2nd', 'Jan 15 2012 should be week 2'); + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1st', 'Jan 1 2012 should be week 1'); + assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1st', 'Jan 7 2012 should be week 1'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2nd', 'Jan 8 2012 should be week 2'); + assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2nd', 'Jan 14 2012 should be week 2'); + assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3rd', 'Jan 15 2012 should be week 3'); + }); + + test('days start on sunday', function (assert) { + assert.equal(moment().startOf('week').format('dddd'), 'Sunday', 'First day of the week should be Sunday'); }); }))); @@ -15787,11 +16462,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -15830,6 +16506,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -15857,16 +16552,13 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('en'); + localeModule('en-nz'); test('parse', function (assert) { - var i, - tests = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'); - + var tests = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'), i; function equalTest(input, mmm, i) { assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); } - for (i = 0; i < 12; i++) { tests[i] = tests[i].split(' '); equalTest(tests[i][0], 'MMM', i); @@ -15889,7 +16581,7 @@ ['D Do DD', '14 14th 14'], ['d do dddd ddd dd', '0 0th Sunday Sun Su'], ['DDD DDDo DDDD', '45 45th 045'], - ['w wo ww', '8 8th 08'], + ['w wo ww', '6 6th 06'], ['h hh', '3 03'], ['H HH', '15 15'], ['m mm', '25 25'], @@ -15897,18 +16589,17 @@ ['a A', 'pm PM'], ['[the] DDDo [day of the year]', 'the 45th day of the year'], ['LTS', '3:25:50 PM'], - ['L', '02/14/2010'], - ['LL', 'February 14, 2010'], - ['LLL', 'February 14, 2010 3:25 PM'], - ['LLLL', 'Sunday, February 14, 2010 3:25 PM'], - ['l', '2/14/2010'], - ['ll', 'Feb 14, 2010'], - ['lll', 'Feb 14, 2010 3:25 PM'], - ['llll', 'Sun, Feb 14, 2010 3:25 PM'] + ['L', '14/02/2010'], + ['LL', '14 February 2010'], + ['LLL', '14 February 2010 3:25 PM'], + ['LLLL', 'Sunday, 14 February 2010 3:25 PM'], + ['l', '14/2/2010'], + ['ll', '14 Feb 2010'], + ['lll', '14 Feb 2010 3:25 PM'], + ['llll', 'Sun, 14 Feb 2010 3:25 PM'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; - for (i = 0; i < a.length; i++) { assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); } @@ -15952,18 +16643,14 @@ }); test('format month', function (assert) { - var i, - expected = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'); - + var expected = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); test('format week', function (assert) { - var i, - expected = 'Sunday Sun Su_Monday Mon Mo_Tuesday Tue Tu_Wednesday Wed We_Thursday Thu Th_Friday Fri Fr_Saturday Sat Sa'.split('_'); - + var expected = 'Sunday Sun Su_Monday Mon Mo_Tuesday Tue Tu_Wednesday Wed We_Thursday Thu Th_Friday Fri Fr_Saturday Sat Sa'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); } @@ -15971,7 +16658,6 @@ test('from', function (assert) { var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'a few seconds', '44 seconds = a few seconds'); assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'a minute', '45 seconds = a minute'); assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'a minute', '89 seconds = a minute'); @@ -16029,7 +16715,6 @@ test('calendar next week', function (assert) { var i, m; - for (i = 2; i < 7; i++) { m = moment().add({d: i}); assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days current time'); @@ -16067,27 +16752,12 @@ assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); }); - test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1st', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1st', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2nd', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2nd', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3rd', 'Jan 15 2012 should be week 3'); - }); - - test('weekdays strict parsing', function (assert) { - var m = moment('2015-01-01T12', moment.ISO_8601, true), - enLocale = moment.localeData('en'); - - for (var i = 0; i < 7; ++i) { - assert.equal(moment(enLocale.weekdays(m.day(i), ''), 'dddd', true).isValid(), true, 'parse weekday ' + i); - assert.equal(moment(enLocale.weekdaysShort(m.day(i), ''), 'ddd', true).isValid(), true, 'parse short weekday ' + i); - assert.equal(moment(enLocale.weekdaysMin(m.day(i), ''), 'dd', true).isValid(), true, 'parse min weekday ' + i); - - // negative tests - assert.equal(moment(enLocale.weekdaysMin(m.day(i), ''), 'ddd', true).isValid(), false, 'parse short weekday ' + i); - assert.equal(moment(enLocale.weekdaysShort(m.day(i), ''), 'dd', true).isValid(), false, 'parse min weekday ' + i); - } + test('weeks year starting sunday formatted', function (assert) { + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52nd', 'Jan 1 2012 should be week 52'); + assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1st', 'Jan 2 2012 should be week 1'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1st', 'Jan 8 2012 should be week 1'); + assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2nd', 'Jan 9 2012 should be week 2'); + assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2nd', 'Jan 15 2012 should be week 2'); }); }))); @@ -16285,11 +16955,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -16328,6 +16999,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -16355,13 +17045,16 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('eo'); + localeModule('en'); test('parse', function (assert) { - var tests = 'januaro jan_februaro feb_marto mar_aprilo apr_majo maj_junio jun_julio jul_aŭgusto aŭg_septembro sep_oktobro okt_novembro nov_decembro dec'.split('_'), i; + var i, + tests = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'); + function equalTest(input, mmm, i) { assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); } + for (i = 0; i < 12; i++) { tests[i] = tests[i].split(' '); equalTest(tests[i][0], 'MMM', i); @@ -16377,83 +17070,88 @@ test('format', function (assert) { var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'dimanĉo, februaro 14a 2010, 3:25:50 p.t.m.'], - ['ddd, hA', 'dim, 3P.T.M.'], - ['M Mo MM MMMM MMM', '2 2a 02 februaro feb'], + ['dddd, MMMM Do YYYY, h:mm:ss a', 'Sunday, February 14th 2010, 3:25:50 pm'], + ['ddd, hA', 'Sun, 3PM'], + ['M Mo MM MMMM MMM', '2 2nd 02 February Feb'], ['YYYY YY', '2010 10'], - ['D Do DD', '14 14a 14'], - ['d do dddd ddd dd', '0 0a dimanĉo dim di'], - ['DDD DDDo DDDD', '45 45a 045'], - ['w wo ww', '7 7a 07'], + ['D Do DD', '14 14th 14'], + ['d do dddd ddd dd', '0 0th Sunday Sun Su'], + ['DDD DDDo DDDD', '45 45th 045'], + ['w wo ww', '8 8th 08'], ['h hh', '3 03'], ['H HH', '15 15'], ['m mm', '25 25'], ['s ss', '50 50'], - ['a A', 'p.t.m. P.T.M.'], - ['[la] DDDo [tago] [de] [la] [jaro]', 'la 45a tago de la jaro'], - ['LTS', '15:25:50'], - ['L', '2010-02-14'], - ['LL', '14-a de februaro, 2010'], - ['LLL', '14-a de februaro, 2010 15:25'], - ['LLLL', 'dimanĉo, la 14-a de februaro, 2010 15:25'], - ['l', '2010-2-14'], - ['ll', '14-a de feb, 2010'], - ['lll', '14-a de feb, 2010 15:25'], - ['llll', 'dim, la 14-a de feb, 2010 15:25'] + ['a A', 'pm PM'], + ['[the] DDDo [day of the year]', 'the 45th day of the year'], + ['LTS', '3:25:50 PM'], + ['L', '02/14/2010'], + ['LL', 'February 14, 2010'], + ['LLL', 'February 14, 2010 3:25 PM'], + ['LLLL', 'Sunday, February 14, 2010 3:25 PM'], + ['l', '2/14/2010'], + ['ll', 'Feb 14, 2010'], + ['lll', 'Feb 14, 2010 3:25 PM'], + ['llll', 'Sun, Feb 14, 2010 3:25 PM'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; + for (i = 0; i < a.length; i++) { assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); } }); test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1a', '1a'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2a', '2a'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3a', '3a'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4a', '4a'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5a', '5a'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6a', '6a'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7a', '7a'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8a', '8a'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9a', '9a'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10a', '10a'); + assert.equal(moment([2011, 0, 1]).format('DDDo'), '1st', '1st'); + assert.equal(moment([2011, 0, 2]).format('DDDo'), '2nd', '2nd'); + assert.equal(moment([2011, 0, 3]).format('DDDo'), '3rd', '3rd'); + assert.equal(moment([2011, 0, 4]).format('DDDo'), '4th', '4th'); + assert.equal(moment([2011, 0, 5]).format('DDDo'), '5th', '5th'); + assert.equal(moment([2011, 0, 6]).format('DDDo'), '6th', '6th'); + assert.equal(moment([2011, 0, 7]).format('DDDo'), '7th', '7th'); + assert.equal(moment([2011, 0, 8]).format('DDDo'), '8th', '8th'); + assert.equal(moment([2011, 0, 9]).format('DDDo'), '9th', '9th'); + assert.equal(moment([2011, 0, 10]).format('DDDo'), '10th', '10th'); - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11a', '11a'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12a', '12a'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13a', '13a'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14a', '14a'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15a', '15a'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16a', '16a'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17a', '17a'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18a', '18a'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19a', '19a'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20a', '20a'); + assert.equal(moment([2011, 0, 11]).format('DDDo'), '11th', '11th'); + assert.equal(moment([2011, 0, 12]).format('DDDo'), '12th', '12th'); + assert.equal(moment([2011, 0, 13]).format('DDDo'), '13th', '13th'); + assert.equal(moment([2011, 0, 14]).format('DDDo'), '14th', '14th'); + assert.equal(moment([2011, 0, 15]).format('DDDo'), '15th', '15th'); + assert.equal(moment([2011, 0, 16]).format('DDDo'), '16th', '16th'); + assert.equal(moment([2011, 0, 17]).format('DDDo'), '17th', '17th'); + assert.equal(moment([2011, 0, 18]).format('DDDo'), '18th', '18th'); + assert.equal(moment([2011, 0, 19]).format('DDDo'), '19th', '19th'); + assert.equal(moment([2011, 0, 20]).format('DDDo'), '20th', '20th'); - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21a', '21a'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22a', '22a'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23a', '23a'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24a', '24a'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25a', '25a'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26a', '26a'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27a', '27a'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28a', '28a'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29a', '29a'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30a', '30a'); + assert.equal(moment([2011, 0, 21]).format('DDDo'), '21st', '21st'); + assert.equal(moment([2011, 0, 22]).format('DDDo'), '22nd', '22nd'); + assert.equal(moment([2011, 0, 23]).format('DDDo'), '23rd', '23rd'); + assert.equal(moment([2011, 0, 24]).format('DDDo'), '24th', '24th'); + assert.equal(moment([2011, 0, 25]).format('DDDo'), '25th', '25th'); + assert.equal(moment([2011, 0, 26]).format('DDDo'), '26th', '26th'); + assert.equal(moment([2011, 0, 27]).format('DDDo'), '27th', '27th'); + assert.equal(moment([2011, 0, 28]).format('DDDo'), '28th', '28th'); + assert.equal(moment([2011, 0, 29]).format('DDDo'), '29th', '29th'); + assert.equal(moment([2011, 0, 30]).format('DDDo'), '30th', '30th'); - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31a', '31a'); + assert.equal(moment([2011, 0, 31]).format('DDDo'), '31st', '31st'); }); test('format month', function (assert) { - var expected = 'januaro jan_februaro feb_marto mar_aprilo apr_majo maj_junio jun_julio jul_aŭgusto aŭg_septembro sep_oktobro okt_novembro nov_decembro dec'.split('_'), i; + var i, + expected = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'); + for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); test('format week', function (assert) { - var expected = 'dimanĉo dim di_lundo lun lu_mardo mard ma_merkredo merk me_ĵaŭdo ĵaŭ ĵa_vendredo ven ve_sabato sab sa'.split('_'), i; + var i, + expected = 'Sunday Sun Su_Monday Mon Mo_Tuesday Tue Tu_Wednesday Wed We_Thursday Thu Th_Friday Fri Fr_Saturday Sat Sa'.split('_'); + for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); } @@ -16461,59 +17159,60 @@ test('from', function (assert) { var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'sekundoj', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minuto', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minuto', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutoj', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutoj', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'horo', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'horo', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 horoj', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 horoj', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 horoj', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'tago', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'tago', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 tagoj', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'tago', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 tagoj', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 tagoj', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'monato', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'monato', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'monato', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 monatoj', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 monatoj', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 monatoj', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'monato', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 monatoj', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'jaro', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 jaroj', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'jaro', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 jaroj', '5 years = 5 years'); + + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'a few seconds', '44 seconds = a few seconds'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'a minute', '45 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'a minute', '89 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutes', '90 seconds = 2 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutes', '44 minutes = 44 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'an hour', '45 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'an hour', '89 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 hours', '90 minutes = 2 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 hours', '5 hours = 5 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 hours', '21 hours = 21 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'a day', '22 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'a day', '35 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 days', '36 hours = 2 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'a day', '1 day = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 days', '5 days = 5 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 days', '25 days = 25 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'a month', '26 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'a month', '30 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'a month', '43 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 months', '46 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 months', '75 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 months', '76 days = 3 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'a month', '1 month = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 months', '5 months = 5 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'a year', '345 days = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 years', '548 days = 2 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'a year', '1 year = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 years', '5 years = 5 years'); }); test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'post sekundoj', 'post prefix'); - assert.equal(moment(0).from(30000), 'antaŭ sekundoj', 'antaŭ prefix'); + assert.equal(moment(30000).from(0), 'in a few seconds', 'prefix'); + assert.equal(moment(0).from(30000), 'a few seconds ago', 'suffix'); }); test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'antaŭ sekundoj', 'now from now should display as in the past'); + assert.equal(moment().fromNow(), 'a few seconds ago', 'now from now should display as in the past'); }); test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'post sekundoj', 'post sekundoj'); - assert.equal(moment().add({d: 5}).fromNow(), 'post 5 tagoj', 'post 5 tagoj'); + assert.equal(moment().add({s: 30}).fromNow(), 'in a few seconds', 'in a few seconds'); + assert.equal(moment().add({d: 5}).fromNow(), 'in 5 days', 'in 5 days'); }); test('calendar day', function (assert) { var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'Hodiaŭ je 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Hodiaŭ je 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Hodiaŭ je 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Morgaŭ je 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hodiaŭ je 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Hieraŭ je 12:00', 'yesterday at the same time'); + assert.equal(moment(a).calendar(), 'Today at 12:00 PM', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'Today at 12:25 PM', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'Today at 1:00 PM', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'Tomorrow at 12:00 PM', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'Today at 11:00 AM', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'Yesterday at 12:00 PM', 'yesterday at the same time'); }); test('calendar next week', function (assert) { @@ -16521,11 +17220,11 @@ for (i = 2; i < 7; i++) { m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [je] LT'), 'Today + ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [je] LT'), 'Today + ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [je] LT'), 'Today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days end of day'); } }); @@ -16534,11 +17233,11 @@ for (i = 2; i < 7; i++) { m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[pasinta] dddd [je] LT'), 'Today - ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[pasinta] dddd [je] LT'), 'Today - ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[pasinta] dddd [je] LT'), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days end of day'); } }); @@ -16556,12 +17255,27 @@ assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); }); - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1a', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1a', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2a', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2a', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3a', 'Jan 9 2012 should be week 3'); + test('weeks year starting sunday format', function (assert) { + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1st', 'Jan 1 2012 should be week 1'); + assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1st', 'Jan 7 2012 should be week 1'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2nd', 'Jan 8 2012 should be week 2'); + assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2nd', 'Jan 14 2012 should be week 2'); + assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3rd', 'Jan 15 2012 should be week 3'); + }); + + test('weekdays strict parsing', function (assert) { + var m = moment('2015-01-01T12', moment.ISO_8601, true), + enLocale = moment.localeData('en'); + + for (var i = 0; i < 7; ++i) { + assert.equal(moment(enLocale.weekdays(m.day(i), ''), 'dddd', true).isValid(), true, 'parse weekday ' + i); + assert.equal(moment(enLocale.weekdaysShort(m.day(i), ''), 'ddd', true).isValid(), true, 'parse short weekday ' + i); + assert.equal(moment(enLocale.weekdaysMin(m.day(i), ''), 'dd', true).isValid(), true, 'parse min weekday ' + i); + + // negative tests + assert.equal(moment(enLocale.weekdaysMin(m.day(i), ''), 'ddd', true).isValid(), false, 'parse short weekday ' + i); + assert.equal(moment(enLocale.weekdaysShort(m.day(i), ''), 'dd', true).isValid(), false, 'parse min weekday ' + i); + } }); }))); @@ -16759,11 +17473,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -16802,6 +17517,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -16829,10 +17563,10 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('es-do'); + localeModule('eo'); test('parse', function (assert) { - var tests = 'enero ene._febrero feb._marzo mar._abril abr._mayo may._junio jun._julio jul._agosto ago._septiembre sep._octubre oct._noviembre nov._diciembre dic.'.split('_'), i; + var tests = 'januaro jan_februaro feb_marto mar_aprilo apr_majo maj_junio jun_julio jul_aŭgusto aŭg_septembro sep_oktobro okt_novembro nov_decembro dec'.split('_'), i; function equalTest(input, mmm, i) { assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); } @@ -16851,30 +17585,29 @@ test('format', function (assert) { var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'domingo, febrero 14º 2010, 3:25:50 pm'], - ['ddd, hA', 'dom., 3PM'], - ['M Mo MM MMMM MMM', '2 2º 02 febrero feb.'], + ['dddd, MMMM Do YYYY, h:mm:ss a', 'dimanĉo, februaro 14a 2010, 3:25:50 p.t.m.'], + ['ddd, hA', 'dim, 3P.T.M.'], + ['M Mo MM MMMM MMM', '2 2a 02 februaro feb'], ['YYYY YY', '2010 10'], - ['D Do DD', '14 14º 14'], - ['d do dddd ddd dd', '0 0º domingo dom. do'], - ['DDD DDDo DDDD', '45 45º 045'], - ['w wo ww', '6 6º 06'], - ['YYYY-MMM-DD', '2010-feb-14'], + ['D Do DD', '14 14a 14'], + ['d do dddd ddd dd', '0 0a dimanĉo dim di'], + ['DDD DDDo DDDD', '45 45a 045'], + ['w wo ww', '7 7a 07'], ['h hh', '3 03'], ['H HH', '15 15'], ['m mm', '25 25'], ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45º day of the year'], - ['LTS', '3:25:50 PM'], - ['L', '14/02/2010'], - ['LL', '14 de febrero de 2010'], - ['LLL', '14 de febrero de 2010 3:25 PM'], - ['LLLL', 'domingo, 14 de febrero de 2010 3:25 PM'], - ['l', '14/2/2010'], - ['ll', '14 de feb. de 2010'], - ['lll', '14 de feb. de 2010 3:25 PM'], - ['llll', 'dom., 14 de feb. de 2010 3:25 PM'] + ['a A', 'p.t.m. P.T.M.'], + ['[la] DDDo [tago] [de] [la] [jaro]', 'la 45a tago de la jaro'], + ['LTS', '15:25:50'], + ['L', '2010-02-14'], + ['LL', '14-a de februaro, 2010'], + ['LLL', '14-a de februaro, 2010 15:25'], + ['LLLL', 'dimanĉo, la 14-a de februaro, 2010 15:25'], + ['l', '2010-2-14'], + ['ll', '14-a de feb, 2010'], + ['lll', '14-a de feb, 2010 15:25'], + ['llll', 'dim, la 14-a de feb, 2010 15:25'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; @@ -16884,51 +17617,51 @@ }); test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1º', '1º'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2º', '2º'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3º', '3º'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4º', '4º'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5º', '5º'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6º', '6º'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7º', '7º'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8º', '8º'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9º', '9º'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10º', '10º'); + assert.equal(moment([2011, 0, 1]).format('DDDo'), '1a', '1a'); + assert.equal(moment([2011, 0, 2]).format('DDDo'), '2a', '2a'); + assert.equal(moment([2011, 0, 3]).format('DDDo'), '3a', '3a'); + assert.equal(moment([2011, 0, 4]).format('DDDo'), '4a', '4a'); + assert.equal(moment([2011, 0, 5]).format('DDDo'), '5a', '5a'); + assert.equal(moment([2011, 0, 6]).format('DDDo'), '6a', '6a'); + assert.equal(moment([2011, 0, 7]).format('DDDo'), '7a', '7a'); + assert.equal(moment([2011, 0, 8]).format('DDDo'), '8a', '8a'); + assert.equal(moment([2011, 0, 9]).format('DDDo'), '9a', '9a'); + assert.equal(moment([2011, 0, 10]).format('DDDo'), '10a', '10a'); - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11º', '11º'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12º', '12º'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13º', '13º'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14º', '14º'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15º', '15º'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16º', '16º'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17º', '17º'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18º', '18º'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19º', '19º'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20º', '20º'); + assert.equal(moment([2011, 0, 11]).format('DDDo'), '11a', '11a'); + assert.equal(moment([2011, 0, 12]).format('DDDo'), '12a', '12a'); + assert.equal(moment([2011, 0, 13]).format('DDDo'), '13a', '13a'); + assert.equal(moment([2011, 0, 14]).format('DDDo'), '14a', '14a'); + assert.equal(moment([2011, 0, 15]).format('DDDo'), '15a', '15a'); + assert.equal(moment([2011, 0, 16]).format('DDDo'), '16a', '16a'); + assert.equal(moment([2011, 0, 17]).format('DDDo'), '17a', '17a'); + assert.equal(moment([2011, 0, 18]).format('DDDo'), '18a', '18a'); + assert.equal(moment([2011, 0, 19]).format('DDDo'), '19a', '19a'); + assert.equal(moment([2011, 0, 20]).format('DDDo'), '20a', '20a'); - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21º', '21º'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22º', '22º'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23º', '23º'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24º', '24º'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25º', '25º'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26º', '26º'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27º', '27º'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28º', '28º'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29º', '29º'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30º', '30º'); + assert.equal(moment([2011, 0, 21]).format('DDDo'), '21a', '21a'); + assert.equal(moment([2011, 0, 22]).format('DDDo'), '22a', '22a'); + assert.equal(moment([2011, 0, 23]).format('DDDo'), '23a', '23a'); + assert.equal(moment([2011, 0, 24]).format('DDDo'), '24a', '24a'); + assert.equal(moment([2011, 0, 25]).format('DDDo'), '25a', '25a'); + assert.equal(moment([2011, 0, 26]).format('DDDo'), '26a', '26a'); + assert.equal(moment([2011, 0, 27]).format('DDDo'), '27a', '27a'); + assert.equal(moment([2011, 0, 28]).format('DDDo'), '28a', '28a'); + assert.equal(moment([2011, 0, 29]).format('DDDo'), '29a', '29a'); + assert.equal(moment([2011, 0, 30]).format('DDDo'), '30a', '30a'); - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31º', '31º'); + assert.equal(moment([2011, 0, 31]).format('DDDo'), '31a', '31a'); }); test('format month', function (assert) { - var expected = 'enero ene._febrero feb._marzo mar._abril abr._mayo may._junio jun._julio jul._agosto ago._septiembre sep._octubre oct._noviembre nov._diciembre dic.'.split('_'), i; + var expected = 'januaro jan_februaro feb_marto mar_aprilo apr_majo maj_junio jun_julio jul_aŭgusto aŭg_septembro sep_oktobro okt_novembro nov_decembro dec'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); test('format week', function (assert) { - var expected = 'domingo dom. do_lunes lun. lu_martes mar. ma_miércoles mié. mi_jueves jue. ju_viernes vie. vi_sábado sáb. sá'.split('_'), i; + var expected = 'dimanĉo dim di_lundo lun lu_mardo mard ma_merkredo merk me_ĵaŭdo ĵaŭ ĵa_vendredo ven ve_sabato sab sa'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); } @@ -16936,60 +17669,59 @@ test('from', function (assert) { var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'unos segundos', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'un minuto', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'un minuto', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutos', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutos', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'una hora', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'una hora', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 horas', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 horas', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 horas', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'un día', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'un día', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 días', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'un día', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 días', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 días', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'un mes', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'un mes', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'un mes', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 meses', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 meses', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 meses', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'un mes', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 meses', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'un año', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 años', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'un año', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 años', '5 years = 5 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'sekundoj', '44 seconds = a few seconds'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minuto', '45 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minuto', '89 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutoj', '90 seconds = 2 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutoj', '44 minutes = 44 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'horo', '45 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'horo', '89 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 horoj', '90 minutes = 2 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 horoj', '5 hours = 5 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 horoj', '21 hours = 21 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'tago', '22 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'tago', '35 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 tagoj', '36 hours = 2 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'tago', '1 day = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 tagoj', '5 days = 5 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 tagoj', '25 days = 25 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'monato', '26 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'monato', '30 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'monato', '43 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 monatoj', '46 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 monatoj', '75 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 monatoj', '76 days = 3 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'monato', '1 month = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 monatoj', '5 months = 5 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'jaro', '345 days = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 jaroj', '548 days = 2 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'jaro', '1 year = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 jaroj', '5 years = 5 years'); }); test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'en unos segundos', 'prefix'); - assert.equal(moment(0).from(30000), 'hace unos segundos', 'suffix'); + assert.equal(moment(30000).from(0), 'post sekundoj', 'post prefix'); + assert.equal(moment(0).from(30000), 'antaŭ sekundoj', 'antaŭ prefix'); }); test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'hace unos segundos', 'now from now should display as in the past'); + assert.equal(moment().fromNow(), 'antaŭ sekundoj', 'now from now should display as in the past'); }); test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'en unos segundos', 'en unos segundos'); - assert.equal(moment().add({d: 5}).fromNow(), 'en 5 días', 'en 5 días'); + assert.equal(moment().add({s: 30}).fromNow(), 'post sekundoj', 'post sekundoj'); + assert.equal(moment().add({d: 5}).fromNow(), 'post 5 tagoj', 'post 5 tagoj'); }); test('calendar day', function (assert) { var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'hoy a las 12:00 PM', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'hoy a las 12:25 PM', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'hoy a las 1:00 PM', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'mañana a las 12:00 PM', 'tomorrow at the same time'); - assert.equal(moment(a).add({d: 1, h : -1}).calendar(), 'mañana a las 11:00 AM', 'tomorrow minus 1 hour'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'hoy a las 11:00 AM', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'ayer a las 12:00 PM', 'yesterday at the same time'); + assert.equal(moment(a).calendar(), 'Hodiaŭ je 12:00', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'Hodiaŭ je 12:25', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'Hodiaŭ je 13:00', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'Morgaŭ je 12:00', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hodiaŭ je 11:00', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'Hieraŭ je 12:00', 'yesterday at the same time'); }); test('calendar next week', function (assert) { @@ -16997,11 +17729,11 @@ for (i = 2; i < 7; i++) { m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [a la' + ((m.hours() !== 1) ? 's' : '') + '] LT'), 'Today + ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('dddd [je] LT'), 'Today + ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [a la' + ((m.hours() !== 1) ? 's' : '') + '] LT'), 'Today + ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('dddd [je] LT'), 'Today + ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [a la' + ((m.hours() !== 1) ? 's' : '') + '] LT'), 'Today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('dddd [je] LT'), 'Today + ' + i + ' days end of day'); } }); @@ -17010,11 +17742,11 @@ for (i = 2; i < 7; i++) { m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[el] dddd [pasado a la' + ((m.hours() !== 1) ? 's' : '') + '] LT'), 'Today - ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('[pasinta] dddd [je] LT'), 'Today - ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[el] dddd [pasado a la' + ((m.hours() !== 1) ? 's' : '') + '] LT'), 'Today - ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('[pasinta] dddd [je] LT'), 'Today - ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[el] dddd [pasado a la' + ((m.hours() !== 1) ? 's' : '') + '] LT'), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[pasinta] dddd [je] LT'), 'Today - ' + i + ' days end of day'); } }); @@ -17033,17 +17765,11 @@ }); test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52º', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1º', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1º', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2º', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2º', 'Jan 15 2012 should be week 2'); - }); - - test('test short months proper', function (assert) { - var str = '02-ago-2016'; // "02-ago-2016" - assert.equal(moment(str, 'DD-MMM-YYYY').month(), 7, '02-ago-2016 month should be 7'); - assert.equal(moment(str, 'DD-MMM-YYYY', true).month(), 7, '02-ago-2016 strict parse month should be 7'); + assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1a', 'Dec 26 2011 should be week 1'); + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1a', 'Jan 1 2012 should be week 1'); + assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2a', 'Jan 2 2012 should be week 2'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2a', 'Jan 8 2012 should be week 2'); + assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3a', 'Jan 9 2012 should be week 3'); }); }))); @@ -17241,11 +17967,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -17284,6 +18011,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -17311,7 +18057,7 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('es-us'); + localeModule('es-do'); test('parse', function (assert) { var tests = 'enero ene._febrero feb._marzo mar._abril abr._mayo may._junio jun._julio jul._agosto ago._septiembre sep._octubre oct._noviembre nov._diciembre dic.'.split('_'), i; @@ -17340,7 +18086,7 @@ ['D Do DD', '14 14º 14'], ['d do dddd ddd dd', '0 0º domingo dom. do'], ['DDD DDDo DDDD', '45 45º 045'], - ['w wo ww', '8 8º 08'], + ['w wo ww', '6 6º 06'], ['YYYY-MMM-DD', '2010-feb-14'], ['h hh', '3 03'], ['H HH', '15 15'], @@ -17348,16 +18094,15 @@ ['s ss', '50 50'], ['a A', 'pm PM'], ['[the] DDDo [day of the year]', 'the 45º day of the year'], - ['LT', '3:25 PM'], ['LTS', '3:25:50 PM'], - ['L', '02/14/2010'], - ['LL', 'febrero de 14 de 2010'], - ['LLL', 'febrero de 14 de 2010 3:25 PM'], - ['LLLL', 'domingo, febrero de 14 de 2010 3:25 PM'], - ['l', '2/14/2010'], - ['ll', 'feb. de 14 de 2010'], - ['lll', 'feb. de 14 de 2010 3:25 PM'], - ['llll', 'dom., feb. de 14 de 2010 3:25 PM'] + ['L', '14/02/2010'], + ['LL', '14 de febrero de 2010'], + ['LLL', '14 de febrero de 2010 3:25 PM'], + ['LLLL', 'domingo, 14 de febrero de 2010 3:25 PM'], + ['l', '14/2/2010'], + ['ll', '14 de feb. de 2010'], + ['lll', '14 de feb. de 2010 3:25 PM'], + ['llll', 'dom., 14 de feb. de 2010 3:25 PM'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; @@ -17404,18 +18149,14 @@ }); test('format month', function (assert) { - var i, - expected = 'enero ene._febrero feb._marzo mar._abril abr._mayo may._junio jun._julio jul._agosto ago._septiembre sep._octubre oct._noviembre nov._diciembre dic.'.split('_'); - + var expected = 'enero ene._febrero feb._marzo mar._abril abr._mayo may._junio jun._julio jul._agosto ago._septiembre sep._octubre oct._noviembre nov._diciembre dic.'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); test('format week', function (assert) { - var i, - expected = 'domingo dom. do_lunes lun. lu_martes mar. ma_miércoles mié. mi_jueves jue. ju_viernes vie. vi_sábado sáb. sá'.split('_'); - + var expected = 'domingo dom. do_lunes lun. lu_martes mar. ma_miércoles mié. mi_jueves jue. ju_viernes vie. vi_sábado sáb. sá'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); } @@ -17423,7 +18164,6 @@ test('from', function (assert) { var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'unos segundos', '44 seconds = a few seconds'); assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'un minuto', '45 seconds = a minute'); assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'un minuto', '89 seconds = a minute'); @@ -17521,12 +18261,17 @@ }); test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1º', 'Jan 1 2012 should be week 1'); + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52º', 'Jan 1 2012 should be week 52'); assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1º', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1º', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2º', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2º', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3º', 'Jan 15 2012 should be week 3'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1º', 'Jan 8 2012 should be week 1'); + assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2º', 'Jan 9 2012 should be week 2'); + assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2º', 'Jan 15 2012 should be week 2'); + }); + + test('test short months proper', function (assert) { + var str = '02-ago-2016'; // "02-ago-2016" + assert.equal(moment(str, 'DD-MMM-YYYY').month(), 7, '02-ago-2016 month should be 7'); + assert.equal(moment(str, 'DD-MMM-YYYY', true).month(), 7, '02-ago-2016 strict parse month should be 7'); }); }))); @@ -17724,11 +18469,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -17767,6 +18513,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -17794,7 +18559,7 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('es'); + localeModule('es-us'); test('parse', function (assert) { var tests = 'enero ene._febrero feb._marzo mar._abril abr._mayo may._junio jun._julio jul._agosto ago._septiembre sep._octubre oct._noviembre nov._diciembre dic.'.split('_'), i; @@ -17823,7 +18588,7 @@ ['D Do DD', '14 14º 14'], ['d do dddd ddd dd', '0 0º domingo dom. do'], ['DDD DDDo DDDD', '45 45º 045'], - ['w wo ww', '6 6º 06'], + ['w wo ww', '8 8º 08'], ['YYYY-MMM-DD', '2010-feb-14'], ['h hh', '3 03'], ['H HH', '15 15'], @@ -17831,15 +18596,16 @@ ['s ss', '50 50'], ['a A', 'pm PM'], ['[the] DDDo [day of the year]', 'the 45º day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], + ['LT', '3:25 PM'], + ['LTS', '3:25:50 PM'], + ['L', '02/14/2010'], ['LL', '14 de febrero de 2010'], - ['LLL', '14 de febrero de 2010 15:25'], - ['LLLL', 'domingo, 14 de febrero de 2010 15:25'], - ['l', '14/2/2010'], + ['LLL', '14 de febrero de 2010 3:25 PM'], + ['LLLL', 'domingo, 14 de febrero de 2010 3:25 PM'], + ['l', '2/14/2010'], ['ll', '14 de feb. de 2010'], - ['lll', '14 de feb. de 2010 15:25'], - ['llll', 'dom., 14 de feb. de 2010 15:25'] + ['lll', '14 de feb. de 2010 3:25 PM'], + ['llll', 'dom., 14 de feb. de 2010 3:25 PM'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; @@ -17886,14 +18652,18 @@ }); test('format month', function (assert) { - var expected = 'enero ene._febrero feb._marzo mar._abril abr._mayo may._junio jun._julio jul._agosto ago._septiembre sep._octubre oct._noviembre nov._diciembre dic.'.split('_'), i; + var i, + expected = 'enero ene._febrero feb._marzo mar._abril abr._mayo may._junio jun._julio jul._agosto ago._septiembre sep._octubre oct._noviembre nov._diciembre dic.'.split('_'); + for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); test('format week', function (assert) { - var expected = 'domingo dom. do_lunes lun. lu_martes mar. ma_miércoles mié. mi_jueves jue. ju_viernes vie. vi_sábado sáb. sá'.split('_'), i; + var i, + expected = 'domingo dom. do_lunes lun. lu_martes mar. ma_miércoles mié. mi_jueves jue. ju_viernes vie. vi_sábado sáb. sá'.split('_'); + for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); } @@ -17901,6 +18671,7 @@ test('from', function (assert) { var start = moment([2007, 1, 28]); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'unos segundos', '44 seconds = a few seconds'); assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'un minuto', '45 seconds = a minute'); assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'un minuto', '89 seconds = a minute'); @@ -17948,13 +18719,13 @@ test('calendar day', function (assert) { var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'hoy a las 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'hoy a las 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'hoy a las 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'mañana a las 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).add({d: 1, h : -1}).calendar(), 'mañana a las 11:00', 'tomorrow minus 1 hour'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'hoy a las 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'ayer a las 12:00', 'yesterday at the same time'); + assert.equal(moment(a).calendar(), 'hoy a las 12:00 PM', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'hoy a las 12:25 PM', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'hoy a las 1:00 PM', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'mañana a las 12:00 PM', 'tomorrow at the same time'); + assert.equal(moment(a).add({d: 1, h : -1}).calendar(), 'mañana a las 11:00 AM', 'tomorrow minus 1 hour'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'hoy a las 11:00 AM', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'ayer a las 12:00 PM', 'yesterday at the same time'); }); test('calendar next week', function (assert) { @@ -17998,16 +18769,22 @@ }); test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52º', 'Jan 1 2012 should be week 52'); + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1º', 'Jan 1 2012 should be week 1'); assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1º', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1º', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2º', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2º', 'Jan 15 2012 should be week 2'); + assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1º', 'Jan 7 2012 should be week 1'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2º', 'Jan 8 2012 should be week 2'); + assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2º', 'Jan 14 2012 should be week 2'); + assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3º', 'Jan 15 2012 should be week 3'); }); test('test short months proper', function (assert) { - var str = '02-ago-2016'; - assert.equal(moment(str, 'DD-MMM-YYYY').month(), '7', '02-ago-2016 month should be 7'); + var str = '02-ago-2016'; // "02-ago-2016" + assert.equal(moment(str, 'DD-MMM-YYYY').month(), 7, '02-ago-2016 month should be 7'); + assert.equal(moment(str, 'DD-MMM-YYYY', true).month(), 7, '02-ago-2016 strict parse month should be 7'); + }); + + test('test lenient month parsing', function (assert) { + assert.ok(moment('nov 01, 2015', 'MMM D, YYYY', true).isValid(), 'nov 01, 2015 should parse correctly'); }); }))); @@ -18205,11 +18982,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -18248,6 +19026,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -18275,12 +19072,12 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('et'); + localeModule('es'); test('parse', function (assert) { - var tests = 'jaanuar jaan_veebruar veebr_märts märts_aprill apr_mai mai_juuni juuni_juuli juuli_august aug_september sept_oktoober okt_november nov_detsember dets'.split('_'), i; + var tests = 'enero ene._febrero feb._marzo mar._abril abr._mayo may._junio jun._julio jul._agosto ago._septiembre sep._octubre oct._noviembre nov._diciembre dic.'.split('_'), i; function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' peaks olema kuu ' + (i + 1)); + assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); } for (i = 0; i < 12; i++) { tests[i] = tests[i].split(' '); @@ -18297,29 +19094,30 @@ test('format', function (assert) { var a = [ - ['dddd, Do MMMM YYYY, H:mm:ss', 'pühapäev, 14. veebruar 2010, 15:25:50'], - ['ddd, h', 'P, 3'], - ['M Mo MM MMMM MMM', '2 2. 02 veebruar veebr'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. pühapäev P P'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '6 6. 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[aasta] DDDo [päev]', 'aasta 45. päev'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14. veebruar 2010'], - ['LLL', '14. veebruar 2010 15:25'], - ['LLLL', 'pühapäev, 14. veebruar 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14. veebr 2010'], - ['lll', '14. veebr 2010 15:25'], - ['llll', 'P, 14. veebr 2010 15:25'] + ['dddd, MMMM Do YYYY, h:mm:ss a', 'domingo, febrero 14º 2010, 3:25:50 pm'], + ['ddd, hA', 'dom., 3PM'], + ['M Mo MM MMMM MMM', '2 2º 02 febrero feb.'], + ['YYYY YY', '2010 10'], + ['D Do DD', '14 14º 14'], + ['d do dddd ddd dd', '0 0º domingo dom. do'], + ['DDD DDDo DDDD', '45 45º 045'], + ['w wo ww', '6 6º 06'], + ['YYYY-MMM-DD', '2010-feb-14'], + ['h hh', '3 03'], + ['H HH', '15 15'], + ['m mm', '25 25'], + ['s ss', '50 50'], + ['a A', 'pm PM'], + ['[the] DDDo [day of the year]', 'the 45º day of the year'], + ['LTS', '15:25:50'], + ['L', '14/02/2010'], + ['LL', '14 de febrero de 2010'], + ['LLL', '14 de febrero de 2010 15:25'], + ['LLLL', 'domingo, 14 de febrero de 2010 15:25'], + ['l', '14/2/2010'], + ['ll', '14 de feb. de 2010'], + ['lll', '14 de feb. de 2010 15:25'], + ['llll', 'dom., 14 de feb. de 2010 15:25'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; @@ -18329,51 +19127,51 @@ }); test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); + assert.equal(moment([2011, 0, 1]).format('DDDo'), '1º', '1º'); + assert.equal(moment([2011, 0, 2]).format('DDDo'), '2º', '2º'); + assert.equal(moment([2011, 0, 3]).format('DDDo'), '3º', '3º'); + assert.equal(moment([2011, 0, 4]).format('DDDo'), '4º', '4º'); + assert.equal(moment([2011, 0, 5]).format('DDDo'), '5º', '5º'); + assert.equal(moment([2011, 0, 6]).format('DDDo'), '6º', '6º'); + assert.equal(moment([2011, 0, 7]).format('DDDo'), '7º', '7º'); + assert.equal(moment([2011, 0, 8]).format('DDDo'), '8º', '8º'); + assert.equal(moment([2011, 0, 9]).format('DDDo'), '9º', '9º'); + assert.equal(moment([2011, 0, 10]).format('DDDo'), '10º', '10º'); - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); + assert.equal(moment([2011, 0, 11]).format('DDDo'), '11º', '11º'); + assert.equal(moment([2011, 0, 12]).format('DDDo'), '12º', '12º'); + assert.equal(moment([2011, 0, 13]).format('DDDo'), '13º', '13º'); + assert.equal(moment([2011, 0, 14]).format('DDDo'), '14º', '14º'); + assert.equal(moment([2011, 0, 15]).format('DDDo'), '15º', '15º'); + assert.equal(moment([2011, 0, 16]).format('DDDo'), '16º', '16º'); + assert.equal(moment([2011, 0, 17]).format('DDDo'), '17º', '17º'); + assert.equal(moment([2011, 0, 18]).format('DDDo'), '18º', '18º'); + assert.equal(moment([2011, 0, 19]).format('DDDo'), '19º', '19º'); + assert.equal(moment([2011, 0, 20]).format('DDDo'), '20º', '20º'); - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); + assert.equal(moment([2011, 0, 21]).format('DDDo'), '21º', '21º'); + assert.equal(moment([2011, 0, 22]).format('DDDo'), '22º', '22º'); + assert.equal(moment([2011, 0, 23]).format('DDDo'), '23º', '23º'); + assert.equal(moment([2011, 0, 24]).format('DDDo'), '24º', '24º'); + assert.equal(moment([2011, 0, 25]).format('DDDo'), '25º', '25º'); + assert.equal(moment([2011, 0, 26]).format('DDDo'), '26º', '26º'); + assert.equal(moment([2011, 0, 27]).format('DDDo'), '27º', '27º'); + assert.equal(moment([2011, 0, 28]).format('DDDo'), '28º', '28º'); + assert.equal(moment([2011, 0, 29]).format('DDDo'), '29º', '29º'); + assert.equal(moment([2011, 0, 30]).format('DDDo'), '30º', '30º'); - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); + assert.equal(moment([2011, 0, 31]).format('DDDo'), '31º', '31º'); }); test('format month', function (assert) { - var expected = 'jaanuar jaan_veebruar veebr_märts märts_aprill apr_mai mai_juuni juuni_juuli juuli_august aug_september sept_oktoober okt_november nov_detsember dets'.split('_'), i; + var expected = 'enero ene._febrero feb._marzo mar._abril abr._mayo may._junio jun._julio jul._agosto ago._septiembre sep._octubre oct._noviembre nov._diciembre dic.'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); test('format week', function (assert) { - var expected = 'pühapäev P P_esmaspäev E E_teisipäev T T_kolmapäev K K_neljapäev N N_reede R R_laupäev L L'.split('_'), i; + var expected = 'domingo dom. do_lunes lun. lu_martes mar. ma_miércoles mié. mi_jueves jue. ju_viernes vie. vi_sábado sáb. sá'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); } @@ -18381,106 +19179,85 @@ test('from', function (assert) { var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'paar sekundit', '44 seconds = paar sekundit'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'üks minut', '45 seconds = üks minut'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'üks minut', '89 seconds = üks minut'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutit', '90 seconds = 2 minutit'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutit', '44 minutes = 44 minutit'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'üks tund', '45 minutes = tund aega'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'üks tund', '89 minutes = üks tund'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 tundi', '90 minutes = 2 tundi'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 tundi', '5 hours = 5 tundi'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 tundi', '21 hours = 21 tundi'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'üks päev', '22 hours = üks päev'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'üks päev', '35 hours = üks päev'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 päeva', '36 hours = 2 päeva'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'üks päev', '1 day = üks päev'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 päeva', '5 days = 5 päeva'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 päeva', '25 days = 25 päeva'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'üks kuu', '26 days = üks kuu'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'üks kuu', '30 days = üks kuu'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'üks kuu', '43 days = üks kuu'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 kuud', '46 days = 2 kuud'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 kuud', '75 days = 2 kuud'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 kuud', '76 days = 3 kuud'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'üks kuu', '1 month = üks kuu'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 kuud', '5 months = 5 kuud'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'üks aasta', '345 days = üks aasta'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 aastat', '548 days = 2 aastat'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'üks aasta', '1 year = üks aasta'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 aastat', '5 years = 5 aastat'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'unos segundos', '44 seconds = a few seconds'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'un minuto', '45 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'un minuto', '89 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutos', '90 seconds = 2 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutos', '44 minutes = 44 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'una hora', '45 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'una hora', '89 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 horas', '90 minutes = 2 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 horas', '5 hours = 5 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 horas', '21 hours = 21 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'un día', '22 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'un día', '35 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 días', '36 hours = 2 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'un día', '1 day = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 días', '5 days = 5 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 días', '25 days = 25 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'un mes', '26 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'un mes', '30 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'un mes', '43 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 meses', '46 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 meses', '75 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 meses', '76 days = 3 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'un mes', '1 month = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 meses', '5 months = 5 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'un año', '345 days = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 años', '548 days = 2 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'un año', '1 year = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 años', '5 years = 5 years'); }); test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'mõne sekundi pärast', 'prefix'); - assert.equal(moment(0).from(30000), 'mõni sekund tagasi', 'suffix'); + assert.equal(moment(30000).from(0), 'en unos segundos', 'prefix'); + assert.equal(moment(0).from(30000), 'hace unos segundos', 'suffix'); }); test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'mõni sekund tagasi', 'now from now should display as in the past'); + assert.equal(moment().fromNow(), 'hace unos segundos', 'now from now should display as in the past'); }); test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'mõne sekundi pärast', 'in a few seconds'); - assert.equal(moment().subtract({s: 30}).fromNow(), 'mõni sekund tagasi', 'a few seconds ago'); - - assert.equal(moment().add({m: 1}).fromNow(), 'ühe minuti pärast', 'in a minute'); - assert.equal(moment().subtract({m: 1}).fromNow(), 'üks minut tagasi', 'a minute ago'); - - assert.equal(moment().add({m: 5}).fromNow(), '5 minuti pärast', 'in 5 minutes'); - assert.equal(moment().subtract({m: 5}).fromNow(), '5 minutit tagasi', '5 minutes ago'); - - assert.equal(moment().add({d: 1}).fromNow(), 'ühe päeva pärast', 'in one day'); - assert.equal(moment().subtract({d: 1}).fromNow(), 'üks päev tagasi', 'one day ago'); - - assert.equal(moment().add({d: 5}).fromNow(), '5 päeva pärast', 'in 5 days'); - assert.equal(moment().subtract({d: 5}).fromNow(), '5 päeva tagasi', '5 days ago'); - - assert.equal(moment().add({M: 1}).fromNow(), 'kuu aja pärast', 'in a month'); - assert.equal(moment().subtract({M: 1}).fromNow(), 'kuu aega tagasi', 'a month ago'); - - assert.equal(moment().add({M: 5}).fromNow(), '5 kuu pärast', 'in 5 months'); - assert.equal(moment().subtract({M: 5}).fromNow(), '5 kuud tagasi', '5 months ago'); - - assert.equal(moment().add({y: 1}).fromNow(), 'ühe aasta pärast', 'in a year'); - assert.equal(moment().subtract({y: 1}).fromNow(), 'aasta tagasi', 'a year ago'); - - assert.equal(moment().add({y: 5}).fromNow(), '5 aasta pärast', 'in 5 years'); - assert.equal(moment().subtract({y: 5}).fromNow(), '5 aastat tagasi', '5 years ago'); + assert.equal(moment().add({s: 30}).fromNow(), 'en unos segundos', 'en unos segundos'); + assert.equal(moment().add({d: 5}).fromNow(), 'en 5 días', 'en 5 días'); }); test('calendar day', function (assert) { var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'Täna, 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Täna, 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Täna, 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Homme, 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Täna, 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Eile, 12:00', 'yesterday at the same time'); + assert.equal(moment(a).calendar(), 'hoy a las 12:00', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'hoy a las 12:25', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'hoy a las 13:00', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'mañana a las 12:00', 'tomorrow at the same time'); + assert.equal(moment(a).add({d: 1, h : -1}).calendar(), 'mañana a las 11:00', 'tomorrow minus 1 hour'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'hoy a las 11:00', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'ayer a las 12:00', 'yesterday at the same time'); }); test('calendar next week', function (assert) { var i, m; + for (i = 2; i < 7; i++) { m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('[Järgmine] dddd LT'), 'Today + ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('dddd [a la' + ((m.hours() !== 1) ? 's' : '') + '] LT'), 'Today + ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Järgmine] dddd LT'), 'Today + ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('dddd [a la' + ((m.hours() !== 1) ? 's' : '') + '] LT'), 'Today + ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Järgmine] dddd LT'), 'Today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('dddd [a la' + ((m.hours() !== 1) ? 's' : '') + '] LT'), 'Today + ' + i + ' days end of day'); } }); test('calendar last week', function (assert) { var i, m; + for (i = 2; i < 7; i++) { m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[Eelmine] dddd LT'), 'Today - ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('[el] dddd [pasado a la' + ((m.hours() !== 1) ? 's' : '') + '] LT'), 'Today - ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Eelmine] dddd LT'), 'Today - ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('[el] dddd [pasado a la' + ((m.hours() !== 1) ? 's' : '') + '] LT'), 'Today - ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Eelmine] dddd LT'), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[el] dddd [pasado a la' + ((m.hours() !== 1) ? 's' : '') + '] LT'), 'Today - ' + i + ' days end of day'); } }); @@ -18488,22 +19265,27 @@ var weeksAgo = moment().subtract({w: 1}), weeksFromNow = moment().add({w: 1}); - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 nädal tagasi'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), '1 nädala pärast'); + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); weeksAgo = moment().subtract({w: 2}); weeksFromNow = moment().add({w: 2}); - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 nädalat tagasi'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), '2 nädala pärast'); + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); }); test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2'); + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52º', 'Jan 1 2012 should be week 52'); + assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1º', 'Jan 2 2012 should be week 1'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1º', 'Jan 8 2012 should be week 1'); + assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2º', 'Jan 9 2012 should be week 2'); + assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2º', 'Jan 15 2012 should be week 2'); + }); + + test('test short months proper', function (assert) { + var str = '02-ago-2016'; + assert.equal(moment(str, 'DD-MMM-YYYY').month(), '7', '02-ago-2016 month should be 7'); }); }))); @@ -18701,11 +19483,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -18744,6 +19527,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -18771,12 +19573,12 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('eu'); + localeModule('et'); test('parse', function (assert) { - var tests = 'urtarrila urt._otsaila ots._martxoa mar._apirila api._maiatza mai._ekaina eka._uztaila uzt._abuztua abu._iraila ira._urria urr._azaroa aza._abendua abe.'.split('_'), i; + var tests = 'jaanuar jaan_veebruar veebr_märts märts_aprill apr_mai mai_juuni juuni_juuli juuli_august aug_september sept_oktoober okt_november nov_detsember dets'.split('_'), i; function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); + assert.equal(moment(input, mmm).month(), i, input + ' peaks olema kuu ' + (i + 1)); } for (i = 0; i < 12; i++) { tests[i] = tests[i].split(' '); @@ -18793,29 +19595,29 @@ test('format', function (assert) { var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'igandea, otsaila 14. 2010, 3:25:50 pm'], - ['ddd, hA', 'ig., 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 otsaila ots.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. igandea ig. ig'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '7 7. 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], - ['LTS', '15:25:50'], - ['L', '2010-02-14'], - ['LL', '2010ko otsailaren 14a'], - ['LLL', '2010ko otsailaren 14a 15:25'], - ['LLLL', 'igandea, 2010ko otsailaren 14a 15:25'], - ['l', '2010-2-14'], - ['ll', '2010ko ots. 14a'], - ['lll', '2010ko ots. 14a 15:25'], - ['llll', 'ig., 2010ko ots. 14a 15:25'] + ['dddd, Do MMMM YYYY, H:mm:ss', 'pühapäev, 14. veebruar 2010, 15:25:50'], + ['ddd, h', 'P, 3'], + ['M Mo MM MMMM MMM', '2 2. 02 veebruar veebr'], + ['YYYY YY', '2010 10'], + ['D Do DD', '14 14. 14'], + ['d do dddd ddd dd', '0 0. pühapäev P P'], + ['DDD DDDo DDDD', '45 45. 045'], + ['w wo ww', '6 6. 06'], + ['h hh', '3 03'], + ['H HH', '15 15'], + ['m mm', '25 25'], + ['s ss', '50 50'], + ['a A', 'pm PM'], + ['[aasta] DDDo [päev]', 'aasta 45. päev'], + ['LTS', '15:25:50'], + ['L', '14.02.2010'], + ['LL', '14. veebruar 2010'], + ['LLL', '14. veebruar 2010 15:25'], + ['LLLL', 'pühapäev, 14. veebruar 2010 15:25'], + ['l', '14.2.2010'], + ['ll', '14. veebr 2010'], + ['lll', '14. veebr 2010 15:25'], + ['llll', 'P, 14. veebr 2010 15:25'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; @@ -18862,14 +19664,14 @@ }); test('format month', function (assert) { - var expected = 'urtarrila urt._otsaila ots._martxoa mar._apirila api._maiatza mai._ekaina eka._uztaila uzt._abuztua abu._iraila ira._urria urr._azaroa aza._abendua abe.'.split('_'), i; + var expected = 'jaanuar jaan_veebruar veebr_märts märts_aprill apr_mai mai_juuni juuni_juuli juuli_august aug_september sept_oktoober okt_november nov_detsember dets'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); test('format week', function (assert) { - var expected = 'igandea ig. ig_astelehena al. al_asteartea ar. ar_asteazkena az. az_osteguna og. og_ostirala ol. ol_larunbata lr. lr'.split('_'), i; + var expected = 'pühapäev P P_esmaspäev E E_teisipäev T T_kolmapäev K K_neljapäev N N_reede R R_laupäev L L'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); } @@ -18877,70 +19679,94 @@ test('from', function (assert) { var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'segundo batzuk', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minutu bat', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minutu bat', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutu', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutu', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ordu bat', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ordu bat', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 ordu', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ordu', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 ordu', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'egun bat', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'egun bat', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 egun', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'egun bat', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 egun', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 egun', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'hilabete bat', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'hilabete bat', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'hilabete bat', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 hilabete', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 hilabete', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 hilabete', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'hilabete bat', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 hilabete', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'urte bat', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 urte', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'urte bat', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 urte', '5 years = 5 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'paar sekundit', '44 seconds = paar sekundit'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'üks minut', '45 seconds = üks minut'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'üks minut', '89 seconds = üks minut'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutit', '90 seconds = 2 minutit'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutit', '44 minutes = 44 minutit'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'üks tund', '45 minutes = tund aega'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'üks tund', '89 minutes = üks tund'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 tundi', '90 minutes = 2 tundi'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 tundi', '5 hours = 5 tundi'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 tundi', '21 hours = 21 tundi'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'üks päev', '22 hours = üks päev'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'üks päev', '35 hours = üks päev'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 päeva', '36 hours = 2 päeva'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'üks päev', '1 day = üks päev'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 päeva', '5 days = 5 päeva'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 päeva', '25 days = 25 päeva'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'üks kuu', '26 days = üks kuu'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'üks kuu', '30 days = üks kuu'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'üks kuu', '43 days = üks kuu'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 kuud', '46 days = 2 kuud'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 kuud', '75 days = 2 kuud'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 kuud', '76 days = 3 kuud'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'üks kuu', '1 month = üks kuu'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 kuud', '5 months = 5 kuud'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'üks aasta', '345 days = üks aasta'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 aastat', '548 days = 2 aastat'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'üks aasta', '1 year = üks aasta'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 aastat', '5 years = 5 aastat'); }); test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'segundo batzuk barru', 'prefix'); - assert.equal(moment(0).from(30000), 'duela segundo batzuk', 'suffix'); + assert.equal(moment(30000).from(0), 'mõne sekundi pärast', 'prefix'); + assert.equal(moment(0).from(30000), 'mõni sekund tagasi', 'suffix'); }); test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'duela segundo batzuk', 'now from now should display as in the past'); + assert.equal(moment().fromNow(), 'mõni sekund tagasi', 'now from now should display as in the past'); }); test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'segundo batzuk barru', 'in seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5 egun barru', 'in 5 days'); + assert.equal(moment().add({s: 30}).fromNow(), 'mõne sekundi pärast', 'in a few seconds'); + assert.equal(moment().subtract({s: 30}).fromNow(), 'mõni sekund tagasi', 'a few seconds ago'); + + assert.equal(moment().add({m: 1}).fromNow(), 'ühe minuti pärast', 'in a minute'); + assert.equal(moment().subtract({m: 1}).fromNow(), 'üks minut tagasi', 'a minute ago'); + + assert.equal(moment().add({m: 5}).fromNow(), '5 minuti pärast', 'in 5 minutes'); + assert.equal(moment().subtract({m: 5}).fromNow(), '5 minutit tagasi', '5 minutes ago'); + + assert.equal(moment().add({d: 1}).fromNow(), 'ühe päeva pärast', 'in one day'); + assert.equal(moment().subtract({d: 1}).fromNow(), 'üks päev tagasi', 'one day ago'); + + assert.equal(moment().add({d: 5}).fromNow(), '5 päeva pärast', 'in 5 days'); + assert.equal(moment().subtract({d: 5}).fromNow(), '5 päeva tagasi', '5 days ago'); + + assert.equal(moment().add({M: 1}).fromNow(), 'kuu aja pärast', 'in a month'); + assert.equal(moment().subtract({M: 1}).fromNow(), 'kuu aega tagasi', 'a month ago'); + + assert.equal(moment().add({M: 5}).fromNow(), '5 kuu pärast', 'in 5 months'); + assert.equal(moment().subtract({M: 5}).fromNow(), '5 kuud tagasi', '5 months ago'); + + assert.equal(moment().add({y: 1}).fromNow(), 'ühe aasta pärast', 'in a year'); + assert.equal(moment().subtract({y: 1}).fromNow(), 'aasta tagasi', 'a year ago'); + + assert.equal(moment().add({y: 5}).fromNow(), '5 aasta pärast', 'in 5 years'); + assert.equal(moment().subtract({y: 5}).fromNow(), '5 aastat tagasi', '5 years ago'); }); test('calendar day', function (assert) { var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'gaur 12:00etan', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'gaur 12:25etan', 'now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'gaur 13:00etan', 'now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'bihar 12:00etan', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'gaur 11:00etan', 'now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'atzo 12:00etan', 'yesterday at the same time'); + assert.equal(moment(a).calendar(), 'Täna, 12:00', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'Täna, 12:25', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'Täna, 13:00', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'Homme, 12:00', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'Täna, 11:00', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'Eile, 12:00', 'yesterday at the same time'); }); test('calendar next week', function (assert) { var i, m; for (i = 2; i < 7; i++) { m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd LT[etan]'), 'Today + ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('[Järgmine] dddd LT'), 'Today + ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd LT[etan]'), 'Today + ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('[Järgmine] dddd LT'), 'Today + ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd LT[etan]'), 'Today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[Järgmine] dddd LT'), 'Today + ' + i + ' days end of day'); } }); @@ -18948,11 +19774,11 @@ var i, m; for (i = 2; i < 7; i++) { m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[aurreko] dddd LT[etan]'), 'Today - ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('[Eelmine] dddd LT'), 'Today - ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[aurreko] dddd LT[etan]'), 'Today - ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('[Eelmine] dddd LT'), 'Today - ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[aurreko] dddd LT[etan]'), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[Eelmine] dddd LT'), 'Today - ' + i + ' days end of day'); } }); @@ -18960,22 +19786,22 @@ var weeksAgo = moment().subtract({w: 1}), weeksFromNow = moment().add({w: 1}); - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 nädal tagasi'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), '1 nädala pärast'); weeksAgo = moment().subtract({w: 2}); weeksFromNow = moment().add({w: 2}); - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 nädalat tagasi'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), '2 nädala pärast'); }); test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1.', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1.', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2.', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2.', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3.', 'Jan 9 2012 should be week 3'); + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); + assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); + assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); + assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2'); }); }))); @@ -19173,11 +19999,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -19216,6 +20043,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -19243,44 +20089,51 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('fa'); + localeModule('eu'); test('parse', function (assert) { - var tests = 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), i; + var tests = 'urtarrila urt._otsaila ots._martxoa mar._apirila api._maiatza mai._ekaina eka._uztaila uzt._abuztua abu._iraila ira._urria urr._azaroa aza._abendua abe.'.split('_'), i; function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1) + ' instead is month ' + moment(input, mmm).month()); + assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); } for (i = 0; i < 12; i++) { - equalTest(tests[i], 'MMM', i); - equalTest(tests[i], 'MMMM', i); + tests[i] = tests[i].split(' '); + equalTest(tests[i][0], 'MMM', i); + equalTest(tests[i][1], 'MMM', i); + equalTest(tests[i][0], 'MMMM', i); + equalTest(tests[i][1], 'MMMM', i); + equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); + equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); + equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); + equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); } }); test('format', function (assert) { var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'یک\u200cشنبه، فوریه ۱۴م ۲۰۱۰، ۳:۲۵:۵۰ بعد از ظهر'], - ['ddd, hA', 'یک\u200cشنبه، ۳بعد از ظهر'], - ['M Mo MM MMMM MMM', '۲ ۲م ۰۲ فوریه فوریه'], - ['YYYY YY', '۲۰۱۰ ۱۰'], - ['D Do DD', '۱۴ ۱۴م ۱۴'], - ['d do dddd ddd dd', '۰ ۰م یک\u200cشنبه یک\u200cشنبه ی'], - ['DDD DDDo DDDD', '۴۵ ۴۵م ۰۴۵'], - ['w wo ww', '۸ ۸م ۰۸'], - ['h hh', '۳ ۰۳'], - ['H HH', '۱۵ ۱۵'], - ['m mm', '۲۵ ۲۵'], - ['s ss', '۵۰ ۵۰'], - ['a A', 'بعد از ظهر بعد از ظهر'], - ['DDDo [روز سال]', '۴۵م روز سال'], - ['LTS', '۱۵:۲۵:۵۰'], - ['L', '۱۴/۰۲/۲۰۱۰'], - ['LL', '۱۴ فوریه ۲۰۱۰'], - ['LLL', '۱۴ فوریه ۲۰۱۰ ۱۵:۲۵'], - ['LLLL', 'یک\u200cشنبه، ۱۴ فوریه ۲۰۱۰ ۱۵:۲۵'], - ['l', '۱۴/۲/۲۰۱۰'], - ['ll', '۱۴ فوریه ۲۰۱۰'], - ['lll', '۱۴ فوریه ۲۰۱۰ ۱۵:۲۵'], - ['llll', 'یک\u200cشنبه، ۱۴ فوریه ۲۰۱۰ ۱۵:۲۵'] + ['dddd, MMMM Do YYYY, h:mm:ss a', 'igandea, otsaila 14. 2010, 3:25:50 pm'], + ['ddd, hA', 'ig., 3PM'], + ['M Mo MM MMMM MMM', '2 2. 02 otsaila ots.'], + ['YYYY YY', '2010 10'], + ['D Do DD', '14 14. 14'], + ['d do dddd ddd dd', '0 0. igandea ig. ig'], + ['DDD DDDo DDDD', '45 45. 045'], + ['w wo ww', '7 7. 07'], + ['h hh', '3 03'], + ['H HH', '15 15'], + ['m mm', '25 25'], + ['s ss', '50 50'], + ['a A', 'pm PM'], + ['[the] DDDo [day of the year]', 'the 45. day of the year'], + ['LTS', '15:25:50'], + ['L', '2010-02-14'], + ['LL', '2010ko otsailaren 14a'], + ['LLL', '2010ko otsailaren 14a 15:25'], + ['LLLL', 'igandea, 2010ko otsailaren 14a 15:25'], + ['l', '2010-2-14'], + ['ll', '2010ko ots. 14a'], + ['lll', '2010ko ots. 14a 15:25'], + ['llll', 'ig., 2010ko ots. 14a 15:25'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; @@ -19290,51 +20143,51 @@ }); test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '۱م', '1'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '۲م', '2'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '۳م', '3'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '۴م', '4'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '۵م', '5'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '۶م', '6'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '۷م', '7'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '۸م', '8'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '۹م', '9'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '۱۰م', '10'); + assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); + assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); + assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); + assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); + assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); + assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); + assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); + assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); + assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); + assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - assert.equal(moment([2011, 0, 11]).format('DDDo'), '۱۱م', '11'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '۱۲م', '12'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '۱۳م', '13'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '۱۴م', '14'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '۱۵م', '15'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '۱۶م', '16'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '۱۷م', '17'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '۱۸م', '18'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '۱۹م', '19'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '۲۰م', '20'); + assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); + assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); + assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); + assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); + assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); + assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); + assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); + assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); + assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); + assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - assert.equal(moment([2011, 0, 21]).format('DDDo'), '۲۱م', '21'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '۲۲م', '22'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '۲۳م', '23'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '۲۴م', '24'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '۲۵م', '25'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '۲۶م', '26'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '۲۷م', '27'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '۲۸م', '28'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '۲۹م', '29'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '۳۰م', '30'); + assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); + assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); + assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); + assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); + assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); + assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); + assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); + assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); + assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); + assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - assert.equal(moment([2011, 0, 31]).format('DDDo'), '۳۱م', '31'); + assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); }); test('format month', function (assert) { - var expected = 'ژانویه ژانویه_فوریه فوریه_مارس مارس_آوریل آوریل_مه مه_ژوئن ژوئن_ژوئیه ژوئیه_اوت اوت_سپتامبر سپتامبر_اکتبر اکتبر_نوامبر نوامبر_دسامبر دسامبر'.split('_'), i; + var expected = 'urtarrila urt._otsaila ots._martxoa mar._apirila api._maiatza mai._ekaina eka._uztaila uzt._abuztua abu._iraila ira._urria urr._azaroa aza._abendua abe.'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); test('format week', function (assert) { - var expected = 'یک\u200cشنبه یک\u200cشنبه ی_دوشنبه دوشنبه د_سه\u200cشنبه سه\u200cشنبه س_چهارشنبه چهارشنبه چ_پنج\u200cشنبه پنج\u200cشنبه پ_جمعه جمعه ج_شنبه شنبه ش'.split('_'), i; + var expected = 'igandea ig. ig_astelehena al. al_asteartea ar. ar_asteazkena az. az_osteguna og. og_ostirala ol. ol_larunbata lr. lr'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); } @@ -19342,70 +20195,70 @@ test('from', function (assert) { var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'چند ثانیه', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'یک دقیقه', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'یک دقیقه', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '۲ دقیقه', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '۴۴ دقیقه', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'یک ساعت', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'یک ساعت', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '۲ ساعت', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '۵ ساعت', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '۲۱ ساعت', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'یک روز', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'یک روز', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '۲ روز', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'یک روز', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '۵ روز', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '۲۵ روز', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'یک ماه', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'یک ماه', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'یک ماه', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '۲ ماه', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '۲ ماه', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '۳ ماه', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'یک ماه', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '۵ ماه', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'یک سال', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '۲ سال', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'یک سال', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '۵ سال', '5 years = 5 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'segundo batzuk', '44 seconds = a few seconds'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minutu bat', '45 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minutu bat', '89 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutu', '90 seconds = 2 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutu', '44 minutes = 44 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ordu bat', '45 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ordu bat', '89 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 ordu', '90 minutes = 2 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ordu', '5 hours = 5 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 ordu', '21 hours = 21 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'egun bat', '22 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'egun bat', '35 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 egun', '36 hours = 2 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'egun bat', '1 day = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 egun', '5 days = 5 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 egun', '25 days = 25 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'hilabete bat', '26 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'hilabete bat', '30 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'hilabete bat', '43 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 hilabete', '46 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 hilabete', '75 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 hilabete', '76 days = 3 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'hilabete bat', '1 month = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 hilabete', '5 months = 5 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'urte bat', '345 days = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 urte', '548 days = 2 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'urte bat', '1 year = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 urte', '5 years = 5 years'); }); test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'در چند ثانیه', 'prefix'); - assert.equal(moment(0).from(30000), 'چند ثانیه پیش', 'suffix'); + assert.equal(moment(30000).from(0), 'segundo batzuk barru', 'prefix'); + assert.equal(moment(0).from(30000), 'duela segundo batzuk', 'suffix'); }); test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'چند ثانیه پیش', 'now from now should display as in the past'); + assert.equal(moment().fromNow(), 'duela segundo batzuk', 'now from now should display as in the past'); }); test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'در چند ثانیه', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'در ۵ روز', 'in 5 days'); + assert.equal(moment().add({s: 30}).fromNow(), 'segundo batzuk barru', 'in seconds'); + assert.equal(moment().add({d: 5}).fromNow(), '5 egun barru', 'in 5 days'); }); test('calendar day', function (assert) { var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'امروز ساعت ۱۲:۰۰', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'امروز ساعت ۱۲:۲۵', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'امروز ساعت ۱۳:۰۰', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'فردا ساعت ۱۲:۰۰', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'امروز ساعت ۱۱:۰۰', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'دیروز ساعت ۱۲:۰۰', 'yesterday at the same time'); + assert.equal(moment(a).calendar(), 'gaur 12:00etan', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'gaur 12:25etan', 'now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'gaur 13:00etan', 'now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'bihar 12:00etan', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'gaur 11:00etan', 'now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'atzo 12:00etan', 'yesterday at the same time'); }); test('calendar next week', function (assert) { var i, m; for (i = 2; i < 7; i++) { m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [ساعت] LT'), 'Today + ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('dddd LT[etan]'), 'Today + ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [ساعت] LT'), 'Today + ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('dddd LT[etan]'), 'Today + ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [ساعت] LT'), 'Today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('dddd LT[etan]'), 'Today + ' + i + ' days end of day'); } }); @@ -19413,11 +20266,11 @@ var i, m; for (i = 2; i < 7; i++) { m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [پیش ساعت] LT'), 'Today - ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('[aurreko] dddd LT[etan]'), 'Today - ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [پیش ساعت] LT'), 'Today - ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('[aurreko] dddd LT[etan]'), 'Today - ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [پیش ساعت] LT'), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[aurreko] dddd LT[etan]'), 'Today - ' + i + ' days end of day'); } }); @@ -19436,11 +20289,11 @@ }); test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 31]).format('w ww wo'), '۱ ۰۱ ۱م', 'Dec 31 2011 should be week 1'); - assert.equal(moment([2012, 0, 6]).format('w ww wo'), '۱ ۰۱ ۱م', 'Jan 6 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '۲ ۰۲ ۲م', 'Jan 7 2012 should be week 2'); - assert.equal(moment([2012, 0, 13]).format('w ww wo'), '۲ ۰۲ ۲م', 'Jan 13 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '۳ ۰۳ ۳م', 'Jan 14 2012 should be week 3'); + assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1.', 'Dec 26 2011 should be week 1'); + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1.', 'Jan 1 2012 should be week 1'); + assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2.', 'Jan 2 2012 should be week 2'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2.', 'Jan 8 2012 should be week 2'); + assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3.', 'Jan 9 2012 should be week 3'); }); }))); @@ -19638,11 +20491,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -19681,6 +20535,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -19708,51 +20581,44 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('fi'); + localeModule('fa'); test('parse', function (assert) { - var tests = 'tammikuu tammi_helmikuu helmi_maaliskuu maalis_huhtikuu huhti_toukokuu touko_kesäkuu kesä_heinäkuu heinä_elokuu elo_syyskuu syys_lokakuu loka_marraskuu marras_joulukuu joulu'.split('_'), i; + var tests = 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), i; function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); + assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1) + ' instead is month ' + moment(input, mmm).month()); } for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); + equalTest(tests[i], 'MMM', i); + equalTest(tests[i], 'MMMM', i); } }); test('format', function (assert) { var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'sunnuntai, helmikuu 14. 2010, 3:25:50 pm'], - ['ddd, hA', 'su, 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 helmikuu helmi'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. sunnuntai su su'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '6 6. 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[vuoden] DDDo [päivä]', 'vuoden 45. päivä'], - ['LTS', '15.25.50'], - ['L', '14.02.2010'], - ['LL', '14. helmikuuta 2010'], - ['LLL', '14. helmikuuta 2010, klo 15.25'], - ['LLLL', 'sunnuntai, 14. helmikuuta 2010, klo 15.25'], - ['l', '14.2.2010'], - ['ll', '14. helmi 2010'], - ['lll', '14. helmi 2010, klo 15.25'], - ['llll', 'su, 14. helmi 2010, klo 15.25'] + ['dddd, MMMM Do YYYY, h:mm:ss a', 'یک\u200cشنبه، فوریه ۱۴م ۲۰۱۰، ۳:۲۵:۵۰ بعد از ظهر'], + ['ddd, hA', 'یک\u200cشنبه، ۳بعد از ظهر'], + ['M Mo MM MMMM MMM', '۲ ۲م ۰۲ فوریه فوریه'], + ['YYYY YY', '۲۰۱۰ ۱۰'], + ['D Do DD', '۱۴ ۱۴م ۱۴'], + ['d do dddd ddd dd', '۰ ۰م یک\u200cشنبه یک\u200cشنبه ی'], + ['DDD DDDo DDDD', '۴۵ ۴۵م ۰۴۵'], + ['w wo ww', '۸ ۸م ۰۸'], + ['h hh', '۳ ۰۳'], + ['H HH', '۱۵ ۱۵'], + ['m mm', '۲۵ ۲۵'], + ['s ss', '۵۰ ۵۰'], + ['a A', 'بعد از ظهر بعد از ظهر'], + ['DDDo [روز سال]', '۴۵م روز سال'], + ['LTS', '۱۵:۲۵:۵۰'], + ['L', '۱۴/۰۲/۲۰۱۰'], + ['LL', '۱۴ فوریه ۲۰۱۰'], + ['LLL', '۱۴ فوریه ۲۰۱۰ ۱۵:۲۵'], + ['LLLL', 'یک\u200cشنبه، ۱۴ فوریه ۲۰۱۰ ۱۵:۲۵'], + ['l', '۱۴/۲/۲۰۱۰'], + ['ll', '۱۴ فوریه ۲۰۱۰'], + ['lll', '۱۴ فوریه ۲۰۱۰ ۱۵:۲۵'], + ['llll', 'یک\u200cشنبه، ۱۴ فوریه ۲۰۱۰ ۱۵:۲۵'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; @@ -19762,51 +20628,51 @@ }); test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1st'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2nd'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3rd'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4th'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5th'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6th'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7th'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8th'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9th'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10th'); + assert.equal(moment([2011, 0, 1]).format('DDDo'), '۱م', '1'); + assert.equal(moment([2011, 0, 2]).format('DDDo'), '۲م', '2'); + assert.equal(moment([2011, 0, 3]).format('DDDo'), '۳م', '3'); + assert.equal(moment([2011, 0, 4]).format('DDDo'), '۴م', '4'); + assert.equal(moment([2011, 0, 5]).format('DDDo'), '۵م', '5'); + assert.equal(moment([2011, 0, 6]).format('DDDo'), '۶م', '6'); + assert.equal(moment([2011, 0, 7]).format('DDDo'), '۷م', '7'); + assert.equal(moment([2011, 0, 8]).format('DDDo'), '۸م', '8'); + assert.equal(moment([2011, 0, 9]).format('DDDo'), '۹م', '9'); + assert.equal(moment([2011, 0, 10]).format('DDDo'), '۱۰م', '10'); - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11th'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12th'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13th'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14th'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15th'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16th'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17th'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18th'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19th'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20th'); + assert.equal(moment([2011, 0, 11]).format('DDDo'), '۱۱م', '11'); + assert.equal(moment([2011, 0, 12]).format('DDDo'), '۱۲م', '12'); + assert.equal(moment([2011, 0, 13]).format('DDDo'), '۱۳م', '13'); + assert.equal(moment([2011, 0, 14]).format('DDDo'), '۱۴م', '14'); + assert.equal(moment([2011, 0, 15]).format('DDDo'), '۱۵م', '15'); + assert.equal(moment([2011, 0, 16]).format('DDDo'), '۱۶م', '16'); + assert.equal(moment([2011, 0, 17]).format('DDDo'), '۱۷م', '17'); + assert.equal(moment([2011, 0, 18]).format('DDDo'), '۱۸م', '18'); + assert.equal(moment([2011, 0, 19]).format('DDDo'), '۱۹م', '19'); + assert.equal(moment([2011, 0, 20]).format('DDDo'), '۲۰م', '20'); - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21st'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22nd'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23rd'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24th'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25th'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26th'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27th'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28th'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29th'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30th'); + assert.equal(moment([2011, 0, 21]).format('DDDo'), '۲۱م', '21'); + assert.equal(moment([2011, 0, 22]).format('DDDo'), '۲۲م', '22'); + assert.equal(moment([2011, 0, 23]).format('DDDo'), '۲۳م', '23'); + assert.equal(moment([2011, 0, 24]).format('DDDo'), '۲۴م', '24'); + assert.equal(moment([2011, 0, 25]).format('DDDo'), '۲۵م', '25'); + assert.equal(moment([2011, 0, 26]).format('DDDo'), '۲۶م', '26'); + assert.equal(moment([2011, 0, 27]).format('DDDo'), '۲۷م', '27'); + assert.equal(moment([2011, 0, 28]).format('DDDo'), '۲۸م', '28'); + assert.equal(moment([2011, 0, 29]).format('DDDo'), '۲۹م', '29'); + assert.equal(moment([2011, 0, 30]).format('DDDo'), '۳۰م', '30'); - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31st'); + assert.equal(moment([2011, 0, 31]).format('DDDo'), '۳۱م', '31'); }); test('format month', function (assert) { - var expected = 'tammikuu tammi_helmikuu helmi_maaliskuu maalis_huhtikuu huhti_toukokuu touko_kesäkuu kesä_heinäkuu heinä_elokuu elo_syyskuu syys_lokakuu loka_marraskuu marras_joulukuu joulu'.split('_'), i; + var expected = 'ژانویه ژانویه_فوریه فوریه_مارس مارس_آوریل آوریل_مه مه_ژوئن ژوئن_ژوئیه ژوئیه_اوت اوت_سپتامبر سپتامبر_اکتبر اکتبر_نوامبر نوامبر_دسامبر دسامبر'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); test('format week', function (assert) { - var expected = 'sunnuntai su su_maanantai ma ma_tiistai ti ti_keskiviikko ke ke_torstai to to_perjantai pe pe_lauantai la la'.split('_'), i; + var expected = 'یک\u200cشنبه یک\u200cشنبه ی_دوشنبه دوشنبه د_سه\u200cشنبه سه\u200cشنبه س_چهارشنبه چهارشنبه چ_پنج\u200cشنبه پنج\u200cشنبه پ_جمعه جمعه ج_شنبه شنبه ش'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); } @@ -19814,71 +20680,70 @@ test('from', function (assert) { var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'muutama sekunti', '44 seconds = few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minuutti', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minuutti', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), 'kaksi minuuttia', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuuttia', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'tunti', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'tunti', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), 'kaksi tuntia', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), 'viisi tuntia', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 tuntia', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'päivä', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'päivä', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), 'kaksi päivää', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'päivä', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), 'viisi päivää', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 päivää', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'kuukausi', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'kuukausi', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'kuukausi', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), 'kaksi kuukautta', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), 'kaksi kuukautta', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), 'kolme kuukautta', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'kuukausi', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), 'viisi kuukautta', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'vuosi', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), 'kaksi vuotta', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'vuosi', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), 'viisi vuotta', '5 years = 5 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'چند ثانیه', '44 seconds = a few seconds'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'یک دقیقه', '45 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'یک دقیقه', '89 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '۲ دقیقه', '90 seconds = 2 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '۴۴ دقیقه', '44 minutes = 44 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'یک ساعت', '45 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'یک ساعت', '89 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '۲ ساعت', '90 minutes = 2 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '۵ ساعت', '5 hours = 5 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '۲۱ ساعت', '21 hours = 21 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'یک روز', '22 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'یک روز', '35 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '۲ روز', '36 hours = 2 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'یک روز', '1 day = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '۵ روز', '5 days = 5 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '۲۵ روز', '25 days = 25 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'یک ماه', '26 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'یک ماه', '30 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'یک ماه', '43 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '۲ ماه', '46 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '۲ ماه', '75 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '۳ ماه', '76 days = 3 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'یک ماه', '1 month = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '۵ ماه', '5 months = 5 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'یک سال', '345 days = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '۲ سال', '548 days = 2 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'یک سال', '1 year = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '۵ سال', '5 years = 5 years'); }); test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'muutaman sekunnin päästä', 'prefix'); - assert.equal(moment(0).from(30000), 'muutama sekunti sitten', 'suffix'); + assert.equal(moment(30000).from(0), 'در چند ثانیه', 'prefix'); + assert.equal(moment(0).from(30000), 'چند ثانیه پیش', 'suffix'); }); test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'muutama sekunti sitten', 'now from now should display as in the past'); + assert.equal(moment().fromNow(), 'چند ثانیه پیش', 'now from now should display as in the past'); }); test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'muutaman sekunnin päästä', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'viiden päivän päästä', 'in 5 days'); + assert.equal(moment().add({s: 30}).fromNow(), 'در چند ثانیه', 'in a few seconds'); + assert.equal(moment().add({d: 5}).fromNow(), 'در ۵ روز', 'in 5 days'); }); test('calendar day', function (assert) { var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'tänään klo 12.00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'tänään klo 12.25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'tänään klo 13.00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'huomenna klo 12.00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'tänään klo 11.00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'eilen klo 12.00', 'yesterday at the same time'); + assert.equal(moment(a).calendar(), 'امروز ساعت ۱۲:۰۰', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'امروز ساعت ۱۲:۲۵', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'امروز ساعت ۱۳:۰۰', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'فردا ساعت ۱۲:۰۰', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'امروز ساعت ۱۱:۰۰', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'دیروز ساعت ۱۲:۰۰', 'yesterday at the same time'); }); test('calendar next week', function (assert) { var i, m; - for (i = 2; i < 7; i++) { m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [klo] LT'), 'today + ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('dddd [ساعت] LT'), 'Today + ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [klo] LT'), 'today + ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('dddd [ساعت] LT'), 'Today + ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [klo] LT'), 'today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('dddd [ساعت] LT'), 'Today + ' + i + ' days end of day'); } }); @@ -19886,11 +20751,11 @@ var i, m; for (i = 2; i < 7; i++) { m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[viime] dddd[na] [klo] LT'), 'today - ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('dddd [پیش ساعت] LT'), 'Today - ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[viime] dddd[na] [klo] LT'), 'today - ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('dddd [پیش ساعت] LT'), 'Today - ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[viime] dddd[na] [klo] LT'), 'today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('dddd [پیش ساعت] LT'), 'Today - ' + i + ' days end of day'); } }); @@ -19898,22 +20763,22 @@ var weeksAgo = moment().subtract({w: 1}), weeksFromNow = moment().add({w: 1}); - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), 'yksi viikko sitten'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'yhden viikon päästä'); + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); weeksAgo = moment().subtract({w: 2}); weeksFromNow = moment().add({w: 2}); - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), 'kaksi viikkoa sitten'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'kaden viikon päästä'); + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); }); test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2'); + assert.equal(moment([2011, 11, 31]).format('w ww wo'), '۱ ۰۱ ۱م', 'Dec 31 2011 should be week 1'); + assert.equal(moment([2012, 0, 6]).format('w ww wo'), '۱ ۰۱ ۱م', 'Jan 6 2012 should be week 1'); + assert.equal(moment([2012, 0, 7]).format('w ww wo'), '۲ ۰۲ ۲م', 'Jan 7 2012 should be week 2'); + assert.equal(moment([2012, 0, 13]).format('w ww wo'), '۲ ۰۲ ۲م', 'Jan 13 2012 should be week 2'); + assert.equal(moment([2012, 0, 14]).format('w ww wo'), '۳ ۰۳ ۳م', 'Jan 14 2012 should be week 3'); }); }))); @@ -20111,11 +20976,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -20154,6 +21020,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -20181,10 +21066,10 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('fo'); + localeModule('fi'); test('parse', function (assert) { - var tests = 'januar jan_februar feb_mars mar_apríl apr_mai mai_juni jun_juli jul_august aug_september sep_oktober okt_november nov_desember des'.split('_'), i; + var tests = 'tammikuu tammi_helmikuu helmi_maaliskuu maalis_huhtikuu huhti_toukokuu touko_kesäkuu kesä_heinäkuu heinä_elokuu elo_syyskuu syys_lokakuu loka_marraskuu marras_joulukuu joulu'.split('_'), i; function equalTest(input, mmm, i) { assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); } @@ -20203,12 +21088,12 @@ test('format', function (assert) { var a = [ - ['dddd [tann] Do MMMM YYYY, h:mm:ss a', 'sunnudagur tann 14. februar 2010, 3:25:50 pm'], - ['ddd hA', 'sun 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 februar feb'], + ['dddd, MMMM Do YYYY, h:mm:ss a', 'sunnuntai, helmikuu 14. 2010, 3:25:50 pm'], + ['ddd, hA', 'su, 3PM'], + ['M Mo MM MMMM MMM', '2 2. 02 helmikuu helmi'], ['YYYY YY', '2010 10'], ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. sunnudagur sun su'], + ['d do dddd ddd dd', '0 0. sunnuntai su su'], ['DDD DDDo DDDD', '45 45. 045'], ['w wo ww', '6 6. 06'], ['h hh', '3 03'], @@ -20216,16 +21101,16 @@ ['m mm', '25 25'], ['s ss', '50 50'], ['a A', 'pm PM'], - ['[tann] DDDo [dagin á árinum]', 'tann 45. dagin á árinum'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 februar 2010'], - ['LLL', '14 februar 2010 15:25'], - ['LLLL', 'sunnudagur 14. februar, 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 feb 2010'], - ['lll', '14 feb 2010 15:25'], - ['llll', 'sun 14. feb, 2010 15:25'] + ['[vuoden] DDDo [päivä]', 'vuoden 45. päivä'], + ['LTS', '15.25.50'], + ['L', '14.02.2010'], + ['LL', '14. helmikuuta 2010'], + ['LLL', '14. helmikuuta 2010, klo 15.25'], + ['LLLL', 'sunnuntai, 14. helmikuuta 2010, klo 15.25'], + ['l', '14.2.2010'], + ['ll', '14. helmi 2010'], + ['lll', '14. helmi 2010, klo 15.25'], + ['llll', 'su, 14. helmi 2010, klo 15.25'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; @@ -20235,51 +21120,51 @@ }); test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); + assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1st'); + assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2nd'); + assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3rd'); + assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4th'); + assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5th'); + assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6th'); + assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7th'); + assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8th'); + assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9th'); + assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10th'); - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); + assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11th'); + assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12th'); + assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13th'); + assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14th'); + assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15th'); + assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16th'); + assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17th'); + assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18th'); + assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19th'); + assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20th'); - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); + assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21st'); + assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22nd'); + assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23rd'); + assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24th'); + assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25th'); + assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26th'); + assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27th'); + assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28th'); + assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29th'); + assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30th'); - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); + assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31st'); }); test('format month', function (assert) { - var expected = 'januar jan_februar feb_mars mar_apríl apr_mai mai_juni jun_juli jul_august aug_september sep_oktober okt_november nov_desember des'.split('_'), i; + var expected = 'tammikuu tammi_helmikuu helmi_maaliskuu maalis_huhtikuu huhti_toukokuu touko_kesäkuu kesä_heinäkuu heinä_elokuu elo_syyskuu syys_lokakuu loka_marraskuu marras_joulukuu joulu'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); test('format week', function (assert) { - var expected = 'sunnudagur sun su_mánadagur mán má_týsdagur týs tý_mikudagur mik mi_hósdagur hós hó_fríggjadagur frí fr_leygardagur ley le'.split('_'), i; + var expected = 'sunnuntai su su_maanantai ma ma_tiistai ti ti_keskiviikko ke ke_torstai to to_perjantai pe pe_lauantai la la'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); } @@ -20287,60 +21172,59 @@ test('from', function (assert) { var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'fá sekund', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ein minutt', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ein minutt', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuttir', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuttir', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ein tími', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ein tími', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 tímar', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 tímar', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 tímar', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ein dagur', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ein dagur', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dagar', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ein dagur', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dagar', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dagar', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ein mánaði', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ein mánaði', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ein mánaði', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mánaðir', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mánaðir', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mánaðir', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ein mánaði', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mánaðir', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'eitt ár', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 ár', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'eitt ár', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 ár', '5 years = 5 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'muutama sekunti', '44 seconds = few seconds'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minuutti', '45 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minuutti', '89 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), 'kaksi minuuttia', '90 seconds = 2 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuuttia', '44 minutes = 44 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'tunti', '45 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'tunti', '89 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), 'kaksi tuntia', '90 minutes = 2 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), 'viisi tuntia', '5 hours = 5 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 tuntia', '21 hours = 21 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'päivä', '22 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'päivä', '35 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), 'kaksi päivää', '36 hours = 2 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'päivä', '1 day = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), 'viisi päivää', '5 days = 5 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 päivää', '25 days = 25 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'kuukausi', '26 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'kuukausi', '30 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'kuukausi', '43 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), 'kaksi kuukautta', '46 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), 'kaksi kuukautta', '75 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), 'kolme kuukautta', '76 days = 3 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'kuukausi', '1 month = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), 'viisi kuukautta', '5 months = 5 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'vuosi', '345 days = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), 'kaksi vuotta', '548 days = 2 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'vuosi', '1 year = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), 'viisi vuotta', '5 years = 5 years'); }); test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'um fá sekund', 'prefix'); - assert.equal(moment(0).from(30000), 'fá sekund síðani', 'suffix'); + assert.equal(moment(30000).from(0), 'muutaman sekunnin päästä', 'prefix'); + assert.equal(moment(0).from(30000), 'muutama sekunti sitten', 'suffix'); }); test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'fá sekund síðani', 'now from now should display as in the past'); + assert.equal(moment().fromNow(), 'muutama sekunti sitten', 'now from now should display as in the past'); }); test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'um fá sekund', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'um 5 dagar', 'in 5 days'); + assert.equal(moment().add({s: 30}).fromNow(), 'muutaman sekunnin päästä', 'in a few seconds'); + assert.equal(moment().add({d: 5}).fromNow(), 'viiden päivän päästä', 'in 5 days'); }); - test('calendar day', function (assert) { var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'Í dag kl. 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Í dag kl. 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Í dag kl. 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Í morgin kl. 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Í dag kl. 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Í gjár kl. 12:00', 'yesterday at the same time'); + assert.equal(moment(a).calendar(), 'tänään klo 12.00', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'tänään klo 12.25', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'tänään klo 13.00', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'huomenna klo 12.00', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'tänään klo 11.00', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'eilen klo 12.00', 'yesterday at the same time'); }); test('calendar next week', function (assert) { @@ -20348,11 +21232,11 @@ for (i = 2; i < 7; i++) { m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [kl.] LT'), 'today + ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('dddd [klo] LT'), 'today + ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [kl.] LT'), 'today + ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('dddd [klo] LT'), 'today + ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [kl.] LT'), 'today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('dddd [klo] LT'), 'today + ' + i + ' days end of day'); } }); @@ -20360,11 +21244,11 @@ var i, m; for (i = 2; i < 7; i++) { m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[síðstu] dddd [kl] LT'), 'today - ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('[viime] dddd[na] [klo] LT'), 'today - ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[síðstu] dddd [kl] LT'), 'today - ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('[viime] dddd[na] [klo] LT'), 'today - ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[síðstu] dddd [kl] LT'), 'today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[viime] dddd[na] [klo] LT'), 'today - ' + i + ' days end of day'); } }); @@ -20585,11 +21469,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -20628,6 +21513,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -20655,16 +21559,13 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('fr-ca'); + localeModule('fo'); test('parse', function (assert) { - var i, - tests = 'janvier janv._février févr._mars mars_avril avr._mai mai_juin juin_juillet juil._août août_septembre sept._octobre oct._novembre nov._décembre déc.'.split('_'); - + var tests = 'januar jan_februar feb_mars mar_apríl apr_mai mai_juni jun_juli jul_august aug_september sep_oktober okt_november nov_desember des'.split('_'), i; function equalTest(input, mmm, i) { assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); } - for (i = 0; i < 12; i++) { tests[i] = tests[i].split(' '); equalTest(tests[i][0], 'MMM', i); @@ -20680,104 +21581,83 @@ test('format', function (assert) { var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'dimanche, février 14e 2010, 3:25:50 pm'], - ['ddd, hA', 'dim., 3PM'], - ['M Mo MM MMMM MMM', '2 2e 02 février févr.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14e 14'], - ['d do dddd ddd dd', '0 0e dimanche dim. di'], - ['DDD DDDo DDDD', '45 45e 045'], - ['w wo ww', '8 8e 08'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[le] Do [jour du mois]', 'le 14e jour du mois'], - ['[le] DDDo [jour de l’année]', 'le 45e jour de l’année'], - ['LTS', '15:25:50'], - ['L', '2010-02-14'], - ['LL', '14 février 2010'], - ['LLL', '14 février 2010 15:25'], - ['LLLL', 'dimanche 14 février 2010 15:25'], - ['l', '2010-2-14'], - ['ll', '14 févr. 2010'], - ['lll', '14 févr. 2010 15:25'], - ['llll', 'dim. 14 févr. 2010 15:25'] + ['dddd [tann] Do MMMM YYYY, h:mm:ss a', 'sunnudagur tann 14. februar 2010, 3:25:50 pm'], + ['ddd hA', 'sun 3PM'], + ['M Mo MM MMMM MMM', '2 2. 02 februar feb'], + ['YYYY YY', '2010 10'], + ['D Do DD', '14 14. 14'], + ['d do dddd ddd dd', '0 0. sunnudagur sun su'], + ['DDD DDDo DDDD', '45 45. 045'], + ['w wo ww', '6 6. 06'], + ['h hh', '3 03'], + ['H HH', '15 15'], + ['m mm', '25 25'], + ['s ss', '50 50'], + ['a A', 'pm PM'], + ['[tann] DDDo [dagin á árinum]', 'tann 45. dagin á árinum'], + ['LTS', '15:25:50'], + ['L', '14/02/2010'], + ['LL', '14 februar 2010'], + ['LLL', '14 februar 2010 15:25'], + ['LLLL', 'sunnudagur 14. februar, 2010 15:25'], + ['l', '14/2/2010'], + ['ll', '14 feb 2010'], + ['lll', '14 feb 2010 15:25'], + ['llll', 'sun 14. feb, 2010 15:25'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; - for (i = 0; i < a.length; i++) { assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); } }); test('format ordinal', function (assert) { - assert.equal(moment([2017, 0, 1]).format('Mo'), '1er', '1er'); - assert.equal(moment([2017, 1, 1]).format('Mo'), '2e', '2e'); - - assert.equal(moment([2017, 0, 1]).format('Qo'), '1er', '1er'); - assert.equal(moment([2017, 3, 1]).format('Qo'), '2e', '2e'); - - assert.equal(moment([2017, 0, 1]).format('Do'), '1er', '1er'); - assert.equal(moment([2017, 0, 2]).format('Do'), '2e', '2e'); - - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1er', '1er'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2e', '2e'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3e', '3e'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4e', '4e'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5e', '5e'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6e', '6e'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7e', '7e'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8e', '8e'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9e', '9e'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10e', '10e'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11e', '11e'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12e', '12e'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13e', '13e'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14e', '14e'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15e', '15e'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16e', '16e'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17e', '17e'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18e', '18e'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19e', '19e'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20e', '20e'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21e', '21e'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22e', '22e'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23e', '23e'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24e', '24e'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25e', '25e'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26e', '26e'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27e', '27e'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28e', '28e'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29e', '29e'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30e', '30e'); + assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); + assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); + assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); + assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); + assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); + assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); + assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); + assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); + assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); + assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31e', '31e'); + assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); + assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); + assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); + assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); + assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); + assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); + assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); + assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); + assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); + assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - assert.equal(moment([2017, 0, 1]).format('do'), '0e', '0e'); - assert.equal(moment([2017, 0, 2]).format('do'), '1er', '1er'); + assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); + assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); + assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); + assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); + assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); + assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); + assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); + assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); + assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); + assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - assert.equal(moment([2017, 0, 4]).format('wo Wo'), '1re 1re', '1re 1re'); - assert.equal(moment([2017, 0, 11]).format('wo Wo'), '2e 2e', '2e 2e'); + assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); }); test('format month', function (assert) { - var i, - expected = 'janvier janv._février févr._mars mars_avril avr._mai mai_juin juin_juillet juil._août août_septembre sept._octobre oct._novembre nov._décembre déc.'.split('_'); - + var expected = 'januar jan_februar feb_mars mar_apríl apr_mai mai_juni jun_juli jul_august aug_september sep_oktober okt_november nov_desember des'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); test('format week', function (assert) { - var i, - expected = 'dimanche dim. di_lundi lun. lu_mardi mar. ma_mercredi mer. me_jeudi jeu. je_vendredi ven. ve_samedi sam. sa'.split('_'); - + var expected = 'sunnudagur sun su_mánadagur mán má_týsdagur týs tý_mikudagur mik mi_hósdagur hós hó_fríggjadagur frí fr_leygardagur ley le'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); } @@ -20785,104 +21665,107 @@ test('from', function (assert) { var start = moment([2007, 1, 28]); - - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'quelques secondes', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'une minute', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'une minute', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutes', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutes', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'une heure', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'une heure', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 heures', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 heures', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 heures', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'un jour', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'un jour', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 jours', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'un jour', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 jours', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 jours', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'un mois', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'un mois', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'un mois', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mois', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mois', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mois', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'un mois', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mois', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'un an', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 ans', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'un an', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 ans', '5 years = 5 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'fá sekund', '44 seconds = a few seconds'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ein minuttur', '45 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ein minuttur', '89 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuttir', '90 seconds = 2 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuttir', '44 minutes = 44 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ein tími', '45 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ein tími', '89 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 tímar', '90 minutes = 2 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 tímar', '5 hours = 5 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 tímar', '21 hours = 21 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ein dagur', '22 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ein dagur', '35 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dagar', '36 hours = 2 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ein dagur', '1 day = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dagar', '5 days = 5 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dagar', '25 days = 25 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ein mánaður', '26 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ein mánaður', '30 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ein mánaður', '43 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mánaðir', '46 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mánaðir', '75 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mánaðir', '76 days = 3 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ein mánaður', '1 month = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mánaðir', '5 months = 5 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'eitt ár', '345 days = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 ár', '548 days = 2 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'eitt ár', '1 year = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 ár', '5 years = 5 years'); }); test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'dans quelques secondes', 'prefix'); - assert.equal(moment(0).from(30000), 'il y a quelques secondes', 'suffix'); + assert.equal(moment(30000).from(0), 'um fá sekund', 'prefix'); + assert.equal(moment(0).from(30000), 'fá sekund síðani', 'suffix'); + }); + + test('now from now', function (assert) { + assert.equal(moment().fromNow(), 'fá sekund síðani', 'now from now should display as in the past'); }); test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'dans quelques secondes', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'dans 5 jours', 'in 5 days'); + assert.equal(moment().add({s: 30}).fromNow(), 'um fá sekund', 'in a few seconds'); + assert.equal(moment().add({d: 5}).fromNow(), 'um 5 dagar', 'in 5 days'); }); - test('same day', function (assert) { + + test('calendar day', function (assert) { var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'Aujourd’hui à 12:00', 'Today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Aujourd’hui à 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Aujourd’hui à 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Demain à 12:00', 'Tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Aujourd’hui à 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Hier à 12:00', 'Yesterday at the same time'); + assert.equal(moment(a).calendar(), 'Í dag kl. 12:00', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'Í dag kl. 12:25', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'Í dag kl. 13:00', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'Í morgin kl. 12:00', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'Í dag kl. 11:00', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'Í gjár kl. 12:00', 'yesterday at the same time'); }); - test('same next week', function (assert) { + test('calendar next week', function (assert) { var i, m; for (i = 2; i < 7; i++) { m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [à] LT'), 'Today + ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('dddd [kl.] LT'), 'today + ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [à] LT'), 'Today + ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('dddd [kl.] LT'), 'today + ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [à] LT'), 'Today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('dddd [kl.] LT'), 'today + ' + i + ' days end of day'); } }); - test('same last week', function (assert) { + test('calendar last week', function (assert) { var i, m; - for (i = 2; i < 7; i++) { m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [dernier à] LT'), 'Today - ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('[síðstu] dddd [kl] LT'), 'today - ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [dernier à] LT'), 'Today - ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('[síðstu] dddd [kl] LT'), 'today - ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [dernier à] LT'), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[síðstu] dddd [kl] LT'), 'today - ' + i + ' days end of day'); } }); - test('same all else', function (assert) { + test('calendar all else', function (assert) { var weeksAgo = moment().subtract({w: 1}), weeksFromNow = moment().add({w: 1}); - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), 'yksi viikko sitten'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'yhden viikon päästä'); weeksAgo = moment().subtract({w: 2}); weeksFromNow = moment().add({w: 2}); - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), 'kaksi viikkoa sitten'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'kaden viikon päästä'); }); test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1re', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1re', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2e', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2e', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3e', 'Jan 15 2012 should be week 3'); + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); + assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); + assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); + assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2'); }); }))); @@ -21080,11 +21963,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -21123,6 +22007,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -21150,7 +22053,7 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('fr-ch'); + localeModule('fr-ca'); test('parse', function (assert) { var i, @@ -21182,7 +22085,7 @@ ['D Do DD', '14 14e 14'], ['d do dddd ddd dd', '0 0e dimanche dim. di'], ['DDD DDDo DDDD', '45 45e 045'], - ['w wo ww', '6 6e 06'], + ['w wo ww', '8 8e 08'], ['h hh', '3 03'], ['H HH', '15 15'], ['m mm', '25 25'], @@ -21191,11 +22094,11 @@ ['[le] Do [jour du mois]', 'le 14e jour du mois'], ['[le] DDDo [jour de l’année]', 'le 45e jour de l’année'], ['LTS', '15:25:50'], - ['L', '14.02.2010'], + ['L', '2010-02-14'], ['LL', '14 février 2010'], ['LLL', '14 février 2010 15:25'], ['LLLL', 'dimanche 14 février 2010 15:25'], - ['l', '14.2.2010'], + ['l', '2010-2-14'], ['ll', '14 févr. 2010'], ['lll', '14 févr. 2010 15:25'], ['llll', 'dim. 14 févr. 2010 15:25'] @@ -21373,11 +22276,11 @@ }); test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52e', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1re', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1re', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2e', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2e', 'Jan 15 2012 should be week 2'); + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1re', 'Jan 1 2012 should be week 1'); + assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1re', 'Jan 7 2012 should be week 1'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2e', 'Jan 8 2012 should be week 2'); + assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2e', 'Jan 14 2012 should be week 2'); + assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3e', 'Jan 15 2012 should be week 3'); }); }))); @@ -21575,11 +22478,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -21618,6 +22522,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -21645,7 +22568,7 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('fr'); + localeModule('fr-ch'); test('parse', function (assert) { var i, @@ -21670,11 +22593,11 @@ test('format', function (assert) { var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'dimanche, février 14 2010, 3:25:50 pm'], + ['dddd, MMMM Do YYYY, h:mm:ss a', 'dimanche, février 14e 2010, 3:25:50 pm'], ['ddd, hA', 'dim., 3PM'], ['M Mo MM MMMM MMM', '2 2e 02 février févr.'], ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], + ['D Do DD', '14 14e 14'], ['d do dddd ddd dd', '0 0e dimanche dim. di'], ['DDD DDDo DDDD', '45 45e 045'], ['w wo ww', '6 6e 06'], @@ -21683,14 +22606,14 @@ ['m mm', '25 25'], ['s ss', '50 50'], ['a A', 'pm PM'], - ['[le] Do [jour du mois]', 'le 14 jour du mois'], + ['[le] Do [jour du mois]', 'le 14e jour du mois'], ['[le] DDDo [jour de l’année]', 'le 45e jour de l’année'], ['LTS', '15:25:50'], - ['L', '14/02/2010'], + ['L', '14.02.2010'], ['LL', '14 février 2010'], ['LLL', '14 février 2010 15:25'], ['LLLL', 'dimanche 14 février 2010 15:25'], - ['l', '14/2/2010'], + ['l', '14.2.2010'], ['ll', '14 févr. 2010'], ['lll', '14 févr. 2010 15:25'], ['llll', 'dim. 14 févr. 2010 15:25'] @@ -21711,7 +22634,7 @@ assert.equal(moment([2017, 3, 1]).format('Qo'), '2e', '2e'); assert.equal(moment([2017, 0, 1]).format('Do'), '1er', '1er'); - assert.equal(moment([2017, 0, 2]).format('Do'), '2', '2'); + assert.equal(moment([2017, 0, 2]).format('Do'), '2e', '2e'); assert.equal(moment([2011, 0, 1]).format('DDDo'), '1er', '1er'); assert.equal(moment([2011, 0, 2]).format('DDDo'), '2e', '2e'); @@ -22070,11 +22993,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -22113,6 +23037,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -22140,13 +23083,16 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('fy'); + localeModule('fr'); test('parse', function (assert) { - var tests = 'jannewaris jan._febrewaris feb._maart mrt._april apr._maaie mai._juny jun._july jul._augustus aug._septimber sep._oktober okt._novimber nov._desimber des.'.split('_'), i; + var i, + tests = 'janvier janv._février févr._mars mars_avril avr._mai mai_juin juin_juillet juil._août août_septembre sept._octobre oct._novembre nov._décembre déc.'.split('_'); + function equalTest(input, mmm, i) { assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); } + for (i = 0; i < 12; i++) { tests[i] = tests[i].split(' '); equalTest(tests[i][0], 'MMM', i); @@ -22162,83 +23108,104 @@ test('format', function (assert) { var a = [ - ['dddd, MMMM Do YYYY, HH:mm:ss', 'snein, febrewaris 14de 2010, 15:25:50'], - ['ddd, HH', 'si., 15'], - ['M Mo MM MMMM MMM', '2 2de 02 febrewaris feb.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14de 14'], - ['d do dddd ddd dd', '0 0de snein si. Si'], - ['DDD DDDo DDDD', '45 45ste 045'], - ['w wo ww', '6 6de 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45ste day of the year'], - ['LTS', '15:25:50'], - ['L', '14-02-2010'], - ['LL', '14 febrewaris 2010'], - ['LLL', '14 febrewaris 2010 15:25'], - ['LLLL', 'snein 14 febrewaris 2010 15:25'], - ['l', '14-2-2010'], - ['ll', '14 feb. 2010'], - ['lll', '14 feb. 2010 15:25'], - ['llll', 'si. 14 feb. 2010 15:25'] + ['dddd, MMMM Do YYYY, h:mm:ss a', 'dimanche, février 14 2010, 3:25:50 pm'], + ['ddd, hA', 'dim., 3PM'], + ['M Mo MM MMMM MMM', '2 2e 02 février févr.'], + ['YYYY YY', '2010 10'], + ['D Do DD', '14 14 14'], + ['d do dddd ddd dd', '0 0e dimanche dim. di'], + ['DDD DDDo DDDD', '45 45e 045'], + ['w wo ww', '6 6e 06'], + ['h hh', '3 03'], + ['H HH', '15 15'], + ['m mm', '25 25'], + ['s ss', '50 50'], + ['a A', 'pm PM'], + ['[le] Do [jour du mois]', 'le 14 jour du mois'], + ['[le] DDDo [jour de l’année]', 'le 45e jour de l’année'], + ['LTS', '15:25:50'], + ['L', '14/02/2010'], + ['LL', '14 février 2010'], + ['LLL', '14 février 2010 15:25'], + ['LLLL', 'dimanche 14 février 2010 15:25'], + ['l', '14/2/2010'], + ['ll', '14 févr. 2010'], + ['lll', '14 févr. 2010 15:25'], + ['llll', 'dim. 14 févr. 2010 15:25'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; + for (i = 0; i < a.length; i++) { assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); } }); test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1ste', '1ste'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2de', '2de'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3de', '3de'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4de', '4de'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5de', '5de'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6de', '6de'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7de', '7de'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8ste', '8ste'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9de', '9de'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10de', '10de'); + assert.equal(moment([2017, 0, 1]).format('Mo'), '1er', '1er'); + assert.equal(moment([2017, 1, 1]).format('Mo'), '2e', '2e'); - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11de', '11de'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12de', '12de'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13de', '13de'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14de', '14de'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15de', '15de'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16de', '16de'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17de', '17de'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18de', '18de'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19de', '19de'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20ste', '20ste'); + assert.equal(moment([2017, 0, 1]).format('Qo'), '1er', '1er'); + assert.equal(moment([2017, 3, 1]).format('Qo'), '2e', '2e'); - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21ste', '21ste'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22ste', '22ste'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23ste', '23ste'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24ste', '24ste'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25ste', '25ste'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26ste', '26ste'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27ste', '27ste'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28ste', '28ste'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29ste', '29ste'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30ste', '30ste'); + assert.equal(moment([2017, 0, 1]).format('Do'), '1er', '1er'); + assert.equal(moment([2017, 0, 2]).format('Do'), '2', '2'); - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31ste', '31ste'); + assert.equal(moment([2011, 0, 1]).format('DDDo'), '1er', '1er'); + assert.equal(moment([2011, 0, 2]).format('DDDo'), '2e', '2e'); + assert.equal(moment([2011, 0, 3]).format('DDDo'), '3e', '3e'); + assert.equal(moment([2011, 0, 4]).format('DDDo'), '4e', '4e'); + assert.equal(moment([2011, 0, 5]).format('DDDo'), '5e', '5e'); + assert.equal(moment([2011, 0, 6]).format('DDDo'), '6e', '6e'); + assert.equal(moment([2011, 0, 7]).format('DDDo'), '7e', '7e'); + assert.equal(moment([2011, 0, 8]).format('DDDo'), '8e', '8e'); + assert.equal(moment([2011, 0, 9]).format('DDDo'), '9e', '9e'); + assert.equal(moment([2011, 0, 10]).format('DDDo'), '10e', '10e'); + + assert.equal(moment([2011, 0, 11]).format('DDDo'), '11e', '11e'); + assert.equal(moment([2011, 0, 12]).format('DDDo'), '12e', '12e'); + assert.equal(moment([2011, 0, 13]).format('DDDo'), '13e', '13e'); + assert.equal(moment([2011, 0, 14]).format('DDDo'), '14e', '14e'); + assert.equal(moment([2011, 0, 15]).format('DDDo'), '15e', '15e'); + assert.equal(moment([2011, 0, 16]).format('DDDo'), '16e', '16e'); + assert.equal(moment([2011, 0, 17]).format('DDDo'), '17e', '17e'); + assert.equal(moment([2011, 0, 18]).format('DDDo'), '18e', '18e'); + assert.equal(moment([2011, 0, 19]).format('DDDo'), '19e', '19e'); + assert.equal(moment([2011, 0, 20]).format('DDDo'), '20e', '20e'); + + assert.equal(moment([2011, 0, 21]).format('DDDo'), '21e', '21e'); + assert.equal(moment([2011, 0, 22]).format('DDDo'), '22e', '22e'); + assert.equal(moment([2011, 0, 23]).format('DDDo'), '23e', '23e'); + assert.equal(moment([2011, 0, 24]).format('DDDo'), '24e', '24e'); + assert.equal(moment([2011, 0, 25]).format('DDDo'), '25e', '25e'); + assert.equal(moment([2011, 0, 26]).format('DDDo'), '26e', '26e'); + assert.equal(moment([2011, 0, 27]).format('DDDo'), '27e', '27e'); + assert.equal(moment([2011, 0, 28]).format('DDDo'), '28e', '28e'); + assert.equal(moment([2011, 0, 29]).format('DDDo'), '29e', '29e'); + assert.equal(moment([2011, 0, 30]).format('DDDo'), '30e', '30e'); + + assert.equal(moment([2011, 0, 31]).format('DDDo'), '31e', '31e'); + + assert.equal(moment([2017, 0, 1]).format('do'), '0e', '0e'); + assert.equal(moment([2017, 0, 2]).format('do'), '1er', '1er'); + + assert.equal(moment([2017, 0, 4]).format('wo Wo'), '1re 1re', '1re 1re'); + assert.equal(moment([2017, 0, 11]).format('wo Wo'), '2e 2e', '2e 2e'); }); test('format month', function (assert) { - var expected = 'jannewaris jan._febrewaris feb._maart mrt._april apr._maaie mai_juny jun._july jul._augustus aug._septimber sep._oktober okt._novimber nov._desimber des.'.split('_'), i; + var i, + expected = 'janvier janv._février févr._mars mars_avril avr._mai mai_juin juin_juillet juil._août août_septembre sept._octobre oct._novembre nov._décembre déc.'.split('_'); + for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); test('format week', function (assert) { - var expected = 'snein si. Si_moandei mo. Mo_tiisdei ti. Ti_woansdei wo. Wo_tongersdei to. To_freed fr. Fr_sneon so. So'.split('_'), i; + var i, + expected = 'dimanche dim. di_lundi lun. lu_mardi mar. ma_mercredi mer. me_jeudi jeu. je_vendredi ven. ve_samedi sam. sa'.split('_'); + for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); } @@ -22246,110 +23213,104 @@ test('from', function (assert) { var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'in pear sekonden', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ien minút', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ien minút', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuten', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuten', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ien oere', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ien oere', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 oeren', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 oeren', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 oeren', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ien dei', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ien dei', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dagen', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ien dei', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dagen', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dagen', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ien moanne', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ien moanne', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ien moanne', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 moannen', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 moannen', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 moannen', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ien moanne', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 moannen', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ien jier', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 jierren', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ien jier', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 jierren', '5 years = 5 years'); - }); - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'oer in pear sekonden', 'prefix'); - assert.equal(moment(0).from(30000), 'in pear sekonden lyn', 'suffix'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'quelques secondes', '44 seconds = a few seconds'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'une minute', '45 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'une minute', '89 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutes', '90 seconds = 2 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutes', '44 minutes = 44 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'une heure', '45 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'une heure', '89 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 heures', '90 minutes = 2 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 heures', '5 hours = 5 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 heures', '21 hours = 21 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'un jour', '22 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'un jour', '35 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 jours', '36 hours = 2 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'un jour', '1 day = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 jours', '5 days = 5 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 jours', '25 days = 25 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'un mois', '26 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'un mois', '30 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'un mois', '43 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mois', '46 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mois', '75 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mois', '76 days = 3 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'un mois', '1 month = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mois', '5 months = 5 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'un an', '345 days = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 ans', '548 days = 2 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'un an', '1 year = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 ans', '5 years = 5 years'); }); - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'in pear sekonden lyn', 'now from now should display as in the past'); + test('suffix', function (assert) { + assert.equal(moment(30000).from(0), 'dans quelques secondes', 'prefix'); + assert.equal(moment(0).from(30000), 'il y a quelques secondes', 'suffix'); }); test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'oer in pear sekonden', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'oer 5 dagen', 'in 5 days'); + assert.equal(moment().add({s: 30}).fromNow(), 'dans quelques secondes', 'in a few seconds'); + assert.equal(moment().add({d: 5}).fromNow(), 'dans 5 jours', 'in 5 days'); }); - test('calendar day', function (assert) { + test('same day', function (assert) { var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'hjoed om 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'hjoed om 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'hjoed om 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'moarn om 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'hjoed om 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'juster om 12:00', 'yesterday at the same time'); + assert.equal(moment(a).calendar(), 'Aujourd’hui à 12:00', 'Today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'Aujourd’hui à 12:25', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'Aujourd’hui à 13:00', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'Demain à 12:00', 'Tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'Aujourd’hui à 11:00', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'Hier à 12:00', 'Yesterday at the same time'); }); - test('calendar next week', function (assert) { + test('same next week', function (assert) { var i, m; + for (i = 2; i < 7; i++) { m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [om] LT'), 'Today + ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('dddd [à] LT'), 'Today + ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [om] LT'), 'Today + ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('dddd [à] LT'), 'Today + ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [om] LT'), 'Today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('dddd [à] LT'), 'Today + ' + i + ' days end of day'); } }); - test('calendar last week', function (assert) { + test('same last week', function (assert) { var i, m; + for (i = 2; i < 7; i++) { m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[ôfrûne] dddd [om] LT'), 'Today - ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('dddd [dernier à] LT'), 'Today - ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[ôfrûne] dddd [om] LT'), 'Today - ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('dddd [dernier à] LT'), 'Today - ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[ôfrûne] dddd [om] LT'), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('dddd [dernier à] LT'), 'Today - ' + i + ' days end of day'); } }); - test('calendar all else', function (assert) { + test('same all else', function (assert) { var weeksAgo = moment().subtract({w: 1}), weeksFromNow = moment().add({w: 1}); - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); weeksAgo = moment().subtract({w: 2}); weeksFromNow = moment().add({w: 2}); - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('month abbreviation', function (assert) { - assert.equal(moment([2012, 5, 23]).format('D-MMM-YYYY'), '23-jun-2012', 'format month abbreviation surrounded by dashes should not include a dot'); - assert.equal(moment([2012, 5, 23]).format('D MMM YYYY'), '23 jun. 2012', 'format month abbreviation not surrounded by dashes should include a dot'); + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); }); test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52ste', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1ste', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1ste', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2de', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2de', 'Jan 15 2012 should be week 2'); + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52e', 'Jan 1 2012 should be week 52'); + assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1re', 'Jan 2 2012 should be week 1'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1re', 'Jan 8 2012 should be week 1'); + assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2e', 'Jan 9 2012 should be week 2'); + assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2e', 'Jan 15 2012 should be week 2'); }); }))); @@ -22547,11 +23508,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -22590,6 +23552,1027 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); + } + + /*global QUnit:false*/ + + function localeModule (name, lifecycle) { + QUnit.module('locale:' + name, { + beforeEach : function () { + moment.locale(name); + moment.createFromInputFallback = function (config) { + throw new Error('input not handled by moment: ' + config._i); + }; + setupDeprecationHandler(test, moment, 'locale'); + if (lifecycle && lifecycle.setup) { + lifecycle.setup(); + } + }, + afterEach : function () { + moment.locale('en'); + teardownDeprecationHandler(test, moment, 'locale'); + if (lifecycle && lifecycle.teardown) { + lifecycle.teardown(); + } + } + }); + defineCommonLocaleTests(name, -1, -1); + } + + localeModule('fy'); + + test('parse', function (assert) { + var tests = 'jannewaris jan._febrewaris feb._maart mrt._april apr._maaie mai._juny jun._july jul._augustus aug._septimber sep._oktober okt._novimber nov._desimber des.'.split('_'), i; + function equalTest(input, mmm, i) { + assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); + } + for (i = 0; i < 12; i++) { + tests[i] = tests[i].split(' '); + equalTest(tests[i][0], 'MMM', i); + equalTest(tests[i][1], 'MMM', i); + equalTest(tests[i][0], 'MMMM', i); + equalTest(tests[i][1], 'MMMM', i); + equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); + equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); + equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); + equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); + } + }); + + test('format', function (assert) { + var a = [ + ['dddd, MMMM Do YYYY, HH:mm:ss', 'snein, febrewaris 14de 2010, 15:25:50'], + ['ddd, HH', 'si., 15'], + ['M Mo MM MMMM MMM', '2 2de 02 febrewaris feb.'], + ['YYYY YY', '2010 10'], + ['D Do DD', '14 14de 14'], + ['d do dddd ddd dd', '0 0de snein si. Si'], + ['DDD DDDo DDDD', '45 45ste 045'], + ['w wo ww', '6 6de 06'], + ['h hh', '3 03'], + ['H HH', '15 15'], + ['m mm', '25 25'], + ['s ss', '50 50'], + ['a A', 'pm PM'], + ['[the] DDDo [day of the year]', 'the 45ste day of the year'], + ['LTS', '15:25:50'], + ['L', '14-02-2010'], + ['LL', '14 febrewaris 2010'], + ['LLL', '14 febrewaris 2010 15:25'], + ['LLLL', 'snein 14 febrewaris 2010 15:25'], + ['l', '14-2-2010'], + ['ll', '14 feb. 2010'], + ['lll', '14 feb. 2010 15:25'], + ['llll', 'si. 14 feb. 2010 15:25'] + ], + b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), + i; + for (i = 0; i < a.length; i++) { + assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); + } + }); + + test('format ordinal', function (assert) { + assert.equal(moment([2011, 0, 1]).format('DDDo'), '1ste', '1ste'); + assert.equal(moment([2011, 0, 2]).format('DDDo'), '2de', '2de'); + assert.equal(moment([2011, 0, 3]).format('DDDo'), '3de', '3de'); + assert.equal(moment([2011, 0, 4]).format('DDDo'), '4de', '4de'); + assert.equal(moment([2011, 0, 5]).format('DDDo'), '5de', '5de'); + assert.equal(moment([2011, 0, 6]).format('DDDo'), '6de', '6de'); + assert.equal(moment([2011, 0, 7]).format('DDDo'), '7de', '7de'); + assert.equal(moment([2011, 0, 8]).format('DDDo'), '8ste', '8ste'); + assert.equal(moment([2011, 0, 9]).format('DDDo'), '9de', '9de'); + assert.equal(moment([2011, 0, 10]).format('DDDo'), '10de', '10de'); + + assert.equal(moment([2011, 0, 11]).format('DDDo'), '11de', '11de'); + assert.equal(moment([2011, 0, 12]).format('DDDo'), '12de', '12de'); + assert.equal(moment([2011, 0, 13]).format('DDDo'), '13de', '13de'); + assert.equal(moment([2011, 0, 14]).format('DDDo'), '14de', '14de'); + assert.equal(moment([2011, 0, 15]).format('DDDo'), '15de', '15de'); + assert.equal(moment([2011, 0, 16]).format('DDDo'), '16de', '16de'); + assert.equal(moment([2011, 0, 17]).format('DDDo'), '17de', '17de'); + assert.equal(moment([2011, 0, 18]).format('DDDo'), '18de', '18de'); + assert.equal(moment([2011, 0, 19]).format('DDDo'), '19de', '19de'); + assert.equal(moment([2011, 0, 20]).format('DDDo'), '20ste', '20ste'); + + assert.equal(moment([2011, 0, 21]).format('DDDo'), '21ste', '21ste'); + assert.equal(moment([2011, 0, 22]).format('DDDo'), '22ste', '22ste'); + assert.equal(moment([2011, 0, 23]).format('DDDo'), '23ste', '23ste'); + assert.equal(moment([2011, 0, 24]).format('DDDo'), '24ste', '24ste'); + assert.equal(moment([2011, 0, 25]).format('DDDo'), '25ste', '25ste'); + assert.equal(moment([2011, 0, 26]).format('DDDo'), '26ste', '26ste'); + assert.equal(moment([2011, 0, 27]).format('DDDo'), '27ste', '27ste'); + assert.equal(moment([2011, 0, 28]).format('DDDo'), '28ste', '28ste'); + assert.equal(moment([2011, 0, 29]).format('DDDo'), '29ste', '29ste'); + assert.equal(moment([2011, 0, 30]).format('DDDo'), '30ste', '30ste'); + + assert.equal(moment([2011, 0, 31]).format('DDDo'), '31ste', '31ste'); + }); + + test('format month', function (assert) { + var expected = 'jannewaris jan._febrewaris feb._maart mrt._april apr._maaie mai_juny jun._july jul._augustus aug._septimber sep._oktober okt._novimber nov._desimber des.'.split('_'), i; + for (i = 0; i < expected.length; i++) { + assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); + } + }); + + test('format week', function (assert) { + var expected = 'snein si. Si_moandei mo. Mo_tiisdei ti. Ti_woansdei wo. Wo_tongersdei to. To_freed fr. Fr_sneon so. So'.split('_'), i; + for (i = 0; i < expected.length; i++) { + assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); + } + }); + + test('from', function (assert) { + var start = moment([2007, 1, 28]); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'in pear sekonden', '44 seconds = a few seconds'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ien minút', '45 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ien minút', '89 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuten', '90 seconds = 2 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuten', '44 minutes = 44 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ien oere', '45 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ien oere', '89 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 oeren', '90 minutes = 2 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 oeren', '5 hours = 5 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 oeren', '21 hours = 21 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ien dei', '22 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ien dei', '35 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dagen', '36 hours = 2 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ien dei', '1 day = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dagen', '5 days = 5 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dagen', '25 days = 25 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ien moanne', '26 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ien moanne', '30 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ien moanne', '43 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 moannen', '46 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 moannen', '75 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 moannen', '76 days = 3 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ien moanne', '1 month = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 moannen', '5 months = 5 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ien jier', '345 days = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 jierren', '548 days = 2 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ien jier', '1 year = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 jierren', '5 years = 5 years'); + }); + + test('suffix', function (assert) { + assert.equal(moment(30000).from(0), 'oer in pear sekonden', 'prefix'); + assert.equal(moment(0).from(30000), 'in pear sekonden lyn', 'suffix'); + }); + + test('now from now', function (assert) { + assert.equal(moment().fromNow(), 'in pear sekonden lyn', 'now from now should display as in the past'); + }); + + test('fromNow', function (assert) { + assert.equal(moment().add({s: 30}).fromNow(), 'oer in pear sekonden', 'in a few seconds'); + assert.equal(moment().add({d: 5}).fromNow(), 'oer 5 dagen', 'in 5 days'); + }); + + test('calendar day', function (assert) { + var a = moment().hours(12).minutes(0).seconds(0); + + assert.equal(moment(a).calendar(), 'hjoed om 12:00', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'hjoed om 12:25', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'hjoed om 13:00', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'moarn om 12:00', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'hjoed om 11:00', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'juster om 12:00', 'yesterday at the same time'); + }); + + test('calendar next week', function (assert) { + var i, m; + for (i = 2; i < 7; i++) { + m = moment().add({d: i}); + assert.equal(m.calendar(), m.format('dddd [om] LT'), 'Today + ' + i + ' days current time'); + m.hours(0).minutes(0).seconds(0).milliseconds(0); + assert.equal(m.calendar(), m.format('dddd [om] LT'), 'Today + ' + i + ' days beginning of day'); + m.hours(23).minutes(59).seconds(59).milliseconds(999); + assert.equal(m.calendar(), m.format('dddd [om] LT'), 'Today + ' + i + ' days end of day'); + } + }); + + test('calendar last week', function (assert) { + var i, m; + for (i = 2; i < 7; i++) { + m = moment().subtract({d: i}); + assert.equal(m.calendar(), m.format('[ôfrûne] dddd [om] LT'), 'Today - ' + i + ' days current time'); + m.hours(0).minutes(0).seconds(0).milliseconds(0); + assert.equal(m.calendar(), m.format('[ôfrûne] dddd [om] LT'), 'Today - ' + i + ' days beginning of day'); + m.hours(23).minutes(59).seconds(59).milliseconds(999); + assert.equal(m.calendar(), m.format('[ôfrûne] dddd [om] LT'), 'Today - ' + i + ' days end of day'); + } + }); + + test('calendar all else', function (assert) { + var weeksAgo = moment().subtract({w: 1}), + weeksFromNow = moment().add({w: 1}); + + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); + + weeksAgo = moment().subtract({w: 2}); + weeksFromNow = moment().add({w: 2}); + + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); + }); + + test('month abbreviation', function (assert) { + assert.equal(moment([2012, 5, 23]).format('D-MMM-YYYY'), '23-jun-2012', 'format month abbreviation surrounded by dashes should not include a dot'); + assert.equal(moment([2012, 5, 23]).format('D MMM YYYY'), '23 jun. 2012', 'format month abbreviation not surrounded by dashes should include a dot'); + }); + + test('weeks year starting sunday formatted', function (assert) { + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52ste', 'Jan 1 2012 should be week 52'); + assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1ste', 'Jan 2 2012 should be week 1'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1ste', 'Jan 8 2012 should be week 1'); + assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2de', 'Jan 9 2012 should be week 2'); + assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2de', 'Jan 15 2012 should be week 2'); + }); + +}))); + + +;(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' + && typeof require === 'function' ? factory(require('../../moment')) : + typeof define === 'function' && define.amd ? define(['../../moment'], factory) : + factory(global.moment) +}(this, (function (moment) { 'use strict'; + + function each(array, callback) { + var i; + for (i = 0; i < array.length; i++) { + callback(array[i], i, array); + } + } + + function setupDeprecationHandler(test, moment$$1, scope) { + test._expectedDeprecations = null; + test._observedDeprecations = null; + test._oldSupress = moment$$1.suppressDeprecationWarnings; + moment$$1.suppressDeprecationWarnings = true; + test.expectedDeprecations = function () { + test._expectedDeprecations = arguments; + test._observedDeprecations = []; + }; + moment$$1.deprecationHandler = function (name, msg) { + var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); + if (deprecationId === -1) { + throw new Error('Unexpected deprecation thrown name=' + + name + ' msg=' + msg); + } + test._observedDeprecations[deprecationId] = 1; + }; + } + + function teardownDeprecationHandler(test, moment$$1, scope) { + moment$$1.suppressDeprecationWarnings = test._oldSupress; + + if (test._expectedDeprecations != null) { + var missedDeprecations = []; + each(test._expectedDeprecations, function (deprecationPattern, id) { + if (test._observedDeprecations[id] !== 1) { + missedDeprecations.push(deprecationPattern); + } + }); + if (missedDeprecations.length !== 0) { + throw new Error('Expected deprecation warnings did not happen: ' + + missedDeprecations.join(' ')); + } + } + } + + function matchedDeprecation(name, msg, deprecations) { + if (deprecations == null) { + return -1; + } + for (var i = 0; i < deprecations.length; ++i) { + if (name != null && name === deprecations[i]) { + return i; + } + if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { + return i; + } + } + return -1; + } + + /*global QUnit:false*/ + + var test = QUnit.test; + + function objectKeys(obj) { + if (Object.keys) { + return Object.keys(obj); + } else { + // IE8 + var res = [], i; + for (i in obj) { + if (obj.hasOwnProperty(i)) { + res.push(i); + } + } + return res; + } + } + + // Pick the first defined of two or three arguments. + + function defineCommonLocaleTests(locale, options) { + test('lenient day of month ordinal parsing', function (assert) { + var i, ordinalStr, testMoment; + for (i = 1; i <= 31; ++i) { + ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); + testMoment = moment(ordinalStr, 'YYYY MM Do'); + assert.equal(testMoment.year(), 2014, + 'lenient day of month ordinal parsing ' + i + ' year check'); + assert.equal(testMoment.month(), 0, + 'lenient day of month ordinal parsing ' + i + ' month check'); + assert.equal(testMoment.date(), i, + 'lenient day of month ordinal parsing ' + i + ' date check'); + } + }); + + test('lenient day of month ordinal parsing of number', function (assert) { + var i, testMoment; + for (i = 1; i <= 31; ++i) { + testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); + assert.equal(testMoment.year(), 2014, + 'lenient day of month ordinal parsing of number ' + i + ' year check'); + assert.equal(testMoment.month(), 0, + 'lenient day of month ordinal parsing of number ' + i + ' month check'); + assert.equal(testMoment.date(), i, + 'lenient day of month ordinal parsing of number ' + i + ' date check'); + } + }); + + test('strict day of month ordinal parsing', function (assert) { + var i, ordinalStr, testMoment; + for (i = 1; i <= 31; ++i) { + ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); + testMoment = moment(ordinalStr, 'YYYY MM Do', true); + assert.ok(testMoment.isValid(), 'strict day of month ordinal parsing ' + i); + } + }); + + test('meridiem invariant', function (assert) { + var h, m, t1, t2; + for (h = 0; h < 24; ++h) { + for (m = 0; m < 60; m += 15) { + t1 = moment.utc([2000, 0, 1, h, m]); + t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); + assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), + 'meridiem at ' + t1.format('HH:mm')); + } + } + }); + + test('date format correctness', function (assert) { + var data, tokens; + data = moment.localeData()._longDateFormat; + tokens = objectKeys(data); + each(tokens, function (srchToken) { + // Check each format string to make sure it does not contain any + // tokens that need to be expanded. + each(tokens, function (baseToken) { + // strip escaped sequences + var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); + assert.equal(false, !!~format.indexOf(srchToken), + 'contains ' + srchToken + ' in ' + baseToken); + }); + }); + }); + + test('month parsing correctness', function (assert) { + var i, m; + + if (locale === 'tr') { + // I can't fix it :( + assert.expect(0); + return; + } + function tester(format) { + var r; + r = moment(m.format(format), format); + assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); + if (locale !== 'ka') { + r = moment(m.format(format).toLocaleUpperCase(), format); + assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); + } + r = moment(m.format(format).toLocaleLowerCase(), format); + assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); + + r = moment(m.format(format), format, true); + assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); + if (locale !== 'ka') { + r = moment(m.format(format).toLocaleUpperCase(), format, true); + assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); + } + r = moment(m.format(format).toLocaleLowerCase(), format, true); + assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); + } + + for (i = 0; i < 12; ++i) { + m = moment([2015, i, 15, 18]); + tester('MMM'); + tester('MMM.'); + tester('MMMM'); + tester('MMMM.'); + } + }); + + test('weekday parsing correctness', function (assert) { + var i, m; + + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { + // tr, az: There is a lower-case letter (ı), that converted to + // upper then lower changes to i + // ro: there is the letter ț which behaves weird under IE8 + // mt: letter Ħ + // ga: month with spaces + assert.expect(0); + return; + } + function tester(format) { + var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format + ' ' + m.toISOString(); + r = moment(m.format(format), format); + assert.equal(r.weekday(), m.weekday(), baseMsg); + if (locale !== 'ka') { + r = moment(m.format(format).toLocaleUpperCase(), format); + assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); + } + r = moment(m.format(format).toLocaleLowerCase(), format); + assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); + r = moment(m.format(format), format, true); + assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); + if (locale !== 'ka') { + r = moment(m.format(format).toLocaleUpperCase(), format, true); + assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); + } + r = moment(m.format(format).toLocaleLowerCase(), format, true); + assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); + } + + for (i = 0; i < 7; ++i) { + m = moment.utc([2015, 0, i + 1, 18]); + tester('dd'); + tester('ddd'); + tester('dddd'); + } + }); + + test('valid localeData', function (assert) { + assert.equal(moment().localeData().months().length, 12, 'months should return 12 months'); + assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months'); + assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days'); + assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); + assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); + }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); + } + + /*global QUnit:false*/ + + function localeModule (name, lifecycle) { + QUnit.module('locale:' + name, { + beforeEach : function () { + moment.locale(name); + moment.createFromInputFallback = function (config) { + throw new Error('input not handled by moment: ' + config._i); + }; + setupDeprecationHandler(test, moment, 'locale'); + if (lifecycle && lifecycle.setup) { + lifecycle.setup(); + } + }, + afterEach : function () { + moment.locale('en'); + teardownDeprecationHandler(test, moment, 'locale'); + if (lifecycle && lifecycle.teardown) { + lifecycle.teardown(); + } + } + }); + defineCommonLocaleTests(name, -1, -1); + } + + localeModule('ga'); + + var months = [ + 'Eanáir,Eaná', + 'Feabhra,Feab', + 'Márta,Márt', + 'Aibreán,Aibr', + 'Bealtaine,Beal', + 'Méitheamh,Méit', + 'Iúil,Iúil', + 'Lúnasa,Lúna', + 'Meán Fómhair,Meán', + 'Deaireadh Fómhair,Deai', + 'Samhain,Samh', + 'Nollaig,Noll' + ]; + + test('parse', function (assert) { + function equalTest(monthName, monthFormat, monthNum) { + assert.equal(moment(monthName, monthFormat).month(), monthNum, monthName + ' should be month ' + (monthNum + 1)); + } + + for (var i = 0; i < 12; i++) { + var testMonth = months[i].split(','); + equalTest(testMonth[0], 'MMM', i); + equalTest(testMonth[1], 'MMM', i); + equalTest(testMonth[0], 'MMMM', i); + equalTest(testMonth[1], 'MMMM', i); + equalTest(testMonth[0].toLocaleLowerCase(), 'MMMM', i); + equalTest(testMonth[1].toLocaleLowerCase(), 'MMMM', i); + equalTest(testMonth[0].toLocaleUpperCase(), 'MMMM', i); + equalTest(testMonth[1].toLocaleUpperCase(), 'MMMM', i); + } + }); + + test('format', function (assert) { + var a = [ + ['dddd, MMMM Do YYYY, h:mm:ss a', 'Dé Domhnaigh, Feabhra 14mh 2010, 3:25:50 pm'], + ['ddd, hA', 'Dom, 3PM'], + ['M Mo MM MMMM MMM', '2 2na 02 Feabhra Feab'], + ['YYYY YY', '2010 10'], + ['D Do DD', '14 14mh 14'], + ['d do dddd ddd dd', '0 0mh Dé Domhnaigh Dom Do'], + ['DDD DDDo DDDD', '45 45mh 045'], + ['w wo ww', '6 6mh 06'], + ['h hh', '3 03'], + ['H HH', '15 15'], + ['m mm', '25 25'], + ['s ss', '50 50'], + ['a A', 'pm PM'], + ['[an] DDDo [latha den bhliadhna]', 'an 45mh latha den bhliadhna'], + ['LTS', '15:25:50'], + ['L', '14/02/2010'], + ['LL', '14 Feabhra 2010'], + ['LLL', '14 Feabhra 2010 15:25'], + ['LLLL', 'Dé Domhnaigh, 14 Feabhra 2010 15:25'], + ['l', '14/2/2010'], + ['ll', '14 Feab 2010'], + ['lll', '14 Feab 2010 15:25'], + ['llll', 'Dom, 14 Feab 2010 15:25'] + ], + b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), + i; + for (i = 0; i < a.length; i++) { + assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); + } + }); + + test('format ordinal', function (assert) { + assert.equal(moment([2011, 0, 1]).format('DDDo'), '1d', '1d'); + assert.equal(moment([2011, 0, 2]).format('DDDo'), '2na', '2na'); + assert.equal(moment([2011, 0, 3]).format('DDDo'), '3mh', '3mh'); + assert.equal(moment([2011, 0, 4]).format('DDDo'), '4mh', '4mh'); + assert.equal(moment([2011, 0, 5]).format('DDDo'), '5mh', '5mh'); + assert.equal(moment([2011, 0, 6]).format('DDDo'), '6mh', '6mh'); + assert.equal(moment([2011, 0, 7]).format('DDDo'), '7mh', '7mh'); + assert.equal(moment([2011, 0, 8]).format('DDDo'), '8mh', '8mh'); + assert.equal(moment([2011, 0, 9]).format('DDDo'), '9mh', '9mh'); + assert.equal(moment([2011, 0, 10]).format('DDDo'), '10mh', '10mh'); + assert.equal(moment([2011, 0, 11]).format('DDDo'), '11mh', '11mh'); + assert.equal(moment([2011, 0, 12]).format('DDDo'), '12na', '12na'); + assert.equal(moment([2011, 0, 13]).format('DDDo'), '13mh', '13mh'); + assert.equal(moment([2011, 0, 14]).format('DDDo'), '14mh', '14mh'); + assert.equal(moment([2011, 0, 15]).format('DDDo'), '15mh', '15mh'); + assert.equal(moment([2011, 0, 16]).format('DDDo'), '16mh', '16mh'); + assert.equal(moment([2011, 0, 17]).format('DDDo'), '17mh', '17mh'); + assert.equal(moment([2011, 0, 18]).format('DDDo'), '18mh', '18mh'); + assert.equal(moment([2011, 0, 19]).format('DDDo'), '19mh', '19mh'); + assert.equal(moment([2011, 0, 20]).format('DDDo'), '20mh', '20mh'); + assert.equal(moment([2011, 0, 21]).format('DDDo'), '21mh', '21mh'); + assert.equal(moment([2011, 0, 22]).format('DDDo'), '22na', '22na'); + assert.equal(moment([2011, 0, 23]).format('DDDo'), '23mh', '23mh'); + assert.equal(moment([2011, 0, 24]).format('DDDo'), '24mh', '24mh'); + assert.equal(moment([2011, 0, 25]).format('DDDo'), '25mh', '25mh'); + assert.equal(moment([2011, 0, 26]).format('DDDo'), '26mh', '26mh'); + assert.equal(moment([2011, 0, 27]).format('DDDo'), '27mh', '27mh'); + assert.equal(moment([2011, 0, 28]).format('DDDo'), '28mh', '28mh'); + assert.equal(moment([2011, 0, 29]).format('DDDo'), '29mh', '29mh'); + assert.equal(moment([2011, 0, 30]).format('DDDo'), '30mh', '30mh'); + assert.equal(moment([2011, 0, 31]).format('DDDo'), '31mh', '31mh'); + }); + + test('format month', function (assert) { + var expected = months; + for (var i = 0; i < expected.length; i++) { + assert.equal(moment([2011, i, 1]).format('MMMM,MMM'), expected[i], expected[i]); + } + }); + + test('format week', function (assert) { + var expected = ['Dé Domhnaigh Dom Do', 'Dé Luain Lua Lu', 'Dé Máirt Mái Má', 'Dé Céadaoin Céa Ce', 'Déardaoin Déa Dé', 'Dé hAoine hAo hA', 'Dé Satharn Sat Sa']; + for (var i = 0; i < expected.length; i++) { + assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); + } + }); + + test('from', function (assert) { + var start = moment([2007, 1, 28]); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'cúpla soicind', '44 seconds = a few seconds'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'nóiméad', '45 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'nóiméad', '89 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 nóiméad', '90 seconds = 2 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 nóiméad', '44 minutes = 44 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'uair an chloig', '45 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'uair an chloig', '89 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 uair an chloig', '90 minutes = 2 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 uair an chloig', '5 hours = 5 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 uair an chloig', '21 hours = 21 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'lá', '22 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'lá', '35 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 lá', '36 hours = 2 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'lá', '1 day = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 lá', '5 days = 5 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 lá', '25 days = 25 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mí', '26 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mí', '30 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mí', '43 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mí', '46 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mí', '75 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mí', '76 days = 3 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mí', '1 month = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mí', '5 months = 5 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'bliain', '345 days = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 bliain', '548 days = 2 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'bliain', '1 year = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 bliain', '5 years = 5 years'); + }); + + test('suffix', function (assert) { + assert.equal(moment(30000).from(0), 'i cúpla soicind', 'prefix'); + assert.equal(moment(0).from(30000), 'cúpla soicind ó shin', 'suffix'); + }); + + test('now from now', function (assert) { + assert.equal(moment().fromNow(), 'cúpla soicind ó shin', 'now from now should display as in the past'); + }); + + test('fromNow', function (assert) { + assert.equal(moment().add({s: 30}).fromNow(), 'i cúpla soicind', 'in a few seconds'); + assert.equal(moment().add({d: 5}).fromNow(), 'i 5 lá', 'in 5 days'); + }); + + test('calendar day', function (assert) { + var a = moment().hours(12).minutes(0).seconds(0); + + assert.equal(moment(a).calendar(), 'Inniu ag 12:00', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'Inniu ag 12:25', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'Inniu ag 13:00', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'Amárach ag 12:00', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'Inniu ag 11:00', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'Inné aig 12:00', 'yesterday at the same time'); + }); + + test('calendar next week', function (assert) { + var i, m; + for (i = 2; i < 7; i++) { + m = moment().add({d: i}); + assert.equal(m.calendar(), m.format('dddd [ag] LT'), 'Today + ' + i + ' days current time'); + m.hours(0).minutes(0).seconds(0).milliseconds(0); + assert.equal(m.calendar(), m.format('dddd [ag] LT'), 'Today + ' + i + ' days beginning of day'); + m.hours(23).minutes(59).seconds(59).milliseconds(999); + assert.equal(m.calendar(), m.format('dddd [ag] LT'), 'Today + ' + i + ' days end of day'); + } + }); + + test('calendar last week', function (assert) { + var i, m; + + for (i = 2; i < 7; i++) { + m = moment().subtract({d: i}); + assert.equal(m.calendar(), m.format('dddd [seo caite] [ag] LT'), 'Today - ' + i + ' days current time'); + m.hours(0).minutes(0).seconds(0).milliseconds(0); + assert.equal(m.calendar(), m.format('dddd [seo caite] [ag] LT'), 'Today - ' + i + ' days beginning of day'); + m.hours(23).minutes(59).seconds(59).milliseconds(999); + assert.equal(m.calendar(), m.format('dddd [seo caite] [ag] LT'), 'Today - ' + i + ' days end of day'); + } + }); + + test('calendar all else', function (assert) { + var weeksAgo = moment().subtract({w: 1}), + weeksFromNow = moment().add({w: 1}); + + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); + + weeksAgo = moment().subtract({w: 2}); + weeksFromNow = moment().add({w: 2}); + + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); + }); + + test('weeks year starting sunday formatted', function (assert) { + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52na', 'Eaná 1 2012 should be week 52'); + assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1d', 'Eaná 2 2012 should be week 1'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1d', 'Eaná 8 2012 should be week 1'); + assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2na', 'Eaná 9 2012 should be week 2'); + assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2na', 'Eaná 15 2012 should be week 2'); + }); + +}))); + + +;(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' + && typeof require === 'function' ? factory(require('../../moment')) : + typeof define === 'function' && define.amd ? define(['../../moment'], factory) : + factory(global.moment) +}(this, (function (moment) { 'use strict'; + + function each(array, callback) { + var i; + for (i = 0; i < array.length; i++) { + callback(array[i], i, array); + } + } + + function setupDeprecationHandler(test, moment$$1, scope) { + test._expectedDeprecations = null; + test._observedDeprecations = null; + test._oldSupress = moment$$1.suppressDeprecationWarnings; + moment$$1.suppressDeprecationWarnings = true; + test.expectedDeprecations = function () { + test._expectedDeprecations = arguments; + test._observedDeprecations = []; + }; + moment$$1.deprecationHandler = function (name, msg) { + var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); + if (deprecationId === -1) { + throw new Error('Unexpected deprecation thrown name=' + + name + ' msg=' + msg); + } + test._observedDeprecations[deprecationId] = 1; + }; + } + + function teardownDeprecationHandler(test, moment$$1, scope) { + moment$$1.suppressDeprecationWarnings = test._oldSupress; + + if (test._expectedDeprecations != null) { + var missedDeprecations = []; + each(test._expectedDeprecations, function (deprecationPattern, id) { + if (test._observedDeprecations[id] !== 1) { + missedDeprecations.push(deprecationPattern); + } + }); + if (missedDeprecations.length !== 0) { + throw new Error('Expected deprecation warnings did not happen: ' + + missedDeprecations.join(' ')); + } + } + } + + function matchedDeprecation(name, msg, deprecations) { + if (deprecations == null) { + return -1; + } + for (var i = 0; i < deprecations.length; ++i) { + if (name != null && name === deprecations[i]) { + return i; + } + if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { + return i; + } + } + return -1; + } + + /*global QUnit:false*/ + + var test = QUnit.test; + + function objectKeys(obj) { + if (Object.keys) { + return Object.keys(obj); + } else { + // IE8 + var res = [], i; + for (i in obj) { + if (obj.hasOwnProperty(i)) { + res.push(i); + } + } + return res; + } + } + + // Pick the first defined of two or three arguments. + + function defineCommonLocaleTests(locale, options) { + test('lenient day of month ordinal parsing', function (assert) { + var i, ordinalStr, testMoment; + for (i = 1; i <= 31; ++i) { + ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); + testMoment = moment(ordinalStr, 'YYYY MM Do'); + assert.equal(testMoment.year(), 2014, + 'lenient day of month ordinal parsing ' + i + ' year check'); + assert.equal(testMoment.month(), 0, + 'lenient day of month ordinal parsing ' + i + ' month check'); + assert.equal(testMoment.date(), i, + 'lenient day of month ordinal parsing ' + i + ' date check'); + } + }); + + test('lenient day of month ordinal parsing of number', function (assert) { + var i, testMoment; + for (i = 1; i <= 31; ++i) { + testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); + assert.equal(testMoment.year(), 2014, + 'lenient day of month ordinal parsing of number ' + i + ' year check'); + assert.equal(testMoment.month(), 0, + 'lenient day of month ordinal parsing of number ' + i + ' month check'); + assert.equal(testMoment.date(), i, + 'lenient day of month ordinal parsing of number ' + i + ' date check'); + } + }); + + test('strict day of month ordinal parsing', function (assert) { + var i, ordinalStr, testMoment; + for (i = 1; i <= 31; ++i) { + ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); + testMoment = moment(ordinalStr, 'YYYY MM Do', true); + assert.ok(testMoment.isValid(), 'strict day of month ordinal parsing ' + i); + } + }); + + test('meridiem invariant', function (assert) { + var h, m, t1, t2; + for (h = 0; h < 24; ++h) { + for (m = 0; m < 60; m += 15) { + t1 = moment.utc([2000, 0, 1, h, m]); + t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); + assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), + 'meridiem at ' + t1.format('HH:mm')); + } + } + }); + + test('date format correctness', function (assert) { + var data, tokens; + data = moment.localeData()._longDateFormat; + tokens = objectKeys(data); + each(tokens, function (srchToken) { + // Check each format string to make sure it does not contain any + // tokens that need to be expanded. + each(tokens, function (baseToken) { + // strip escaped sequences + var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); + assert.equal(false, !!~format.indexOf(srchToken), + 'contains ' + srchToken + ' in ' + baseToken); + }); + }); + }); + + test('month parsing correctness', function (assert) { + var i, m; + + if (locale === 'tr') { + // I can't fix it :( + assert.expect(0); + return; + } + function tester(format) { + var r; + r = moment(m.format(format), format); + assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); + if (locale !== 'ka') { + r = moment(m.format(format).toLocaleUpperCase(), format); + assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); + } + r = moment(m.format(format).toLocaleLowerCase(), format); + assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); + + r = moment(m.format(format), format, true); + assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); + if (locale !== 'ka') { + r = moment(m.format(format).toLocaleUpperCase(), format, true); + assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); + } + r = moment(m.format(format).toLocaleLowerCase(), format, true); + assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); + } + + for (i = 0; i < 12; ++i) { + m = moment([2015, i, 15, 18]); + tester('MMM'); + tester('MMM.'); + tester('MMMM'); + tester('MMMM.'); + } + }); + + test('weekday parsing correctness', function (assert) { + var i, m; + + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { + // tr, az: There is a lower-case letter (ı), that converted to + // upper then lower changes to i + // ro: there is the letter ț which behaves weird under IE8 + // mt: letter Ħ + // ga: month with spaces + assert.expect(0); + return; + } + function tester(format) { + var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format + ' ' + m.toISOString(); + r = moment(m.format(format), format); + assert.equal(r.weekday(), m.weekday(), baseMsg); + if (locale !== 'ka') { + r = moment(m.format(format).toLocaleUpperCase(), format); + assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); + } + r = moment(m.format(format).toLocaleLowerCase(), format); + assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); + r = moment(m.format(format), format, true); + assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); + if (locale !== 'ka') { + r = moment(m.format(format).toLocaleUpperCase(), format, true); + assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); + } + r = moment(m.format(format).toLocaleLowerCase(), format, true); + assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); + } + + for (i = 0; i < 7; ++i) { + m = moment.utc([2015, 0, i + 1, 18]); + tester('dd'); + tester('ddd'); + tester('dddd'); + } + }); + + test('valid localeData', function (assert) { + assert.equal(moment().localeData().months().length, 12, 'months should return 12 months'); + assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months'); + assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days'); + assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); + assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); + }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -23032,11 +25015,513 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { + // tr, az: There is a lower-case letter (ı), that converted to + // upper then lower changes to i + // ro: there is the letter ț which behaves weird under IE8 + // mt: letter Ħ + // ga: month with spaces + assert.expect(0); + return; + } + function tester(format) { + var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format + ' ' + m.toISOString(); + r = moment(m.format(format), format); + assert.equal(r.weekday(), m.weekday(), baseMsg); + if (locale !== 'ka') { + r = moment(m.format(format).toLocaleUpperCase(), format); + assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); + } + r = moment(m.format(format).toLocaleLowerCase(), format); + assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); + r = moment(m.format(format), format, true); + assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); + if (locale !== 'ka') { + r = moment(m.format(format).toLocaleUpperCase(), format, true); + assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); + } + r = moment(m.format(format).toLocaleLowerCase(), format, true); + assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); + } + + for (i = 0; i < 7; ++i) { + m = moment.utc([2015, 0, i + 1, 18]); + tester('dd'); + tester('ddd'); + tester('dddd'); + } + }); + + test('valid localeData', function (assert) { + assert.equal(moment().localeData().months().length, 12, 'months should return 12 months'); + assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months'); + assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days'); + assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); + assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); + }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); + } + + /*global QUnit:false*/ + + function localeModule (name, lifecycle) { + QUnit.module('locale:' + name, { + beforeEach : function () { + moment.locale(name); + moment.createFromInputFallback = function (config) { + throw new Error('input not handled by moment: ' + config._i); + }; + setupDeprecationHandler(test, moment, 'locale'); + if (lifecycle && lifecycle.setup) { + lifecycle.setup(); + } + }, + afterEach : function () { + moment.locale('en'); + teardownDeprecationHandler(test, moment, 'locale'); + if (lifecycle && lifecycle.teardown) { + lifecycle.teardown(); + } + } + }); + defineCommonLocaleTests(name, -1, -1); + } + + localeModule('gl'); + + test('parse', function (assert) { + var tests = 'xaneiro xan._febreiro feb._marzo mar._abril abr._maio mai._xuño xuñ._xullo xul._agosto ago._setembro set._outubro out._novembro nov._decembro dec.'.split('_'), i; + function equalTest(input, mmm, i) { + assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); + } + for (i = 0; i < 12; i++) { + tests[i] = tests[i].split(' '); + equalTest(tests[i][0], 'MMM', i); + equalTest(tests[i][1], 'MMM', i); + equalTest(tests[i][0], 'MMMM', i); + equalTest(tests[i][1], 'MMMM', i); + equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); + equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); + equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); + equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); + } + }); + + test('format', function (assert) { + var a = [ + ['dddd, MMMM Do YYYY, h:mm:ss a', 'domingo, febreiro 14º 2010, 3:25:50 pm'], + ['ddd, hA', 'dom., 3PM'], + ['M Mo MM MMMM MMM', '2 2º 02 febreiro feb.'], + ['YYYY YY', '2010 10'], + ['D Do DD', '14 14º 14'], + ['d do dddd ddd dd', '0 0º domingo dom. do'], + ['DDD DDDo DDDD', '45 45º 045'], + ['w wo ww', '6 6º 06'], + ['h hh', '3 03'], + ['H HH', '15 15'], + ['m mm', '25 25'], + ['s ss', '50 50'], + ['a A', 'pm PM'], + ['[the] DDDo [day of the year]', 'the 45º day of the year'], + ['LTS', '15:25:50'], + ['L', '14/02/2010'], + ['LL', '14 de febreiro de 2010'], + ['LLL', '14 de febreiro de 2010 15:25'], + ['LLLL', 'domingo, 14 de febreiro de 2010 15:25'], + ['l', '14/2/2010'], + ['ll', '14 de feb. de 2010'], + ['lll', '14 de feb. de 2010 15:25'], + ['llll', 'dom., 14 de feb. de 2010 15:25'] + ], + b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), + i; + for (i = 0; i < a.length; i++) { + assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); + } + }); + + test('format ordinal', function (assert) { + assert.equal(moment([2011, 0, 1]).format('DDDo'), '1º', '1º'); + assert.equal(moment([2011, 0, 2]).format('DDDo'), '2º', '2º'); + assert.equal(moment([2011, 0, 3]).format('DDDo'), '3º', '3º'); + assert.equal(moment([2011, 0, 4]).format('DDDo'), '4º', '4º'); + assert.equal(moment([2011, 0, 5]).format('DDDo'), '5º', '5º'); + assert.equal(moment([2011, 0, 6]).format('DDDo'), '6º', '6º'); + assert.equal(moment([2011, 0, 7]).format('DDDo'), '7º', '7º'); + assert.equal(moment([2011, 0, 8]).format('DDDo'), '8º', '8º'); + assert.equal(moment([2011, 0, 9]).format('DDDo'), '9º', '9º'); + assert.equal(moment([2011, 0, 10]).format('DDDo'), '10º', '10º'); + + assert.equal(moment([2011, 0, 11]).format('DDDo'), '11º', '11º'); + assert.equal(moment([2011, 0, 12]).format('DDDo'), '12º', '12º'); + assert.equal(moment([2011, 0, 13]).format('DDDo'), '13º', '13º'); + assert.equal(moment([2011, 0, 14]).format('DDDo'), '14º', '14º'); + assert.equal(moment([2011, 0, 15]).format('DDDo'), '15º', '15º'); + assert.equal(moment([2011, 0, 16]).format('DDDo'), '16º', '16º'); + assert.equal(moment([2011, 0, 17]).format('DDDo'), '17º', '17º'); + assert.equal(moment([2011, 0, 18]).format('DDDo'), '18º', '18º'); + assert.equal(moment([2011, 0, 19]).format('DDDo'), '19º', '19º'); + assert.equal(moment([2011, 0, 20]).format('DDDo'), '20º', '20º'); + + assert.equal(moment([2011, 0, 21]).format('DDDo'), '21º', '21º'); + assert.equal(moment([2011, 0, 22]).format('DDDo'), '22º', '22º'); + assert.equal(moment([2011, 0, 23]).format('DDDo'), '23º', '23º'); + assert.equal(moment([2011, 0, 24]).format('DDDo'), '24º', '24º'); + assert.equal(moment([2011, 0, 25]).format('DDDo'), '25º', '25º'); + assert.equal(moment([2011, 0, 26]).format('DDDo'), '26º', '26º'); + assert.equal(moment([2011, 0, 27]).format('DDDo'), '27º', '27º'); + assert.equal(moment([2011, 0, 28]).format('DDDo'), '28º', '28º'); + assert.equal(moment([2011, 0, 29]).format('DDDo'), '29º', '29º'); + assert.equal(moment([2011, 0, 30]).format('DDDo'), '30º', '30º'); + + assert.equal(moment([2011, 0, 31]).format('DDDo'), '31º', '31º'); + }); + + test('format month', function (assert) { + var expected = 'xaneiro xan._febreiro feb._marzo mar._abril abr._maio mai._xuño xuñ._xullo xul._agosto ago._setembro set._outubro out._novembro nov._decembro dec.'.split('_'), i; + for (i = 0; i < expected.length; i++) { + assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); + } + }); + + test('format week', function (assert) { + var expected = 'domingo dom. do_luns lun. lu_martes mar. ma_mércores mér. mé_xoves xov. xo_venres ven. ve_sábado sáb. sá'.split('_'), + i; + for (i = 0; i < expected.length; i++) { + assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); + } + }); + + test('from', function (assert) { + var start = moment([2007, 1, 28]); + + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'uns segundos', '44 seconds = a few seconds'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'un minuto', '45 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'un minuto', '89 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutos', '90 seconds = 2 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutos', '44 minutes = 44 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'unha hora', '45 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'unha hora', '89 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 horas', '90 minutes = 2 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 horas', '5 hours = 5 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 horas', '21 hours = 21 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'un día', '22 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'un día', '35 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 días', '36 hours = 2 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'un día', '1 day = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 días', '5 days = 5 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 días', '25 days = 25 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'un mes', '26 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'un mes', '30 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'un mes', '43 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 meses', '46 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 meses', '75 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 meses', '76 days = 3 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'un mes', '1 month = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 meses', '5 months = 5 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'un ano', '345 days = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 anos', '548 days = 2 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'un ano', '1 year = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 anos', '5 years = 5 years'); + }); + + test('suffix', function (assert) { + assert.equal(moment(30000).from(0), 'nuns segundos', 'prefix'); + assert.equal(moment(0).from(30000), 'hai uns segundos', 'suffix'); + }); + + test('now from now', function (assert) { + assert.equal(moment().fromNow(), 'hai uns segundos', 'now from now should display as in the past'); + }); + + test('fromNow', function (assert) { + assert.equal(moment().add({s: 30}).fromNow(), 'nuns segundos', 'nuns segundos'); + assert.equal(moment().add({d: 5}).fromNow(), 'en 5 días', 'en 5 días'); + }); + + test('calendar day', function (assert) { + var a = moment().hours(12).minutes(0).seconds(0); + + assert.equal(moment(a).calendar(), 'hoxe ás 12:00', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'hoxe ás 12:25', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'hoxe ás 13:00', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'mañá ás 12:00', 'tomorrow at the same time'); + assert.equal(moment(a).add({d: 1, h : -1}).calendar(), 'mañá ás 11:00', 'tomorrow minus 1 hour'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'hoxe ás 11:00', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'onte á 12:00', 'yesterday at the same time'); + }); + + test('calendar next week', function (assert) { + var i, m; + + for (i = 2; i < 7; i++) { + m = moment().add({d: i}); + assert.equal(m.calendar(), m.format('dddd [' + ((m.hours() !== 1) ? 'ás' : 'a') + '] LT'), 'Today + ' + i + ' days current time'); + m.hours(0).minutes(0).seconds(0).milliseconds(0); + assert.equal(m.calendar(), m.format('dddd [' + ((m.hours() !== 1) ? 'ás' : 'a') + '] LT'), 'Today + ' + i + ' days beginning of day'); + m.hours(23).minutes(59).seconds(59).milliseconds(999); + assert.equal(m.calendar(), m.format('dddd [' + ((m.hours() !== 1) ? 'ás' : 'a') + '] LT'), 'Today + ' + i + ' days end of day'); + } + }); + + test('calendar last week', function (assert) { + var i, m; + for (i = 2; i < 7; i++) { + m = moment().subtract({d: i}); + assert.equal(m.calendar(), m.format('[o] dddd [pasado ' + ((m.hours() !== 1) ? 'ás' : 'a') + '] LT'), 'Today - ' + i + ' days current time'); + m.hours(0).minutes(0).seconds(0).milliseconds(0); + assert.equal(m.calendar(), m.format('[o] dddd [pasado ' + ((m.hours() !== 1) ? 'ás' : 'a') + '] LT'), 'Today - ' + i + ' days beginning of day'); + m.hours(23).minutes(59).seconds(59).milliseconds(999); + assert.equal(m.calendar(), m.format('[o] dddd [pasado ' + ((m.hours() !== 1) ? 'ás' : 'a') + '] LT'), 'Today - ' + i + ' days end of day'); + } + }); + + test('calendar all else', function (assert) { + var weeksAgo = moment().subtract({w: 1}), + weeksFromNow = moment().add({w: 1}); + + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); + + weeksAgo = moment().subtract({w: 2}); + weeksFromNow = moment().add({w: 2}); + + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); + }); + + test('regression tests', function (assert) { + var lastWeek = moment().subtract({d: 4}).hours(1); + assert.equal(lastWeek.calendar(), lastWeek.format('[o] dddd [pasado a] LT'), '1 o\'clock bug'); + }); + + test('weeks year starting sunday formatted', function (assert) { + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52º', 'Jan 1 2012 should be week 52'); + assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1º', 'Jan 2 2012 should be week 1'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1º', 'Jan 8 2012 should be week 1'); + assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2º', 'Jan 9 2012 should be week 2'); + assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2º', 'Jan 15 2012 should be week 2'); + }); + +}))); + + +;(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' + && typeof require === 'function' ? factory(require('../../moment')) : + typeof define === 'function' && define.amd ? define(['../../moment'], factory) : + factory(global.moment) +}(this, (function (moment) { 'use strict'; + + function each(array, callback) { + var i; + for (i = 0; i < array.length; i++) { + callback(array[i], i, array); + } + } + + function setupDeprecationHandler(test, moment$$1, scope) { + test._expectedDeprecations = null; + test._observedDeprecations = null; + test._oldSupress = moment$$1.suppressDeprecationWarnings; + moment$$1.suppressDeprecationWarnings = true; + test.expectedDeprecations = function () { + test._expectedDeprecations = arguments; + test._observedDeprecations = []; + }; + moment$$1.deprecationHandler = function (name, msg) { + var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); + if (deprecationId === -1) { + throw new Error('Unexpected deprecation thrown name=' + + name + ' msg=' + msg); + } + test._observedDeprecations[deprecationId] = 1; + }; + } + + function teardownDeprecationHandler(test, moment$$1, scope) { + moment$$1.suppressDeprecationWarnings = test._oldSupress; + + if (test._expectedDeprecations != null) { + var missedDeprecations = []; + each(test._expectedDeprecations, function (deprecationPattern, id) { + if (test._observedDeprecations[id] !== 1) { + missedDeprecations.push(deprecationPattern); + } + }); + if (missedDeprecations.length !== 0) { + throw new Error('Expected deprecation warnings did not happen: ' + + missedDeprecations.join(' ')); + } + } + } + + function matchedDeprecation(name, msg, deprecations) { + if (deprecations == null) { + return -1; + } + for (var i = 0; i < deprecations.length; ++i) { + if (name != null && name === deprecations[i]) { + return i; + } + if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { + return i; + } + } + return -1; + } + + /*global QUnit:false*/ + + var test = QUnit.test; + + function objectKeys(obj) { + if (Object.keys) { + return Object.keys(obj); + } else { + // IE8 + var res = [], i; + for (i in obj) { + if (obj.hasOwnProperty(i)) { + res.push(i); + } + } + return res; + } + } + + // Pick the first defined of two or three arguments. + + function defineCommonLocaleTests(locale, options) { + test('lenient day of month ordinal parsing', function (assert) { + var i, ordinalStr, testMoment; + for (i = 1; i <= 31; ++i) { + ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); + testMoment = moment(ordinalStr, 'YYYY MM Do'); + assert.equal(testMoment.year(), 2014, + 'lenient day of month ordinal parsing ' + i + ' year check'); + assert.equal(testMoment.month(), 0, + 'lenient day of month ordinal parsing ' + i + ' month check'); + assert.equal(testMoment.date(), i, + 'lenient day of month ordinal parsing ' + i + ' date check'); + } + }); + + test('lenient day of month ordinal parsing of number', function (assert) { + var i, testMoment; + for (i = 1; i <= 31; ++i) { + testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); + assert.equal(testMoment.year(), 2014, + 'lenient day of month ordinal parsing of number ' + i + ' year check'); + assert.equal(testMoment.month(), 0, + 'lenient day of month ordinal parsing of number ' + i + ' month check'); + assert.equal(testMoment.date(), i, + 'lenient day of month ordinal parsing of number ' + i + ' date check'); + } + }); + + test('strict day of month ordinal parsing', function (assert) { + var i, ordinalStr, testMoment; + for (i = 1; i <= 31; ++i) { + ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); + testMoment = moment(ordinalStr, 'YYYY MM Do', true); + assert.ok(testMoment.isValid(), 'strict day of month ordinal parsing ' + i); + } + }); + + test('meridiem invariant', function (assert) { + var h, m, t1, t2; + for (h = 0; h < 24; ++h) { + for (m = 0; m < 60; m += 15) { + t1 = moment.utc([2000, 0, 1, h, m]); + t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); + assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), + 'meridiem at ' + t1.format('HH:mm')); + } + } + }); + + test('date format correctness', function (assert) { + var data, tokens; + data = moment.localeData()._longDateFormat; + tokens = objectKeys(data); + each(tokens, function (srchToken) { + // Check each format string to make sure it does not contain any + // tokens that need to be expanded. + each(tokens, function (baseToken) { + // strip escaped sequences + var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); + assert.equal(false, !!~format.indexOf(srchToken), + 'contains ' + srchToken + ' in ' + baseToken); + }); + }); + }); + + test('month parsing correctness', function (assert) { + var i, m; + + if (locale === 'tr') { + // I can't fix it :( + assert.expect(0); + return; + } + function tester(format) { + var r; + r = moment(m.format(format), format); + assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); + if (locale !== 'ka') { + r = moment(m.format(format).toLocaleUpperCase(), format); + assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); + } + r = moment(m.format(format).toLocaleLowerCase(), format); + assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); + + r = moment(m.format(format), format, true); + assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); + if (locale !== 'ka') { + r = moment(m.format(format).toLocaleUpperCase(), format, true); + assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); + } + r = moment(m.format(format).toLocaleLowerCase(), format, true); + assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); + } + + for (i = 0; i < 12; ++i) { + m = moment([2015, i, 15, 18]); + tester('MMM'); + tester('MMM.'); + tester('MMMM'); + tester('MMMM.'); + } + }); + + test('weekday parsing correctness', function (assert) { + var i, m; + + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -23075,6 +25560,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -23102,13 +25606,16 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('gl'); + localeModule('gom-latn'); test('parse', function (assert) { - var tests = 'xaneiro xan._febreiro feb._marzo mar._abril abr._maio mai._xuño xuñ._xullo xul._agosto ago._setembro set._outubro out._novembro nov._decembro dec.'.split('_'), i; + var i, + tests = 'Janer Jan._Febrer Feb._Mars Mars_Abril Abr._Mai Mai_Jun Jun_Julai Jul._Agost Ago._Setembr Set._Otubr Otu._Novembr Nov._Dezembr Dez.'.split('_'); + function equalTest(input, mmm, i) { assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); } + for (i = 0; i < 12; i++) { tests[i] = tests[i].split(' '); equalTest(tests[i][0], 'MMM', i); @@ -23124,84 +25631,88 @@ test('format', function (assert) { var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'domingo, febreiro 14º 2010, 3:25:50 pm'], - ['ddd, hA', 'dom., 3PM'], - ['M Mo MM MMMM MMM', '2 2º 02 febreiro feb.'], + ['dddd, MMMM Do YYYY, h:mm:ss a', 'Aitar, Febrer 14er 2010, 3:25:50 donparam'], + ['ddd, hA', 'Ait., 3donparam'], + ['M Mo MM MMMM MMM', '2 2 02 Febrer Feb.'], ['YYYY YY', '2010 10'], - ['D Do DD', '14 14º 14'], - ['d do dddd ddd dd', '0 0º domingo dom. do'], - ['DDD DDDo DDDD', '45 45º 045'], - ['w wo ww', '6 6º 06'], + ['D Do DD', '14 14er 14'], + ['d do dddd ddd dd', '0 0 Aitar Ait. Ai'], + ['DDD DDDo DDDD', '45 45 045'], + ['w wo ww', '6 6 06'], ['h hh', '3 03'], ['H HH', '15 15'], ['m mm', '25 25'], ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45º day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 de febreiro de 2010'], - ['LLL', '14 de febreiro de 2010 15:25'], - ['LLLL', 'domingo, 14 de febreiro de 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 de feb. de 2010'], - ['lll', '14 de feb. de 2010 15:25'], - ['llll', 'dom., 14 de feb. de 2010 15:25'] + ['a A', 'donparam donparam'], + ['[the] DDDo [day of the year]', 'the 45 day of the year'], + ['LTS', 'donparam 3:25:50 vazta'], + ['L', '14-02-2010'], + ['LL', '14 Febrer 2010'], + ['LLL', '14 Febrer 2010 donparam 3:25 vazta'], + ['LLLL', 'Aitar, Febrerachea 14er, 2010, donparam 3:25 vazta'], + ['l', '14-2-2010'], + ['ll', '14 Feb. 2010'], + ['lll', '14 Feb. 2010 donparam 3:25 vazta'], + ['llll', 'Ait., 14 Feb. 2010, donparam 3:25 vazta'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; + for (i = 0; i < a.length; i++) { assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); } }); test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1º', '1º'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2º', '2º'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3º', '3º'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4º', '4º'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5º', '5º'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6º', '6º'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7º', '7º'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8º', '8º'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9º', '9º'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10º', '10º'); + assert.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1'); + assert.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2'); + assert.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3'); + assert.equal(moment([2011, 0, 4]).format('DDDo'), '4', '4'); + assert.equal(moment([2011, 0, 5]).format('DDDo'), '5', '5'); + assert.equal(moment([2011, 0, 6]).format('DDDo'), '6', '6'); + assert.equal(moment([2011, 0, 7]).format('DDDo'), '7', '7'); + assert.equal(moment([2011, 0, 8]).format('DDDo'), '8', '8'); + assert.equal(moment([2011, 0, 9]).format('DDDo'), '9', '9'); + assert.equal(moment([2011, 0, 10]).format('DDDo'), '10', '10'); - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11º', '11º'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12º', '12º'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13º', '13º'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14º', '14º'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15º', '15º'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16º', '16º'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17º', '17º'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18º', '18º'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19º', '19º'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20º', '20º'); + assert.equal(moment([2011, 0, 11]).format('DDDo'), '11', '11'); + assert.equal(moment([2011, 0, 12]).format('DDDo'), '12', '12'); + assert.equal(moment([2011, 0, 13]).format('DDDo'), '13', '13'); + assert.equal(moment([2011, 0, 14]).format('DDDo'), '14', '14'); + assert.equal(moment([2011, 0, 15]).format('DDDo'), '15', '15'); + assert.equal(moment([2011, 0, 16]).format('DDDo'), '16', '16'); + assert.equal(moment([2011, 0, 17]).format('DDDo'), '17', '17'); + assert.equal(moment([2011, 0, 18]).format('DDDo'), '18', '18'); + assert.equal(moment([2011, 0, 19]).format('DDDo'), '19', '19'); + assert.equal(moment([2011, 0, 20]).format('DDDo'), '20', '20'); - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21º', '21º'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22º', '22º'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23º', '23º'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24º', '24º'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25º', '25º'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26º', '26º'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27º', '27º'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28º', '28º'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29º', '29º'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30º', '30º'); + assert.equal(moment([2011, 0, 21]).format('DDDo'), '21', '21'); + assert.equal(moment([2011, 0, 22]).format('DDDo'), '22', '22'); + assert.equal(moment([2011, 0, 23]).format('DDDo'), '23', '23'); + assert.equal(moment([2011, 0, 24]).format('DDDo'), '24', '24'); + assert.equal(moment([2011, 0, 25]).format('DDDo'), '25', '25'); + assert.equal(moment([2011, 0, 26]).format('DDDo'), '26', '26'); + assert.equal(moment([2011, 0, 27]).format('DDDo'), '27', '27'); + assert.equal(moment([2011, 0, 28]).format('DDDo'), '28', '28'); + assert.equal(moment([2011, 0, 29]).format('DDDo'), '29', '29'); + assert.equal(moment([2011, 0, 30]).format('DDDo'), '30', '30'); - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31º', '31º'); + assert.equal(moment([2011, 0, 31]).format('DDDo'), '31', '31'); }); test('format month', function (assert) { - var expected = 'xaneiro xan._febreiro feb._marzo mar._abril abr._maio mai._xuño xuñ._xullo xul._agosto ago._setembro set._outubro out._novembro nov._decembro dec.'.split('_'), i; + var i, + expected = 'Janer Jan._Febrer Feb._Mars Mars_Abril Abr._Mai Mai_Jun Jun_Julai Jul._Agost Ago._Setembr Set._Otubr Otu._Novembr Nov._Dezembr Dez.'.split('_'); + for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); test('format week', function (assert) { - var expected = 'domingo dom. do_luns lun. lu_martes mar. ma_mércores mér. mé_xoves xov. xo_venres ven. ve_sábado sáb. sá'.split('_'), - i; + var i, + expected = 'Aitar Ait. Ai_Somar Som. Sm_Mongllar Mon. Mo_Budvar Bud. Bu_Brestar Bre. Br_Sukrar Suk. Su_Son\'var Son. Sn'.split('_'); + for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); } @@ -23210,60 +25721,63 @@ test('from', function (assert) { var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'uns segundos', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'un minuto', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'un minuto', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutos', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutos', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'unha hora', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'unha hora', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 horas', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 horas', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 horas', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'un día', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'un día', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 días', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'un día', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 días', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 días', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'un mes', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'un mes', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'un mes', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 meses', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 meses', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 meses', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'un mes', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 meses', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'un ano', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 anos', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'un ano', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 anos', '5 years = 5 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'thodde secondanim', '44 seconds = a few seconds'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'eka mintan', '45 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'eka mintan', '89 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 mintanim', '90 seconds = 2 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 mintanim', '44 minutes = 44 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'eka voran', '45 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'eka voran', '89 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 voranim', '90 minutes = 2 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 voranim', '5 hours = 5 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 voranim', '21 hours = 21 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'eka disan', '22 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'eka disan', '35 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 disanim', '36 hours = 2 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'eka disan', '1 day = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 disanim', '5 days = 5 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 disanim', '25 days = 25 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'eka mhoinean', '26 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'eka mhoinean', '30 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'eka mhoinean', '43 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mhoineanim', '46 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mhoineanim', '75 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mhoineanim', '76 days = 3 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'eka mhoinean', '1 month = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mhoineanim', '5 months = 5 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'eka vorsan', '345 days = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 vorsanim', '548 days = 2 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'eka vorsan', '1 year = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 vorsanim', '5 years = 5 years'); }); test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'nuns segundos', 'prefix'); - assert.equal(moment(0).from(30000), 'hai uns segundos', 'suffix'); + assert.equal(moment(30000).from(0), 'thodde second', 'prefix'); + assert.equal(moment(0).from(30000), 'thodde second adim', 'suffix'); }); test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'hai uns segundos', 'now from now should display as in the past'); + assert.equal(moment().fromNow(), 'thodde second adim', 'now from now should display as in the past'); }); test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'nuns segundos', 'nuns segundos'); - assert.equal(moment().add({d: 5}).fromNow(), 'en 5 días', 'en 5 días'); + assert.equal(moment().add({s: 30}).fromNow(), 'thodde second', 'in a few seconds'); + assert.equal(moment().add({d: 5}).fromNow(), '5 dis', 'in 5 days'); + }); + + test('ago', function (assert) { + assert.equal(moment().subtract({h: 3}).fromNow(), '3 voram adim', '3 hours ago'); }); test('calendar day', function (assert) { var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'hoxe ás 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'hoxe ás 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'hoxe ás 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'mañá ás 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).add({d: 1, h : -1}).calendar(), 'mañá ás 11:00', 'tomorrow minus 1 hour'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'hoxe ás 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'onte á 12:00', 'yesterday at the same time'); + assert.equal(moment(a).calendar(), 'Aiz donparam 12:00 vazta', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'Aiz donparam 12:25 vazta', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'Aiz donparam 1:00 vazta', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'Faleam donparam 12:00 vazta', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'Aiz sokalli 11:00 vazta', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kal donparam 12:00 vazta', 'yesterday at the same time'); }); test('calendar next week', function (assert) { @@ -23271,23 +25785,24 @@ for (i = 2; i < 7; i++) { m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [' + ((m.hours() !== 1) ? 'ás' : 'a') + '] LT'), 'Today + ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('[Ieta to] dddd[,] LT'), 'Today + ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [' + ((m.hours() !== 1) ? 'ás' : 'a') + '] LT'), 'Today + ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('[Ieta to] dddd[,] LT'), 'Today + ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [' + ((m.hours() !== 1) ? 'ás' : 'a') + '] LT'), 'Today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[Ieta to] dddd[,] LT'), 'Today + ' + i + ' days end of day'); } }); test('calendar last week', function (assert) { var i, m; + for (i = 2; i < 7; i++) { m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[o] dddd [pasado ' + ((m.hours() !== 1) ? 'ás' : 'a') + '] LT'), 'Today - ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('[Fatlo] dddd[,] LT'), 'Today - ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[o] dddd [pasado ' + ((m.hours() !== 1) ? 'ás' : 'a') + '] LT'), 'Today - ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('[Fatlo] dddd[,] LT'), 'Today - ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[o] dddd [pasado ' + ((m.hours() !== 1) ? 'ás' : 'a') + '] LT'), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[Fatlo] dddd[,] LT'), 'Today - ' + i + ' days end of day'); } }); @@ -23305,17 +25820,12 @@ assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); }); - test('regression tests', function (assert) { - var lastWeek = moment().subtract({d: 4}).hours(1); - assert.equal(lastWeek.calendar(), lastWeek.format('[o] dddd [pasado a] LT'), '1 o\'clock bug'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52º', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1º', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1º', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2º', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2º', 'Jan 15 2012 should be week 2'); + test('weeks year starting sunday format', function (assert) { + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52', 'Jan 1 2012 should be week 52'); + assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1', 'Jan 2 2012 should be week 1'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1', 'Jan 8 2012 should be week 1'); + assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2', 'Jan 14 2012 should be week 2'); + assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2', 'Jan 15 2012 should be week 2'); }); }))); @@ -23513,11 +26023,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -23556,6 +26067,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -23583,16 +26113,13 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('gom-latn'); + localeModule('gu'); test('parse', function (assert) { - var i, - tests = 'Janer Jan._Febrer Feb._Mars Mars_Abril Abr._Mai Mai_Jun Jun_Julai Jul._Agost Ago._Setembr Set._Otubr Otu._Novembr Nov._Dezembr Dez.'.split('_'); - + var tests = 'જાન્યુઆરી જાન્યુ._ફેબ્રુઆરી ફેબ્રુ._માર્ચ માર્ચ_એપ્રિલ એપ્રિ._મે મે_જૂન જૂન_જુલાઈ જુલા._ઑગસ્ટ ઑગ._સપ્ટેમ્બર સપ્ટે._ઑક્ટ્બર ઑક્ટ્._નવેમ્બર નવે._ડિસેમ્બર ડિસે..'.split('_'), i; function equalTest(input, mmm, i) { assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); } - for (i = 0; i < 12; i++) { tests[i] = tests[i].split(' '); equalTest(tests[i][0], 'MMM', i); @@ -23608,88 +26135,82 @@ test('format', function (assert) { var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Aitar, Febrer 14er 2010, 3:25:50 donparam'], - ['ddd, hA', 'Ait., 3donparam'], - ['M Mo MM MMMM MMM', '2 2 02 Febrer Feb.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14er 14'], - ['d do dddd ddd dd', '0 0 Aitar Ait. Ai'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '6 6 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'donparam donparam'], - ['[the] DDDo [day of the year]', 'the 45 day of the year'], - ['LTS', 'donparam 3:25:50 vazta'], - ['L', '14-02-2010'], - ['LL', '14 Febrer 2010'], - ['LLL', '14 Febrer 2010 donparam 3:25 vazta'], - ['LLLL', 'Aitar, Febrerachea 14er, 2010, donparam 3:25 vazta'], - ['l', '14-2-2010'], - ['ll', '14 Feb. 2010'], - ['lll', '14 Feb. 2010 donparam 3:25 vazta'], - ['llll', 'Ait., 14 Feb. 2010, donparam 3:25 vazta'] + ['dddd, Do MMMM YYYY, a h:mm:ss વાગ્યે', 'રવિવાર, ૧૪ ફેબ્રુઆરી ૨૦૧૦, બપોર ૩:૨૫:૫૦ વાગ્યે'], + ['ddd, a h વાગ્યે', 'રવિ, બપોર ૩ વાગ્યે'], + ['M Mo MM MMMM MMM', '૨ ૨ ૦૨ ફેબ્રુઆરી ફેબ્રુ.'], + ['YYYY YY', '૨૦૧૦ ૧૦'], + ['D Do DD', '૧૪ ૧૪ ૧૪'], + ['d do dddd ddd dd', '૦ ૦ રવિવાર રવિ ર'], + ['DDD DDDo DDDD', '૪૫ ૪૫ ૦૪૫'], + ['w wo ww', '૮ ૮ ૦૮'], + ['h hh', '૩ ૦૩'], + ['H HH', '૧૫ ૧૫'], + ['m mm', '૨૫ ૨૫'], + ['s ss', '૫૦ ૫૦'], + ['a A', 'બપોર બપોર'], + ['LTS', 'બપોર ૩:૨૫:૫૦ વાગ્યે'], + ['L', '૧૪/૦૨/૨૦૧૦'], + ['LL', '૧૪ ફેબ્રુઆરી ૨૦૧૦'], + ['LLL', '૧૪ ફેબ્રુઆરી ૨૦૧૦, બપોર ૩:૨૫ વાગ્યે'], + ['LLLL', 'રવિવાર, ૧૪ ફેબ્રુઆરી ૨૦૧૦, બપોર ૩:૨૫ વાગ્યે'], + ['l', '૧૪/૨/૨૦૧૦'], + ['ll', '૧૪ ફેબ્રુ. ૨૦૧૦'], + ['lll', '૧૪ ફેબ્રુ. ૨૦૧૦, બપોર ૩:૨૫ વાગ્યે'], + ['llll', 'રવિ, ૧૪ ફેબ્રુ. ૨૦૧૦, બપોર ૩:૨૫ વાગ્યે'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; - for (i = 0; i < a.length; i++) { assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); } }); test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4', '4'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5', '5'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6', '6'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7', '7'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8', '8'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9', '9'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10', '10'); + assert.equal(moment([2011, 0, 1]).format('DDDo'), '૧', '૧'); + assert.equal(moment([2011, 0, 2]).format('DDDo'), '૨', '૨'); + assert.equal(moment([2011, 0, 3]).format('DDDo'), '૩', '૩'); + assert.equal(moment([2011, 0, 4]).format('DDDo'), '૪', '૪'); + assert.equal(moment([2011, 0, 5]).format('DDDo'), '૫', '૫'); + assert.equal(moment([2011, 0, 6]).format('DDDo'), '૬', '૬'); + assert.equal(moment([2011, 0, 7]).format('DDDo'), '૭', '૭'); + assert.equal(moment([2011, 0, 8]).format('DDDo'), '૮', '૮'); + assert.equal(moment([2011, 0, 9]).format('DDDo'), '૯', '૯'); + assert.equal(moment([2011, 0, 10]).format('DDDo'), '૧૦', '૧૦'); - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11', '11'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12', '12'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13', '13'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14', '14'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15', '15'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16', '16'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17', '17'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18', '18'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19', '19'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20', '20'); + assert.equal(moment([2011, 0, 11]).format('DDDo'), '૧૧', '૧૧'); + assert.equal(moment([2011, 0, 12]).format('DDDo'), '૧૨', '૧૨'); + assert.equal(moment([2011, 0, 13]).format('DDDo'), '૧૩', '૧૩'); + assert.equal(moment([2011, 0, 14]).format('DDDo'), '૧૪', '૧૪'); + assert.equal(moment([2011, 0, 15]).format('DDDo'), '૧૫', '૧૫'); + assert.equal(moment([2011, 0, 16]).format('DDDo'), '૧૬', '૧૬'); + assert.equal(moment([2011, 0, 17]).format('DDDo'), '૧૭', '૧૭'); + assert.equal(moment([2011, 0, 18]).format('DDDo'), '૧૮', '૧૮'); + assert.equal(moment([2011, 0, 19]).format('DDDo'), '૧૯', '૧૯'); + assert.equal(moment([2011, 0, 20]).format('DDDo'), '૨૦', '૨૦'); - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21', '21'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22', '22'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23', '23'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24', '24'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25', '25'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26', '26'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27', '27'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28', '28'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29', '29'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30', '30'); + assert.equal(moment([2011, 0, 21]).format('DDDo'), '૨૧', '૨૧'); + assert.equal(moment([2011, 0, 22]).format('DDDo'), '૨૨', '૨૨'); + assert.equal(moment([2011, 0, 23]).format('DDDo'), '૨૩', '૨૩'); + assert.equal(moment([2011, 0, 24]).format('DDDo'), '૨૪', '૨૪'); + assert.equal(moment([2011, 0, 25]).format('DDDo'), '૨૫', '૨૫'); + assert.equal(moment([2011, 0, 26]).format('DDDo'), '૨૬', '૨૬'); + assert.equal(moment([2011, 0, 27]).format('DDDo'), '૨૭', '૨૭'); + assert.equal(moment([2011, 0, 28]).format('DDDo'), '૨૮', '૨૮'); + assert.equal(moment([2011, 0, 29]).format('DDDo'), '૨૯', '૨૯'); + assert.equal(moment([2011, 0, 30]).format('DDDo'), '૩૦', '૩૦'); - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31', '31'); + assert.equal(moment([2011, 0, 31]).format('DDDo'), '૩૧', '૩૧'); }); test('format month', function (assert) { - var i, - expected = 'Janer Jan._Febrer Feb._Mars Mars_Abril Abr._Mai Mai_Jun Jun_Julai Jul._Agost Ago._Setembr Set._Otubr Otu._Novembr Nov._Dezembr Dez.'.split('_'); - + var expected = 'જાન્યુઆરી જાન્યુ._ફેબ્રુઆરી ફેબ્રુ._માર્ચ માર્ચ_એપ્રિલ એપ્રિ._મે મે_જૂન જૂન_જુલાઈ જુલા._ઑગસ્ટ ઑગ._સપ્ટેમ્બર સપ્ટે._ઑક્ટ્બર ઑક્ટ્._નવેમ્બર નવે._ડિસેમ્બર ડિસે.'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); test('format week', function (assert) { - var i, - expected = 'Aitar Ait. Ai_Somar Som. Sm_Mongllar Mon. Mo_Budvar Bud. Bu_Brestar Bre. Br_Sukrar Suk. Su_Son\'var Son. Sn'.split('_'); - + var expected = 'રવિવાર રવિ ર_સોમવાર સોમ સો_મંગળવાર મંગળ મં_બુધ્વાર બુધ્ બુ_ગુરુવાર ગુરુ ગુ_શુક્રવાર શુક્ર શુ_શનિવાર શનિ શ'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); } @@ -23697,76 +26218,70 @@ test('from', function (assert) { var start = moment([2007, 1, 28]); - - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'thodde secondanim', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'eka mintan', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'eka mintan', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 mintanim', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 mintanim', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'eka horan', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'eka horan', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 horanim', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 horanim', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 horanim', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'eka disan', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'eka disan', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 disanim', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'eka disan', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 disanim', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 disanim', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'eka mhoinean', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'eka mhoinean', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'eka mhoinean', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mhoineanim', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mhoineanim', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mhoineanim', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'eka mhoinean', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mhoineanim', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'eka vorsan', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 vorsanim', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'eka vorsan', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 vorsanim', '5 years = 5 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'અમુક પળો', '44 seconds = a few seconds'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'એક મિનિટ', '45 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'એક મિનિટ', '89 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '૨ મિનિટ', '90 seconds = 2 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '૪૪ મિનિટ', '44 minutes = 44 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'એક કલાક', '45 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'એક કલાક', '89 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '૨ કલાક', '90 minutes = 2 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '૫ કલાક', '5 hours = 5 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '૨૧ કલાક', '21 hours = 21 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'એક દિવસ', '22 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'એક દિવસ', '35 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '૨ દિવસ', '36 hours = 2 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'એક દિવસ', '1 day = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '૫ દિવસ', '5 days = 5 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '૨૫ દિવસ', '25 days = 25 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'એક મહિનો', '26 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'એક મહિનો', '30 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'એક મહિનો', '43 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '૨ મહિનો', '46 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '૨ મહિનો', '75 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '૩ મહિનો', '76 days = 3 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'એક મહિનો', '1 month = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '૫ મહિનો', '5 months = 5 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'એક વર્ષ', '345 days = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '૨ વર્ષ', '548 days = 2 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'એક વર્ષ', '1 year = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '૫ વર્ષ', '5 years = 5 years'); }); test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'thodde second', 'prefix'); - assert.equal(moment(0).from(30000), 'thodde second adim', 'suffix'); + assert.equal(moment(30000).from(0), 'અમુક પળો મા', 'prefix'); + assert.equal(moment(0).from(30000), 'અમુક પળો પેહલા', 'suffix'); }); test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'thodde second adim', 'now from now should display as in the past'); + assert.equal(moment().fromNow(), 'અમુક પળો પેહલા', 'now from now should display as in the past'); }); test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'thodde second', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5 dis', 'in 5 days'); - }); - - test('ago', function (assert) { - assert.equal(moment().subtract({h: 3}).fromNow(), '3 horam adim', '3 hours ago'); + assert.equal(moment().add({s: 30}).fromNow(), 'અમુક પળો મા', 'અમુક પળો મા'); + assert.equal(moment().add({d: 5}).fromNow(), '૫ દિવસ મા', '૫ દિવસ મા'); }); test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); + var a = moment().hours(2).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'Aiz donparam 12:00 vazta', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Aiz donparam 12:25 vazta', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Aiz donparam 1:00 vazta', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Faleam donparam 12:00 vazta', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Aiz sokalli 11:00 vazta', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kal donparam 12:00 vazta', 'yesterday at the same time'); + assert.equal(moment(a).calendar(), 'આજ રાત ૨:૦૦ વાગ્યે', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'આજ રાત ૨:૨૫ વાગ્યે', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 3}).calendar(), 'આજ સવાર ૫:૦૦ વાગ્યે', 'Now plus 3 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'કાલે રાત ૨:૦૦ વાગ્યે', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'આજ રાત ૧:૦૦ વાગ્યે', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'ગઇકાલે રાત ૨:૦૦ વાગ્યે', 'yesterday at the same time'); }); test('calendar next week', function (assert) { var i, m; - for (i = 2; i < 7; i++) { m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('[Ieta to] dddd[,] LT'), 'Today + ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Ieta to] dddd[,] LT'), 'Today + ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Ieta to] dddd[,] LT'), 'Today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days end of day'); } }); @@ -23775,11 +26290,11 @@ for (i = 2; i < 7; i++) { m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[Fatlo] dddd[,] LT'), 'Today - ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('[પાછલા] dddd[,] LT'), 'Today - ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Fatlo] dddd[,] LT'), 'Today - ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('[પાછલા] dddd[,] LT'), 'Today - ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Fatlo] dddd[,] LT'), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[પાછલા] dddd[,] LT'), 'Today - ' + i + ' days end of day'); } }); @@ -23797,12 +26312,28 @@ assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); }); - test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2', 'Jan 15 2012 should be week 2'); + test('meridiem', function (assert) { + assert.equal(moment([2011, 2, 23, 2, 30]).format('a'), 'રાત', 'before dawn'); + assert.equal(moment([2011, 2, 23, 9, 30]).format('a'), 'સવાર', 'morning'); + assert.equal(moment([2011, 2, 23, 14, 30]).format('a'), 'બપોર', 'during day'); + assert.equal(moment([2011, 2, 23, 17, 30]).format('a'), 'સાંજ', 'evening'); + assert.equal(moment([2011, 2, 23, 19, 30]).format('a'), 'સાંજ', 'late evening'); + assert.equal(moment([2011, 2, 23, 21, 20]).format('a'), 'રાત', 'night'); + + assert.equal(moment([2011, 2, 23, 2, 30]).format('A'), 'રાત', 'before dawn'); + assert.equal(moment([2011, 2, 23, 9, 30]).format('A'), 'સવાર', 'morning'); + assert.equal(moment([2011, 2, 23, 14, 30]).format('A'), 'બપોર', ' during day'); + assert.equal(moment([2011, 2, 23, 17, 30]).format('A'), 'સાંજ', 'evening'); + assert.equal(moment([2011, 2, 23, 19, 30]).format('A'), 'સાંજ', 'late evening'); + assert.equal(moment([2011, 2, 23, 21, 20]).format('A'), 'રાત', 'night'); + }); + + test('weeks year starting sunday formatted', function (assert) { + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '૧ ૦૧ ૧', 'Jan 1 2012 should be week 1'); + assert.equal(moment([2012, 0, 7]).format('w ww wo'), '૧ ૦૧ ૧', 'Jan 7 2012 should be week 1'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '૨ ૦૨ ૨', 'Jan 8 2012 should be week 2'); + assert.equal(moment([2012, 0, 14]).format('w ww wo'), '૨ ૦૨ ૨', 'Jan 14 2012 should be week 2'); + assert.equal(moment([2012, 0, 15]).format('w ww wo'), '૩ ૦૩ ૩', 'Jan 15 2012 should be week 3'); }); }))); @@ -24000,11 +26531,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -24043,6 +26575,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -24070,10 +26621,10 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('gu'); + localeModule('he'); test('parse', function (assert) { - var tests = 'જાન્યુઆરી જાન્યુ._ફેબ્રુઆરી ફેબ્રુ._માર્ચ માર્ચ_એપ્રિલ એપ્રિ._મે મે_જૂન જૂન_જુલાઈ જુલા._ઑગસ્ટ ઑગ._સપ્ટેમ્બર સપ્ટે._ઑક્ટ્બર ઑક્ટ્._નવેમ્બર નવે._ડિસેમ્બર ડિસે..'.split('_'), i; + var tests = 'ינואר ינו׳_פברואר פבר׳_מרץ מרץ_אפריל אפר׳_מאי מאי_יוני יוני_יולי יולי_אוגוסט אוג׳_ספטמבר ספט׳_אוקטובר אוק׳_נובמבר נוב׳_דצמבר דצמ׳'.split('_'), i; function equalTest(input, mmm, i) { assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); } @@ -24092,28 +26643,29 @@ test('format', function (assert) { var a = [ - ['dddd, Do MMMM YYYY, a h:mm:ss વાગ્યે', 'રવિવાર, ૧૪ ફેબ્રુઆરી ૨૦૧૦, બપોર ૩:૨૫:૫૦ વાગ્યે'], - ['ddd, a h વાગ્યે', 'રવિ, બપોર ૩ વાગ્યે'], - ['M Mo MM MMMM MMM', '૨ ૨ ૦૨ ફેબ્રુઆરી ફેબ્રુ.'], - ['YYYY YY', '૨૦૧૦ ૧૦'], - ['D Do DD', '૧૪ ૧૪ ૧૪'], - ['d do dddd ddd dd', '૦ ૦ રવિવાર રવિ ર'], - ['DDD DDDo DDDD', '૪૫ ૪૫ ૦૪૫'], - ['w wo ww', '૮ ૮ ૦૮'], - ['h hh', '૩ ૦૩'], - ['H HH', '૧૫ ૧૫'], - ['m mm', '૨૫ ૨૫'], - ['s ss', '૫૦ ૫૦'], - ['a A', 'બપોર બપોર'], - ['LTS', 'બપોર ૩:૨૫:૫૦ વાગ્યે'], - ['L', '૧૪/૦૨/૨૦૧૦'], - ['LL', '૧૪ ફેબ્રુઆરી ૨૦૧૦'], - ['LLL', '૧૪ ફેબ્રુઆરી ૨૦૧૦, બપોર ૩:૨૫ વાગ્યે'], - ['LLLL', 'રવિવાર, ૧૪ ફેબ્રુઆરી ૨૦૧૦, બપોર ૩:૨૫ વાગ્યે'], - ['l', '૧૪/૨/૨૦૧૦'], - ['ll', '૧૪ ફેબ્રુ. ૨૦૧૦'], - ['lll', '૧૪ ફેબ્રુ. ૨૦૧૦, બપોર ૩:૨૫ વાગ્યે'], - ['llll', 'રવિ, ૧૪ ફેબ્રુ. ૨૦૧૦, બપોર ૩:૨૫ વાગ્યે'] + ['dddd, MMMM Do YYYY, h:mm:ss a', 'ראשון, פברואר 14 2010, 3:25:50 אחה"צ'], + ['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 ראשון א׳ א'], + ['DDD DDDo DDDD', '45 45 045'], + ['w wo ww', '8 8 08'], + ['h hh', '3 03'], + ['H HH', '15 15'], + ['m mm', '25 25'], + ['s ss', '50 50'], + ['a A', 'אחה"צ אחרי הצהריים'], + ['[the] DDDo [day of the year]', 'the 45 day of the year'], + ['LTS', '15:25:50'], + ['L', '14/02/2010'], + ['LL', '14 בפברואר 2010'], + ['LLL', '14 בפברואר 2010 15:25'], + ['LLLL', 'ראשון, 14 בפברואר 2010 15:25'], + ['l', '14/2/2010'], + ['ll', '14 פבר׳ 2010'], + ['lll', '14 פבר׳ 2010 15:25'], + ['llll', 'א׳, 14 פבר׳ 2010 15:25'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; @@ -24122,52 +26674,15 @@ } }); - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '૧', '૧'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '૨', '૨'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '૩', '૩'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '૪', '૪'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '૫', '૫'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '૬', '૬'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '૭', '૭'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '૮', '૮'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '૯', '૯'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '૧૦', '૧૦'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '૧૧', '૧૧'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '૧૨', '૧૨'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '૧૩', '૧૩'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '૧૪', '૧૪'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '૧૫', '૧૫'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '૧૬', '૧૬'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '૧૭', '૧૭'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '૧૮', '૧૮'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '૧૯', '૧૯'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '૨૦', '૨૦'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '૨૧', '૨૧'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '૨૨', '૨૨'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '૨૩', '૨૩'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '૨૪', '૨૪'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '૨૫', '૨૫'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '૨૬', '૨૬'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '૨૭', '૨૭'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '૨૮', '૨૮'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '૨૯', '૨૯'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '૩૦', '૩૦'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '૩૧', '૩૧'); - }); - test('format month', function (assert) { - var expected = 'જાન્યુઆરી જાન્યુ._ફેબ્રુઆરી ફેબ્રુ._માર્ચ માર્ચ_એપ્રિલ એપ્રિ._મે મે_જૂન જૂન_જુલાઈ જુલા._ઑગસ્ટ ઑગ._સપ્ટેમ્બર સપ્ટે._ઑક્ટ્બર ઑક્ટ્._નવેમ્બર નવે._ડિસેમ્બર ડિસે.'.split('_'), i; + var expected = 'ינואר ינו׳_פברואר פבר׳_מרץ מרץ_אפריל אפר׳_מאי מאי_יוני יוני_יולי יולי_אוגוסט אוג׳_ספטמבר ספט׳_אוקטובר אוק׳_נובמבר נוב׳_דצמבר דצמ׳'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); test('format week', function (assert) { - var expected = 'રવિવાર રવિ ર_સોમવાર સોમ સો_મંગળવાર મંગળ મં_બુધ્વાર બુધ્ બુ_ગુરુવાર ગુરુ ગુ_શુક્રવાર શુક્ર શુ_શનિવાર શનિ શ'.split('_'), i; + var expected = 'ראשון א׳ א|שני ב׳ ב|שלישי ג׳ ג|רביעי ד׳ ד|חמישי ה׳ ה|שישי ו׳ ו|שבת ש׳ ש'.split('|'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); } @@ -24175,83 +26690,84 @@ test('from', function (assert) { var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'અમુક પળો', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'એક મિનિટ', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'એક મિનિટ', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '૨ મિનિટ', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '૪૪ મિનિટ', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'એક કલાક', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'એક કલાક', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '૨ કલાક', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '૫ કલાક', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '૨૧ કલાક', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'એક દિવસ', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'એક દિવસ', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '૨ દિવસ', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'એક દિવસ', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '૫ દિવસ', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '૨૫ દિવસ', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'એક મહિનો', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'એક મહિનો', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'એક મહિનો', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '૨ મહિનો', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '૨ મહિનો', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '૩ મહિનો', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'એક મહિનો', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '૫ મહિનો', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'એક વર્ષ', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '૨ વર્ષ', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'એક વર્ષ', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '૫ વર્ષ', '5 years = 5 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'מספר שניות', '44 seconds = a few seconds'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'דקה', '45 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'דקה', '89 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 דקות', '90 seconds = 2 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 דקות', '44 minutes = 44 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'שעה', '45 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'שעה', '89 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), 'שעתיים', '90 minutes = 2 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 שעות', '5 hours = 5 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 שעות', '21 hours = 21 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'יום', '22 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'יום', '35 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), 'יומיים', '36 hours = 2 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'יום', '1 day = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 ימים', '5 days = 5 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 ימים', '25 days = 25 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'חודש', '26 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'חודש', '30 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'חודש', '43 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), 'חודשיים', '46 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), 'חודשיים', '75 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 חודשים', '76 days = 3 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'חודש', '1 month = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 חודשים', '5 months = 5 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'שנה', '345 days = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), 'שנתיים', '548 days = 2 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 3699}), true), '10 שנים', '345 days = 10 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 7340}), true), '20 שנה', '548 days = 20 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'שנה', '1 year = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 שנים', '5 years = 5 years'); }); test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'અમુક પળો મા', 'prefix'); - assert.equal(moment(0).from(30000), 'અમુક પળો પેહલા', 'suffix'); + assert.equal(moment(30000).from(0), 'בעוד מספר שניות', 'prefix'); + assert.equal(moment(0).from(30000), 'לפני מספר שניות', 'suffix'); }); test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'અમુક પળો પેહલા', 'now from now should display as in the past'); + assert.equal(moment().fromNow(), 'לפני מספר שניות', 'now from now should display as in the past'); }); test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'અમુક પળો મા', 'અમુક પળો મા'); - assert.equal(moment().add({d: 5}).fromNow(), '૫ દિવસ મા', '૫ દિવસ મા'); + assert.equal(moment().add({s: 30}).fromNow(), 'בעוד מספר שניות', 'in a few seconds'); + assert.equal(moment().add({d: 5}).fromNow(), 'בעוד 5 ימים', 'in 5 days'); }); test('calendar day', function (assert) { - var a = moment().hours(2).minutes(0).seconds(0); + var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'આજ રાત ૨:૦૦ વાગ્યે', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'આજ રાત ૨:૨૫ વાગ્યે', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 3}).calendar(), 'આજ સવાર ૫:૦૦ વાગ્યે', 'Now plus 3 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'કાલે રાત ૨:૦૦ વાગ્યે', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'આજ રાત ૧:૦૦ વાગ્યે', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'ગઇકાલે રાત ૨:૦૦ વાગ્યે', 'yesterday at the same time'); + assert.equal(moment(a).calendar(), 'היום ב־12:00', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'היום ב־12:25', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'היום ב־13:00', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'מחר ב־12:00', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'היום ב־11:00', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'אתמול ב־12:00', 'yesterday at the same time'); }); test('calendar next week', function (assert) { var i, m; for (i = 2; i < 7; i++) { m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('dddd [בשעה] LT'), 'Today + ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('dddd [בשעה] LT'), 'Today + ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('dddd [בשעה] LT'), 'Today + ' + i + ' days end of day'); } }); test('calendar last week', function (assert) { var i, m; - for (i = 2; i < 7; i++) { m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[પાછલા] dddd[,] LT'), 'Today - ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('[ביום] dddd [האחרון בשעה] LT'), 'Today - ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[પાછલા] dddd[,] LT'), 'Today - ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('[ביום] dddd [האחרון בשעה] LT'), 'Today - ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[પાછલા] dddd[,] LT'), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[ביום] dddd [האחרון בשעה] LT'), 'Today - ' + i + ' days end of day'); } }); @@ -24269,28 +26785,12 @@ assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); }); - test('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 2, 30]).format('a'), 'રાત', 'before dawn'); - assert.equal(moment([2011, 2, 23, 9, 30]).format('a'), 'સવાર', 'morning'); - assert.equal(moment([2011, 2, 23, 14, 30]).format('a'), 'બપોર', 'during day'); - assert.equal(moment([2011, 2, 23, 17, 30]).format('a'), 'સાંજ', 'evening'); - assert.equal(moment([2011, 2, 23, 19, 30]).format('a'), 'સાંજ', 'late evening'); - assert.equal(moment([2011, 2, 23, 21, 20]).format('a'), 'રાત', 'night'); - - assert.equal(moment([2011, 2, 23, 2, 30]).format('A'), 'રાત', 'before dawn'); - assert.equal(moment([2011, 2, 23, 9, 30]).format('A'), 'સવાર', 'morning'); - assert.equal(moment([2011, 2, 23, 14, 30]).format('A'), 'બપોર', ' during day'); - assert.equal(moment([2011, 2, 23, 17, 30]).format('A'), 'સાંજ', 'evening'); - assert.equal(moment([2011, 2, 23, 19, 30]).format('A'), 'સાંજ', 'late evening'); - assert.equal(moment([2011, 2, 23, 21, 20]).format('A'), 'રાત', 'night'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '૧ ૦૧ ૧', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '૧ ૦૧ ૧', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '૨ ૦૨ ૨', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '૨ ૦૨ ૨', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '૩ ૦૩ ૩', 'Jan 15 2012 should be week 3'); + test('weeks year starting sunday format', function (assert) { + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', 'Jan 1 2012 should be week 1'); + assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1', 'Jan 7 2012 should be week 1'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 should be week 2'); + assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2', 'Jan 14 2012 should be week 2'); + assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 should be week 3'); }); }))); @@ -24488,11 +26988,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -24531,6 +27032,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -24558,10 +27078,10 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('he'); + localeModule('hi'); test('parse', function (assert) { - var tests = 'ינואר ינו׳_פברואר פבר׳_מרץ מרץ_אפריל אפר׳_מאי מאי_יוני יוני_יולי יולי_אוגוסט אוג׳_ספטמבר ספט׳_אוקטובר אוק׳_נובמבר נוב׳_דצמבר דצמ׳'.split('_'), i; + var tests = 'जनवरी जन._फ़रवरी फ़र._मार्च मार्च_अप्रैल अप्रै._मई मई_जून जून_जुलाई जुल._अगस्त अग._सितम्बर सित._अक्टूबर अक्टू._नवम्बर नव._दिसम्बर दिस.'.split('_'), i; function equalTest(input, mmm, i) { assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); } @@ -24580,29 +27100,28 @@ test('format', function (assert) { var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'ראשון, פברואר 14 2010, 3:25:50 אחה"צ'], - ['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 ראשון א׳ א'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '8 8 08'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'אחה"צ אחרי הצהריים'], - ['[the] DDDo [day of the year]', 'the 45 day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 בפברואר 2010'], - ['LLL', '14 בפברואר 2010 15:25'], - ['LLLL', 'ראשון, 14 בפברואר 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 פבר׳ 2010'], - ['lll', '14 פבר׳ 2010 15:25'], - ['llll', 'א׳, 14 פבר׳ 2010 15:25'] + ['dddd, Do MMMM YYYY, a h:mm:ss बजे', 'रविवार, १४ फ़रवरी २०१०, दोपहर ३:२५:५० बजे'], + ['ddd, a h बजे', 'रवि, दोपहर ३ बजे'], + ['M Mo MM MMMM MMM', '२ २ ०२ फ़रवरी फ़र.'], + ['YYYY YY', '२०१० १०'], + ['D Do DD', '१४ १४ १४'], + ['d do dddd ddd dd', '० ० रविवार रवि र'], + ['DDD DDDo DDDD', '४५ ४५ ०४५'], + ['w wo ww', '८ ८ ०८'], + ['h hh', '३ ०३'], + ['H HH', '१५ १५'], + ['m mm', '२५ २५'], + ['s ss', '५० ५०'], + ['a A', 'दोपहर दोपहर'], + ['LTS', 'दोपहर ३:२५:५० बजे'], + ['L', '१४/०२/२०१०'], + ['LL', '१४ फ़रवरी २०१०'], + ['LLL', '१४ फ़रवरी २०१०, दोपहर ३:२५ बजे'], + ['LLLL', 'रविवार, १४ फ़रवरी २०१०, दोपहर ३:२५ बजे'], + ['l', '१४/२/२०१०'], + ['ll', '१४ फ़र. २०१०'], + ['lll', '१४ फ़र. २०१०, दोपहर ३:२५ बजे'], + ['llll', 'रवि, १४ फ़र. २०१०, दोपहर ३:२५ बजे'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; @@ -24611,15 +27130,52 @@ } }); + test('format ordinal', function (assert) { + assert.equal(moment([2011, 0, 1]).format('DDDo'), '१', '१'); + assert.equal(moment([2011, 0, 2]).format('DDDo'), '२', '२'); + assert.equal(moment([2011, 0, 3]).format('DDDo'), '३', '३'); + assert.equal(moment([2011, 0, 4]).format('DDDo'), '४', '४'); + assert.equal(moment([2011, 0, 5]).format('DDDo'), '५', '५'); + assert.equal(moment([2011, 0, 6]).format('DDDo'), '६', '६'); + assert.equal(moment([2011, 0, 7]).format('DDDo'), '७', '७'); + assert.equal(moment([2011, 0, 8]).format('DDDo'), '८', '८'); + assert.equal(moment([2011, 0, 9]).format('DDDo'), '९', '९'); + assert.equal(moment([2011, 0, 10]).format('DDDo'), '१०', '१०'); + + assert.equal(moment([2011, 0, 11]).format('DDDo'), '११', '११'); + assert.equal(moment([2011, 0, 12]).format('DDDo'), '१२', '१२'); + assert.equal(moment([2011, 0, 13]).format('DDDo'), '१३', '१३'); + assert.equal(moment([2011, 0, 14]).format('DDDo'), '१४', '१४'); + assert.equal(moment([2011, 0, 15]).format('DDDo'), '१५', '१५'); + assert.equal(moment([2011, 0, 16]).format('DDDo'), '१६', '१६'); + assert.equal(moment([2011, 0, 17]).format('DDDo'), '१७', '१७'); + assert.equal(moment([2011, 0, 18]).format('DDDo'), '१८', '१८'); + assert.equal(moment([2011, 0, 19]).format('DDDo'), '१९', '१९'); + assert.equal(moment([2011, 0, 20]).format('DDDo'), '२०', '२०'); + + assert.equal(moment([2011, 0, 21]).format('DDDo'), '२१', '२१'); + assert.equal(moment([2011, 0, 22]).format('DDDo'), '२२', '२२'); + assert.equal(moment([2011, 0, 23]).format('DDDo'), '२३', '२३'); + assert.equal(moment([2011, 0, 24]).format('DDDo'), '२४', '२४'); + assert.equal(moment([2011, 0, 25]).format('DDDo'), '२५', '२५'); + assert.equal(moment([2011, 0, 26]).format('DDDo'), '२६', '२६'); + assert.equal(moment([2011, 0, 27]).format('DDDo'), '२७', '२७'); + assert.equal(moment([2011, 0, 28]).format('DDDo'), '२८', '२८'); + assert.equal(moment([2011, 0, 29]).format('DDDo'), '२९', '२९'); + assert.equal(moment([2011, 0, 30]).format('DDDo'), '३०', '३०'); + + assert.equal(moment([2011, 0, 31]).format('DDDo'), '३१', '३१'); + }); + test('format month', function (assert) { - var expected = 'ינואר ינו׳_פברואר פבר׳_מרץ מרץ_אפריל אפר׳_מאי מאי_יוני יוני_יולי יולי_אוגוסט אוג׳_ספטמבר ספט׳_אוקטובר אוק׳_נובמבר נוב׳_דצמבר דצמ׳'.split('_'), i; + var expected = 'जनवरी जन._फ़रवरी फ़र._मार्च मार्च_अप्रैल अप्रै._मई मई_जून जून_जुलाई जुल._अगस्त अग._सितम्बर सित._अक्टूबर अक्टू._नवम्बर नव._दिसम्बर दिस.'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); test('format week', function (assert) { - var expected = 'ראשון א׳ א|שני ב׳ ב|שלישי ג׳ ג|רביעי ד׳ ד|חמישי ה׳ ה|שישי ו׳ ו|שבת ש׳ ש'.split('|'), i; + var expected = 'रविवार रवि र_सोमवार सोम सो_मंगलवार मंगल मं_बुधवार बुध बु_गुरूवार गुरू गु_शुक्रवार शुक्र शु_शनिवार शनि श'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); } @@ -24627,84 +27183,83 @@ test('from', function (assert) { var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'מספר שניות', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'דקה', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'דקה', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 דקות', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 דקות', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'שעה', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'שעה', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), 'שעתיים', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 שעות', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 שעות', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'יום', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'יום', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), 'יומיים', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'יום', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 ימים', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 ימים', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'חודש', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'חודש', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'חודש', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), 'חודשיים', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), 'חודשיים', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 חודשים', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'חודש', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 חודשים', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'שנה', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), 'שנתיים', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 3699}), true), '10 שנים', '345 days = 10 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 7340}), true), '20 שנה', '548 days = 20 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'שנה', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 שנים', '5 years = 5 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'कुछ ही क्षण', '44 seconds = a few seconds'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'एक मिनट', '45 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'एक मिनट', '89 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '२ मिनट', '90 seconds = 2 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '४४ मिनट', '44 minutes = 44 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'एक घंटा', '45 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'एक घंटा', '89 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '२ घंटे', '90 minutes = 2 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '५ घंटे', '5 hours = 5 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '२१ घंटे', '21 hours = 21 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'एक दिन', '22 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'एक दिन', '35 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '२ दिन', '36 hours = 2 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'एक दिन', '1 day = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '५ दिन', '5 days = 5 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '२५ दिन', '25 days = 25 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'एक महीने', '26 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'एक महीने', '30 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'एक महीने', '43 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '२ महीने', '46 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '२ महीने', '75 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '३ महीने', '76 days = 3 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'एक महीने', '1 month = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '५ महीने', '5 months = 5 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'एक वर्ष', '345 days = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '२ वर्ष', '548 days = 2 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'एक वर्ष', '1 year = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '५ वर्ष', '5 years = 5 years'); }); test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'בעוד מספר שניות', 'prefix'); - assert.equal(moment(0).from(30000), 'לפני מספר שניות', 'suffix'); + assert.equal(moment(30000).from(0), 'कुछ ही क्षण में', 'prefix'); + assert.equal(moment(0).from(30000), 'कुछ ही क्षण पहले', 'suffix'); }); test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'לפני מספר שניות', 'now from now should display as in the past'); + assert.equal(moment().fromNow(), 'कुछ ही क्षण पहले', 'now from now should display as in the past'); }); test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'בעוד מספר שניות', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'בעוד 5 ימים', 'in 5 days'); + assert.equal(moment().add({s: 30}).fromNow(), 'कुछ ही क्षण में', 'कुछ ही क्षण में'); + assert.equal(moment().add({d: 5}).fromNow(), '५ दिन में', '५ दिन में'); }); test('calendar day', function (assert) { var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'היום ב־12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'היום ב־12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'היום ב־13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'מחר ב־12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'היום ב־11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'אתמול ב־12:00', 'yesterday at the same time'); + assert.equal(moment(a).calendar(), 'आज दोपहर १२:०० बजे', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'आज दोपहर १२:२५ बजे', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 3}).calendar(), 'आज दोपहर ३:०० बजे', 'Now plus 3 hours'); + assert.equal(moment(a).add({d: 1}).calendar(), 'कल दोपहर १२:०० बजे', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'आज दोपहर ११:०० बजे', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'कल दोपहर १२:०० बजे', 'yesterday at the same time'); }); test('calendar next week', function (assert) { var i, m; for (i = 2; i < 7; i++) { m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [בשעה] LT'), 'Today + ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [בשעה] LT'), 'Today + ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [בשעה] LT'), 'Today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days end of day'); } }); test('calendar last week', function (assert) { var i, m; + for (i = 2; i < 7; i++) { m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[ביום] dddd [האחרון בשעה] LT'), 'Today - ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('[पिछले] dddd[,] LT'), 'Today - ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[ביום] dddd [האחרון בשעה] LT'), 'Today - ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('[पिछले] dddd[,] LT'), 'Today - ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[ביום] dddd [האחרון בשעה] LT'), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[पिछले] dddd[,] LT'), 'Today - ' + i + ' days end of day'); } }); @@ -24722,12 +27277,28 @@ assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); }); - test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 should be week 3'); + test('meridiem', function (assert) { + assert.equal(moment([2011, 2, 23, 2, 30]).format('a'), 'रात', 'before dawn'); + assert.equal(moment([2011, 2, 23, 9, 30]).format('a'), 'सुबह', 'morning'); + assert.equal(moment([2011, 2, 23, 14, 30]).format('a'), 'दोपहर', 'during day'); + assert.equal(moment([2011, 2, 23, 17, 30]).format('a'), 'शाम', 'evening'); + assert.equal(moment([2011, 2, 23, 19, 30]).format('a'), 'शाम', 'late evening'); + assert.equal(moment([2011, 2, 23, 21, 20]).format('a'), 'रात', 'night'); + + assert.equal(moment([2011, 2, 23, 2, 30]).format('A'), 'रात', 'before dawn'); + assert.equal(moment([2011, 2, 23, 9, 30]).format('A'), 'सुबह', 'morning'); + assert.equal(moment([2011, 2, 23, 14, 30]).format('A'), 'दोपहर', ' during day'); + assert.equal(moment([2011, 2, 23, 17, 30]).format('A'), 'शाम', 'evening'); + assert.equal(moment([2011, 2, 23, 19, 30]).format('A'), 'शाम', 'late evening'); + assert.equal(moment([2011, 2, 23, 21, 20]).format('A'), 'रात', 'night'); + }); + + test('weeks year starting sunday formatted', function (assert) { + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '१ ०१ १', 'Jan 1 2012 should be week 1'); + assert.equal(moment([2012, 0, 7]).format('w ww wo'), '१ ०१ १', 'Jan 7 2012 should be week 1'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '२ ०२ २', 'Jan 8 2012 should be week 2'); + assert.equal(moment([2012, 0, 14]).format('w ww wo'), '२ ०२ २', 'Jan 14 2012 should be week 2'); + assert.equal(moment([2012, 0, 15]).format('w ww wo'), '३ ०३ ३', 'Jan 15 2012 should be week 3'); }); }))); @@ -24925,11 +27496,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -24968,6 +27540,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -24995,10 +27586,10 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('hi'); + localeModule('hr'); test('parse', function (assert) { - var tests = 'जनवरी जन._फ़रवरी फ़र._मार्च मार्च_अप्रैल अप्रै._मई मई_जून जून_जुलाई जुल._अगस्त अग._सितम्बर सित._अक्टूबर अक्टू._नवम्बर नव._दिसम्बर दिस.'.split('_'), i; + var tests = 'siječanj sij._veljača velj._ožujak ožu._travanj tra._svibanj svi._lipanj lip._srpanj srp._kolovoz kol._rujan ruj._listopad lis._studeni stu._prosinac pro.'.split('_'), i; function equalTest(input, mmm, i) { assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); } @@ -25017,28 +27608,29 @@ test('format', function (assert) { var a = [ - ['dddd, Do MMMM YYYY, a h:mm:ss बजे', 'रविवार, १४ फ़रवरी २०१०, दोपहर ३:२५:५० बजे'], - ['ddd, a h बजे', 'रवि, दोपहर ३ बजे'], - ['M Mo MM MMMM MMM', '२ २ ०२ फ़रवरी फ़र.'], - ['YYYY YY', '२०१० १०'], - ['D Do DD', '१४ १४ १४'], - ['d do dddd ddd dd', '० ० रविवार रवि र'], - ['DDD DDDo DDDD', '४५ ४५ ०४५'], - ['w wo ww', '८ ८ ०८'], - ['h hh', '३ ०३'], - ['H HH', '१५ १५'], - ['m mm', '२५ २५'], - ['s ss', '५० ५०'], - ['a A', 'दोपहर दोपहर'], - ['LTS', 'दोपहर ३:२५:५० बजे'], - ['L', '१४/०२/२०१०'], - ['LL', '१४ फ़रवरी २०१०'], - ['LLL', '१४ फ़रवरी २०१०, दोपहर ३:२५ बजे'], - ['LLLL', 'रविवार, १४ फ़रवरी २०१०, दोपहर ३:२५ बजे'], - ['l', '१४/२/२०१०'], - ['ll', '१४ फ़र. २०१०'], - ['lll', '१४ फ़र. २०१०, दोपहर ३:२५ बजे'], - ['llll', 'रवि, १४ फ़र. २०१०, दोपहर ३:२५ बजे'] + ['dddd, Do MMMM YYYY, h:mm:ss a', 'nedjelja, 14. veljače 2010, 3:25:50 pm'], + ['ddd, hA', 'ned., 3PM'], + ['M Mo MM MMMM MMM', '2 2. 02 veljača velj.'], + ['YYYY YY', '2010 10'], + ['D Do DD', '14 14. 14'], + ['d do dddd ddd dd', '0 0. nedjelja ned. ne'], + ['DDD DDDo DDDD', '45 45. 045'], + ['w wo ww', '7 7. 07'], + ['h hh', '3 03'], + ['H HH', '15 15'], + ['m mm', '25 25'], + ['s ss', '50 50'], + ['a A', 'pm PM'], + ['[the] DDDo [day of the year]', 'the 45. day of the year'], + ['LTS', '15:25:50'], + ['L', '14.02.2010'], + ['LL', '14. veljača 2010'], + ['LLL', '14. veljača 2010 15:25'], + ['LLLL', 'nedjelja, 14. veljača 2010 15:25'], + ['l', '14.2.2010'], + ['ll', '14. velj. 2010'], + ['lll', '14. velj. 2010 15:25'], + ['llll', 'ned., 14. velj. 2010 15:25'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; @@ -25048,51 +27640,51 @@ }); test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '१', '१'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '२', '२'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '३', '३'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '४', '४'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '५', '५'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '६', '६'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '७', '७'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '८', '८'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '९', '९'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '१०', '१०'); + assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); + assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); + assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); + assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); + assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); + assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); + assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); + assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); + assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); + assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - assert.equal(moment([2011, 0, 11]).format('DDDo'), '११', '११'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '१२', '१२'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '१३', '१३'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '१४', '१४'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '१५', '१५'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '१६', '१६'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '१७', '१७'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '१८', '१८'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '१९', '१९'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '२०', '२०'); + assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); + assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); + assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); + assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); + assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); + assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); + assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); + assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); + assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); + assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - assert.equal(moment([2011, 0, 21]).format('DDDo'), '२१', '२१'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '२२', '२२'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '२३', '२३'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '२४', '२४'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '२५', '२५'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '२६', '२६'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '२७', '२७'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '२८', '२८'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '२९', '२९'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '३०', '३०'); + assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); + assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); + assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); + assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); + assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); + assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); + assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); + assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); + assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); + assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - assert.equal(moment([2011, 0, 31]).format('DDDo'), '३१', '३१'); + assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); }); test('format month', function (assert) { - var expected = 'जनवरी जन._फ़रवरी फ़र._मार्च मार्च_अप्रैल अप्रै._मई मई_जून जून_जुलाई जुल._अगस्त अग._सितम्बर सित._अक्टूबर अक्टू._नवम्बर नव._दिसम्बर दिस.'.split('_'), i; + var expected = 'siječanj sij._veljača velj._ožujak ožu._travanj tra._svibanj svi._lipanj lip._srpanj srp._kolovoz kol._rujan ruj._listopad lis._studeni stu._prosinac pro.'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); test('format week', function (assert) { - var expected = 'रविवार रवि र_सोमवार सोम सो_मंगलवार मंगल मं_बुधवार बुध बु_गुरूवार गुरू गु_शुक्रवार शुक्र शु_शनिवार शनि श'.split('_'), i; + var expected = 'nedjelja ned. ne_ponedjeljak pon. po_utorak uto. ut_srijeda sri. sr_četvrtak čet. če_petak pet. pe_subota sub. su'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); } @@ -25100,83 +27692,115 @@ test('from', function (assert) { var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'कुछ ही क्षण', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'एक मिनट', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'एक मिनट', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '२ मिनट', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '४४ मिनट', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'एक घंटा', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'एक घंटा', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '२ घंटे', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '५ घंटे', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '२१ घंटे', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'एक दिन', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'एक दिन', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '२ दिन', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'एक दिन', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '५ दिन', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '२५ दिन', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'एक महीने', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'एक महीने', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'एक महीने', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '२ महीने', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '२ महीने', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '३ महीने', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'एक महीने', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '५ महीने', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'एक वर्ष', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '२ वर्ष', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'एक वर्ष', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '५ वर्ष', '5 years = 5 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'par sekundi', '44 seconds = a few seconds'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'jedna minuta', '45 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'jedna minuta', '89 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minute', '90 seconds = 2 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuta', '44 minutes = 44 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'jedan sat', '45 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'jedan sat', '89 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 sata', '90 minutes = 2 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 sati', '5 hours = 5 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 sati', '21 hours = 21 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'dan', '22 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'dan', '35 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dana', '36 hours = 2 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'dan', '1 day = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dana', '5 days = 5 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dana', '25 days = 25 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mjesec', '26 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mjesec', '30 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mjesec', '43 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mjeseca', '46 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mjeseca', '75 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mjeseca', '76 days = 3 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mjesec', '1 month = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mjeseci', '5 months = 5 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'godinu', '345 days = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 godine', '548 days = 2 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'godinu', '1 year = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 godina', '5 years = 5 years'); }); test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'कुछ ही क्षण में', 'prefix'); - assert.equal(moment(0).from(30000), 'कुछ ही क्षण पहले', 'suffix'); + assert.equal(moment(30000).from(0), 'za par sekundi', 'prefix'); + assert.equal(moment(0).from(30000), 'prije par sekundi', 'prefix'); }); test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'कुछ ही क्षण पहले', 'now from now should display as in the past'); + assert.equal(moment().fromNow(), 'prije par sekundi', 'now from now should display as in the past'); }); test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'कुछ ही क्षण में', 'कुछ ही क्षण में'); - assert.equal(moment().add({d: 5}).fromNow(), '५ दिन में', '५ दिन में'); + assert.equal(moment().add({s: 30}).fromNow(), 'za par sekundi', 'in a few seconds'); + assert.equal(moment().add({d: 5}).fromNow(), 'za 5 dana', 'in 5 days'); }); test('calendar day', function (assert) { var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'आज दोपहर १२:०० बजे', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'आज दोपहर १२:२५ बजे', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 3}).calendar(), 'आज दोपहर ३:०० बजे', 'Now plus 3 hours'); - assert.equal(moment(a).add({d: 1}).calendar(), 'कल दोपहर १२:०० बजे', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'आज दोपहर ११:०० बजे', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'कल दोपहर १२:०० बजे', 'yesterday at the same time'); + assert.equal(moment(a).calendar(), 'danas u 12:00', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'danas u 12:25', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'danas u 13:00', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'sutra u 12:00', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'danas u 11:00', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'jučer u 12:00', 'yesterday at the same time'); }); test('calendar next week', function (assert) { var i, m; + + function makeFormat(d) { + switch (d.day()) { + case 0: + return '[u] [nedjelju] [u] LT'; + case 3: + return '[u] [srijedu] [u] LT'; + case 6: + return '[u] [subotu] [u] LT'; + case 1: + case 2: + case 4: + case 5: + return '[u] dddd [u] LT'; + } + } + for (i = 2; i < 7; i++) { m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days current time'); + assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days end of day'); } }); test('calendar last week', function (assert) { var i, m; + function makeFormat(d) { + switch (d.day()) { + case 0: + case 3: + return '[prošlu] dddd [u] LT'; + case 6: + return '[prošle] [subote] [u] LT'; + case 1: + case 2: + case 4: + case 5: + return '[prošli] dddd [u] LT'; + } + } + for (i = 2; i < 7; i++) { m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[पिछले] dddd[,] LT'), 'Today - ' + i + ' days current time'); + assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[पिछले] dddd[,] LT'), 'Today - ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[पिछले] dddd[,] LT'), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days end of day'); } }); @@ -25194,28 +27818,12 @@ assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); }); - test('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 2, 30]).format('a'), 'रात', 'before dawn'); - assert.equal(moment([2011, 2, 23, 9, 30]).format('a'), 'सुबह', 'morning'); - assert.equal(moment([2011, 2, 23, 14, 30]).format('a'), 'दोपहर', 'during day'); - assert.equal(moment([2011, 2, 23, 17, 30]).format('a'), 'शाम', 'evening'); - assert.equal(moment([2011, 2, 23, 19, 30]).format('a'), 'शाम', 'late evening'); - assert.equal(moment([2011, 2, 23, 21, 20]).format('a'), 'रात', 'night'); - - assert.equal(moment([2011, 2, 23, 2, 30]).format('A'), 'रात', 'before dawn'); - assert.equal(moment([2011, 2, 23, 9, 30]).format('A'), 'सुबह', 'morning'); - assert.equal(moment([2011, 2, 23, 14, 30]).format('A'), 'दोपहर', ' during day'); - assert.equal(moment([2011, 2, 23, 17, 30]).format('A'), 'शाम', 'evening'); - assert.equal(moment([2011, 2, 23, 19, 30]).format('A'), 'शाम', 'late evening'); - assert.equal(moment([2011, 2, 23, 21, 20]).format('A'), 'रात', 'night'); - }); - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '१ ०१ १', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '१ ०१ १', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '२ ०२ २', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '२ ०२ २', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '३ ०३ ३', 'Jan 15 2012 should be week 3'); + assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1.', 'Dec 26 2011 should be week 1'); + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1.', 'Jan 1 2012 should be week 1'); + assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2.', 'Jan 2 2012 should be week 2'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2.', 'Jan 8 2012 should be week 2'); + assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3.', 'Jan 9 2012 should be week 3'); }); }))); @@ -25413,11 +28021,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -25456,6 +28065,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -25483,10 +28111,11 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('hr'); + localeModule('hu'); test('parse', function (assert) { - var tests = 'siječanj sij._veljača velj._ožujak ožu._travanj tra._svibanj svi._lipanj lip._srpanj srp._kolovoz kol._rujan ruj._listopad lis._studeni stu._prosinac pro.'.split('_'), i; + var tests = 'január jan_február feb_március márc_április ápr_május máj_június jún_július júl_augusztus aug_szeptember szept_október okt_november nov_december dec'.split('_'), + i; function equalTest(input, mmm, i) { assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); } @@ -25505,29 +28134,27 @@ test('format', function (assert) { var a = [ - ['dddd, Do MMMM YYYY, h:mm:ss a', 'nedjelja, 14. veljače 2010, 3:25:50 pm'], - ['ddd, hA', 'ned., 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 veljača velj.'], + ['dddd, MMMM Do YYYY, HH:mm:ss', 'vasárnap, február 14. 2010, 15:25:50'], + ['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 dd', '0 0. nedjelja ned. ne'], + ['d do dddd ddd dd', '0 0. vasárnap vas v'], ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '7 7. 07'], - ['h hh', '3 03'], + ['w wo ww', '6 6. 06'], ['H HH', '15 15'], ['m mm', '25 25'], ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], + ['[az év] DDDo [napja]', 'az év 45. napja'], ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14. veljača 2010'], - ['LLL', '14. veljača 2010 15:25'], - ['LLLL', 'nedjelja, 14. veljača 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14. velj. 2010'], - ['lll', '14. velj. 2010 15:25'], - ['llll', 'ned., 14. velj. 2010 15:25'] + ['L', '2010.02.14.'], + ['LL', '2010. február 14.'], + ['LLL', '2010. február 14. 15:25'], + ['LLLL', '2010. február 14., vasárnap 15:25'], + ['l', '2010.2.14.'], + ['ll', '2010. feb 14.'], + ['lll', '2010. feb 14. 15:25'], + ['llll', '2010. feb 14., vas 15:25'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; @@ -25536,6 +28163,18 @@ } }); + test('meridiem', function (assert) { + assert.equal(moment([2011, 2, 23, 0, 0]).format('a'), 'de', 'am'); + assert.equal(moment([2011, 2, 23, 11, 59]).format('a'), 'de', 'am'); + assert.equal(moment([2011, 2, 23, 12, 0]).format('a'), 'du', 'pm'); + assert.equal(moment([2011, 2, 23, 23, 59]).format('a'), 'du', 'pm'); + + assert.equal(moment([2011, 2, 23, 0, 0]).format('A'), 'DE', 'AM'); + assert.equal(moment([2011, 2, 23, 11, 59]).format('A'), 'DE', 'AM'); + assert.equal(moment([2011, 2, 23, 12, 0]).format('A'), 'DU', 'PM'); + assert.equal(moment([2011, 2, 23, 23, 59]).format('A'), 'DU', 'PM'); + }); + test('format ordinal', function (assert) { assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); @@ -25574,130 +28213,100 @@ }); test('format month', function (assert) { - var expected = 'siječanj sij._veljača velj._ožujak ožu._travanj tra._svibanj svi._lipanj lip._srpanj srp._kolovoz kol._rujan ruj._listopad lis._studeni stu._prosinac pro.'.split('_'), i; + var expected = 'január jan_február feb_március márc_április ápr_május máj_június jún_július júl_augusztus aug_szeptember szept_október okt_november nov_december dec'.split('_'), + i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); test('format week', function (assert) { - var expected = 'nedjelja ned. ne_ponedjeljak pon. po_utorak uto. ut_srijeda sri. sr_četvrtak čet. če_petak pet. pe_subota sub. su'.split('_'), i; + 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; for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); + assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd'), expected[i], expected[i]); } }); test('from', function (assert) { var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'par sekundi', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'jedna minuta', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'jedna minuta', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minute', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuta', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'jedan sat', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'jedan sat', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 sata', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 sati', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 sati', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'dan', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'dan', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dana', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'dan', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dana', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dana', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mjesec', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mjesec', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mjesec', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mjeseca', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mjeseca', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mjeseca', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mjesec', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mjeseci', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'godinu', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 godine', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'godinu', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 godina', '5 years = 5 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'néhány másodperc', '44 másodperc = néhány másodperc'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'egy perc', '45 másodperc = egy perc'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'egy perc', '89 másodperc = egy perc'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 perc', '90 másodperc = 2 perc'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 perc', '44 perc = 44 perc'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'egy óra', '45 perc = egy óra'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'egy óra', '89 perc = egy óra'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 óra', '90 perc = 2 óra'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 óra', '5 óra = 5 óra'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 óra', '21 óra = 21 óra'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'egy nap', '22 óra = egy nap'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'egy nap', '35 óra = egy nap'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 nap', '36 óra = 2 nap'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'egy nap', '1 nap = egy nap'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 nap', '5 nap = 5 nap'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 nap', '25 nap = 25 nap'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'egy hónap', '26 nap = egy hónap'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'egy hónap', '30 nap = egy hónap'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'egy hónap', '45 nap = egy hónap'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 hónap', '46 nap = 2 hónap'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 hónap', '75 nap = 2 hónap'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 hónap', '76 nap = 3 hónap'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'egy hónap', '1 hónap = egy hónap'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 hónap', '5 hónap = 5 hónap'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'egy év', '345 nap = egy év'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 év', '548 nap = 2 év'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'egy év', '1 év = egy év'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 év', '5 év = 5 év'); }); test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'za par sekundi', 'prefix'); - assert.equal(moment(0).from(30000), 'prije par sekundi', 'prefix'); + assert.equal(moment(30000).from(0), 'néhány másodperc múlva', 'prefix'); + assert.equal(moment(0).from(30000), 'néhány másodperce', 'suffix'); }); test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'prije par sekundi', 'now from now should display as in the past'); + assert.equal(moment().fromNow(), 'néhány másodperce', 'now from now should display as in the past'); }); test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'za par sekundi', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'za 5 dana', 'in 5 days'); + assert.equal(moment().add({s: 30}).fromNow(), 'néhány másodperc múlva', 'néhány másodperc múlva'); + assert.equal(moment().add({d: 5}).fromNow(), '5 nap múlva', '5 nap múlva'); }); test('calendar day', function (assert) { var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'danas u 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'danas u 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'danas u 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'sutra u 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'danas u 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'jučer u 12:00', 'yesterday at the same time'); + assert.equal(moment(a).calendar(), 'ma 12:00-kor', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'ma 12:25-kor', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'ma 13:00-kor', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'holnap 12:00-kor', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'ma 11:00-kor', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'tegnap 12:00-kor', 'yesterday at the same time'); }); test('calendar next week', function (assert) { - var i, m; - - function makeFormat(d) { - switch (d.day()) { - case 0: - return '[u] [nedjelju] [u] LT'; - case 3: - return '[u] [srijedu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - } - + var i, m, days = 'vasárnap_hétfőn_kedden_szerdán_csütörtökön_pénteken_szombaton'.split('_'); for (i = 2; i < 7; i++) { m = moment().add({d: i}); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('[' + days[m.day()] + '] LT[-kor]'), 'today + ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('[' + days[m.day()] + '] LT[-kor]'), 'today + ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[' + days[m.day()] + '] LT[-kor]'), 'today + ' + i + ' days end of day'); } }); test('calendar last week', function (assert) { - var i, m; - - function makeFormat(d) { - switch (d.day()) { - case 0: - case 3: - return '[prošlu] dddd [u] LT'; - case 6: - return '[prošle] [subote] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[prošli] dddd [u] LT'; - } - } + var i, m, days = 'vasárnap_hétfőn_kedden_szerdán_csütörtökön_pénteken_szombaton'.split('_'); for (i = 2; i < 7; i++) { m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('[múlt ' + days[m.day()] + '] LT[-kor]'), 'today - ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('[múlt ' + days[m.day()] + '] LT[-kor]'), 'today - ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[múlt ' + days[m.day()] + '] LT[-kor]'), 'today - ' + i + ' days end of day'); } }); @@ -25705,22 +28314,22 @@ var weeksAgo = moment().subtract({w: 1}), weeksFromNow = moment().add({w: 1}); - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), 'egy héte'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'egy hét múlva'); weeksAgo = moment().subtract({w: 2}); weeksFromNow = moment().add({w: 2}); - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 hete'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), '2 hét múlva'); }); test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1.', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1.', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2.', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2.', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3.', 'Jan 9 2012 should be week 3'); + assert.equal(moment([2011, 11, 26]).format('w ww wo'), '52 52 52.', 'Dec 26 2011 should be week 52'); + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); + assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); + assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); }); }))); @@ -25918,11 +28527,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -25961,6 +28571,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -25988,11 +28617,10 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('hu'); + localeModule('hy-am'); test('parse', function (assert) { - var tests = 'január jan_február feb_március márc_április ápr_május máj_június jún_július júl_augusztus aug_szeptember szept_október okt_november nov_december dec'.split('_'), - i; + var tests = 'հունվար հնվ_փետրվար փտր_մարտ մրտ_ապրիլ ապր_մայիս մյս_հունիս հնս_հուլիս հլս_օգոստոս օգս_սեպտեմբեր սպտ_հոկտեմբեր հկտ_նոյեմբեր նմբ_դեկտեմբեր դկտ'.split('_'), i; function equalTest(input, mmm, i) { assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); } @@ -26009,29 +28637,35 @@ } }); + test('parse exceptional case', function (assert) { + assert.equal(moment('11 մայիսի 1989', ['DD MMMM YYYY']).format('DD-MM-YYYY'), '11-05-1989'); + }); + test('format', function (assert) { var a = [ - ['dddd, MMMM Do YYYY, HH:mm:ss', 'vasárnap, február 14. 2010, 15:25:50'], - ['ddd, HH', 'vas, 15'], - ['M Mo MM MMMM MMM', '2 2. 02 február feb'], + ['dddd, Do MMMM YYYY, HH:mm:ss', 'կիրակի, 14 փետրվարի 2010, 15:25:50'], + ['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. vasárnap vas v'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '6 6. 06'], + ['D Do DD', '14 14 14'], + ['d do dddd ddd dd', '0 0 կիրակի կրկ կրկ'], + ['DDD DDDo DDDD', '45 45-րդ 045'], + ['w wo ww', '7 7-րդ 07'], + ['h hh', '3 03'], ['H HH', '15 15'], ['m mm', '25 25'], ['s ss', '50 50'], - ['[az év] DDDo [napja]', 'az év 45. napja'], + ['a A', 'ցերեկվա ցերեկվա'], + ['[տարվա] DDDo [օրը]', 'տարվա 45-րդ օրը'], ['LTS', '15:25:50'], - ['L', '2010.02.14.'], - ['LL', '2010. február 14.'], - ['LLL', '2010. február 14. 15:25'], - ['LLLL', '2010. február 14., vasárnap 15:25'], - ['l', '2010.2.14.'], - ['ll', '2010. feb 14.'], - ['lll', '2010. feb 14. 15:25'], - ['llll', '2010. feb 14., vas 15:25'] + ['L', '14.02.2010'], + ['LL', '14 փետրվարի 2010 թ.'], + ['LLL', '14 փետրվարի 2010 թ., 15:25'], + ['LLLL', 'կիրակի, 14 փետրվարի 2010 թ., 15:25'], + ['l', '14.2.2010'], + ['ll', '14 փտր 2010 թ.'], + ['lll', '14 փտր 2010 թ., 15:25'], + ['llll', 'կրկ, 14 փտր 2010 թ., 15:25'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; @@ -26040,150 +28674,201 @@ } }); - test('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 0, 0]).format('a'), 'de', 'am'); - assert.equal(moment([2011, 2, 23, 11, 59]).format('a'), 'de', 'am'); - assert.equal(moment([2011, 2, 23, 12, 0]).format('a'), 'du', 'pm'); - assert.equal(moment([2011, 2, 23, 23, 59]).format('a'), 'du', 'pm'); - - assert.equal(moment([2011, 2, 23, 0, 0]).format('A'), 'DE', 'AM'); - assert.equal(moment([2011, 2, 23, 11, 59]).format('A'), 'DE', 'AM'); - assert.equal(moment([2011, 2, 23, 12, 0]).format('A'), 'DU', 'PM'); - assert.equal(moment([2011, 2, 23, 23, 59]).format('A'), 'DU', 'PM'); + test('format meridiem', function (assert) { + assert.equal(moment([2012, 11, 28, 0, 0]).format('A'), 'գիշերվա', 'night'); + assert.equal(moment([2012, 11, 28, 3, 59]).format('A'), 'գիշերվա', 'night'); + assert.equal(moment([2012, 11, 28, 4, 0]).format('A'), 'առավոտվա', 'morning'); + assert.equal(moment([2012, 11, 28, 11, 59]).format('A'), 'առավոտվա', 'morning'); + assert.equal(moment([2012, 11, 28, 12, 0]).format('A'), 'ցերեկվա', 'afternoon'); + assert.equal(moment([2012, 11, 28, 16, 59]).format('A'), 'ցերեկվա', 'afternoon'); + assert.equal(moment([2012, 11, 28, 17, 0]).format('A'), 'երեկոյան', 'evening'); + assert.equal(moment([2012, 11, 28, 23, 59]).format('A'), 'երեկոյան', 'evening'); }); test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); + assert.equal(moment([2011, 0, 1]).format('DDDo'), '1-ին', '1-ին'); + assert.equal(moment([2011, 0, 2]).format('DDDo'), '2-րդ', '2-րդ'); + assert.equal(moment([2011, 0, 3]).format('DDDo'), '3-րդ', '3-րդ'); + assert.equal(moment([2011, 0, 4]).format('DDDo'), '4-րդ', '4-րդ'); + assert.equal(moment([2011, 0, 5]).format('DDDo'), '5-րդ', '5-րդ'); + assert.equal(moment([2011, 0, 6]).format('DDDo'), '6-րդ', '6-րդ'); + assert.equal(moment([2011, 0, 7]).format('DDDo'), '7-րդ', '7-րդ'); + assert.equal(moment([2011, 0, 8]).format('DDDo'), '8-րդ', '8-րդ'); + assert.equal(moment([2011, 0, 9]).format('DDDo'), '9-րդ', '9-րդ'); + assert.equal(moment([2011, 0, 10]).format('DDDo'), '10-րդ', '10-րդ'); - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); + assert.equal(moment([2011, 0, 11]).format('DDDo'), '11-րդ', '11-րդ'); + assert.equal(moment([2011, 0, 12]).format('DDDo'), '12-րդ', '12-րդ'); + assert.equal(moment([2011, 0, 13]).format('DDDo'), '13-րդ', '13-րդ'); + assert.equal(moment([2011, 0, 14]).format('DDDo'), '14-րդ', '14-րդ'); + assert.equal(moment([2011, 0, 15]).format('DDDo'), '15-րդ', '15-րդ'); + assert.equal(moment([2011, 0, 16]).format('DDDo'), '16-րդ', '16-րդ'); + assert.equal(moment([2011, 0, 17]).format('DDDo'), '17-րդ', '17-րդ'); + assert.equal(moment([2011, 0, 18]).format('DDDo'), '18-րդ', '18-րդ'); + assert.equal(moment([2011, 0, 19]).format('DDDo'), '19-րդ', '19-րդ'); + assert.equal(moment([2011, 0, 20]).format('DDDo'), '20-րդ', '20-րդ'); - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); + assert.equal(moment([2011, 0, 21]).format('DDDo'), '21-րդ', '21-րդ'); + assert.equal(moment([2011, 0, 22]).format('DDDo'), '22-րդ', '22-րդ'); + assert.equal(moment([2011, 0, 23]).format('DDDo'), '23-րդ', '23-րդ'); + assert.equal(moment([2011, 0, 24]).format('DDDo'), '24-րդ', '24-րդ'); + assert.equal(moment([2011, 0, 25]).format('DDDo'), '25-րդ', '25-րդ'); + assert.equal(moment([2011, 0, 26]).format('DDDo'), '26-րդ', '26-րդ'); + assert.equal(moment([2011, 0, 27]).format('DDDo'), '27-րդ', '27-րդ'); + assert.equal(moment([2011, 0, 28]).format('DDDo'), '28-րդ', '28-րդ'); + assert.equal(moment([2011, 0, 29]).format('DDDo'), '29-րդ', '29-րդ'); + assert.equal(moment([2011, 0, 30]).format('DDDo'), '30-րդ', '30-րդ'); - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); + assert.equal(moment([2011, 0, 31]).format('DDDo'), '31-րդ', '31-րդ'); }); test('format month', function (assert) { - var expected = 'január jan_február feb_március márc_április ápr_május máj_június jún_július júl_augusztus aug_szeptember szept_október okt_november nov_december dec'.split('_'), - i; + var expected = 'հունվար հնվ_փետրվար փտր_մարտ մրտ_ապրիլ ապր_մայիս մյս_հունիս հնս_հուլիս հլս_օգոստոս օգս_սեպտեմբեր սպտ_հոկտեմբեր հկտ_նոյեմբեր նմբ_դեկտեմբեր դկտ'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); + test('format month case', function (assert) { + var months = { + 'nominative': 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split('_'), + 'accusative': 'հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի'.split('_') + }, i; + for (i = 0; i < 12; i++) { + assert.equal(moment([2011, i, 1]).format('D MMMM'), '1 ' + months.accusative[i], '1 ' + months.accusative[i]); + assert.equal(moment([2011, i, 1]).format('MMMM'), months.nominative[i], '1 ' + months.nominative[i]); + } + }); + + test('format month short case', function (assert) { + var monthsShort = { + 'nominative': 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_'), + 'accusative': 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_') + }, i; + for (i = 0; i < 12; i++) { + assert.equal(moment([2011, i, 1]).format('D MMM'), '1 ' + monthsShort.accusative[i], '1 ' + monthsShort.accusative[i]); + assert.equal(moment([2011, i, 1]).format('MMM'), monthsShort.nominative[i], '1 ' + monthsShort.nominative[i]); + } + }); + + test('format month case with escaped symbols', function (assert) { + var months = { + 'nominative': 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split('_'), + 'accusative': 'հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի'.split('_') + }, i; + for (i = 0; i < 12; i++) { + assert.equal(moment([2013, i, 1]).format('D[] MMMM'), '1 ' + months.accusative[i], '1 ' + months.accusative[i]); + assert.equal(moment([2013, i, 1]).format('[]D[] []MMMM[]'), '1 ' + months.accusative[i] + '', '1 ' + months.accusative[i] + ''); + assert.equal(moment([2013, i, 1]).format('D[-ին օրը] MMMM'), '1-ին օրը ' + months.accusative[i], '1-ին օրը ' + months.accusative[i]); + assert.equal(moment([2013, i, 1]).format('D, MMMM'), '1, ' + months.nominative[i], '1, ' + months.nominative[i]); + } + }); + + test('format month short case with escaped symbols', function (assert) { + var monthsShort = { + 'nominative': 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_'), + 'accusative': 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_') + }, i; + for (i = 0; i < 12; i++) { + assert.equal(moment([2013, i, 1]).format('D[] MMM'), '1 ' + monthsShort.accusative[i], '1 ' + monthsShort.accusative[i]); + assert.equal(moment([2013, i, 1]).format('[]D[] []MMM[]'), '1 ' + monthsShort.accusative[i] + '', '1 ' + monthsShort.accusative[i] + ''); + assert.equal(moment([2013, i, 1]).format('D[-ին օրը] MMM'), '1-ին օրը ' + monthsShort.accusative[i], '1-ին օրը ' + monthsShort.accusative[i]); + assert.equal(moment([2013, i, 1]).format('D, MMM'), '1, ' + monthsShort.nominative[i], '1, ' + monthsShort.nominative[i]); + } + }); + test('format week', function (assert) { - 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; + var expected = 'կիրակի կրկ կրկ_երկուշաբթի երկ երկ_երեքշաբթի երք երք_չորեքշաբթի չրք չրք_հինգշաբթի հնգ հնգ_ուրբաթ ուրբ ուրբ_շաբաթ շբթ շբթ'.split('_'), i; for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd'), expected[i], expected[i]); + assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); } }); test('from', function (assert) { var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'néhány másodperc', '44 másodperc = néhány másodperc'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'egy perc', '45 másodperc = egy perc'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'egy perc', '89 másodperc = egy perc'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 perc', '90 másodperc = 2 perc'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 perc', '44 perc = 44 perc'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'egy óra', '45 perc = egy óra'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'egy óra', '89 perc = egy óra'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 óra', '90 perc = 2 óra'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 óra', '5 óra = 5 óra'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 óra', '21 óra = 21 óra'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'egy nap', '22 óra = egy nap'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'egy nap', '35 óra = egy nap'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 nap', '36 óra = 2 nap'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'egy nap', '1 nap = egy nap'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 nap', '5 nap = 5 nap'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 nap', '25 nap = 25 nap'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'egy hónap', '26 nap = egy hónap'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'egy hónap', '30 nap = egy hónap'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'egy hónap', '45 nap = egy hónap'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 hónap', '46 nap = 2 hónap'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 hónap', '75 nap = 2 hónap'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 hónap', '76 nap = 3 hónap'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'egy hónap', '1 hónap = egy hónap'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 hónap', '5 hónap = 5 hónap'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'egy év', '345 nap = egy év'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 év', '548 nap = 2 év'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'egy év', '1 év = egy év'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 év', '5 év = 5 év'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'մի քանի վայրկյան', '44 seconds = seconds'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'րոպե', '45 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'րոպե', '89 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 րոպե', '90 seconds = 2 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 րոպե', '44 minutes = 44 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ժամ', '45 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ժամ', '89 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 ժամ', '90 minutes = 2 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ժամ', '5 hours = 5 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 ժամ', '21 hours = 21 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'օր', '22 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'օր', '35 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 օր', '36 hours = 2 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'օր', '1 day = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 օր', '5 days = 5 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 11}), true), '11 օր', '11 days = 11 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 21}), true), '21 օր', '21 days = 21 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 օր', '25 days = 25 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ամիս', '26 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ամիս', '30 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ամիս', '43 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 ամիս', '46 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 ամիս', '75 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 ամիս', '76 days = 3 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ամիս', '1 month = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 ամիս', '5 months = 5 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'տարի', '345 days = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 տարի', '548 days = 2 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'տարի', '1 year = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 տարի', '5 years = 5 years'); }); test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'néhány másodperc múlva', 'prefix'); - assert.equal(moment(0).from(30000), 'néhány másodperce', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'néhány másodperce', 'now from now should display as in the past'); + assert.equal(moment(30000).from(0), 'մի քանի վայրկյան հետո', 'prefix'); + assert.equal(moment(0).from(30000), 'մի քանի վայրկյան առաջ', 'suffix'); }); test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'néhány másodperc múlva', 'néhány másodperc múlva'); - assert.equal(moment().add({d: 5}).fromNow(), '5 nap múlva', '5 nap múlva'); + assert.equal(moment().add({s: 30}).fromNow(), 'մի քանի վայրկյան հետո', 'in seconds'); + assert.equal(moment().add({d: 5}).fromNow(), '5 օր հետո', 'in 5 days'); }); test('calendar day', function (assert) { var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'ma 12:00-kor', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'ma 12:25-kor', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'ma 13:00-kor', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'holnap 12:00-kor', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'ma 11:00-kor', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'tegnap 12:00-kor', 'yesterday at the same time'); + assert.equal(moment(a).calendar(), 'այսօր 12:00', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'այսօր 12:25', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'այսօր 13:00', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'վաղը 12:00', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'այսօր 11:00', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'երեկ 12:00', 'yesterday at the same time'); }); test('calendar next week', function (assert) { - var i, m, days = 'vasárnap_hétfőn_kedden_szerdán_csütörtökön_pénteken_szombaton'.split('_'); + var i, m; + function makeFormat(d) { + return 'dddd [օրը ժամը] LT'; + } + for (i = 2; i < 7; i++) { m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('[' + days[m.day()] + '] LT[-kor]'), 'today + ' + i + ' days current time'); + assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[' + days[m.day()] + '] LT[-kor]'), 'today + ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[' + days[m.day()] + '] LT[-kor]'), 'today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days end of day'); } }); test('calendar last week', function (assert) { - var i, m, days = 'vasárnap_hétfőn_kedden_szerdán_csütörtökön_pénteken_szombaton'.split('_'); + var i, m; + + function makeFormat(d) { + return '[անցած] dddd [օրը ժամը] LT'; + } for (i = 2; i < 7; i++) { m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[múlt ' + days[m.day()] + '] LT[-kor]'), 'today - ' + i + ' days current time'); + assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[múlt ' + days[m.day()] + '] LT[-kor]'), 'today - ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[múlt ' + days[m.day()] + '] LT[-kor]'), 'today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days end of day'); } }); @@ -26191,22 +28876,22 @@ var weeksAgo = moment().subtract({w: 1}), weeksFromNow = moment().add({w: 1}); - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), 'egy héte'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'egy hét múlva'); + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); weeksAgo = moment().subtract({w: 2}); weeksFromNow = moment().add({w: 2}); - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 hete'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), '2 hét múlva'); + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); }); test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '52 52 52.', 'Dec 26 2011 should be week 52'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); + assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1-ին', 'Dec 26 2011 should be week 1'); + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1-ին', 'Jan 1 2012 should be week 1'); + assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2-րդ', 'Jan 2 2012 should be week 2'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2-րդ', 'Jan 8 2012 should be week 2'); + assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3-րդ', 'Jan 9 2012 should be week 3'); }); }))); @@ -26404,11 +29089,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -26447,6 +29133,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -26474,10 +29179,10 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('hy-am'); + localeModule('id'); test('parse', function (assert) { - var tests = 'հունվար հնվ_փետրվար փտր_մարտ մրտ_ապրիլ ապր_մայիս մյս_հունիս հնս_հուլիս հլս_օգոստոս օգս_սեպտեմբեր սպտ_հոկտեմբեր հկտ_նոյեմբեր նմբ_դեկտեմբեր դկտ'.split('_'), i; + var tests = 'Januari Jan_Februari Feb_Maret Mar_April Apr_Mei Mei_Juni Jun_Juli Jul_Agustus Agt_September Sep_Oktober Okt_November Nov_Desember Des'.split('_'), i; function equalTest(input, mmm, i) { assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); } @@ -26494,35 +29199,31 @@ } }); - test('parse exceptional case', function (assert) { - assert.equal(moment('11 մայիսի 1989', ['DD MMMM YYYY']).format('DD-MM-YYYY'), '11-05-1989'); - }); - test('format', function (assert) { var a = [ - ['dddd, Do MMMM YYYY, HH:mm:ss', 'կիրակի, 14 փետրվարի 2010, 15:25:50'], - ['ddd, h A', 'կրկ, 3 ցերեկվա'], - ['M Mo MM MMMM MMM', '2 2 02 փետրվար փտր'], + ['dddd, MMMM Do YYYY, h:mm:ss a', 'Minggu, Februari 14 2010, 3:25:50 sore'], + ['ddd, hA', 'Min, 3sore'], + ['M Mo MM MMMM MMM', '2 2 02 Februari Feb'], ['YYYY YY', '2010 10'], ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 կիրակի կրկ կրկ'], - ['DDD DDDo DDDD', '45 45-րդ 045'], - ['w wo ww', '7 7-րդ 07'], + ['d do dddd ddd dd', '0 0 Minggu Min Mg'], + ['DDD DDDo DDDD', '45 45 045'], + ['w wo ww', '7 7 07'], ['h hh', '3 03'], ['H HH', '15 15'], ['m mm', '25 25'], ['s ss', '50 50'], - ['a A', 'ցերեկվա ցերեկվա'], - ['[տարվա] DDDo [օրը]', 'տարվա 45-րդ օրը'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 փետրվարի 2010 թ.'], - ['LLL', '14 փետրվարի 2010 թ., 15:25'], - ['LLLL', 'կիրակի, 14 փետրվարի 2010 թ., 15:25'], - ['l', '14.2.2010'], - ['ll', '14 փտր 2010 թ.'], - ['lll', '14 փտր 2010 թ., 15:25'], - ['llll', 'կրկ, 14 փտր 2010 թ., 15:25'] + ['a A', 'sore sore'], + ['[the] DDDo [day of the year]', 'the 45 day of the year'], + ['LTS', '15.25.50'], + ['L', '14/02/2010'], + ['LL', '14 Februari 2010'], + ['LLL', '14 Februari 2010 pukul 15.25'], + ['LLLL', 'Minggu, 14 Februari 2010 pukul 15.25'], + ['l', '14/2/2010'], + ['ll', '14 Feb 2010'], + ['lll', '14 Feb 2010 pukul 15.25'], + ['llll', 'Min, 14 Feb 2010 pukul 15.25'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; @@ -26531,111 +29232,15 @@ } }); - test('format meridiem', function (assert) { - assert.equal(moment([2012, 11, 28, 0, 0]).format('A'), 'գիշերվա', 'night'); - assert.equal(moment([2012, 11, 28, 3, 59]).format('A'), 'գիշերվա', 'night'); - assert.equal(moment([2012, 11, 28, 4, 0]).format('A'), 'առավոտվա', 'morning'); - assert.equal(moment([2012, 11, 28, 11, 59]).format('A'), 'առավոտվա', 'morning'); - assert.equal(moment([2012, 11, 28, 12, 0]).format('A'), 'ցերեկվա', 'afternoon'); - assert.equal(moment([2012, 11, 28, 16, 59]).format('A'), 'ցերեկվա', 'afternoon'); - assert.equal(moment([2012, 11, 28, 17, 0]).format('A'), 'երեկոյան', 'evening'); - assert.equal(moment([2012, 11, 28, 23, 59]).format('A'), 'երեկոյան', 'evening'); - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1-ին', '1-ին'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2-րդ', '2-րդ'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3-րդ', '3-րդ'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4-րդ', '4-րդ'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5-րդ', '5-րդ'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6-րդ', '6-րդ'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7-րդ', '7-րդ'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8-րդ', '8-րդ'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9-րդ', '9-րդ'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10-րդ', '10-րդ'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11-րդ', '11-րդ'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12-րդ', '12-րդ'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13-րդ', '13-րդ'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14-րդ', '14-րդ'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15-րդ', '15-րդ'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16-րդ', '16-րդ'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17-րդ', '17-րդ'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18-րդ', '18-րդ'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19-րդ', '19-րդ'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20-րդ', '20-րդ'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21-րդ', '21-րդ'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22-րդ', '22-րդ'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23-րդ', '23-րդ'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24-րդ', '24-րդ'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25-րդ', '25-րդ'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26-րդ', '26-րդ'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27-րդ', '27-րդ'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28-րդ', '28-րդ'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29-րդ', '29-րդ'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30-րդ', '30-րդ'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31-րդ', '31-րդ'); - }); - test('format month', function (assert) { - var expected = 'հունվար հնվ_փետրվար փտր_մարտ մրտ_ապրիլ ապր_մայիս մյս_հունիս հնս_հուլիս հլս_օգոստոս օգս_սեպտեմբեր սպտ_հոկտեմբեր հկտ_նոյեմբեր նմբ_դեկտեմբեր դկտ'.split('_'), i; + var expected = 'Januari Jan_Februari Feb_Maret Mar_April Apr_Mei Mei_Juni Jun_Juli Jul_Agustus Agt_September Sep_Oktober Okt_November Nov_Desember Des'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); - test('format month case', function (assert) { - var months = { - 'nominative': 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split('_'), - 'accusative': 'հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի'.split('_') - }, i; - for (i = 0; i < 12; i++) { - assert.equal(moment([2011, i, 1]).format('D MMMM'), '1 ' + months.accusative[i], '1 ' + months.accusative[i]); - assert.equal(moment([2011, i, 1]).format('MMMM'), months.nominative[i], '1 ' + months.nominative[i]); - } - }); - - test('format month short case', function (assert) { - var monthsShort = { - 'nominative': 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_'), - 'accusative': 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_') - }, i; - for (i = 0; i < 12; i++) { - assert.equal(moment([2011, i, 1]).format('D MMM'), '1 ' + monthsShort.accusative[i], '1 ' + monthsShort.accusative[i]); - assert.equal(moment([2011, i, 1]).format('MMM'), monthsShort.nominative[i], '1 ' + monthsShort.nominative[i]); - } - }); - - test('format month case with escaped symbols', function (assert) { - var months = { - 'nominative': 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split('_'), - 'accusative': 'հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի'.split('_') - }, i; - for (i = 0; i < 12; i++) { - assert.equal(moment([2013, i, 1]).format('D[] MMMM'), '1 ' + months.accusative[i], '1 ' + months.accusative[i]); - assert.equal(moment([2013, i, 1]).format('[]D[] []MMMM[]'), '1 ' + months.accusative[i] + '', '1 ' + months.accusative[i] + ''); - assert.equal(moment([2013, i, 1]).format('D[-ին օրը] MMMM'), '1-ին օրը ' + months.accusative[i], '1-ին օրը ' + months.accusative[i]); - assert.equal(moment([2013, i, 1]).format('D, MMMM'), '1, ' + months.nominative[i], '1, ' + months.nominative[i]); - } - }); - - test('format month short case with escaped symbols', function (assert) { - var monthsShort = { - 'nominative': 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_'), - 'accusative': 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_') - }, i; - for (i = 0; i < 12; i++) { - assert.equal(moment([2013, i, 1]).format('D[] MMM'), '1 ' + monthsShort.accusative[i], '1 ' + monthsShort.accusative[i]); - assert.equal(moment([2013, i, 1]).format('[]D[] []MMM[]'), '1 ' + monthsShort.accusative[i] + '', '1 ' + monthsShort.accusative[i] + ''); - assert.equal(moment([2013, i, 1]).format('D[-ին օրը] MMM'), '1-ին օրը ' + monthsShort.accusative[i], '1-ին օրը ' + monthsShort.accusative[i]); - assert.equal(moment([2013, i, 1]).format('D, MMM'), '1, ' + monthsShort.nominative[i], '1, ' + monthsShort.nominative[i]); - } - }); - test('format week', function (assert) { - var expected = 'կիրակի կրկ կրկ_երկուշաբթի երկ երկ_երեքշաբթի երք երք_չորեքշաբթի չրք չրք_հինգշաբթի հնգ հնգ_ուրբաթ ուրբ ուրբ_շաբաթ շբթ շբթ'.split('_'), i; + var expected = 'Minggu Min Mg_Senin Sen Sn_Selasa Sel Sl_Rabu Rab Rb_Kamis Kam Km_Jumat Jum Jm_Sabtu Sab Sb'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); } @@ -26643,89 +29248,82 @@ test('from', function (assert) { var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'մի քանի վայրկյան', '44 seconds = seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'րոպե', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'րոպե', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 րոպե', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 րոպե', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ժամ', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ժամ', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 ժամ', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ժամ', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 ժամ', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'օր', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'օր', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 օր', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'օր', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 օր', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 11}), true), '11 օր', '11 days = 11 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 21}), true), '21 օր', '21 days = 21 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 օր', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ամիս', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ամիս', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ամիս', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 ամիս', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 ամիս', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 ամիս', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ամիս', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 ամիս', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'տարի', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 տարի', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'տարի', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 տարի', '5 years = 5 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'beberapa detik', '44 seconds = a few seconds'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'semenit', '45 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'semenit', '89 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 menit', '90 seconds = 2 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 menit', '44 minutes = 44 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'sejam', '45 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'sejam', '89 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 jam', '90 minutes = 2 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 jam', '5 hours = 5 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 jam', '21 hours = 21 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'sehari', '22 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'sehari', '35 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 hari', '36 hours = 2 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'sehari', '1 day = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 hari', '5 days = 5 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 hari', '25 days = 25 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'sebulan', '26 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'sebulan', '30 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'sebulan', '43 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 bulan', '46 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 bulan', '75 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 bulan', '76 days = 3 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'sebulan', '1 month = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 bulan', '5 months = 5 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'setahun', '345 days = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 tahun', '548 days = 2 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'setahun', '1 year = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 tahun', '5 years = 5 years'); }); test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'մի քանի վայրկյան հետո', 'prefix'); - assert.equal(moment(0).from(30000), 'մի քանի վայրկյան առաջ', 'suffix'); + assert.equal(moment(30000).from(0), 'dalam beberapa detik', 'prefix'); + assert.equal(moment(0).from(30000), 'beberapa detik yang lalu', 'suffix'); + }); + + test('now from now', function (assert) { + assert.equal(moment().fromNow(), 'beberapa detik yang lalu', 'now from now should display as in the past'); }); test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'մի քանի վայրկյան հետո', 'in seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5 օր հետո', 'in 5 days'); + assert.equal(moment().add({s: 30}).fromNow(), 'dalam beberapa detik', 'in a few seconds'); + assert.equal(moment().add({d: 5}).fromNow(), 'dalam 5 hari', 'in 5 days'); }); test('calendar day', function (assert) { var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'այսօր 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'այսօր 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'այսօր 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'վաղը 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'այսօր 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'երեկ 12:00', 'yesterday at the same time'); + assert.equal(moment(a).calendar(), 'Hari ini pukul 12.00', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'Hari ini pukul 12.25', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'Hari ini pukul 13.00', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'Besok pukul 12.00', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hari ini pukul 11.00', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kemarin pukul 12.00', 'yesterday at the same time'); }); test('calendar next week', function (assert) { var i, m; - function makeFormat(d) { - return 'dddd [օրը ժամը] LT'; - } - for (i = 2; i < 7; i++) { m = moment().add({d: i}); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Today + ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Today + ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Today + ' + i + ' days end of day'); } }); test('calendar last week', function (assert) { var i, m; - - function makeFormat(d) { - return '[անցած] dddd [օրը ժամը] LT'; - } - for (i = 2; i < 7; i++) { m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('dddd [lalu pukul] LT'), 'Today - ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('dddd [lalu pukul] LT'), 'Today - ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('dddd [lalu pukul] LT'), 'Today - ' + i + ' days end of day'); } }); @@ -26744,11 +29342,11 @@ }); test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1-ին', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1-ին', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2-րդ', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2-րդ', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3-րդ', 'Jan 9 2012 should be week 3'); + assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1', 'Dec 26 2011 should be week 1'); + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', 'Jan 1 2012 should be week 1'); + assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2', 'Jan 2 2012 should be week 2'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 should be week 2'); + assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3', 'Jan 9 2012 should be week 3'); }); }))); @@ -26946,11 +29544,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -26989,6 +29588,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -27016,10 +29634,10 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('id'); + localeModule('is'); test('parse', function (assert) { - var tests = 'Januari Jan_Februari Feb_Maret Mar_April Apr_Mei Mei_Juni Jun_Juli Jul_Agustus Agt_September Sep_Oktober Okt_November Nov_Desember Des'.split('_'), i; + var tests = 'janúar jan_febrúar feb_mars mar_apríl apr_maí maí_júní jún_júlí júl_ágúst ágú_september sep_október okt_nóvember nóv_desember des'.split('_'), i; function equalTest(input, mmm, i) { assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); } @@ -27038,29 +29656,29 @@ test('format', function (assert) { var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Minggu, Februari 14 2010, 3:25:50 sore'], - ['ddd, hA', 'Min, 3sore'], - ['M Mo MM MMMM MMM', '2 2 02 Februari Feb'], + ['dddd, Do MMMM YYYY, h:mm:ss a', 'sunnudagur, 14. febrúar 2010, 3:25:50 pm'], + ['ddd, hA', 'sun, 3PM'], + ['M Mo MM MMMM MMM', '2 2. 02 febrúar feb'], ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 Minggu Min Mg'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '7 7 07'], + ['D Do DD', '14 14. 14'], + ['d do dddd ddd dd', '0 0. sunnudagur sun Su'], + ['DDD DDDo DDDD', '45 45. 045'], + ['w wo ww', '6 6. 06'], ['h hh', '3 03'], ['H HH', '15 15'], ['m mm', '25 25'], ['s ss', '50 50'], - ['a A', 'sore sore'], - ['[the] DDDo [day of the year]', 'the 45 day of the year'], - ['LTS', '15.25.50'], - ['L', '14/02/2010'], - ['LL', '14 Februari 2010'], - ['LLL', '14 Februari 2010 pukul 15.25'], - ['LLLL', 'Minggu, 14 Februari 2010 pukul 15.25'], - ['l', '14/2/2010'], - ['ll', '14 Feb 2010'], - ['lll', '14 Feb 2010 pukul 15.25'], - ['llll', 'Min, 14 Feb 2010 pukul 15.25'] + ['a A', 'pm PM'], + ['[the] DDDo [day of the year]', 'the 45. day of the year'], + ['LTS', '15:25:50'], + ['L', '14.02.2010'], + ['LL', '14. febrúar 2010'], + ['LLL', '14. febrúar 2010 kl. 15:25'], + ['LLLL', 'sunnudagur, 14. febrúar 2010 kl. 15:25'], + ['l', '14.2.2010'], + ['ll', '14. feb 2010'], + ['lll', '14. feb 2010 kl. 15:25'], + ['llll', 'sun, 14. feb 2010 kl. 15:25'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; @@ -27069,15 +29687,52 @@ } }); + test('format ordinal', function (assert) { + assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); + assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); + assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); + assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); + assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); + assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); + assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); + assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); + assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); + assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); + + assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); + assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); + assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); + assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); + assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); + assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); + assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); + assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); + assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); + assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); + + assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); + assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); + assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); + assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); + assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); + assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); + assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); + assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); + assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); + assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); + + assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); + }); + test('format month', function (assert) { - var expected = 'Januari Jan_Februari Feb_Maret Mar_April Apr_Mei Mei_Juni Jun_Juli Jul_Agustus Agt_September Sep_Oktober Okt_November Nov_Desember Des'.split('_'), i; + var expected = 'janúar jan_febrúar feb_mars mar_apríl apr_maí maí_júní jún_júlí júl_ágúst ágú_september sep_október okt_nóvember nóv_desember des'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); test('format week', function (assert) { - var expected = 'Minggu Min Mg_Senin Sen Sn_Selasa Sel Sl_Rabu Rab Rb_Kamis Kam Km_Jumat Jum Jm_Sabtu Sab Sb'.split('_'), i; + var expected = 'sunnudagur sun Su_mánudagur mán Má_þriðjudagur þri Þr_miðvikudagur mið Mi_fimmtudagur fim Fi_föstudagur fös Fö_laugardagur lau La'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); } @@ -27085,82 +29740,89 @@ test('from', function (assert) { var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'beberapa detik', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'semenit', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'semenit', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 menit', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 menit', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'sejam', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'sejam', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 jam', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 jam', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 jam', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'sehari', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'sehari', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 hari', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'sehari', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 hari', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 hari', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'sebulan', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'sebulan', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'sebulan', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 bulan', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 bulan', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 bulan', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'sebulan', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 bulan', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'setahun', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 tahun', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'setahun', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 tahun', '5 years = 5 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'nokkrar sekúndur', '44 seconds = a few seconds'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'mínúta', '45 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'mínúta', '89 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 mínútur', '90 seconds = 2 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 mínútur', '44 minutes = 44 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 21}), true), '21 mínúta', '21 minutes = 21 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'klukkustund', '45 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'klukkustund', '89 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 klukkustundir', '90 minutes = 2 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 klukkustundir', '5 hours = 5 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 klukkustund', '21 hours = 21 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'dagur', '22 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'dagur', '35 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dagar', '36 hours = 2 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'dagur', '1 day = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dagar', '5 days = 5 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dagar', '25 days = 25 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 11}), true), '11 dagar', '11 days = 11 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 21}), true), '21 dagur', '21 days = 21 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mánuður', '26 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mánuður', '30 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mánuður', '43 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mánuðir', '46 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mánuðir', '75 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mánuðir', '76 days = 3 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mánuður', '1 month = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mánuðir', '5 months = 5 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ár', '345 days = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 ár', '548 days = 2 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ár', '1 year = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 ár', '5 years = 5 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 21}), true), '21 ár', '21 years = 21 years'); }); test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'dalam beberapa detik', 'prefix'); - assert.equal(moment(0).from(30000), 'beberapa detik yang lalu', 'suffix'); + assert.equal(moment(30000).from(0), 'eftir nokkrar sekúndur', 'prefix'); + assert.equal(moment(0).from(30000), 'fyrir nokkrum sekúndum síðan', 'suffix'); + assert.equal(moment().subtract({m: 1}).fromNow(), 'fyrir mínútu síðan', 'a minute ago'); }); test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'beberapa detik yang lalu', 'now from now should display as in the past'); + assert.equal(moment().fromNow(), 'fyrir nokkrum sekúndum síðan', 'now from now should display as in the past'); }); test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'dalam beberapa detik', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'dalam 5 hari', 'in 5 days'); + assert.equal(moment().add({s: 30}).fromNow(), 'eftir nokkrar sekúndur', 'in a few seconds'); + assert.equal(moment().add({m: 1}).fromNow(), 'eftir mínútu', 'in a minute'); + assert.equal(moment().add({d: 5}).fromNow(), 'eftir 5 daga', 'in 5 days'); }); test('calendar day', function (assert) { var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'Hari ini pukul 12.00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Hari ini pukul 12.25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Hari ini pukul 13.00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Besok pukul 12.00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hari ini pukul 11.00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kemarin pukul 12.00', 'yesterday at the same time'); + assert.equal(moment(a).calendar(), 'í dag kl. 12:00', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'í dag kl. 12:25', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'í dag kl. 13:00', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'á morgun kl. 12:00', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'í dag kl. 11:00', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'í gær kl. 12:00', 'yesterday at the same time'); }); test('calendar next week', function (assert) { var i, m; for (i = 2; i < 7; i++) { m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Today + ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('dddd [kl.] LT'), 'Today + ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Today + ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('dddd [kl.] LT'), 'Today + ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('dddd [kl.] LT'), 'Today + ' + i + ' days end of day'); } }); test('calendar last week', function (assert) { var i, m; + for (i = 2; i < 7; i++) { m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [lalu pukul] LT'), 'Today - ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('[síðasta] dddd [kl.] LT'), 'Today - ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [lalu pukul] LT'), 'Today - ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('[síðasta] dddd [kl.] LT'), 'Today - ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [lalu pukul] LT'), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[síðasta] dddd [kl.] LT'), 'Today - ' + i + ' days end of day'); } }); @@ -27179,11 +29841,11 @@ }); test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3', 'Jan 9 2012 should be week 3'); + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); + assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); + assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); + assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2'); }); }))); @@ -27381,11 +30043,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -27424,6 +30087,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -27451,10 +30133,10 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('is'); + localeModule('it-ch'); test('parse', function (assert) { - var tests = 'janúar jan_febrúar feb_mars mar_apríl apr_maí maí_júní jún_júlí júl_ágúst ágú_september sep_október okt_nóvember nóv_desember des'.split('_'), i; + var tests = 'gennaio gen_febbraio feb_marzo mar_aprile apr_maggio mag_giugno giu_luglio lug_agosto ago_settembre set_ottobre ott_novembre nov_dicembre dic'.split('_'), i; function equalTest(input, mmm, i) { assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); } @@ -27473,29 +30155,29 @@ test('format', function (assert) { var a = [ - ['dddd, Do MMMM YYYY, h:mm:ss a', 'sunnudagur, 14. febrúar 2010, 3:25:50 pm'], - ['ddd, hA', 'sun, 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 febrúar feb'], + ['dddd, MMMM Do YYYY, h:mm:ss a', 'domenica, febbraio 14º 2010, 3:25:50 pm'], + ['ddd, hA', 'dom, 3PM'], + ['M Mo MM MMMM MMM', '2 2º 02 febbraio feb'], ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. sunnudagur sun Su'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '6 6. 06'], + ['D Do DD', '14 14º 14'], + ['d do dddd ddd dd', '0 0º domenica dom do'], + ['DDD DDDo DDDD', '45 45º 045'], + ['w wo ww', '6 6º 06'], ['h hh', '3 03'], ['H HH', '15 15'], ['m mm', '25 25'], ['s ss', '50 50'], ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], + ['[the] DDDo [day of the year]', 'the 45º day of the year'], ['LTS', '15:25:50'], ['L', '14.02.2010'], - ['LL', '14. febrúar 2010'], - ['LLL', '14. febrúar 2010 kl. 15:25'], - ['LLLL', 'sunnudagur, 14. febrúar 2010 kl. 15:25'], + ['LL', '14 febbraio 2010'], + ['LLL', '14 febbraio 2010 15:25'], + ['LLLL', 'domenica 14 febbraio 2010 15:25'], ['l', '14.2.2010'], - ['ll', '14. feb 2010'], - ['lll', '14. feb 2010 kl. 15:25'], - ['llll', 'sun, 14. feb 2010 kl. 15:25'] + ['ll', '14 feb 2010'], + ['lll', '14 feb 2010 15:25'], + ['llll', 'dom 14 feb 2010 15:25'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; @@ -27505,51 +30187,51 @@ }); test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); + assert.equal(moment([2011, 0, 1]).format('DDDo'), '1º', '1º'); + assert.equal(moment([2011, 0, 2]).format('DDDo'), '2º', '2º'); + assert.equal(moment([2011, 0, 3]).format('DDDo'), '3º', '3º'); + assert.equal(moment([2011, 0, 4]).format('DDDo'), '4º', '4º'); + assert.equal(moment([2011, 0, 5]).format('DDDo'), '5º', '5º'); + assert.equal(moment([2011, 0, 6]).format('DDDo'), '6º', '6º'); + assert.equal(moment([2011, 0, 7]).format('DDDo'), '7º', '7º'); + assert.equal(moment([2011, 0, 8]).format('DDDo'), '8º', '8º'); + assert.equal(moment([2011, 0, 9]).format('DDDo'), '9º', '9º'); + assert.equal(moment([2011, 0, 10]).format('DDDo'), '10º', '10º'); - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); + assert.equal(moment([2011, 0, 11]).format('DDDo'), '11º', '11º'); + assert.equal(moment([2011, 0, 12]).format('DDDo'), '12º', '12º'); + assert.equal(moment([2011, 0, 13]).format('DDDo'), '13º', '13º'); + assert.equal(moment([2011, 0, 14]).format('DDDo'), '14º', '14º'); + assert.equal(moment([2011, 0, 15]).format('DDDo'), '15º', '15º'); + assert.equal(moment([2011, 0, 16]).format('DDDo'), '16º', '16º'); + assert.equal(moment([2011, 0, 17]).format('DDDo'), '17º', '17º'); + assert.equal(moment([2011, 0, 18]).format('DDDo'), '18º', '18º'); + assert.equal(moment([2011, 0, 19]).format('DDDo'), '19º', '19º'); + assert.equal(moment([2011, 0, 20]).format('DDDo'), '20º', '20º'); - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); + assert.equal(moment([2011, 0, 21]).format('DDDo'), '21º', '21º'); + assert.equal(moment([2011, 0, 22]).format('DDDo'), '22º', '22º'); + assert.equal(moment([2011, 0, 23]).format('DDDo'), '23º', '23º'); + assert.equal(moment([2011, 0, 24]).format('DDDo'), '24º', '24º'); + assert.equal(moment([2011, 0, 25]).format('DDDo'), '25º', '25º'); + assert.equal(moment([2011, 0, 26]).format('DDDo'), '26º', '26º'); + assert.equal(moment([2011, 0, 27]).format('DDDo'), '27º', '27º'); + assert.equal(moment([2011, 0, 28]).format('DDDo'), '28º', '28º'); + assert.equal(moment([2011, 0, 29]).format('DDDo'), '29º', '29º'); + assert.equal(moment([2011, 0, 30]).format('DDDo'), '30º', '30º'); - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); + assert.equal(moment([2011, 0, 31]).format('DDDo'), '31º', '31º'); }); test('format month', function (assert) { - var expected = 'janúar jan_febrúar feb_mars mar_apríl apr_maí maí_júní jún_júlí júl_ágúst ágú_september sep_október okt_nóvember nóv_desember des'.split('_'), i; + var expected = 'gennaio gen_febbraio feb_marzo mar_aprile apr_maggio mag_giugno giu_luglio lug_agosto ago_settembre set_ottobre ott_novembre nov_dicembre dic'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); test('format week', function (assert) { - var expected = 'sunnudagur sun Su_mánudagur mán Má_þriðjudagur þri Þr_miðvikudagur mið Mi_fimmtudagur fim Fi_föstudagur fös Fö_laugardagur lau La'.split('_'), i; + var expected = 'domenica dom do_lunedì lun lu_martedì mar ma_mercoledì mer me_giovedì gio gi_venerdì ven ve_sabato sab sa'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); } @@ -27557,89 +30239,81 @@ test('from', function (assert) { var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'nokkrar sekúndur', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'mínúta', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'mínúta', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 mínútur', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 mínútur', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 21}), true), '21 mínúta', '21 minutes = 21 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'klukkustund', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'klukkustund', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 klukkustundir', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 klukkustundir', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 klukkustund', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'dagur', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'dagur', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dagar', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'dagur', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dagar', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dagar', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 11}), true), '11 dagar', '11 days = 11 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 21}), true), '21 dagur', '21 days = 21 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mánuður', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mánuður', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mánuður', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mánuðir', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mánuðir', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mánuðir', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mánuður', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mánuðir', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ár', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 ár', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ár', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 ár', '5 years = 5 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 21}), true), '21 ár', '21 years = 21 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'alcuni secondi', '44 seconds = seconds'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'un minuto', '45 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'un minuto', '89 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuti', '90 seconds = 2 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuti', '44 minutes = 44 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'un\'ora', '45 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'un\'ora', '89 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 ore', '90 minutes = 2 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ore', '5 hours = 5 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 ore', '21 hours = 21 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'un giorno', '22 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'un giorno', '35 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 giorni', '36 hours = 2 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'un giorno', '1 day = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 giorni', '5 days = 5 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 giorni', '25 days = 25 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'un mese', '26 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'un mese', '30 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'un mese', '43 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mesi', '46 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mesi', '75 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mesi', '76 days = 3 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'un mese', '1 month = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mesi', '5 months = 5 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'un anno', '345 days = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 anni', '548 days = 2 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'un anno', '1 year = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 anni', '5 years = 5 years'); }); test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'eftir nokkrar sekúndur', 'prefix'); - assert.equal(moment(0).from(30000), 'fyrir nokkrum sekúndum síðan', 'suffix'); - assert.equal(moment().subtract({m: 1}).fromNow(), 'fyrir mínútu síðan', 'a minute ago'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'fyrir nokkrum sekúndum síðan', 'now from now should display as in the past'); + assert.equal(moment(30000).from(0), 'in alcuni secondi', 'prefix'); + assert.equal(moment(0).from(30000), 'alcuni secondi fa', 'suffix'); }); test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'eftir nokkrar sekúndur', 'in a few seconds'); - assert.equal(moment().add({m: 1}).fromNow(), 'eftir mínútu', 'in a minute'); - assert.equal(moment().add({d: 5}).fromNow(), 'eftir 5 daga', 'in 5 days'); + assert.equal(moment().add({s: 30}).fromNow(), 'in alcuni secondi', 'in seconds'); + assert.equal(moment().add({d: 5}).fromNow(), 'tra 5 giorni', 'in 5 days'); }); test('calendar day', function (assert) { var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'í dag kl. 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'í dag kl. 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'í dag kl. 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'á morgun kl. 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'í dag kl. 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'í gær kl. 12:00', 'yesterday at the same time'); + assert.equal(moment(a).calendar(), 'Oggi alle 12:00', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'Oggi alle 12:25', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'Oggi alle 13:00', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'Domani alle 12:00', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'Oggi alle 11:00', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ieri alle 12:00', 'yesterday at the same time'); }); test('calendar next week', function (assert) { var i, m; for (i = 2; i < 7; i++) { m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [kl.] LT'), 'Today + ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('dddd [alle] LT'), 'Today + ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [kl.] LT'), 'Today + ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('dddd [alle] LT'), 'Today + ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [kl.] LT'), 'Today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('dddd [alle] LT'), 'Today + ' + i + ' days end of day'); } }); test('calendar last week', function (assert) { - var i, m; - + var i, m, weekday, datestring; for (i = 2; i < 7; i++) { m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[síðasta] dddd [kl.] LT'), 'Today - ' + i + ' days current time'); + // Different date string + weekday = parseInt(m.format('d'), 10); + datestring = (weekday === 0) ? '[la scorsa] dddd [alle] LT' : '[lo scorso] dddd [alle] LT'; + assert.equal(m.calendar(), m.format(datestring), 'Today - ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[síðasta] dddd [kl.] LT'), 'Today - ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format(datestring), 'Today - ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[síðasta] dddd [kl.] LT'), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format(datestring), 'Today - ' + i + ' days end of day'); } }); @@ -27658,11 +30332,11 @@ }); test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2'); + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52º', 'Jan 1 2012 should be week 52'); + assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1º', 'Jan 2 2012 should be week 1'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1º', 'Jan 8 2012 should be week 1'); + assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2º', 'Jan 9 2012 should be week 2'); + assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2º', 'Jan 15 2012 should be week 2'); }); }))); @@ -27860,11 +30534,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -27903,6 +30578,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -28331,11 +31025,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -28374,6 +31069,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -28423,9 +31137,9 @@ test('format', function (assert) { var a = [ - ['dddd, MMMM Do YYYY, a h:mm:ss', '日曜日, 2月 14日 2010, 午後 3:25:50'], + ['dddd, MMMM Do YYYY, a h:mm:ss', '日曜日, 二月 14日 2010, 午後 3:25:50'], ['ddd, Ah', '日, 午後3'], - ['M Mo MM MMMM MMM', '2 2 02 2月 2月'], + ['M Mo MM MMMM MMM', '2 2 02 二月 2月'], ['YYYY YY', '2010 10'], ['D Do DD', '14 14日 14'], ['d do dddd ddd dd', '0 0日 日曜日 日 日'], @@ -28455,7 +31169,7 @@ }); test('format month', function (assert) { - var expected = '1月 1月_2月 2月_3月 3月_4月 4月_5月 5月_6月 6月_7月 7月_8月 8月_9月 9月_10月 10月_11月 11月_12月 12月'.split('_'), i; + var expected = '一月 1月_二月 2月_三月 3月_四月 4月_五月 5月_六月 6月_七月 7月_八月 8月_九月 9月_十月 10月_十一月 11月_十二月 12月'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } @@ -28788,11 +31502,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -28831,6 +31546,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -29226,11 +31960,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -29269,6 +32004,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -29712,11 +32466,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -29755,6 +32510,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -30185,11 +32959,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -30228,6 +33003,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -30932,11 +33726,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -30975,6 +33770,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -31420,11 +34234,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -31463,6 +34278,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -31927,11 +34761,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -31970,6 +34805,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -32424,11 +35278,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -32467,6 +35322,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -32897,11 +35771,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -32940,6 +35815,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -33347,11 +36241,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -33390,6 +36285,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -33820,11 +36734,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -33863,6 +36778,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -34313,11 +37247,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -34356,6 +37291,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -34812,11 +37766,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -34855,6 +37810,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -35322,11 +38296,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -35365,6 +38340,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -35795,11 +38789,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -35838,6 +38833,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -36282,11 +39296,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -36325,6 +39340,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -36770,11 +39804,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -36813,6 +39848,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -37252,11 +40306,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -37295,6 +40350,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -37740,11 +40814,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -37783,6 +40858,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -38221,11 +41315,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -38264,6 +41359,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -38702,11 +41816,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -38745,6 +41860,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -39175,11 +42309,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -39218,6 +42353,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -39725,11 +42879,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -39768,6 +42923,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -40198,11 +43372,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -40241,6 +43416,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -40685,11 +43879,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -40728,6 +43923,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -41164,11 +44378,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -41207,6 +44422,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -41643,11 +44877,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -41686,6 +44921,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -42115,11 +45369,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -42158,6 +45413,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -42700,11 +45974,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -42743,6 +46018,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -43238,11 +46532,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -43281,6 +46576,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -43311,7 +46625,7 @@ localeModule('pt-br'); test('parse', function (assert) { - var tests = 'janeiro jan_fevereiro fev_março mar_abril abr_maio mai_junho jun_julho jul_agosto ago_setembro set_outubro out_novembro nov_dezembro dez'.split('_'), i; + var tests = 'Janeiro Jan_Fevereiro Fev_Março Mar_Abril Abr_Maio Mai_Junho Jun_Julho Jul_Agosto Ago_Setembro Set_Outubro Out_Novembro Nov_Dezembro Dez'.split('_'), i; function equalTest(input, mmm, i) { assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); @@ -43332,9 +46646,9 @@ test('format', function (assert) { var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Domingo, fevereiro 14º 2010, 3:25:50 pm'], + ['dddd, MMMM Do YYYY, h:mm:ss a', 'Domingo, Fevereiro 14º 2010, 3:25:50 pm'], ['ddd, hA', 'Dom, 3PM'], - ['M Mo MM MMMM MMM', '2 2º 02 fevereiro fev'], + ['M Mo MM MMMM MMM', '2 2º 02 Fevereiro Fev'], ['YYYY YY', '2010 10'], ['D Do DD', '14 14º 14'], ['d do dddd ddd', '0 0º Domingo Dom'], @@ -43348,13 +46662,13 @@ ['[the] DDDo [day of the year]', 'the 45º day of the year'], ['LTS', '15:25:50'], ['L', '14/02/2010'], - ['LL', '14 de fevereiro de 2010'], - ['LLL', '14 de fevereiro de 2010 às 15:25'], - ['LLLL', 'Domingo, 14 de fevereiro de 2010 às 15:25'], + ['LL', '14 de Fevereiro de 2010'], + ['LLL', '14 de Fevereiro de 2010 às 15:25'], + ['LLLL', 'Domingo, 14 de Fevereiro de 2010 às 15:25'], ['l', '14/2/2010'], - ['ll', '14 de fev de 2010'], - ['lll', '14 de fev de 2010 às 15:25'], - ['llll', 'Dom, 14 de fev de 2010 às 15:25'] + ['ll', '14 de Fev de 2010'], + ['lll', '14 de Fev de 2010 às 15:25'], + ['llll', 'Dom, 14 de Fev de 2010 às 15:25'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; @@ -43401,7 +46715,7 @@ }); test('format month', function (assert) { - var expected = 'janeiro jan_fevereiro fev_março mar_abril abr_maio mai_junho jun_julho jul_agosto ago_setembro set_outubro out_novembro nov_dezembro dez'.split('_'), i; + var expected = 'Janeiro Jan_Fevereiro Fev_Março Mar_Abril Abr_Maio Mai_Junho Jun_Julho Jul_Agosto Ago_Setembro Set_Outubro Out_Novembro Nov_Dezembro Dez'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } @@ -43722,11 +47036,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -43765,6 +47080,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -43795,7 +47129,7 @@ localeModule('pt'); test('parse', function (assert) { - var tests = 'janeiro jan_fevereiro fev_março mar_abril abr_maio mai_junho jun_julho jul_agosto ago_setembro set_outubro out_novembro nov_dezembro dez'.split('_'), i; + var tests = 'Janeiro Jan_Fevereiro Fev_Março Mar_Abril Abr_Maio Mai_Junho Jun_Julho Jul_Agosto Ago_Setembro Set_Outubro Out_Novembro Nov_Dezembro Dez'.split('_'), i; function equalTest(input, mmm, i) { assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); } @@ -43814,9 +47148,9 @@ test('format', function (assert) { var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Domingo, fevereiro 14º 2010, 3:25:50 pm'], + ['dddd, MMMM Do YYYY, h:mm:ss a', 'Domingo, Fevereiro 14º 2010, 3:25:50 pm'], ['ddd, hA', 'Dom, 3PM'], - ['M Mo MM MMMM MMM', '2 2º 02 fevereiro fev'], + ['M Mo MM MMMM MMM', '2 2º 02 Fevereiro Fev'], ['YYYY YY', '2010 10'], ['D Do DD', '14 14º 14'], ['d do dddd ddd', '0 0º Domingo Dom'], @@ -43830,13 +47164,13 @@ ['[the] DDDo [day of the year]', 'the 45º day of the year'], ['LTS', '15:25:50'], ['L', '14/02/2010'], - ['LL', '14 de fevereiro de 2010'], - ['LLL', '14 de fevereiro de 2010 15:25'], - ['LLLL', 'Domingo, 14 de fevereiro de 2010 15:25'], + ['LL', '14 de Fevereiro de 2010'], + ['LLL', '14 de Fevereiro de 2010 15:25'], + ['LLLL', 'Domingo, 14 de Fevereiro de 2010 15:25'], ['l', '14/2/2010'], - ['ll', '14 de fev de 2010'], - ['lll', '14 de fev de 2010 15:25'], - ['llll', 'Dom, 14 de fev de 2010 15:25'] + ['ll', '14 de Fev de 2010'], + ['lll', '14 de Fev de 2010 15:25'], + ['llll', 'Dom, 14 de Fev de 2010 15:25'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; @@ -43883,7 +47217,7 @@ }); test('format month', function (assert) { - var expected = 'janeiro jan_fevereiro fev_março mar_abril abr_maio mai_junho jun_julho jul_agosto ago_setembro set_outubro out_novembro nov_dezembro dez'.split('_'), i; + var expected = 'Janeiro Jan_Fevereiro Fev_Março Mar_Abril Abr_Maio Mai_Junho Jun_Julho Jul_Agosto Ago_Setembro Set_Outubro Out_Novembro Nov_Dezembro Dez'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } @@ -44190,11 +47524,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -44233,6 +47568,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -44670,11 +48024,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -44713,6 +48068,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -45290,11 +48664,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -45333,6 +48708,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -45776,11 +49170,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -45819,6 +49214,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -46259,11 +49673,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -46302,6 +49717,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -46726,11 +50160,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -46769,6 +50204,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -47286,11 +50740,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -47329,6 +50784,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -47882,11 +51356,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -47925,6 +51400,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -48370,11 +51864,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -48413,6 +51908,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -48877,11 +52391,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -48920,6 +52435,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -49384,11 +52918,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -49427,6 +52962,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -49889,11 +53443,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -49932,6 +53487,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -50361,11 +53935,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -50404,6 +53979,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -50833,11 +54427,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -50876,6 +54471,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -51308,11 +54922,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -51351,6 +54966,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -51381,7 +55015,7 @@ localeModule('te'); test('parse', function (assert) { - var tests = 'జనవరి జన._ఫిబ్రవరి ఫిబ్ర._మార్చి మార్చి_ఏప్రిల్ ఏప్రి._మే మే_జూన్ జూన్_జూలై జూలై_ఆగస్టు ఆగ._సెప్టెంబర్ సెప్._అక్టోబర్ అక్టో._నవంబర్ నవ._డిసెంబర్ డిసె.'.split('_'), i; + var tests = 'జనవరి జన._ఫిబ్రవరి ఫిబ్ర._మార్చి మార్చి_ఏప్రిల్ ఏప్రి._మే మే_జూన్ జూన్_జులై జులై_ఆగస్టు ఆగ._సెప్టెంబర్ సెప్._అక్టోబర్ అక్టో._నవంబర్ నవ._డిసెంబర్ డిసె.'.split('_'), i; function equalTest(input, mmm, i) { assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); } @@ -51468,7 +55102,7 @@ }); test('format month', function (assert) { - var expected = 'జనవరి జన._ఫిబ్రవరి ఫిబ్ర._మార్చి మార్చి_ఏప్రిల్ ఏప్రి._మే మే_జూన్ జూన్_జూలై జూలై_ఆగస్టు ఆగ._సెప్టెంబర్ సెప్._అక్టోబర్ అక్టో._నవంబర్ నవ._డిసెంబర్ డిసె.'.split('_'), i; + var expected = 'జనవరి జన._ఫిబ్రవరి ఫిబ్ర._మార్చి మార్చి_ఏప్రిల్ ఏప్రి._మే మే_జూన్ జూన్_జులై జులై_ఆగస్టు ఆగ._సెప్టెంబర్ సెప్._అక్టోబర్ అక్టో._నవంబర్ నవ._డిసెంబర్ డిసె.'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } @@ -51796,11 +55430,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -51839,6 +55474,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -52269,11 +55923,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -52312,6 +55967,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -52753,11 +56427,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -52796,6 +56471,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -53188,11 +56882,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -53231,6 +56926,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -53659,11 +57373,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -53702,6 +57417,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -54147,11 +57881,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -54190,6 +57925,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -54630,11 +58384,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -54673,6 +58428,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -55106,11 +58880,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -55149,6 +58924,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -55578,11 +59372,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -55621,6 +59416,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -56050,11 +59864,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -56093,6 +59908,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -56495,11 +60329,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -56538,6 +60373,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -57000,11 +60854,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -57043,6 +60898,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -57487,11 +61361,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -57530,6 +61405,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -57960,11 +61854,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -58003,6 +61898,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -58433,11 +62347,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -58476,6 +62391,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -58916,11 +62850,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -58959,6 +62894,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -59389,11 +63343,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -59432,6 +63387,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -59865,11 +63839,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -59908,6 +63883,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -60312,11 +64306,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -60355,6 +64350,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -60766,11 +64780,12 @@ test('weekday parsing correctness', function (assert) { var i, m; - if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt') { + if (locale === 'tr' || locale === 'az' || locale === 'ro' || locale === 'mt' || locale === 'ga') { // tr, az: There is a lower-case letter (ı), that converted to // upper then lower changes to i // ro: there is the letter ț which behaves weird under IE8 // mt: letter Ħ + // ga: month with spaces assert.expect(0); return; } @@ -60809,6 +64824,25 @@ assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days'); assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days'); }); + + test('localeData weekdays can localeSort', function (assert) { + var weekdays = moment().localeData().weekdays(); + var weekdaysShort = moment().localeData().weekdaysShort(); + var weekdaysMin = moment().localeData().weekdaysMin(); + var shift = moment().localeData()._week.dow; + assert.deepEqual( + moment().localeData().weekdays(true), + weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)), + 'weekdays should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysShort(true), + weekdaysShort.slice(shift, 7).concat(weekdaysShort.slice(0, shift)), + 'weekdaysShort should localeSort'); + assert.deepEqual( + moment().localeData().weekdaysMin(true), + weekdaysMin.slice(shift, 7).concat(weekdaysMin.slice(0, shift)), + 'weekdaysMin should localeSort'); + }); } /*global QUnit:false*/ @@ -64993,6 +69027,7 @@ // years assert.equal(moment.duration(1, 'year').asYears(), 1, '1 year as years'); + assert.equal(moment.duration(1, 'year').asQuarters(), 4, '1 year as quarters'); assert.equal(moment.duration(1, 'year').asMonths(), 12, '1 year as months'); assert.equal(moment.duration(400, 'year').asMonths(), 4800, '400 years as months'); assert.equal(moment.duration(1, 'year').asWeeks().toFixed(3), 52.143, '1 year as weeks'); @@ -65006,8 +69041,24 @@ assert.equal(moment.duration(1, 'year').asSeconds(), 31536000, '1 year as seconds'); assert.equal(moment.duration(1, 'year').asMilliseconds(), 31536000000, '1 year as milliseconds'); + // quarters + assert.equal(moment.duration(1, 'quarter').asYears(), 0.25, '1 quarter as years'); + assert.equal(moment.duration(1, 'quarter').asQuarters(), 1, '1 quarter as quarters'); + assert.equal(moment.duration(1, 'quarter').asMonths(), 3, '1 quarter as months'); + assert.equal(moment.duration(2, 'quarter').asWeeks().toFixed(3), 26.143, '2 month as quarters'); + assert.equal(moment.duration(1, 'quarter').asDays(), 91, '1 quarter as days'); + assert.equal(moment.duration(2, 'quarter').asDays(), 183, '2 quarter as days'); + assert.equal(moment.duration(3, 'quarter').asDays(), 274, '4 quarter as days'); + assert.equal(moment.duration(4, 'quarter').asDays(), 365, '4 quarter as days'); + assert.equal(moment.duration(1, 'quarter').asHours(), 2184, '1 quarter as hours'); + assert.equal(moment.duration(3, 'quarter').asHours(), 6576, '3 quarter as hours'); + assert.equal(moment.duration(2, 'quarter').asMinutes(), 263520, '2 quarter as minutes'); + assert.equal(moment.duration(3, 'quarter').asSeconds(), 23673600, '3 quarter as seconds'); + assert.equal(moment.duration(1, 'quarter').asMilliseconds(), 7862400000, '1 quarter as milliseconds'); + // months assert.equal(moment.duration(1, 'month').asYears().toFixed(4), 0.0833, '1 month as years'); + assert.equal(moment.duration(6, 'month').asQuarters(), 2, '6 month as quarters'); assert.equal(moment.duration(1, 'month').asMonths(), 1, '1 month as months'); assert.equal(moment.duration(1, 'month').asWeeks().toFixed(3), 4.286, '1 month as weeks'); assert.equal(moment.duration(1, 'month').asDays(), 30, '1 month as days'); @@ -65032,64 +69083,70 @@ assert.equal(moment.duration(1, 'month').asMilliseconds(), 2592000000, '1 month as milliseconds'); // weeks - assert.equal(moment.duration(1, 'week').asYears().toFixed(4), 0.0192, '1 week as years'); - assert.equal(moment.duration(1, 'week').asMonths().toFixed(3), 0.230, '1 week as months'); - assert.equal(moment.duration(1, 'week').asWeeks(), 1, '1 week as weeks'); - assert.equal(moment.duration(1, 'week').asDays(), 7, '1 week as days'); - assert.equal(moment.duration(1, 'week').asHours(), 168, '1 week as hours'); - assert.equal(moment.duration(1, 'week').asMinutes(), 10080, '1 week as minutes'); - assert.equal(moment.duration(1, 'week').asSeconds(), 604800, '1 week as seconds'); - assert.equal(moment.duration(1, 'week').asMilliseconds(), 604800000, '1 week as milliseconds'); + assert.equal(moment.duration(1, 'week').asYears().toFixed(4), 0.0192, '1 week as years'); + assert.equal(moment.duration(1, 'week').asQuarters().toFixed(4), 0.0767, '1 week as quarters'); + assert.equal(moment.duration(1, 'week').asMonths().toFixed(3), 0.230, '1 week as months'); + assert.equal(moment.duration(1, 'week').asWeeks(), 1, '1 week as weeks'); + assert.equal(moment.duration(1, 'week').asDays(), 7, '1 week as days'); + assert.equal(moment.duration(1, 'week').asHours(), 168, '1 week as hours'); + assert.equal(moment.duration(1, 'week').asMinutes(), 10080, '1 week as minutes'); + assert.equal(moment.duration(1, 'week').asSeconds(), 604800, '1 week as seconds'); + assert.equal(moment.duration(1, 'week').asMilliseconds(), 604800000, '1 week as milliseconds'); // days - assert.equal(moment.duration(1, 'day').asYears().toFixed(4), 0.0027, '1 day as years'); - assert.equal(moment.duration(1, 'day').asMonths().toFixed(3), 0.033, '1 day as months'); - assert.equal(moment.duration(1, 'day').asWeeks().toFixed(3), 0.143, '1 day as weeks'); - assert.equal(moment.duration(1, 'day').asDays(), 1, '1 day as days'); - assert.equal(moment.duration(1, 'day').asHours(), 24, '1 day as hours'); - assert.equal(moment.duration(1, 'day').asMinutes(), 1440, '1 day as minutes'); - assert.equal(moment.duration(1, 'day').asSeconds(), 86400, '1 day as seconds'); - assert.equal(moment.duration(1, 'day').asMilliseconds(), 86400000, '1 day as milliseconds'); + assert.equal(moment.duration(1, 'day').asYears().toFixed(4), 0.0027, '1 day as years'); + assert.equal(moment.duration(1, 'day').asQuarters().toFixed(4), 0.0110, '1 day as quarters'); + assert.equal(moment.duration(1, 'day').asMonths().toFixed(3), 0.033, '1 day as months'); + assert.equal(moment.duration(1, 'day').asWeeks().toFixed(3), 0.143, '1 day as weeks'); + assert.equal(moment.duration(1, 'day').asDays(), 1, '1 day as days'); + assert.equal(moment.duration(1, 'day').asHours(), 24, '1 day as hours'); + assert.equal(moment.duration(1, 'day').asMinutes(), 1440, '1 day as minutes'); + assert.equal(moment.duration(1, 'day').asSeconds(), 86400, '1 day as seconds'); + assert.equal(moment.duration(1, 'day').asMilliseconds(), 86400000, '1 day as milliseconds'); // hours - assert.equal(moment.duration(1, 'hour').asYears().toFixed(6), 0.000114, '1 hour as years'); - assert.equal(moment.duration(1, 'hour').asMonths().toFixed(5), 0.00137, '1 hour as months'); - assert.equal(moment.duration(1, 'hour').asWeeks().toFixed(5), 0.00595, '1 hour as weeks'); - assert.equal(moment.duration(1, 'hour').asDays().toFixed(4), 0.0417, '1 hour as days'); - assert.equal(moment.duration(1, 'hour').asHours(), 1, '1 hour as hours'); - assert.equal(moment.duration(1, 'hour').asMinutes(), 60, '1 hour as minutes'); - assert.equal(moment.duration(1, 'hour').asSeconds(), 3600, '1 hour as seconds'); - assert.equal(moment.duration(1, 'hour').asMilliseconds(), 3600000, '1 hour as milliseconds'); + assert.equal(moment.duration(1, 'hour').asYears().toFixed(6), 0.000114, '1 hour as years'); + assert.equal(moment.duration(1, 'hour').asQuarters().toFixed(6), 0.000456, '1 hour as quarters'); + assert.equal(moment.duration(1, 'hour').asMonths().toFixed(5), 0.00137, '1 hour as months'); + assert.equal(moment.duration(1, 'hour').asWeeks().toFixed(5), 0.00595, '1 hour as weeks'); + assert.equal(moment.duration(1, 'hour').asDays().toFixed(4), 0.0417, '1 hour as days'); + assert.equal(moment.duration(1, 'hour').asHours(), 1, '1 hour as hours'); + assert.equal(moment.duration(1, 'hour').asMinutes(), 60, '1 hour as minutes'); + assert.equal(moment.duration(1, 'hour').asSeconds(), 3600, '1 hour as seconds'); + assert.equal(moment.duration(1, 'hour').asMilliseconds(), 3600000, '1 hour as milliseconds'); // minutes - assert.equal(moment.duration(1, 'minute').asYears().toFixed(8), 0.00000190, '1 minute as years'); - assert.equal(moment.duration(1, 'minute').asMonths().toFixed(7), 0.0000228, '1 minute as months'); - assert.equal(moment.duration(1, 'minute').asWeeks().toFixed(7), 0.0000992, '1 minute as weeks'); - assert.equal(moment.duration(1, 'minute').asDays().toFixed(6), 0.000694, '1 minute as days'); - assert.equal(moment.duration(1, 'minute').asHours().toFixed(4), 0.0167, '1 minute as hours'); - assert.equal(moment.duration(1, 'minute').asMinutes(), 1, '1 minute as minutes'); - assert.equal(moment.duration(1, 'minute').asSeconds(), 60, '1 minute as seconds'); - assert.equal(moment.duration(1, 'minute').asMilliseconds(), 60000, '1 minute as milliseconds'); + assert.equal(moment.duration(1, 'minute').asYears().toFixed(8), 0.00000190, '1 minute as years'); + assert.equal(moment.duration(1, 'minute').asQuarters().toFixed(8), 0.00000761, '1 minute as quarters'); + assert.equal(moment.duration(1, 'minute').asMonths().toFixed(7), 0.0000228, '1 minute as months'); + assert.equal(moment.duration(1, 'minute').asWeeks().toFixed(7), 0.0000992, '1 minute as weeks'); + assert.equal(moment.duration(1, 'minute').asDays().toFixed(6), 0.000694, '1 minute as days'); + assert.equal(moment.duration(1, 'minute').asHours().toFixed(4), 0.0167, '1 minute as hours'); + assert.equal(moment.duration(1, 'minute').asMinutes(), 1, '1 minute as minutes'); + assert.equal(moment.duration(1, 'minute').asSeconds(), 60, '1 minute as seconds'); + assert.equal(moment.duration(1, 'minute').asMilliseconds(), 60000, '1 minute as milliseconds'); // seconds - assert.equal(moment.duration(1, 'second').asYears().toFixed(10), 0.0000000317, '1 second as years'); - assert.equal(moment.duration(1, 'second').asMonths().toFixed(9), 0.000000380, '1 second as months'); - assert.equal(moment.duration(1, 'second').asWeeks().toFixed(8), 0.00000165, '1 second as weeks'); - assert.equal(moment.duration(1, 'second').asDays().toFixed(7), 0.0000116, '1 second as days'); - assert.equal(moment.duration(1, 'second').asHours().toFixed(6), 0.000278, '1 second as hours'); - assert.equal(moment.duration(1, 'second').asMinutes().toFixed(4), 0.0167, '1 second as minutes'); - assert.equal(moment.duration(1, 'second').asSeconds(), 1, '1 second as seconds'); - assert.equal(moment.duration(1, 'second').asMilliseconds(), 1000, '1 second as milliseconds'); + assert.equal(moment.duration(1, 'second').asYears().toFixed(10), 0.0000000317, '1 second as years'); + assert.equal(moment.duration(1, 'second').asQuarters().toFixed(10), 0.0000001268, '1 second as quarters'); + assert.equal(moment.duration(1, 'second').asMonths().toFixed(9), 0.000000380, '1 second as months'); + assert.equal(moment.duration(1, 'second').asWeeks().toFixed(8), 0.00000165, '1 second as weeks'); + assert.equal(moment.duration(1, 'second').asDays().toFixed(7), 0.0000116, '1 second as days'); + assert.equal(moment.duration(1, 'second').asHours().toFixed(6), 0.000278, '1 second as hours'); + assert.equal(moment.duration(1, 'second').asMinutes().toFixed(4), 0.0167, '1 second as minutes'); + assert.equal(moment.duration(1, 'second').asSeconds(), 1, '1 second as seconds'); + assert.equal(moment.duration(1, 'second').asMilliseconds(), 1000, '1 second as milliseconds'); // milliseconds - assert.equal(moment.duration(1, 'millisecond').asYears().toFixed(13), 0.0000000000317, '1 millisecond as years'); - assert.equal(moment.duration(1, 'millisecond').asMonths().toFixed(12), 0.000000000380, '1 millisecond as months'); - assert.equal(moment.duration(1, 'millisecond').asWeeks().toFixed(11), 0.00000000165, '1 millisecond as weeks'); - assert.equal(moment.duration(1, 'millisecond').asDays().toFixed(10), 0.0000000116, '1 millisecond as days'); - assert.equal(moment.duration(1, 'millisecond').asHours().toFixed(9), 0.000000278, '1 millisecond as hours'); - assert.equal(moment.duration(1, 'millisecond').asMinutes().toFixed(7), 0.0000167, '1 millisecond as minutes'); - assert.equal(moment.duration(1, 'millisecond').asSeconds(), 0.001, '1 millisecond as seconds'); - assert.equal(moment.duration(1, 'millisecond').asMilliseconds(), 1, '1 millisecond as milliseconds'); + assert.equal(moment.duration(1, 'millisecond').asYears().toFixed(13), 0.0000000000317, '1 millisecond as years'); + assert.equal(moment.duration(1, 'millisecond').asQuarters().toFixed(13), 0.0000000001268, '1 millisecond as quarters'); + assert.equal(moment.duration(1, 'millisecond').asMonths().toFixed(12), 0.000000000380, '1 millisecond as months'); + assert.equal(moment.duration(1, 'millisecond').asWeeks().toFixed(11), 0.00000000165, '1 millisecond as weeks'); + assert.equal(moment.duration(1, 'millisecond').asDays().toFixed(10), 0.0000000116, '1 millisecond as days'); + assert.equal(moment.duration(1, 'millisecond').asHours().toFixed(9), 0.000000278, '1 millisecond as hours'); + assert.equal(moment.duration(1, 'millisecond').asMinutes().toFixed(7), 0.0000167, '1 millisecond as minutes'); + assert.equal(moment.duration(1, 'millisecond').asSeconds(), 0.001, '1 millisecond as seconds'); + assert.equal(moment.duration(1, 'millisecond').asMilliseconds(), 1, '1 millisecond as milliseconds'); }); test('as getters for small units', function (assert) { @@ -65511,6 +69568,7 @@ assert.ok(isNaN(invalid.asDays()), 'invalid.asDays is NaN; i=' + i); assert.ok(isNaN(invalid.asWeeks()), 'invalid.asWeeks is NaN; i=' + i); assert.ok(isNaN(invalid.asMonths()), 'invalid.asMonths is NaN; i=' + i); + assert.ok(isNaN(invalid.asQuarters()), 'invalid.asQuarters is NaN; i=' + i); assert.ok(isNaN(invalid.asYears()), 'invalid.asYears is NaN; i=' + i); assert.ok(isNaN(invalid.valueOf()), 'invalid.valueOf is NaN; i=' + i); assert.ok(isNaN(invalid.get('hours')), 'invalid.get is NaN; i=' + i); @@ -72595,6 +76653,16 @@ a.subtract(1, 'months'); assert.equal(a.fromNow(), 'a year ago', 'Above custom days to years threshold'); moment.relativeTimeThreshold('M', 11); + + // multiple thresholds + moment.relativeTimeThreshold('ss', 3); + a = moment(); + a.subtract(4, 'seconds'); + assert.equal(a.fromNow(), '4 seconds ago', 'Before setting s relative time threshold'); + moment.relativeTimeThreshold('s', 59); + assert.equal(a.fromNow(), 'a few seconds ago', 'After setting s relative time threshold'); + moment.relativeTimeThreshold('ss', 44); + moment.relativeTimeThreshold('s', 45); }); test('custom rounding', function (assert) { @@ -73152,6 +77220,30 @@ assert.equal(+m, +m.clone().endOf('milliseconds'), 'endOf with milliseconds argument should change time'); }); + test('startOf for year zero', function (assert) { + var m = moment('0000-02-29T12:34:56.789Z').parseZone(); + assert.equal(m.clone().startOf('ms').toISOString(), '0000-02-29T12:34:56.789Z', 'startOf millisecond should preserve year'); + assert.equal(m.clone().startOf('s').toISOString(), '0000-02-29T12:34:56.000Z', 'startOf second should preserve year'); + assert.equal(m.clone().startOf('m').toISOString(), '0000-02-29T12:34:00.000Z', 'startOf minute should preserve year'); + assert.equal(m.clone().startOf('h').toISOString(), '0000-02-29T12:00:00.000Z', 'startOf hour should preserve year'); + assert.equal(m.clone().startOf('d').toISOString(), '0000-02-29T00:00:00.000Z', 'startOf day should preserve year'); + assert.equal(m.clone().startOf('M').toISOString(), '0000-02-01T00:00:00.000Z', 'startOf month should preserve year'); + assert.equal(m.clone().startOf('Q').toISOString(), '0000-01-01T00:00:00.000Z', 'startOf quarter should preserve year'); + assert.equal(m.clone().startOf('y').toISOString(), '0000-01-01T00:00:00.000Z', 'startOf year should preserve year'); + }); + + test('endOf for year zero', function (assert) { + var m = moment('0000-02-29T12:34:56.789Z').parseZone(); + assert.equal(m.clone().endOf('ms').toISOString(), '0000-02-29T12:34:56.789Z', 'endOf millisecond should preserve year'); + assert.equal(m.clone().endOf('s').toISOString(), '0000-02-29T12:34:56.999Z', 'endOf second should preserve year'); + assert.equal(m.clone().endOf('m').toISOString(), '0000-02-29T12:34:59.999Z', 'endOf minute should preserve year'); + assert.equal(m.clone().endOf('h').toISOString(), '0000-02-29T12:59:59.999Z', 'endOf hour should preserve year'); + assert.equal(m.clone().endOf('d').toISOString(), '0000-02-29T23:59:59.999Z', 'endOf day should preserve year'); + assert.equal(m.clone().endOf('M').toISOString(), '0000-02-29T23:59:59.999Z', 'endOf month should preserve year'); + assert.equal(m.clone().endOf('Q').toISOString(), '0000-03-31T23:59:59.999Z', 'endOf quarter should preserve year'); + assert.equal(m.clone().endOf('y').toISOString(), '0000-12-31T23:59:59.999Z', 'endOf year should preserve year'); + }); + }))); diff --git a/moment.js b/moment.js index 3ec5d3d54b..1b129716ac 100644 --- a/moment.js +++ b/moment.js @@ -1142,22 +1142,36 @@ function createDate (y, m, d, h, M, s, ms) { // can't just apply() to create a date: // https://stackoverflow.com/q/181348 - var date = new Date(y, m, d, h, M, s, ms); - + var date; // the date constructor remaps years 0-99 to 1900-1999 - if (y < 100 && y >= 0 && isFinite(date.getFullYear())) { - date.setFullYear(y); + if (y < 100 && y >= 0) { + // preserve leap years using a full 400 year cycle, then reset + date = new Date(y + 400, m, d, h, M, s, ms); + if (isFinite(date.getFullYear())) { + date.setFullYear(y); + } + } else { + date = new Date(y, m, d, h, M, s, ms); } + return date; } function createUTCDate (y) { - var date = new Date(Date.UTC.apply(null, arguments)); - + var date; // the Date.UTC function remaps years 0-99 to 1900-1999 - if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) { - date.setUTCFullYear(y); + if (y < 100 && y >= 0) { + var args = Array.prototype.slice.call(arguments); + // preserve leap years using a full 400 year cycle, then reset + args[0] = y + 400; + date = new Date(Date.UTC.apply(null, args)); + if (isFinite(date.getUTCFullYear())) { + date.setUTCFullYear(y); + } + } else { + date = new Date(Date.UTC.apply(null, arguments)); } + return date; } @@ -1368,25 +1382,28 @@ } // LOCALES + function shiftWeekdays (ws, n) { + return ws.slice(n, 7).concat(ws.slice(0, n)); + } var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'); function localeWeekdays (m, format) { - if (!m) { - return isArray(this._weekdays) ? this._weekdays : - this._weekdays['standalone']; - } - return isArray(this._weekdays) ? this._weekdays[m.day()] : - this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()]; + var weekdays = isArray(this._weekdays) ? this._weekdays : + this._weekdays[(m && m !== true && this._weekdays.isFormat.test(format)) ? 'format' : 'standalone']; + return (m === true) ? shiftWeekdays(weekdays, this._week.dow) + : (m) ? weekdays[m.day()] : weekdays; } var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'); function localeWeekdaysShort (m) { - return (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort; + return (m === true) ? shiftWeekdays(this._weekdaysShort, this._week.dow) + : (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort; } var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'); function localeWeekdaysMin (m) { - return (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin; + return (m === true) ? shiftWeekdays(this._weekdaysMin, this._week.dow) + : (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin; } function handleStrictParse$1(weekdayName, format, strict) { @@ -3081,7 +3098,7 @@ } function positiveMomentsDifference(base, other) { - var res = {milliseconds: 0, months: 0}; + var res = {}; res.months = other.month() - base.month() + (other.year() - base.year()) * 12; @@ -3419,62 +3436,130 @@ return this._locale; } + var MS_PER_SECOND = 1000; + var MS_PER_MINUTE = 60 * MS_PER_SECOND; + var MS_PER_HOUR = 60 * MS_PER_MINUTE; + var MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR; + + // actual modulo - handles negative numbers (for dates before 1970): + function mod$1(dividend, divisor) { + return (dividend % divisor + divisor) % divisor; + } + + function localStartOfDate(y, m, d) { + // the date constructor remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0) { + // preserve leap years using a full 400 year cycle, then reset + return new Date(y + 400, m, d) - MS_PER_400_YEARS; + } else { + return new Date(y, m, d).valueOf(); + } + } + + function utcStartOfDate(y, m, d) { + // Date.UTC remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0) { + // preserve leap years using a full 400 year cycle, then reset + return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS; + } else { + return Date.UTC(y, m, d); + } + } + function startOf (units) { + var time; units = normalizeUnits(units); - // the following switch intentionally omits break keywords - // to utilize falling through the cases. + if (units === undefined || units === 'millisecond' || !this.isValid()) { + return this; + } + + var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; + switch (units) { case 'year': - this.month(0); - /* falls through */ + time = startOfDate(this.year(), 0, 1); + break; case 'quarter': + time = startOfDate(this.year(), this.month() - this.month() % 3, 1); + break; case 'month': - this.date(1); - /* falls through */ + time = startOfDate(this.year(), this.month(), 1); + break; case 'week': + time = startOfDate(this.year(), this.month(), this.date() - this.weekday()); + break; case 'isoWeek': + time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1)); + break; case 'day': case 'date': - this.hours(0); - /* falls through */ + time = startOfDate(this.year(), this.month(), this.date()); + break; case 'hour': - this.minutes(0); - /* falls through */ + time = this._d.valueOf(); + time -= mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR); + break; case 'minute': - this.seconds(0); - /* falls through */ + time = this._d.valueOf(); + time -= mod$1(time, MS_PER_MINUTE); + break; case 'second': - this.milliseconds(0); - } - - // weeks are a special case - if (units === 'week') { - this.weekday(0); - } - if (units === 'isoWeek') { - this.isoWeekday(1); - } - - // quarters are also special - if (units === 'quarter') { - this.month(Math.floor(this.month() / 3) * 3); + time = this._d.valueOf(); + time -= mod$1(time, MS_PER_SECOND); + break; } + this._d.setTime(time); + hooks.updateOffset(this, true); return this; } function endOf (units) { + var time; units = normalizeUnits(units); - if (units === undefined || units === 'millisecond') { + if (units === undefined || units === 'millisecond' || !this.isValid()) { return this; } - // 'date' is an alias for 'day', so it should be considered as such. - if (units === 'date') { - units = 'day'; + var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; + + switch (units) { + case 'year': + time = startOfDate(this.year() + 1, 0, 1) - 1; + break; + case 'quarter': + time = startOfDate(this.year(), this.month() - this.month() % 3 + 3, 1) - 1; + break; + case 'month': + time = startOfDate(this.year(), this.month() + 1, 1) - 1; + break; + case 'week': + time = startOfDate(this.year(), this.month(), this.date() - this.weekday() + 7) - 1; + break; + case 'isoWeek': + time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1; + break; + case 'day': + case 'date': + time = startOfDate(this.year(), this.month(), this.date() + 1) - 1; + break; + case 'hour': + time = this._d.valueOf(); + time += MS_PER_HOUR - mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR) - 1; + break; + case 'minute': + time = this._d.valueOf(); + time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1; + break; + case 'second': + time = this._d.valueOf(); + time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1; + break; } - return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms'); + this._d.setTime(time); + hooks.updateOffset(this, true); + return this; } function valueOf () { @@ -4180,10 +4265,14 @@ units = normalizeUnits(units); - if (units === 'month' || units === 'year') { - days = this._days + milliseconds / 864e5; + if (units === 'month' || units === 'quarter' || units === 'year') { + days = this._days + milliseconds / 864e5; months = this._months + daysToMonths(days); - return units === 'month' ? months : months / 12; + switch (units) { + case 'month': return months; + case 'quarter': return months / 3; + case 'year': return months / 12; + } } else { // handle milliseconds separately because of floating point math errors (issue #1867) days = this._days + Math.round(monthsToDays(this._months)); @@ -4226,6 +4315,7 @@ var asDays = makeAs('d'); var asWeeks = makeAs('w'); var asMonths = makeAs('M'); + var asQuarters = makeAs('Q'); var asYears = makeAs('y'); function clone$1 () { @@ -4417,6 +4507,7 @@ proto$2.asDays = asDays; proto$2.asWeeks = asWeeks; proto$2.asMonths = asMonths; + proto$2.asQuarters = asQuarters; proto$2.asYears = asYears; proto$2.valueOf = valueOf$1; proto$2._bubble = bubble; @@ -4461,7 +4552,7 @@ // Side effect imports - hooks.version = '2.23.0'; + hooks.version = '2.24.0'; setHookCallback(createLocal);