diff --git a/.gitignore b/.gitignore index 46586e8e55..3385b03aa2 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ nyc_output .coveralls.yml .vscode/ .idea +*.iml diff --git a/component.json b/component.json index 3101237836..0afd170d5e 100644 --- a/component.json +++ b/component.json @@ -5,32 +5,6 @@ "description": "Parse, validate, manipulate, and display dates in JavaScript.", "files": [ "moment.js", - "locale/af.js", - "locale/ar-dz.js", - "locale/ar-kw.js", - "locale/ar-ly.js", - "locale/ar-ma.js", - "locale/ar-sa.js", - "locale/ar-tn.js", - "locale/ar.js", - "locale/az.js", - "locale/be.js", - "locale/bg.js", - "locale/bm.js", - "locale/bn.js", - "locale/bo.js", - "locale/br.js", - "locale/bs.js", - "locale/ca.js", - "locale/cs.js", - "locale/cv.js", - "locale/cy.js", - "locale/da.js", - "locale/de-at.js", - "locale/de-ch.js", - "locale/de.js", - "locale/dv.js", - "locale/el.js", "locale/en-SG.js", "locale/en-au.js", "locale/en-ca.js", @@ -38,100 +12,12 @@ "locale/en-ie.js", "locale/en-il.js", "locale/en-nz.js", - "locale/eo.js", + "locale/en-sg.js", "locale/es-do.js", "locale/es-us.js", "locale/es.js", - "locale/et.js", - "locale/eu.js", - "locale/fa.js", - "locale/fi.js", - "locale/fo.js", - "locale/fr-ca.js", - "locale/fr-ch.js", - "locale/fr.js", - "locale/fy.js", - "locale/ga.js", - "locale/gd.js", - "locale/gl.js", - "locale/gom-latn.js", - "locale/gu.js", - "locale/he.js", - "locale/hi.js", - "locale/hr.js", - "locale/hu.js", - "locale/hy-am.js", - "locale/id.js", - "locale/is.js", - "locale/it-ch.js", - "locale/it.js", - "locale/ja.js", - "locale/jv.js", - "locale/ka.js", - "locale/kk.js", - "locale/km.js", - "locale/kn.js", - "locale/ko.js", - "locale/ku.js", - "locale/ky.js", - "locale/lb.js", - "locale/lo.js", - "locale/lt.js", - "locale/lv.js", - "locale/me.js", - "locale/mi.js", - "locale/mk.js", - "locale/ml.js", - "locale/mn.js", - "locale/mr.js", - "locale/ms-my.js", - "locale/ms.js", - "locale/mt.js", - "locale/my.js", - "locale/nb.js", - "locale/ne.js", - "locale/nl-be.js", - "locale/nl.js", - "locale/nn.js", - "locale/pa-in.js", - "locale/pl.js", "locale/pt-br.js", - "locale/pt.js", - "locale/ro.js", - "locale/ru.js", - "locale/sd.js", - "locale/se.js", - "locale/si.js", - "locale/sk.js", - "locale/sl.js", - "locale/sq.js", - "locale/sr-cyrl.js", - "locale/sr.js", - "locale/ss.js", - "locale/sv.js", - "locale/sw.js", - "locale/ta.js", - "locale/te.js", - "locale/tet.js", - "locale/tg.js", - "locale/th.js", - "locale/tl-ph.js", - "locale/tlh.js", - "locale/tr.js", - "locale/tzl.js", - "locale/tzm-latn.js", - "locale/tzm.js", - "locale/ug-cn.js", - "locale/uk.js", - "locale/ur.js", - "locale/uz-latn.js", - "locale/uz.js", - "locale/vi.js", - "locale/x-pseudo.js", - "locale/yo.js", - "locale/zh-cn.js", - "locale/zh-hk.js", - "locale/zh-tw.js" + "locale/pt.js" ], "scripts": [ "moment.js" diff --git a/locale/af.js b/locale/af.js deleted file mode 100644 index 0b2bb26e55..0000000000 --- a/locale/af.js +++ /dev/null @@ -1,72 +0,0 @@ -//! 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 af = moment.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 (input) { - return /^nm$/i.test(input); - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 12) { - return isLower ? 'vm' : 'VM'; - } else { - return isLower ? '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ôre 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 (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); // Thanks to Joris Röling : https://github.com/jjupiter - }, - week : { - dow : 1, // Maandag is die eerste dag van die week. - doy : 4 // Die week wat die 4de Januarie bevat is die eerste week van die jaar. - } - }); - - return af; - -}))); diff --git a/locale/ar-dz.js b/locale/ar-dz.js deleted file mode 100644 index e6efd0a26d..0000000000 --- a/locale/ar-dz.js +++ /dev/null @@ -1,58 +0,0 @@ -//! 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 arDz = moment.defineLocale('ar-dz', { - months : 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - monthsShort : 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'احد_اثنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'أح_إث_ثلا_أر_خم_جم_سب'.split('_'), - weekdaysParseExact : true, - 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: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'في %s', - past : 'منذ %s', - s : 'ثوان', - ss : '%d ثانية', - m : 'دقيقة', - mm : '%d دقائق', - h : 'ساعة', - hh : '%d ساعات', - d : 'يوم', - dd : '%d أيام', - M : 'شهر', - MM : '%d أشهر', - y : 'سنة', - yy : '%d سنوات' - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return arDz; - -}))); diff --git a/locale/ar-kw.js b/locale/ar-kw.js deleted file mode 100644 index 6a72e9bacd..0000000000 --- a/locale/ar-kw.js +++ /dev/null @@ -1,58 +0,0 @@ -//! 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 arKw = moment.defineLocale('ar-kw', { - months : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), - monthsShort : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), - weekdays : 'الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - 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: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'في %s', - past : 'منذ %s', - s : 'ثوان', - ss : '%d ثانية', - m : 'دقيقة', - mm : '%d دقائق', - h : 'ساعة', - hh : '%d ساعات', - d : 'يوم', - dd : '%d أيام', - M : 'شهر', - MM : '%d أشهر', - y : 'سنة', - yy : '%d سنوات' - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } - }); - - return arKw; - -}))); diff --git a/locale/ar-ly.js b/locale/ar-ly.js deleted file mode 100644 index 0df68c8b41..0000000000 --- a/locale/ar-ly.js +++ /dev/null @@ -1,121 +0,0 @@ -//! 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 symbolMap = { - '1': '1', - '2': '2', - '3': '3', - '4': '4', - '5': '5', - '6': '6', - '7': '7', - '8': '8', - '9': '9', - '0': '0' - }, pluralForm = function (n) { - return n === 0 ? 0 : n === 1 ? 1 : n === 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5; - }, plurals = { - s : ['أقل من ثانية', 'ثانية واحدة', ['ثانيتان', 'ثانيتين'], '%d ثوان', '%d ثانية', '%d ثانية'], - m : ['أقل من دقيقة', 'دقيقة واحدة', ['دقيقتان', 'دقيقتين'], '%d دقائق', '%d دقيقة', '%d دقيقة'], - h : ['أقل من ساعة', 'ساعة واحدة', ['ساعتان', 'ساعتين'], '%d ساعات', '%d ساعة', '%d ساعة'], - d : ['أقل من يوم', 'يوم واحد', ['يومان', 'يومين'], '%d أيام', '%d يومًا', '%d يوم'], - M : ['أقل من شهر', 'شهر واحد', ['شهران', 'شهرين'], '%d أشهر', '%d شهرا', '%d شهر'], - y : ['أقل من عام', 'عام واحد', ['عامان', 'عامين'], '%d أعوام', '%d عامًا', '%d عام'] - }, pluralize = function (u) { - return function (number, withoutSuffix, string, isFuture) { - var f = pluralForm(number), - str = plurals[u][pluralForm(number)]; - if (f === 2) { - str = str[withoutSuffix ? 0 : 1]; - } - return str.replace(/%d/i, number); - }; - }, months = [ - 'يناير', - 'فبراير', - 'مارس', - 'أبريل', - 'مايو', - 'يونيو', - 'يوليو', - 'أغسطس', - 'سبتمبر', - 'أكتوبر', - 'نوفمبر', - 'ديسمبر' - ]; - - var arLy = moment.defineLocale('ar-ly', { - months : months, - monthsShort : months, - weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - 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: /ص|م/, - isPM : function (input) { - return 'م' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ص'; - } else { - return 'م'; - } - }, - calendar : { - sameDay: '[اليوم عند الساعة] LT', - nextDay: '[غدًا عند الساعة] LT', - nextWeek: 'dddd [عند الساعة] LT', - lastDay: '[أمس عند الساعة] LT', - lastWeek: 'dddd [عند الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'بعد %s', - past : 'منذ %s', - s : pluralize('s'), - ss : pluralize('s'), - m : pluralize('m'), - mm : pluralize('m'), - h : pluralize('h'), - hh : pluralize('h'), - d : pluralize('d'), - dd : pluralize('d'), - M : pluralize('M'), - MM : pluralize('M'), - y : pluralize('y'), - yy : pluralize('y') - }, - preparse: function (string) { - return string.replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }).replace(/,/g, '،'); - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } - }); - - return arLy; - -}))); diff --git a/locale/ar-ma.js b/locale/ar-ma.js deleted file mode 100644 index 42db49a7e1..0000000000 --- a/locale/ar-ma.js +++ /dev/null @@ -1,58 +0,0 @@ -//! 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 arMa = moment.defineLocale('ar-ma', { - months : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), - monthsShort : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), - weekdays : 'الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - 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: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'في %s', - past : 'منذ %s', - s : 'ثوان', - ss : '%d ثانية', - m : 'دقيقة', - mm : '%d دقائق', - h : 'ساعة', - hh : '%d ساعات', - d : 'يوم', - dd : '%d أيام', - M : 'شهر', - MM : '%d أشهر', - y : 'سنة', - yy : '%d سنوات' - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } - }); - - return arMa; - -}))); diff --git a/locale/ar-sa.js b/locale/ar-sa.js deleted file mode 100644 index 1c6d46d519..0000000000 --- a/locale/ar-sa.js +++ /dev/null @@ -1,103 +0,0 @@ -//! 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 symbolMap = { - '1': '١', - '2': '٢', - '3': '٣', - '4': '٤', - '5': '٥', - '6': '٦', - '7': '٧', - '8': '٨', - '9': '٩', - '0': '٠' - }, numberMap = { - '١': '1', - '٢': '2', - '٣': '3', - '٤': '4', - '٥': '5', - '٦': '6', - '٧': '7', - '٨': '8', - '٩': '9', - '٠': '0' - }; - - var arSa = moment.defineLocale('ar-sa', { - months : 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - monthsShort : 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - 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: /ص|م/, - isPM : function (input) { - return 'م' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ص'; - } else { - return 'م'; - } - }, - calendar : { - sameDay: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'في %s', - past : 'منذ %s', - s : 'ثوان', - ss : '%d ثانية', - m : 'دقيقة', - mm : '%d دقائق', - h : 'ساعة', - hh : '%d ساعات', - d : 'يوم', - dd : '%d أيام', - M : 'شهر', - MM : '%d أشهر', - y : 'سنة', - yy : '%d سنوات' - }, - preparse: function (string) { - return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { - return numberMap[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }).replace(/,/g, '،'); - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - return arSa; - -}))); diff --git a/locale/ar-tn.js b/locale/ar-tn.js deleted file mode 100644 index 8437717b69..0000000000 --- a/locale/ar-tn.js +++ /dev/null @@ -1,58 +0,0 @@ -//! 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 arTn = moment.defineLocale('ar-tn', { - months: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - monthsShort: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - 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: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' - }, - relativeTime: { - future: 'في %s', - past: 'منذ %s', - s: 'ثوان', - ss : '%d ثانية', - m: 'دقيقة', - mm: '%d دقائق', - h: 'ساعة', - hh: '%d ساعات', - d: 'يوم', - dd: '%d أيام', - M: 'شهر', - MM: '%d أشهر', - y: 'سنة', - yy: '%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 arTn; - -}))); diff --git a/locale/ar.js b/locale/ar.js deleted file mode 100644 index 1549cc1512..0000000000 --- a/locale/ar.js +++ /dev/null @@ -1,134 +0,0 @@ -//! 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 symbolMap = { - '1': '١', - '2': '٢', - '3': '٣', - '4': '٤', - '5': '٥', - '6': '٦', - '7': '٧', - '8': '٨', - '9': '٩', - '0': '٠' - }, numberMap = { - '١': '1', - '٢': '2', - '٣': '3', - '٤': '4', - '٥': '5', - '٦': '6', - '٧': '7', - '٨': '8', - '٩': '9', - '٠': '0' - }, pluralForm = function (n) { - return n === 0 ? 0 : n === 1 ? 1 : n === 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5; - }, plurals = { - s : ['أقل من ثانية', 'ثانية واحدة', ['ثانيتان', 'ثانيتين'], '%d ثوان', '%d ثانية', '%d ثانية'], - m : ['أقل من دقيقة', 'دقيقة واحدة', ['دقيقتان', 'دقيقتين'], '%d دقائق', '%d دقيقة', '%d دقيقة'], - h : ['أقل من ساعة', 'ساعة واحدة', ['ساعتان', 'ساعتين'], '%d ساعات', '%d ساعة', '%d ساعة'], - d : ['أقل من يوم', 'يوم واحد', ['يومان', 'يومين'], '%d أيام', '%d يومًا', '%d يوم'], - M : ['أقل من شهر', 'شهر واحد', ['شهران', 'شهرين'], '%d أشهر', '%d شهرا', '%d شهر'], - y : ['أقل من عام', 'عام واحد', ['عامان', 'عامين'], '%d أعوام', '%d عامًا', '%d عام'] - }, pluralize = function (u) { - return function (number, withoutSuffix, string, isFuture) { - var f = pluralForm(number), - str = plurals[u][pluralForm(number)]; - if (f === 2) { - str = str[withoutSuffix ? 0 : 1]; - } - return str.replace(/%d/i, number); - }; - }, months = [ - 'يناير', - 'فبراير', - 'مارس', - 'أبريل', - 'مايو', - 'يونيو', - 'يوليو', - 'أغسطس', - 'سبتمبر', - 'أكتوبر', - 'نوفمبر', - 'ديسمبر' - ]; - - var ar = moment.defineLocale('ar', { - months : months, - monthsShort : months, - weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - 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: /ص|م/, - isPM : function (input) { - return 'م' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ص'; - } else { - return 'م'; - } - }, - calendar : { - sameDay: '[اليوم عند الساعة] LT', - nextDay: '[غدًا عند الساعة] LT', - nextWeek: 'dddd [عند الساعة] LT', - lastDay: '[أمس عند الساعة] LT', - lastWeek: 'dddd [عند الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'بعد %s', - past : 'منذ %s', - s : pluralize('s'), - ss : pluralize('s'), - m : pluralize('m'), - mm : pluralize('m'), - h : pluralize('h'), - hh : pluralize('h'), - d : pluralize('d'), - dd : pluralize('d'), - M : pluralize('M'), - MM : pluralize('M'), - y : pluralize('y'), - yy : pluralize('y') - }, - preparse: function (string) { - return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { - return numberMap[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }).replace(/,/g, '،'); - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } - }); - - return ar; - -}))); diff --git a/locale/az.js b/locale/az.js deleted file mode 100644 index 348ddffeaa..0000000000 --- a/locale/az.js +++ /dev/null @@ -1,104 +0,0 @@ -//! 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 suffixes = { - 1: '-inci', - 5: '-inci', - 8: '-inci', - 70: '-inci', - 80: '-inci', - 2: '-nci', - 7: '-nci', - 20: '-nci', - 50: '-nci', - 3: '-üncü', - 4: '-üncü', - 100: '-üncü', - 6: '-ncı', - 9: '-uncu', - 10: '-uncu', - 30: '-uncu', - 60: '-ıncı', - 90: '-ıncı' - }; - - var az = moment.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əsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə'.split('_'), - weekdaysShort : 'Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən'.split('_'), - weekdaysMin : 'Bz_BE_ÇA_Çə_CA_Cü_Şə'.split('_'), - weekdaysParseExact : true, - 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ün saat] LT', - nextDay : '[sabah saat] LT', - nextWeek : '[gələn həftə] dddd [saat] LT', - lastDay : '[dünən] LT', - lastWeek : '[keçən həftə] dddd [saat] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s sonra', - past : '%s əvvəl', - s : 'birneçə saniyə', - ss : '%d saniyə', - m : 'bir dəqiqə', - mm : '%d dəqiqə', - h : 'bir saat', - hh : '%d saat', - d : 'bir gün', - dd : '%d gün', - M : 'bir ay', - MM : '%d ay', - y : 'bir il', - yy : '%d il' - }, - meridiemParse: /gecə|səhər|gündüz|axşam/, - isPM : function (input) { - return /^(gündüz|axşam)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'gecə'; - } else if (hour < 12) { - return 'səhər'; - } else if (hour < 17) { - return 'gündüz'; - } else { - return 'axşam'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}-(ıncı|inci|nci|üncü|ncı|uncu)/, - ordinal : function (number) { - if (number === 0) { // special case for zero - return number + '-ıncı'; - } - var a = number % 10, - b = number % 100 - a, - c = number >= 100 ? 100 : null; - return number + (suffixes[a] || suffixes[b] || suffixes[c]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return az; - -}))); diff --git a/locale/be.js b/locale/be.js deleted file mode 100644 index 10db1c192f..0000000000 --- a/locale/be.js +++ /dev/null @@ -1,131 +0,0 @@ -//! 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'; - - - function plural(word, num) { - var forms = word.split('_'); - return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]); - } - function relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'ss': withoutSuffix ? 'секунда_секунды_секунд' : 'секунду_секунды_секунд', - 'mm': withoutSuffix ? 'хвіліна_хвіліны_хвілін' : 'хвіліну_хвіліны_хвілін', - 'hh': withoutSuffix ? 'гадзіна_гадзіны_гадзін' : 'гадзіну_гадзіны_гадзін', - 'dd': 'дзень_дні_дзён', - 'MM': 'месяц_месяцы_месяцаў', - 'yy': 'год_гады_гадоў' - }; - if (key === 'm') { - return withoutSuffix ? 'хвіліна' : 'хвіліну'; - } - else if (key === 'h') { - return withoutSuffix ? 'гадзіна' : 'гадзіну'; - } - else { - return number + ' ' + plural(format[key], +number); - } - } - - var be = moment.defineLocale('be', { - months : { - format: 'студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня'.split('_'), - standalone: 'студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань'.split('_') - }, - monthsShort : 'студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж'.split('_'), - weekdays : { - format: 'нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу'.split('_'), - standalone: 'нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота'.split('_'), - isFormat: /\[ ?[Ууў] ?(?:мінулую|наступную)? ?\] ?dddd/ - }, - weekdaysShort : 'нд_пн_ат_ср_чц_пт_сб'.split('_'), - weekdaysMin : 'нд_пн_ат_ср_чц_пт_сб'.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: '[Сёння ў] LT', - nextDay: '[Заўтра ў] LT', - lastDay: '[Учора ў] LT', - nextWeek: function () { - return '[У] dddd [ў] LT'; - }, - lastWeek: function () { - switch (this.day()) { - case 0: - case 3: - case 5: - case 6: - return '[У мінулую] dddd [ў] LT'; - case 1: - case 2: - case 4: - return '[У мінулы] dddd [ў] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'праз %s', - past : '%s таму', - s : 'некалькі секунд', - m : relativeTimeWithPlural, - mm : relativeTimeWithPlural, - h : relativeTimeWithPlural, - hh : relativeTimeWithPlural, - d : 'дзень', - dd : relativeTimeWithPlural, - M : 'месяц', - MM : relativeTimeWithPlural, - y : 'год', - yy : relativeTimeWithPlural - }, - meridiemParse: /ночы|раніцы|дня|вечара/, - isPM : function (input) { - return /^(дня|вечара)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ночы'; - } else if (hour < 12) { - return 'раніцы'; - } else if (hour < 17) { - return 'дня'; - } else { - return 'вечара'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}-(і|ы|га)/, - ordinal: function (number, period) { - switch (period) { - case 'M': - case 'd': - case 'DDD': - case 'w': - case 'W': - return (number % 10 === 2 || number % 10 === 3) && (number % 100 !== 12 && number % 100 !== 13) ? number + '-і' : number + '-ы'; - case 'D': - return number + '-га'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return be; - -}))); diff --git a/locale/bg.js b/locale/bg.js deleted file mode 100644 index c70ba304b3..0000000000 --- a/locale/bg.js +++ /dev/null @@ -1,89 +0,0 @@ -//! 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 bg = moment.defineLocale('bg', { - months : 'януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември'.split('_'), - monthsShort : 'янр_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек'.split('_'), - weekdays : 'неделя_понеделник_вторник_сряда_четвъртък_петък_събота'.split('_'), - weekdaysShort : 'нед_пон_вто_сря_чет_пет_съб'.split('_'), - weekdaysMin : 'нд_пн_вт_ср_чт_пт_сб'.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 : '[Днес в] LT', - nextDay : '[Утре в] LT', - nextWeek : 'dddd [в] LT', - lastDay : '[Вчера в] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - case 3: - case 6: - return '[В изминалата] dddd [в] LT'; - case 1: - case 2: - case 4: - case 5: - return '[В изминалия] dddd [в] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'след %s', - past : 'преди %s', - s : 'няколко секунди', - ss : '%d секунди', - m : 'минута', - mm : '%d минути', - h : 'час', - hh : '%d часа', - d : 'ден', - dd : '%d дни', - M : 'месец', - MM : '%d месеца', - y : 'година', - yy : '%d години' - }, - dayOfMonthOrdinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/, - ordinal : function (number) { - var lastDigit = number % 10, - last2Digits = number % 100; - if (number === 0) { - return number + '-ев'; - } else if (last2Digits === 0) { - return number + '-ен'; - } else if (last2Digits > 10 && last2Digits < 20) { - return number + '-ти'; - } else if (lastDigit === 1) { - return number + '-ви'; - } else if (lastDigit === 2) { - return number + '-ри'; - } else if (lastDigit === 7 || lastDigit === 8) { - return number + '-ми'; - } else { - return number + '-ти'; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return bg; - -}))); diff --git a/locale/bm.js b/locale/bm.js deleted file mode 100644 index 2bb50f5197..0000000000 --- a/locale/bm.js +++ /dev/null @@ -1,57 +0,0 @@ -//! 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 bm = moment.defineLocale('bm', { - months : 'Zanwuyekalo_Fewuruyekalo_Marisikalo_Awirilikalo_Mɛkalo_Zuwɛnkalo_Zuluyekalo_Utikalo_Sɛtanburukalo_ɔkutɔburukalo_Nowanburukalo_Desanburukalo'.split('_'), - monthsShort : 'Zan_Few_Mar_Awi_Mɛ_Zuw_Zul_Uti_Sɛt_ɔku_Now_Des'.split('_'), - weekdays : 'Kari_Ntɛnɛn_Tarata_Araba_Alamisa_Juma_Sibiri'.split('_'), - weekdaysShort : 'Kar_Ntɛ_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ɛrɛ] HH:mm', - LLLL : 'dddd MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm' - }, - calendar : { - sameDay : '[Bi lɛrɛ] LT', - nextDay : '[Sini lɛrɛ] LT', - nextWeek : 'dddd [don lɛrɛ] LT', - lastDay : '[Kunu lɛrɛ] LT', - lastWeek : 'dddd [tɛmɛnen lɛrɛ] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s kɔnɔ', - past : 'a bɛ %s bɔ', - s : 'sanga dama dama', - ss : 'sekondi %d', - m : 'miniti kelen', - mm : 'miniti %d', - h : 'lɛrɛ kelen', - hh : 'lɛrɛ %d', - d : 'tile kelen', - dd : 'tile %d', - M : 'kalo kelen', - MM : 'kalo %d', - y : 'san kelen', - yy : 'san %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 bm; - -}))); diff --git a/locale/bn.js b/locale/bn.js deleted file mode 100644 index 8fe715862e..0000000000 --- a/locale/bn.js +++ /dev/null @@ -1,118 +0,0 @@ -//! 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 symbolMap = { - '1': '১', - '2': '২', - '3': '৩', - '4': '৪', - '5': '৫', - '6': '৬', - '7': '৭', - '8': '৮', - '9': '৯', - '0': '০' - }, - numberMap = { - '১': '1', - '২': '2', - '৩': '3', - '৪': '4', - '৫': '5', - '৬': '6', - '৭': '7', - '৮': '8', - '৯': '9', - '০': '0' - }; - - var bn = moment.defineLocale('bn', { - months : 'জানুয়ারী_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর'.split('_'), - monthsShort : 'জানু_ফেব_মার্চ_এপ্র_মে_জুন_জুল_আগ_সেপ্ট_অক্টো_নভে_ডিসে'.split('_'), - weekdays : 'রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার'.split('_'), - weekdaysShort : 'রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি'.split('_'), - weekdaysMin : 'রবি_সোম_মঙ্গ_বুধ_বৃহঃ_শুক্র_শনি'.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 : '[আজ] LT', - nextDay : '[আগামীকাল] LT', - nextWeek : 'dddd, LT', - lastDay : '[গতকাল] LT', - lastWeek : '[গত] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s পরে', - past : '%s আগে', - s : 'কয়েক সেকেন্ড', - ss : '%d সেকেন্ড', - m : 'এক মিনিট', - mm : '%d মিনিট', - h : 'এক ঘন্টা', - hh : '%d ঘন্টা', - d : 'এক দিন', - dd : '%d দিন', - M : 'এক মাস', - MM : '%d মাস', - y : 'এক বছর', - yy : '%d বছর' - }, - preparse: function (string) { - return string.replace(/[১২৩৪৫৬৭৮৯০]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - meridiemParse: /রাত|সকাল|দুপুর|বিকাল|রাত/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ((meridiem === 'রাত' && hour >= 4) || - (meridiem === 'দুপুর' && hour < 5) || - meridiem === 'বিকাল') { - return hour + 12; - } else { - return hour; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'রাত'; - } else if (hour < 10) { - return 'সকাল'; - } else if (hour < 17) { - return 'দুপুর'; - } else if (hour < 20) { - return 'বিকাল'; - } else { - return 'রাত'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - return bn; - -}))); diff --git a/locale/bo.js b/locale/bo.js deleted file mode 100644 index 6a98016395..0000000000 --- a/locale/bo.js +++ /dev/null @@ -1,118 +0,0 @@ -//! 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 symbolMap = { - '1': '༡', - '2': '༢', - '3': '༣', - '4': '༤', - '5': '༥', - '6': '༦', - '7': '༧', - '8': '༨', - '9': '༩', - '0': '༠' - }, - numberMap = { - '༡': '1', - '༢': '2', - '༣': '3', - '༤': '4', - '༥': '5', - '༦': '6', - '༧': '7', - '༨': '8', - '༩': '9', - '༠': '0' - }; - - var bo = moment.defineLocale('bo', { - months : 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split('_'), - monthsShort : 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split('_'), - weekdays : 'གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་'.split('_'), - weekdaysShort : 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split('_'), - weekdaysMin : 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.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 : '[དི་རིང] LT', - nextDay : '[སང་ཉིན] LT', - nextWeek : '[བདུན་ཕྲག་རྗེས་མ], LT', - lastDay : '[ཁ་སང] LT', - lastWeek : '[བདུན་ཕྲག་མཐའ་མ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ལ་', - past : '%s སྔན་ལ', - s : 'ལམ་སང', - ss : '%d སྐར་ཆ།', - m : 'སྐར་མ་གཅིག', - mm : '%d སྐར་མ', - h : 'ཆུ་ཚོད་གཅིག', - hh : '%d ཆུ་ཚོད', - d : 'ཉིན་གཅིག', - dd : '%d ཉིན་', - M : 'ཟླ་བ་གཅིག', - MM : '%d ཟླ་བ', - y : 'ལོ་གཅིག', - yy : '%d ལོ' - }, - preparse: function (string) { - return string.replace(/[༡༢༣༤༥༦༧༨༩༠]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - meridiemParse: /མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ((meridiem === 'མཚན་མོ' && hour >= 4) || - (meridiem === 'ཉིན་གུང' && hour < 5) || - meridiem === 'དགོང་དག') { - return hour + 12; - } else { - return hour; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'མཚན་མོ'; - } else if (hour < 10) { - return 'ཞོགས་ཀས'; - } else if (hour < 17) { - return 'ཉིན་གུང'; - } else if (hour < 20) { - return 'དགོང་དག'; - } else { - return 'མཚན་མོ'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - return bo; - -}))); diff --git a/locale/br.js b/locale/br.js deleted file mode 100644 index 42994ca65b..0000000000 --- a/locale/br.js +++ /dev/null @@ -1,107 +0,0 @@ -//! 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'; - - - function relativeTimeWithMutation(number, withoutSuffix, key) { - var format = { - 'mm': 'munutenn', - 'MM': 'miz', - 'dd': 'devezh' - }; - return number + ' ' + mutation(format[key], number); - } - function specialMutationForYears(number) { - switch (lastNumber(number)) { - case 1: - case 3: - case 4: - case 5: - case 9: - return number + ' bloaz'; - default: - return number + ' vloaz'; - } - } - function lastNumber(number) { - if (number > 9) { - return lastNumber(number % 10); - } - return number; - } - function mutation(text, number) { - if (number === 2) { - return softMutation(text); - } - return text; - } - function softMutation(text) { - var mutationTable = { - 'm': 'v', - 'b': 'v', - 'd': 'z' - }; - if (mutationTable[text.charAt(0)] === undefined) { - return text; - } - return mutationTable[text.charAt(0)] + text.substring(1); - } - - var br = moment.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 : true, - 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ù', - ss : '%d eilenn', - m : 'ur vunutenn', - mm : relativeTimeWithMutation, - h : 'un eur', - hh : '%d eur', - d : 'un devezh', - dd : relativeTimeWithMutation, - M : 'ur miz', - MM : relativeTimeWithMutation, - y : 'ur bloaz', - yy : specialMutationForYears - }, - dayOfMonthOrdinalParse: /\d{1,2}(añ|vet)/, - ordinal : function (number) { - var output = (number === 1) ? 'añ' : 'vet'; - 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 br; - -}))); diff --git a/locale/bs.js b/locale/bs.js deleted file mode 100644 index 5e3e428603..0000000000 --- a/locale/bs.js +++ /dev/null @@ -1,150 +0,0 @@ -//! 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'; - - - function translate(number, withoutSuffix, key) { - var result = number + ' '; - switch (key) { - case 'ss': - if (number === 1) { - result += 'sekunda'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'sekunde'; - } else { - result += 'sekundi'; - } - return result; - case 'm': - return withoutSuffix ? 'jedna minuta' : 'jedne minute'; - case 'mm': - if (number === 1) { - result += 'minuta'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'minute'; - } else { - result += 'minuta'; - } - return result; - case 'h': - return withoutSuffix ? 'jedan sat' : 'jednog sata'; - case 'hh': - if (number === 1) { - result += 'sat'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'sata'; - } else { - result += 'sati'; - } - return result; - case 'dd': - if (number === 1) { - result += 'dan'; - } else { - result += 'dana'; - } - return result; - case 'MM': - if (number === 1) { - result += 'mjesec'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'mjeseca'; - } else { - result += 'mjeseci'; - } - return result; - case 'yy': - if (number === 1) { - result += 'godina'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'godine'; - } else { - result += 'godina'; - } - return result; - } - } - - var bs = moment.defineLocale('bs', { - months : 'januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar'.split('_'), - monthsShort : 'jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), - weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), - weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[danas u] LT', - nextDay : '[sutra u] LT', - nextWeek : function () { - switch (this.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'; - } - }, - lastDay : '[jučer u] LT', - lastWeek : function () { - switch (this.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'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'prije %s', - s : 'par sekundi', - ss : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : 'dan', - dd : translate, - M : 'mjesec', - MM : translate, - y : 'godinu', - yy : translate - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return bs; - -}))); diff --git a/locale/ca.js b/locale/ca.js deleted file mode 100644 index 9a823b9377..0000000000 --- a/locale/ca.js +++ /dev/null @@ -1,87 +0,0 @@ -//! 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 ca = moment.defineLocale('ca', { - months : { - standalone: 'gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre'.split('_'), - format: 'de gener_de febrer_de març_d\'abril_de maig_de juny_de juliol_d\'agost_de setembre_d\'octubre_de novembre_de desembre'.split('_'), - isFormat: /D[oD]?(\s)+MMMM/ - }, - monthsShort : 'gen._febr._març_abr._maig_juny_jul._ag._set._oct._nov._des.'.split('_'), - monthsParseExact : true, - weekdays : 'diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte'.split('_'), - weekdaysShort : 'dg._dl._dt._dc._dj._dv._ds.'.split('_'), - weekdaysMin : 'dg_dl_dt_dc_dj_dv_ds'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM [de] YYYY', - ll : 'D MMM YYYY', - LLL : 'D MMMM [de] YYYY [a les] H:mm', - lll : 'D MMM YYYY, H:mm', - LLLL : 'dddd D MMMM [de] YYYY [a les] H:mm', - llll : 'ddd D MMM YYYY, H:mm' - }, - calendar : { - sameDay : function () { - return '[avui a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - nextDay : function () { - return '[demà a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - nextWeek : function () { - return 'dddd [a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - lastDay : function () { - return '[ahir a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - lastWeek : function () { - return '[el] dddd [passat a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'd\'aquí %s', - past : 'fa %s', - s : 'uns segons', - ss : '%d segons', - m : 'un minut', - mm : '%d minuts', - h : 'una hora', - hh : '%d hores', - d : 'un dia', - dd : '%d dies', - M : 'un mes', - MM : '%d mesos', - y : 'un any', - yy : '%d anys' - }, - dayOfMonthOrdinalParse: /\d{1,2}(r|n|t|è|a)/, - ordinal : function (number, period) { - var output = (number === 1) ? 'r' : - (number === 2) ? 'n' : - (number === 3) ? 'r' : - (number === 4) ? 't' : 'è'; - if (period === 'w' || period === 'W') { - output = 'a'; - } - 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 ca; - -}))); diff --git a/locale/cs.js b/locale/cs.js deleted file mode 100644 index bb9e3572d2..0000000000 --- a/locale/cs.js +++ /dev/null @@ -1,171 +0,0 @@ -//! 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 = '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); - } - function translate(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': // a few seconds / in a few seconds / a few seconds ago - return (withoutSuffix || isFuture) ? 'pár sekund' : 'pár sekundami'; - case 'ss': // 9 seconds / in 9 seconds / 9 seconds ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'sekundy' : 'sekund'); - } else { - return result + 'sekundami'; - } - break; - case 'm': // a minute / in a minute / a minute ago - return withoutSuffix ? 'minuta' : (isFuture ? 'minutu' : 'minutou'); - case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'minuty' : 'minut'); - } else { - return result + 'minutami'; - } - break; - case 'h': // an hour / in an hour / an hour ago - return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou'); - case 'hh': // 9 hours / in 9 hours / 9 hours ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'hodiny' : 'hodin'); - } else { - return result + 'hodinami'; - } - break; - case 'd': // a day / in a day / a day ago - return (withoutSuffix || isFuture) ? 'den' : 'dnem'; - case 'dd': // 9 days / in 9 days / 9 days ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'dny' : 'dní'); - } else { - return result + 'dny'; - } - break; - case 'M': // a month / in a month / a month ago - return (withoutSuffix || isFuture) ? 'měsíc' : 'měsícem'; - case 'MM': // 9 months / in 9 months / 9 months ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'měsíce' : 'měsíců'); - } else { - return result + 'měsíci'; - } - break; - case 'y': // a year / in a year / a year ago - return (withoutSuffix || isFuture) ? 'rok' : 'rokem'; - case 'yy': // 9 years / in 9 years / 9 years ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'roky' : 'let'); - } else { - return result + 'lety'; - } - break; - } - } - - var cs = moment.defineLocale('cs', { - months : months, - monthsShort : monthsShort, - 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('_'), - longDateFormat : { - LT: 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd D. MMMM YYYY H:mm', - l : 'D. M. YYYY' - }, - calendar : { - sameDay: '[dnes v] LT', - nextDay: '[zítra v] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[v neděli v] LT'; - case 1: - case 2: - return '[v] dddd [v] LT'; - case 3: - return '[ve středu v] LT'; - case 4: - return '[ve čtvrtek v] LT'; - case 5: - return '[v pátek v] LT'; - case 6: - return '[v sobotu v] LT'; - } - }, - lastDay: '[včera v] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[minulou neděli v] LT'; - case 1: - case 2: - return '[minulé] dddd [v] LT'; - case 3: - return '[minulou středu v] LT'; - case 4: - case 5: - return '[minulý] dddd [v] LT'; - case 6: - return '[minulou sobotu v] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'za %s', - past : 'před %s', - s : translate, - ss : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : translate, - dd : translate, - M : translate, - MM : translate, - y : translate, - yy : translate - }, - 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 cs; - -}))); diff --git a/locale/cv.js b/locale/cv.js deleted file mode 100644 index 1db1488c71..0000000000 --- a/locale/cv.js +++ /dev/null @@ -1,62 +0,0 @@ -//! 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 cv = moment.defineLocale('cv', { - months : 'кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав'.split('_'), - monthsShort : 'кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш'.split('_'), - weekdays : 'вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун'.split('_'), - weekdaysShort : 'выр_тун_ытл_юн_кӗҫ_эрн_шӑм'.split('_'), - weekdaysMin : 'вр_тн_ыт_юн_кҫ_эр_шм'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD-MM-YYYY', - LL : 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]', - LLL : 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm', - LLLL : 'dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm' - }, - calendar : { - sameDay: '[Паян] LT [сехетре]', - nextDay: '[Ыран] LT [сехетре]', - lastDay: '[Ӗнер] LT [сехетре]', - nextWeek: '[Ҫитес] dddd LT [сехетре]', - lastWeek: '[Иртнӗ] dddd LT [сехетре]', - sameElse: 'L' - }, - relativeTime : { - future : function (output) { - var affix = /сехет$/i.exec(output) ? 'рен' : /ҫул$/i.exec(output) ? 'тан' : 'ран'; - return output + affix; - }, - past : '%s каялла', - s : 'пӗр-ик ҫеккунт', - ss : '%d ҫеккунт', - m : 'пӗр минут', - mm : '%d минут', - h : 'пӗр сехет', - hh : '%d сехет', - d : 'пӗр кун', - dd : '%d кун', - M : 'пӗр уйӑх', - MM : '%d уйӑх', - y : 'пӗр ҫул', - yy : '%d ҫул' - }, - dayOfMonthOrdinalParse: /\d{1,2}-мӗш/, - ordinal : '%d-мӗш', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return cv; - -}))); diff --git a/locale/cy.js b/locale/cy.js deleted file mode 100644 index 84cbd463ed..0000000000 --- a/locale/cy.js +++ /dev/null @@ -1,79 +0,0 @@ -//! 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 cy = moment.defineLocale('cy', { - months: 'Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr'.split('_'), - monthsShort: 'Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag'.split('_'), - weekdays: 'Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn'.split('_'), - weekdaysShort: 'Sul_Llun_Maw_Mer_Iau_Gwe_Sad'.split('_'), - weekdaysMin: 'Su_Ll_Ma_Me_Ia_Gw_Sa'.split('_'), - weekdaysParseExact : true, - // time formats are the same as en-gb - 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: '[Heddiw am] LT', - nextDay: '[Yfory am] LT', - nextWeek: 'dddd [am] LT', - lastDay: '[Ddoe am] LT', - lastWeek: 'dddd [diwethaf am] LT', - sameElse: 'L' - }, - relativeTime: { - future: 'mewn %s', - past: '%s yn ôl', - s: 'ychydig eiliadau', - ss: '%d eiliad', - m: 'munud', - mm: '%d munud', - h: 'awr', - hh: '%d awr', - d: 'diwrnod', - dd: '%d diwrnod', - M: 'mis', - MM: '%d mis', - y: 'blwyddyn', - yy: '%d flynedd' - }, - dayOfMonthOrdinalParse: /\d{1,2}(fed|ain|af|il|ydd|ed|eg)/, - // traditional ordinal numbers above 31 are not commonly used in colloquial Welsh - ordinal: function (number) { - var b = number, - output = '', - lookup = [ - '', 'af', 'il', 'ydd', 'ydd', 'ed', 'ed', 'ed', 'fed', 'fed', 'fed', // 1af to 10fed - 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'fed' // 11eg to 20fed - ]; - if (b > 20) { - if (b === 40 || b === 50 || b === 60 || b === 80 || b === 100) { - output = 'fed'; // not 30ain, 70ain or 90ain - } else { - output = 'ain'; - } - } else if (b > 0) { - output = lookup[b]; - } - 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 cy; - -}))); diff --git a/locale/da.js b/locale/da.js deleted file mode 100644 index 22a1a5b999..0000000000 --- a/locale/da.js +++ /dev/null @@ -1,59 +0,0 @@ -//! 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 da = moment.defineLocale('da', { - months : 'januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december'.split('_'), - monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), - weekdays : 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'), - weekdaysShort : 'søn_man_tir_ons_tor_fre_lør'.split('_'), - weekdaysMin : 'sø_ma_ti_on_to_fr_lø'.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.] D. MMMM YYYY [kl.] HH:mm' - }, - calendar : { - sameDay : '[i dag kl.] LT', - nextDay : '[i morgen kl.] LT', - nextWeek : 'på dddd [kl.] LT', - lastDay : '[i går kl.] LT', - lastWeek : '[i] dddd[s kl.] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'om %s', - past : '%s siden', - s : 'få sekunder', - ss : '%d sekunder', - m : 'et minut', - mm : '%d minutter', - h : 'en time', - hh : '%d timer', - d : 'en dag', - dd : '%d dage', - M : 'en måned', - MM : '%d måneder', - y : 'et år', - yy : '%d år' - }, - 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 da; - -}))); diff --git a/locale/de-at.js b/locale/de-at.js deleted file mode 100644 index e3ac47b424..0000000000 --- a/locale/de-at.js +++ /dev/null @@ -1,75 +0,0 @@ -//! 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'; - - - function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eine Minute', 'einer Minute'], - 'h': ['eine Stunde', 'einer Stunde'], - 'd': ['ein Tag', 'einem Tag'], - 'dd': [number + ' Tage', number + ' Tagen'], - 'M': ['ein Monat', 'einem Monat'], - 'MM': [number + ' Monate', number + ' Monaten'], - 'y': ['ein Jahr', 'einem Jahr'], - 'yy': [number + ' Jahre', number + ' Jahren'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } - - var deAt = moment.defineLocale('de-at', { - months : 'Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort : 'Jän._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'), - weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), - weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - 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: '[heute um] LT [Uhr]', - sameElse: 'L', - nextDay: '[morgen um] LT [Uhr]', - nextWeek: 'dddd [um] LT [Uhr]', - lastDay: '[gestern um] LT [Uhr]', - lastWeek: '[letzten] dddd [um] LT [Uhr]' - }, - relativeTime : { - future : 'in %s', - past : 'vor %s', - s : 'ein paar Sekunden', - ss : '%d Sekunden', - m : processRelativeTime, - mm : '%d Minuten', - h : processRelativeTime, - hh : '%d Stunden', - d : processRelativeTime, - dd : processRelativeTime, - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - 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 deAt; - -}))); diff --git a/locale/de-ch.js b/locale/de-ch.js deleted file mode 100644 index 2676afbc79..0000000000 --- a/locale/de-ch.js +++ /dev/null @@ -1,75 +0,0 @@ -//! 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'; - - - function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eine Minute', 'einer Minute'], - 'h': ['eine Stunde', 'einer Stunde'], - 'd': ['ein Tag', 'einem Tag'], - 'dd': [number + ' Tage', number + ' Tagen'], - 'M': ['ein Monat', 'einem Monat'], - 'MM': [number + ' Monate', number + ' Monaten'], - 'y': ['ein Jahr', 'einem Jahr'], - 'yy': [number + ' Jahre', number + ' Jahren'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } - - var deCh = moment.defineLocale('de-ch', { - months : 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort : 'Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'), - weekdaysShort : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - 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: '[heute um] LT [Uhr]', - sameElse: 'L', - nextDay: '[morgen um] LT [Uhr]', - nextWeek: 'dddd [um] LT [Uhr]', - lastDay: '[gestern um] LT [Uhr]', - lastWeek: '[letzten] dddd [um] LT [Uhr]' - }, - relativeTime : { - future : 'in %s', - past : 'vor %s', - s : 'ein paar Sekunden', - ss : '%d Sekunden', - m : processRelativeTime, - mm : '%d Minuten', - h : processRelativeTime, - hh : '%d Stunden', - d : processRelativeTime, - dd : processRelativeTime, - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - 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 deCh; - -}))); diff --git a/locale/de.js b/locale/de.js deleted file mode 100644 index d5c084a2c8..0000000000 --- a/locale/de.js +++ /dev/null @@ -1,75 +0,0 @@ -//! 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'; - - - function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eine Minute', 'einer Minute'], - 'h': ['eine Stunde', 'einer Stunde'], - 'd': ['ein Tag', 'einem Tag'], - 'dd': [number + ' Tage', number + ' Tagen'], - 'M': ['ein Monat', 'einem Monat'], - 'MM': [number + ' Monate', number + ' Monaten'], - 'y': ['ein Jahr', 'einem Jahr'], - 'yy': [number + ' Jahre', number + ' Jahren'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } - - var de = moment.defineLocale('de', { - months : 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort : 'Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'), - weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), - weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - 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: '[heute um] LT [Uhr]', - sameElse: 'L', - nextDay: '[morgen um] LT [Uhr]', - nextWeek: 'dddd [um] LT [Uhr]', - lastDay: '[gestern um] LT [Uhr]', - lastWeek: '[letzten] dddd [um] LT [Uhr]' - }, - relativeTime : { - future : 'in %s', - past : 'vor %s', - s : 'ein paar Sekunden', - ss : '%d Sekunden', - m : processRelativeTime, - mm : '%d Minuten', - h : processRelativeTime, - hh : '%d Stunden', - d : processRelativeTime, - dd : processRelativeTime, - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - 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 de; - -}))); diff --git a/locale/dv.js b/locale/dv.js deleted file mode 100644 index 8729b02c0c..0000000000 --- a/locale/dv.js +++ /dev/null @@ -1,98 +0,0 @@ -//! 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 = [ - 'ޖެނުއަރީ', - 'ފެބްރުއަރީ', - 'މާރިޗު', - 'އޭޕްރީލު', - 'މޭ', - 'ޖޫން', - 'ޖުލައި', - 'އޯގަސްޓު', - 'ސެޕްޓެމްބަރު', - 'އޮކްޓޯބަރު', - 'ނޮވެމްބަރު', - 'ޑިސެމްބަރު' - ], weekdays = [ - 'އާދިއްތަ', - 'ހޯމަ', - 'އަންގާރަ', - 'ބުދަ', - 'ބުރާސްފަތި', - 'ހުކުރު', - 'ހޮނިހިރު' - ]; - - var dv = moment.defineLocale('dv', { - months : months, - monthsShort : months, - weekdays : weekdays, - weekdaysShort : weekdays, - weekdaysMin : 'އާދި_ހޯމަ_އަން_ބުދަ_ބުރާ_ހުކު_ހޮނި'.split('_'), - longDateFormat : { - - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'D/M/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - meridiemParse: /މކ|މފ/, - isPM : function (input) { - return 'މފ' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'މކ'; - } else { - return 'މފ'; - } - }, - calendar : { - sameDay : '[މިއަދު] LT', - nextDay : '[މާދަމާ] LT', - nextWeek : 'dddd LT', - lastDay : '[އިއްޔެ] LT', - lastWeek : '[ފާއިތުވި] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ތެރޭގައި %s', - past : 'ކުރިން %s', - s : 'ސިކުންތުކޮޅެއް', - ss : 'd% ސިކުންތު', - m : 'މިނިޓެއް', - mm : 'މިނިޓު %d', - h : 'ގަޑިއިރެއް', - hh : 'ގަޑިއިރު %d', - d : 'ދުވަހެއް', - dd : 'ދުވަސް %d', - M : 'މަހެއް', - MM : 'މަސް %d', - y : 'އަހަރެއް', - yy : 'އަހަރު %d' - }, - preparse: function (string) { - return string.replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/,/g, '،'); - }, - week : { - dow : 7, // Sunday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } - }); - - return dv; - -}))); diff --git a/locale/el.js b/locale/el.js deleted file mode 100644 index f01fa772a6..0000000000 --- a/locale/el.js +++ /dev/null @@ -1,99 +0,0 @@ -//! 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'; - - function isFunction(input) { - return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; - } - - - var el = moment.defineLocale('el', { - monthsNominativeEl : 'Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος'.split('_'), - monthsGenitiveEl : 'Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου'.split('_'), - months : function (momentToFormat, format) { - if (!momentToFormat) { - return this._monthsNominativeEl; - } else if (typeof format === 'string' && /D/.test(format.substring(0, format.indexOf('MMMM')))) { // if there is a day number before 'MMMM' - return this._monthsGenitiveEl[momentToFormat.month()]; - } else { - return this._monthsNominativeEl[momentToFormat.month()]; - } - }, - monthsShort : 'Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ'.split('_'), - weekdays : 'Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο'.split('_'), - weekdaysShort : 'Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ'.split('_'), - weekdaysMin : 'Κυ_Δε_Τρ_Τε_Πε_Πα_Σα'.split('_'), - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'μμ' : 'ΜΜ'; - } else { - return isLower ? 'πμ' : 'ΠΜ'; - } - }, - isPM : function (input) { - return ((input + '').toLowerCase()[0] === 'μ'); - }, - meridiemParse : /[ΠΜ]\.?Μ?\.?/i, - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendarEl : { - sameDay : '[Σήμερα {}] LT', - nextDay : '[Αύριο {}] LT', - nextWeek : 'dddd [{}] LT', - lastDay : '[Χθες {}] LT', - lastWeek : function () { - switch (this.day()) { - case 6: - return '[το προηγούμενο] dddd [{}] LT'; - default: - return '[την προηγούμενη] dddd [{}] LT'; - } - }, - sameElse : 'L' - }, - calendar : function (key, mom) { - var output = this._calendarEl[key], - hours = mom && mom.hours(); - if (isFunction(output)) { - output = output.apply(mom); - } - return output.replace('{}', (hours % 12 === 1 ? 'στη' : 'στις')); - }, - relativeTime : { - future : 'σε %s', - past : '%s πριν', - s : 'λίγα δευτερόλεπτα', - ss : '%d δευτερόλεπτα', - m : 'ένα λεπτό', - mm : '%d λεπτά', - h : 'μία ώρα', - hh : '%d ώρες', - d : 'μία μέρα', - dd : '%d μέρες', - M : 'ένας μήνας', - MM : '%d μήνες', - y : 'ένας χρόνος', - yy : '%d χρόνια' - }, - dayOfMonthOrdinalParse: /\d{1,2}η/, - ordinal: '%dη', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4st is the first week of the year. - } - }); - - return el; - -}))); diff --git a/locale/tet.js b/locale/en-sg.js similarity index 51% rename from locale/tet.js rename to locale/en-sg.js index efa53da1ec..d317c8ad77 100644 --- a/locale/tet.js +++ b/locale/en-sg.js @@ -8,12 +8,12 @@ }(this, (function (moment) { 'use strict'; - var tet = moment.defineLocale('tet', { - months : 'Janeiru_Fevereiru_Marsu_Abril_Maiu_Juñu_Jullu_Agustu_Setembru_Outubru_Novembru_Dezembru'.split('_'), - monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'), - weekdays : 'Domingu_Segunda_Tersa_Kuarta_Kinta_Sesta_Sabadu'.split('_'), - weekdaysShort : 'Dom_Seg_Ters_Kua_Kint_Sest_Sab'.split('_'), - weekdaysMin : 'Do_Seg_Te_Ku_Ki_Ses_Sa'.split('_'), + 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', @@ -23,28 +23,28 @@ LLLL : 'dddd, D MMMM YYYY HH:mm' }, calendar : { - sameDay: '[Ohin iha] LT', - nextDay: '[Aban iha] LT', - nextWeek: 'dddd [iha] LT', - lastDay: '[Horiseik iha] LT', - lastWeek: 'dddd [semana kotuk] [iha] LT', - sameElse: 'L' + 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 : 'iha %s', - past : '%s liuba', - s : 'minutu balun', - ss : 'minutu %d', - m : 'minutu ida', - mm : 'minutu %d', - h : 'oras ida', - hh : 'oras %d', - d : 'loron ida', - dd : 'loron %d', - M : 'fulan ida', - MM : 'fulan %d', - y : 'tinan ida', - yy : 'tinan %d' + 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) { @@ -61,6 +61,6 @@ } }); - return tet; + return enSg; }))); diff --git a/locale/eo.js b/locale/eo.js deleted file mode 100644 index 283ebed893..0000000000 --- a/locale/eo.js +++ /dev/null @@ -1,70 +0,0 @@ -//! 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 eo = moment.defineLocale('eo', { - months : 'januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro'.split('_'), - monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aŭg_sep_okt_nov_dec'.split('_'), - weekdays : 'dimanĉo_lundo_mardo_merkredo_ĵaŭdo_vendredo_sabato'.split('_'), - weekdaysShort : 'dim_lun_mard_merk_ĵaŭ_ven_sab'.split('_'), - weekdaysMin : 'di_lu_ma_me_ĵa_ve_sa'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'D[-a de] MMMM, YYYY', - LLL : 'D[-a de] MMMM, YYYY HH:mm', - LLLL : 'dddd, [la] D[-a de] MMMM, YYYY HH:mm' - }, - meridiemParse: /[ap]\.t\.m/i, - isPM: function (input) { - return input.charAt(0).toLowerCase() === 'p'; - }, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'p.t.m.' : 'P.T.M.'; - } else { - return isLower ? 'a.t.m.' : 'A.T.M.'; - } - }, - calendar : { - sameDay : '[Hodiaŭ je] LT', - nextDay : '[Morgaŭ je] LT', - nextWeek : 'dddd [je] LT', - lastDay : '[Hieraŭ je] LT', - lastWeek : '[pasinta] dddd [je] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'post %s', - past : 'antaŭ %s', - s : 'sekundoj', - ss : '%d sekundoj', - m : 'minuto', - mm : '%d minutoj', - h : 'horo', - hh : '%d horoj', - d : 'tago',//ne 'diurno', ĉar estas uzita por proksimumo - dd : '%d tagoj', - M : 'monato', - MM : '%d monatoj', - y : 'jaro', - yy : '%d jaroj' - }, - dayOfMonthOrdinalParse: /\d{1,2}a/, - ordinal : '%da', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return eo; - -}))); diff --git a/locale/es.js b/locale/es.js index aed6802603..39e9f462dc 100644 --- a/locale/es.js +++ b/locale/es.js @@ -83,7 +83,8 @@ 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. - } + }, + invalidDate: 'Fecha invalida' }); return es; diff --git a/locale/et.js b/locale/et.js deleted file mode 100644 index 8a81b04083..0000000000 --- a/locale/et.js +++ /dev/null @@ -1,79 +0,0 @@ -//! 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'; - - - function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 's' : ['mõne sekundi', 'mõni sekund', 'paar sekundit'], - 'ss': [number + 'sekundi', number + 'sekundit'], - 'm' : ['ühe minuti', 'üks minut'], - 'mm': [number + ' minuti', number + ' minutit'], - 'h' : ['ühe tunni', 'tund aega', 'üks tund'], - 'hh': [number + ' tunni', number + ' tundi'], - 'd' : ['ühe päeva', 'üks päev'], - 'M' : ['kuu aja', 'kuu aega', 'üks kuu'], - 'MM': [number + ' kuu', number + ' kuud'], - 'y' : ['ühe aasta', 'aasta', 'üks aasta'], - 'yy': [number + ' aasta', number + ' aastat'] - }; - if (withoutSuffix) { - return format[key][2] ? format[key][2] : format[key][1]; - } - return isFuture ? format[key][0] : format[key][1]; - } - - var et = moment.defineLocale('et', { - months : 'jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember'.split('_'), - monthsShort : 'jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets'.split('_'), - weekdays : 'pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev'.split('_'), - weekdaysShort : 'P_E_T_K_N_R_L'.split('_'), - weekdaysMin : 'P_E_T_K_N_R_L'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[Täna,] LT', - nextDay : '[Homme,] LT', - nextWeek : '[Järgmine] dddd LT', - lastDay : '[Eile,] LT', - lastWeek : '[Eelmine] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s pärast', - past : '%s tagasi', - s : processRelativeTime, - ss : processRelativeTime, - m : processRelativeTime, - mm : processRelativeTime, - h : processRelativeTime, - hh : processRelativeTime, - d : processRelativeTime, - dd : '%d päeva', - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - 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 et; - -}))); diff --git a/locale/eu.js b/locale/eu.js deleted file mode 100644 index 2c7781b940..0000000000 --- a/locale/eu.js +++ /dev/null @@ -1,65 +0,0 @@ -//! 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 eu = moment.defineLocale('eu', { - months : 'urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua'.split('_'), - monthsShort : 'urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.'.split('_'), - monthsParseExact : true, - weekdays : 'igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata'.split('_'), - weekdaysShort : 'ig._al._ar._az._og._ol._lr.'.split('_'), - weekdaysMin : 'ig_al_ar_az_og_ol_lr'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'YYYY[ko] MMMM[ren] D[a]', - LLL : 'YYYY[ko] MMMM[ren] D[a] HH:mm', - LLLL : 'dddd, YYYY[ko] MMMM[ren] D[a] HH:mm', - l : 'YYYY-M-D', - ll : 'YYYY[ko] MMM D[a]', - lll : 'YYYY[ko] MMM D[a] HH:mm', - llll : 'ddd, YYYY[ko] MMM D[a] HH:mm' - }, - calendar : { - sameDay : '[gaur] LT[etan]', - nextDay : '[bihar] LT[etan]', - nextWeek : 'dddd LT[etan]', - lastDay : '[atzo] LT[etan]', - lastWeek : '[aurreko] dddd LT[etan]', - sameElse : 'L' - }, - relativeTime : { - future : '%s barru', - past : 'duela %s', - s : 'segundo batzuk', - ss : '%d segundo', - m : 'minutu bat', - mm : '%d minutu', - h : 'ordu bat', - hh : '%d ordu', - d : 'egun bat', - dd : '%d egun', - M : 'hilabete bat', - MM : '%d hilabete', - y : 'urte bat', - yy : '%d urte' - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return eu; - -}))); diff --git a/locale/fa.js b/locale/fa.js deleted file mode 100644 index e84f7ca1d3..0000000000 --- a/locale/fa.js +++ /dev/null @@ -1,105 +0,0 @@ -//! 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 symbolMap = { - '1': '۱', - '2': '۲', - '3': '۳', - '4': '۴', - '5': '۵', - '6': '۶', - '7': '۷', - '8': '۸', - '9': '۹', - '0': '۰' - }, numberMap = { - '۱': '1', - '۲': '2', - '۳': '3', - '۴': '4', - '۵': '5', - '۶': '6', - '۷': '7', - '۸': '8', - '۹': '9', - '۰': '0' - }; - - var fa = moment.defineLocale('fa', { - months : 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), - monthsShort : 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), - weekdays : 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'), - weekdaysShort : 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'), - weekdaysMin : 'ی_د_س_چ_پ_ج_ش'.split('_'), - weekdaysParseExact : true, - 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: /قبل از ظهر|بعد از ظهر/, - isPM: function (input) { - return /بعد از ظهر/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'قبل از ظهر'; - } else { - return 'بعد از ظهر'; - } - }, - calendar : { - sameDay : '[امروز ساعت] LT', - nextDay : '[فردا ساعت] LT', - nextWeek : 'dddd [ساعت] LT', - lastDay : '[دیروز ساعت] LT', - lastWeek : 'dddd [پیش] [ساعت] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'در %s', - past : '%s پیش', - s : 'چند ثانیه', - ss : 'ثانیه d%', - m : 'یک دقیقه', - mm : '%d دقیقه', - h : 'یک ساعت', - hh : '%d ساعت', - d : 'یک روز', - dd : '%d روز', - M : 'یک ماه', - MM : '%d ماه', - y : 'یک سال', - yy : '%d سال' - }, - preparse: function (string) { - return string.replace(/[۰-۹]/g, function (match) { - return numberMap[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }).replace(/,/g, '،'); - }, - dayOfMonthOrdinalParse: /\d{1,2}م/, - ordinal : '%dم', - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } - }); - - return fa; - -}))); diff --git a/locale/fi.js b/locale/fi.js deleted file mode 100644 index b01159935a..0000000000 --- a/locale/fi.js +++ /dev/null @@ -1,108 +0,0 @@ -//! 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 numbersPast = 'nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän'.split(' '), - numbersFuture = [ - 'nolla', 'yhden', 'kahden', 'kolmen', 'neljän', 'viiden', 'kuuden', - numbersPast[7], numbersPast[8], numbersPast[9] - ]; - function translate(number, withoutSuffix, key, isFuture) { - var result = ''; - switch (key) { - case 's': - return isFuture ? 'muutaman sekunnin' : 'muutama sekunti'; - case 'ss': - return isFuture ? 'sekunnin' : 'sekuntia'; - case 'm': - return isFuture ? 'minuutin' : 'minuutti'; - case 'mm': - result = isFuture ? 'minuutin' : 'minuuttia'; - break; - case 'h': - return isFuture ? 'tunnin' : 'tunti'; - case 'hh': - result = isFuture ? 'tunnin' : 'tuntia'; - break; - case 'd': - return isFuture ? 'päivän' : 'päivä'; - case 'dd': - result = isFuture ? 'päivän' : 'päivää'; - break; - case 'M': - return isFuture ? 'kuukauden' : 'kuukausi'; - case 'MM': - result = isFuture ? 'kuukauden' : 'kuukautta'; - break; - case 'y': - return isFuture ? 'vuoden' : 'vuosi'; - case 'yy': - result = isFuture ? 'vuoden' : 'vuotta'; - break; - } - result = verbalNumber(number, isFuture) + ' ' + result; - return result; - } - function verbalNumber(number, isFuture) { - return number < 10 ? (isFuture ? numbersFuture[number] : numbersPast[number]) : number; - } - - var fi = moment.defineLocale('fi', { - months : 'tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu'.split('_'), - monthsShort : 'tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu'.split('_'), - weekdays : 'sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai'.split('_'), - weekdaysShort : 'su_ma_ti_ke_to_pe_la'.split('_'), - weekdaysMin : 'su_ma_ti_ke_to_pe_la'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD.MM.YYYY', - LL : 'Do MMMM[ta] YYYY', - LLL : 'Do MMMM[ta] YYYY, [klo] HH.mm', - LLLL : 'dddd, Do MMMM[ta] YYYY, [klo] HH.mm', - l : 'D.M.YYYY', - ll : 'Do MMM YYYY', - lll : 'Do MMM YYYY, [klo] HH.mm', - llll : 'ddd, Do MMM YYYY, [klo] HH.mm' - }, - calendar : { - sameDay : '[tänään] [klo] LT', - nextDay : '[huomenna] [klo] LT', - nextWeek : 'dddd [klo] LT', - lastDay : '[eilen] [klo] LT', - lastWeek : '[viime] dddd[na] [klo] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s päästä', - past : '%s sitten', - s : translate, - ss : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : translate, - dd : translate, - M : translate, - MM : translate, - y : translate, - yy : translate - }, - 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 fi; - -}))); diff --git a/locale/fo.js b/locale/fo.js deleted file mode 100644 index 8e81cfe681..0000000000 --- a/locale/fo.js +++ /dev/null @@ -1,59 +0,0 @@ -//! 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 fo = moment.defineLocale('fo', { - months : 'januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember'.split('_'), - monthsShort : 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'), - weekdays : 'sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur'.split('_'), - weekdaysShort : 'sun_mán_týs_mik_hós_frí_ley'.split('_'), - weekdaysMin : 'su_má_tý_mi_hó_fr_le'.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 : '[Í dag kl.] LT', - nextDay : '[Í morgin kl.] LT', - nextWeek : 'dddd [kl.] LT', - lastDay : '[Í gjár kl.] LT', - lastWeek : '[síðstu] dddd [kl] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'um %s', - past : '%s síðani', - s : 'fá sekund', - ss : '%d sekundir', - m : 'ein minuttur', - mm : '%d minuttir', - h : 'ein tími', - hh : '%d tímar', - d : 'ein dagur', - dd : '%d dagar', - M : 'ein mánaður', - MM : '%d mánaðir', - y : 'eitt ár', - yy : '%d ár' - }, - 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 fo; - -}))); diff --git a/locale/fr-ca.js b/locale/fr-ca.js deleted file mode 100644 index ad1f77d5e6..0000000000 --- a/locale/fr-ca.js +++ /dev/null @@ -1,73 +0,0 @@ -//! 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 frCa = moment.defineLocale('fr-ca', { - months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), - monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), - monthsParseExact : true, - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'di_lu_ma_me_je_ve_sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Aujourd’hui à] LT', - nextDay : '[Demain à] LT', - nextWeek : 'dddd [à] LT', - lastDay : '[Hier à] LT', - lastWeek : 'dddd [dernier à] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dans %s', - past : 'il y a %s', - s : 'quelques secondes', - ss : '%d secondes', - m : 'une minute', - mm : '%d minutes', - h : 'une heure', - hh : '%d heures', - d : 'un jour', - dd : '%d jours', - M : 'un mois', - MM : '%d mois', - y : 'un an', - yy : '%d ans' - }, - dayOfMonthOrdinalParse: /\d{1,2}(er|e)/, - ordinal : function (number, period) { - switch (period) { - // Words with masculine grammatical gender: mois, trimestre, jour - default: - case 'M': - case 'Q': - case 'D': - case 'DDD': - case 'd': - return number + (number === 1 ? 'er' : 'e'); - - // Words with feminine grammatical gender: semaine - case 'w': - case 'W': - return number + (number === 1 ? 're' : 'e'); - } - } - }); - - return frCa; - -}))); diff --git a/locale/fr-ch.js b/locale/fr-ch.js deleted file mode 100644 index 54033d14b8..0000000000 --- a/locale/fr-ch.js +++ /dev/null @@ -1,77 +0,0 @@ -//! 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 frCh = moment.defineLocale('fr-ch', { - months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), - monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), - monthsParseExact : true, - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'di_lu_ma_me_je_ve_sa'.split('_'), - weekdaysParseExact : true, - 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 : '[Aujourd’hui à] LT', - nextDay : '[Demain à] LT', - nextWeek : 'dddd [à] LT', - lastDay : '[Hier à] LT', - lastWeek : 'dddd [dernier à] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dans %s', - past : 'il y a %s', - s : 'quelques secondes', - ss : '%d secondes', - m : 'une minute', - mm : '%d minutes', - h : 'une heure', - hh : '%d heures', - d : 'un jour', - dd : '%d jours', - M : 'un mois', - MM : '%d mois', - y : 'un an', - yy : '%d ans' - }, - dayOfMonthOrdinalParse: /\d{1,2}(er|e)/, - ordinal : function (number, period) { - switch (period) { - // Words with masculine grammatical gender: mois, trimestre, jour - default: - case 'M': - case 'Q': - case 'D': - case 'DDD': - case 'd': - return number + (number === 1 ? 'er' : 'e'); - - // Words with feminine grammatical gender: semaine - case 'w': - case 'W': - return number + (number === 1 ? 're' : 'e'); - } - }, - 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 frCh; - -}))); diff --git a/locale/fr.js b/locale/fr.js deleted file mode 100644 index 9286707339..0000000000 --- a/locale/fr.js +++ /dev/null @@ -1,82 +0,0 @@ -//! 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 fr = moment.defineLocale('fr', { - months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), - monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), - monthsParseExact : true, - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'di_lu_ma_me_je_ve_sa'.split('_'), - weekdaysParseExact : true, - 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 : '[Aujourd’hui à] LT', - nextDay : '[Demain à] LT', - nextWeek : 'dddd [à] LT', - lastDay : '[Hier à] LT', - lastWeek : 'dddd [dernier à] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dans %s', - past : 'il y a %s', - s : 'quelques secondes', - ss : '%d secondes', - m : 'une minute', - mm : '%d minutes', - h : 'une heure', - hh : '%d heures', - d : 'un jour', - dd : '%d jours', - M : 'un mois', - MM : '%d mois', - y : 'un an', - yy : '%d ans' - }, - dayOfMonthOrdinalParse: /\d{1,2}(er|)/, - ordinal : function (number, period) { - switch (period) { - // TODO: Return 'e' when day of month > 1. Move this case inside - // block for masculine words below. - // See https://github.com/moment/moment/issues/3375 - case 'D': - return number + (number === 1 ? 'er' : ''); - - // Words with masculine grammatical gender: mois, trimestre, jour - default: - case 'M': - case 'Q': - case 'DDD': - case 'd': - return number + (number === 1 ? 'er' : 'e'); - - // Words with feminine grammatical gender: semaine - case 'w': - case 'W': - return number + (number === 1 ? 're' : 'e'); - } - }, - 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 fr; - -}))); diff --git a/locale/fy.js b/locale/fy.js deleted file mode 100644 index 9a672bf4ff..0000000000 --- a/locale/fy.js +++ /dev/null @@ -1,74 +0,0 @@ -//! 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 monthsShortWithDots = 'jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.'.split('_'), - monthsShortWithoutDots = 'jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'); - - var fy = moment.defineLocale('fy', { - months : 'jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber'.split('_'), - monthsShort : function (m, format) { - if (!m) { - return monthsShortWithDots; - } else if (/-MMM-/.test(format)) { - return monthsShortWithoutDots[m.month()]; - } else { - return monthsShortWithDots[m.month()]; - } - }, - monthsParseExact : true, - weekdays : 'snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon'.split('_'), - weekdaysShort : 'si._mo._ti._wo._to._fr._so.'.split('_'), - weekdaysMin : 'Si_Mo_Ti_Wo_To_Fr_So'.split('_'), - weekdaysParseExact : true, - 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: '[hjoed om] LT', - nextDay: '[moarn om] LT', - nextWeek: 'dddd [om] LT', - lastDay: '[juster om] LT', - lastWeek: '[ôfrûne] dddd [om] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'oer %s', - past : '%s lyn', - s : 'in pear sekonden', - ss : '%d sekonden', - m : 'ien minút', - mm : '%d minuten', - h : 'ien oere', - hh : '%d oeren', - d : 'ien dei', - dd : '%d dagen', - M : 'ien moanne', - MM : '%d moannen', - y : 'ien jier', - yy : '%d jierren' - }, - dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/, - ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); - }, - 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 fy; - -}))); diff --git a/locale/ga.js b/locale/ga.js deleted file mode 100644 index a5b92de489..0000000000 --- a/locale/ga.js +++ /dev/null @@ -1,76 +0,0 @@ -//! 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/gd.js b/locale/gd.js deleted file mode 100644 index 4d0d88a747..0000000000 --- a/locale/gd.js +++ /dev/null @@ -1,75 +0,0 @@ -//! 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 = [ - '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 = ['Faoi', 'Gear', 'Màrt', 'Gibl', 'Cèit', 'Ògmh', 'Iuch', 'Lùn', 'Sult', 'Dàmh', 'Samh', 'Dùbh']; - - var weekdays = ['Didòmhnaich', 'Diluain', 'Dimàirt', 'Diciadain', 'Diardaoin', 'Dihaoine', 'Disathairne']; - - var weekdaysShort = ['Did', 'Dil', 'Dim', 'Dic', 'Dia', 'Dih', 'Dis']; - - var weekdaysMin = ['Dò', 'Lu', 'Mà', 'Ci', 'Ar', 'Ha', 'Sa']; - - var gd = moment.defineLocale('gd', { - 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 : '[An-diugh aig] LT', - nextDay : '[A-màireach aig] LT', - nextWeek : 'dddd [aig] LT', - lastDay : '[An-dè aig] LT', - lastWeek : 'dddd [seo chaidh] [aig] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ann an %s', - past : 'bho chionn %s', - s : 'beagan diogan', - ss : '%d diogan', - m : 'mionaid', - mm : '%d mionaidean', - h : 'uair', - hh : '%d uairean', - d : 'latha', - dd : '%d latha', - M : 'mìos', - MM : '%d mìosan', - y : 'bliadhna', - yy : '%d bliadhna' - }, - 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 gd; - -}))); diff --git a/locale/gl.js b/locale/gl.js deleted file mode 100644 index 1cc4177ccc..0000000000 --- a/locale/gl.js +++ /dev/null @@ -1,76 +0,0 @@ -//! 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 gl = moment.defineLocale('gl', { - months : 'xaneiro_febreiro_marzo_abril_maio_xuño_xullo_agosto_setembro_outubro_novembro_decembro'.split('_'), - monthsShort : 'xan._feb._mar._abr._mai._xuñ._xul._ago._set._out._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'domingo_luns_martes_mércores_xoves_venres_sábado'.split('_'), - weekdaysShort : 'dom._lun._mar._mér._xov._ven._sáb.'.split('_'), - weekdaysMin : 'do_lu_ma_mé_xo_ve_sá'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [de] MMMM [de] YYYY', - LLL : 'D [de] MMMM [de] YYYY H:mm', - LLLL : 'dddd, D [de] MMMM [de] YYYY H:mm' - }, - calendar : { - sameDay : function () { - return '[hoxe ' + ((this.hours() !== 1) ? 'ás' : 'á') + '] LT'; - }, - nextDay : function () { - return '[mañá ' + ((this.hours() !== 1) ? 'ás' : 'á') + '] LT'; - }, - nextWeek : function () { - return 'dddd [' + ((this.hours() !== 1) ? 'ás' : 'a') + '] LT'; - }, - lastDay : function () { - return '[onte ' + ((this.hours() !== 1) ? 'á' : 'a') + '] LT'; - }, - lastWeek : function () { - return '[o] dddd [pasado ' + ((this.hours() !== 1) ? 'ás' : 'a') + '] LT'; - }, - sameElse : 'L' - }, - relativeTime : { - future : function (str) { - if (str.indexOf('un') === 0) { - return 'n' + str; - } - return 'en ' + str; - }, - past : 'hai %s', - s : 'uns segundos', - ss : '%d segundos', - m : 'un minuto', - mm : '%d minutos', - h : 'unha hora', - hh : '%d horas', - d : 'un día', - dd : '%d días', - M : 'un mes', - MM : '%d meses', - y : 'un ano', - yy : '%d anos' - }, - 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 gl; - -}))); diff --git a/locale/gom-latn.js b/locale/gom-latn.js deleted file mode 100644 index bfad12e739..0000000000 --- a/locale/gom-latn.js +++ /dev/null @@ -1,122 +0,0 @@ -//! 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'; - - - function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 's': ['thodde secondanim', 'thodde second'], - 'ss': [number + ' secondanim', number + ' second'], - 'm': ['eka mintan', 'ek minute'], - 'mm': [number + ' mintanim', number + ' mintam'], - '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'], - 'MM': [number + ' mhoineanim', number + ' mhoine'], - 'y': ['eka vorsan', 'ek voros'], - 'yy': [number + ' vorsanim', number + ' vorsam'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } - - var gomLatn = moment.defineLocale('gom-latn', { - months : 'Janer_Febrer_Mars_Abril_Mai_Jun_Julai_Agost_Setembr_Otubr_Novembr_Dezembr'.split('_'), - monthsShort : 'Jan._Feb._Mars_Abr._Mai_Jun_Jul._Ago._Set._Otu._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays : 'Aitar_Somar_Mongllar_Budvar_Brestar_Sukrar_Son\'var'.split('_'), - weekdaysShort : 'Ait._Som._Mon._Bud._Bre._Suk._Son.'.split('_'), - weekdaysMin : 'Ai_Sm_Mo_Bu_Br_Su_Sn'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'A h:mm [vazta]', - LTS : 'A h:mm:ss [vazta]', - L : 'DD-MM-YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY A h:mm [vazta]', - LLLL : 'dddd, MMMM[achea] Do, YYYY, A h:mm [vazta]', - llll: 'ddd, D MMM YYYY, A h:mm [vazta]' - }, - calendar : { - sameDay: '[Aiz] LT', - nextDay: '[Faleam] LT', - nextWeek: '[Ieta to] dddd[,] LT', - lastDay: '[Kal] LT', - lastWeek: '[Fatlo] dddd[,] LT', - sameElse: 'L' - }, - relativeTime : { - future : '%s', - past : '%s adim', - s : processRelativeTime, - ss : processRelativeTime, - m : processRelativeTime, - mm : processRelativeTime, - h : processRelativeTime, - hh : processRelativeTime, - d : processRelativeTime, - dd : processRelativeTime, - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - dayOfMonthOrdinalParse : /\d{1,2}(er)/, - ordinal : function (number, period) { - switch (period) { - // the ordinal 'er' only applies to day of the month - case 'D': - return number + 'er'; - default: - case 'M': - case 'Q': - case 'DDD': - case 'd': - case 'w': - case 'W': - return number; - } - }, - 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. - }, - meridiemParse: /rati|sokalli|donparam|sanje/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'rati') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'sokalli') { - return hour; - } else if (meridiem === 'donparam') { - return hour > 12 ? hour : hour + 12; - } else if (meridiem === 'sanje') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'rati'; - } else if (hour < 12) { - return 'sokalli'; - } else if (hour < 16) { - return 'donparam'; - } else if (hour < 20) { - return 'sanje'; - } else { - return 'rati'; - } - } - }); - - return gomLatn; - -}))); diff --git a/locale/gu.js b/locale/gu.js deleted file mode 100644 index 9f80dbd7fd..0000000000 --- a/locale/gu.js +++ /dev/null @@ -1,123 +0,0 @@ -//! 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 symbolMap = { - '1': '૧', - '2': '૨', - '3': '૩', - '4': '૪', - '5': '૫', - '6': '૬', - '7': '૭', - '8': '૮', - '9': '૯', - '0': '૦' - }, - numberMap = { - '૧': '1', - '૨': '2', - '૩': '3', - '૪': '4', - '૫': '5', - '૬': '6', - '૭': '7', - '૮': '8', - '૯': '9', - '૦': '0' - }; - - var gu = moment.defineLocale('gu', { - months: 'જાન્યુઆરી_ફેબ્રુઆરી_માર્ચ_એપ્રિલ_મે_જૂન_જુલાઈ_ઑગસ્ટ_સપ્ટેમ્બર_ઑક્ટ્બર_નવેમ્બર_ડિસેમ્બર'.split('_'), - monthsShort: 'જાન્યુ._ફેબ્રુ._માર્ચ_એપ્રિ._મે_જૂન_જુલા._ઑગ._સપ્ટે._ઑક્ટ્._નવે._ડિસે.'.split('_'), - monthsParseExact: true, - weekdays: 'રવિવાર_સોમવાર_મંગળવાર_બુધ્વાર_ગુરુવાર_શુક્રવાર_શનિવાર'.split('_'), - weekdaysShort: 'રવિ_સોમ_મંગળ_બુધ્_ગુરુ_શુક્ર_શનિ'.split('_'), - weekdaysMin: 'ર_સો_મં_બુ_ગુ_શુ_શ'.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: '[આજ] LT', - nextDay: '[કાલે] LT', - nextWeek: 'dddd, LT', - lastDay: '[ગઇકાલે] LT', - lastWeek: '[પાછલા] dddd, LT', - sameElse: 'L' - }, - relativeTime: { - future: '%s મા', - past: '%s પેહલા', - s: 'અમુક પળો', - ss: '%d સેકંડ', - m: 'એક મિનિટ', - mm: '%d મિનિટ', - h: 'એક કલાક', - hh: '%d કલાક', - d: 'એક દિવસ', - dd: '%d દિવસ', - M: 'એક મહિનો', - MM: '%d મહિનો', - y: 'એક વર્ષ', - yy: '%d વર્ષ' - }, - preparse: function (string) { - return string.replace(/[૧૨૩૪૫૬૭૮૯૦]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - // Gujarati notation for meridiems are quite fuzzy in practice. While there exists - // a rigid notion of a 'Pahar' it is not used as rigidly in modern Gujarati. - meridiemParse: /રાત|બપોર|સવાર|સાંજ/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'રાત') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'સવાર') { - return hour; - } else if (meridiem === 'બપોર') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'સાંજ') { - return hour + 12; - } - }, - meridiem: function (hour, minute, isLower) { - if (hour < 4) { - return 'રાત'; - } else if (hour < 10) { - return 'સવાર'; - } else if (hour < 17) { - return 'બપોર'; - } else if (hour < 20) { - return 'સાંજ'; - } else { - return 'રાત'; - } - }, - week: { - dow: 0, // Sunday is the first day of the week. - doy: 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - return gu; - -}))); diff --git a/locale/he.js b/locale/he.js deleted file mode 100644 index 7a22e8d7f1..0000000000 --- a/locale/he.js +++ /dev/null @@ -1,96 +0,0 @@ -//! 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 he = moment.defineLocale('he', { - months : 'ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר'.split('_'), - monthsShort : 'ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳'.split('_'), - weekdays : 'ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת'.split('_'), - weekdaysShort : 'א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳'.split('_'), - weekdaysMin : 'א_ב_ג_ד_ה_ו_ש'.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', - l : 'D/M/YYYY', - ll : 'D MMM YYYY', - lll : 'D MMM YYYY HH:mm', - llll : 'ddd, D MMM YYYY HH:mm' - }, - calendar : { - sameDay : '[היום ב־]LT', - nextDay : '[מחר ב־]LT', - nextWeek : 'dddd [בשעה] LT', - lastDay : '[אתמול ב־]LT', - lastWeek : '[ביום] dddd [האחרון בשעה] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'בעוד %s', - past : 'לפני %s', - s : 'מספר שניות', - ss : '%d שניות', - m : 'דקה', - mm : '%d דקות', - h : 'שעה', - hh : function (number) { - if (number === 2) { - return 'שעתיים'; - } - return number + ' שעות'; - }, - d : 'יום', - dd : function (number) { - if (number === 2) { - return 'יומיים'; - } - return number + ' ימים'; - }, - M : 'חודש', - MM : function (number) { - if (number === 2) { - return 'חודשיים'; - } - return number + ' חודשים'; - }, - y : 'שנה', - yy : function (number) { - if (number === 2) { - return 'שנתיים'; - } else if (number % 10 === 0 && number !== 10) { - return number + ' שנה'; - } - return number + ' שנים'; - } - }, - meridiemParse: /אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i, - isPM : function (input) { - return /^(אחה"צ|אחרי הצהריים|בערב)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 5) { - return 'לפנות בוקר'; - } else if (hour < 10) { - return 'בבוקר'; - } else if (hour < 12) { - return isLower ? 'לפנה"צ' : 'לפני הצהריים'; - } else if (hour < 18) { - return isLower ? 'אחה"צ' : 'אחרי הצהריים'; - } else { - return 'בערב'; - } - } - }); - - return he; - -}))); diff --git a/locale/hi.js b/locale/hi.js deleted file mode 100644 index a07860a049..0000000000 --- a/locale/hi.js +++ /dev/null @@ -1,123 +0,0 @@ -//! 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 symbolMap = { - '1': '१', - '2': '२', - '3': '३', - '4': '४', - '5': '५', - '6': '६', - '7': '७', - '8': '८', - '9': '९', - '0': '०' - }, - numberMap = { - '१': '1', - '२': '2', - '३': '3', - '४': '4', - '५': '5', - '६': '6', - '७': '7', - '८': '8', - '९': '9', - '०': '0' - }; - - var hi = moment.defineLocale('hi', { - months : 'जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर'.split('_'), - monthsShort : 'जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.'.split('_'), - monthsParseExact: true, - weekdays : 'रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'), - weekdaysShort : 'रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि'.split('_'), - weekdaysMin : 'र_सो_मं_बु_गु_शु_श'.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 : '[आज] LT', - nextDay : '[कल] LT', - nextWeek : 'dddd, LT', - lastDay : '[कल] LT', - lastWeek : '[पिछले] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s में', - past : '%s पहले', - s : 'कुछ ही क्षण', - ss : '%d सेकंड', - m : 'एक मिनट', - mm : '%d मिनट', - h : 'एक घंटा', - hh : '%d घंटे', - d : 'एक दिन', - dd : '%d दिन', - M : 'एक महीने', - MM : '%d महीने', - y : 'एक वर्ष', - yy : '%d वर्ष' - }, - preparse: function (string) { - return string.replace(/[१२३४५६७८९०]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - // Hindi notation for meridiems are quite fuzzy in practice. While there exists - // a rigid notion of a 'Pahar' it is not used as rigidly in modern Hindi. - meridiemParse: /रात|सुबह|दोपहर|शाम/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'रात') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'सुबह') { - return hour; - } else if (meridiem === 'दोपहर') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'शाम') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'रात'; - } else if (hour < 10) { - return 'सुबह'; - } else if (hour < 17) { - return 'दोपहर'; - } else if (hour < 20) { - return 'शाम'; - } else { - return 'रात'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - return hi; - -}))); diff --git a/locale/hr.js b/locale/hr.js deleted file mode 100644 index bf1597b6bb..0000000000 --- a/locale/hr.js +++ /dev/null @@ -1,153 +0,0 @@ -//! 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'; - - - function translate(number, withoutSuffix, key) { - var result = number + ' '; - switch (key) { - case 'ss': - if (number === 1) { - result += 'sekunda'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'sekunde'; - } else { - result += 'sekundi'; - } - return result; - case 'm': - return withoutSuffix ? 'jedna minuta' : 'jedne minute'; - case 'mm': - if (number === 1) { - result += 'minuta'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'minute'; - } else { - result += 'minuta'; - } - return result; - case 'h': - return withoutSuffix ? 'jedan sat' : 'jednog sata'; - case 'hh': - if (number === 1) { - result += 'sat'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'sata'; - } else { - result += 'sati'; - } - return result; - case 'dd': - if (number === 1) { - result += 'dan'; - } else { - result += 'dana'; - } - return result; - case 'MM': - if (number === 1) { - result += 'mjesec'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'mjeseca'; - } else { - result += 'mjeseci'; - } - return result; - case 'yy': - if (number === 1) { - result += 'godina'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'godine'; - } else { - result += 'godina'; - } - return result; - } - } - - var hr = moment.defineLocale('hr', { - months : { - format: 'siječnja_veljače_ožujka_travnja_svibnja_lipnja_srpnja_kolovoza_rujna_listopada_studenoga_prosinca'.split('_'), - standalone: 'siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac'.split('_') - }, - monthsShort : 'sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.'.split('_'), - monthsParseExact: true, - weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), - weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), - weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[danas u] LT', - nextDay : '[sutra u] LT', - nextWeek : function () { - switch (this.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'; - } - }, - lastDay : '[jučer u] LT', - lastWeek : function () { - switch (this.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'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'prije %s', - s : 'par sekundi', - ss : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : 'dan', - dd : translate, - M : 'mjesec', - MM : translate, - y : 'godinu', - yy : translate - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return hr; - -}))); diff --git a/locale/hu.js b/locale/hu.js deleted file mode 100644 index 53e9bb6eb4..0000000000 --- a/locale/hu.js +++ /dev/null @@ -1,109 +0,0 @@ -//! 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 weekEndings = 'vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton'.split(' '); - function translate(number, withoutSuffix, key, isFuture) { - var num = number; - switch (key) { - case 's': - return (isFuture || withoutSuffix) ? 'néhány másodperc' : 'néhány másodperce'; - case 'ss': - return num + (isFuture || withoutSuffix) ? ' másodperc' : ' másodperce'; - case 'm': - return 'egy' + (isFuture || withoutSuffix ? ' perc' : ' perce'); - case 'mm': - return num + (isFuture || withoutSuffix ? ' perc' : ' perce'); - case 'h': - return 'egy' + (isFuture || withoutSuffix ? ' óra' : ' órája'); - case 'hh': - return num + (isFuture || withoutSuffix ? ' óra' : ' órája'); - case 'd': - return 'egy' + (isFuture || withoutSuffix ? ' nap' : ' napja'); - case 'dd': - return num + (isFuture || withoutSuffix ? ' nap' : ' napja'); - case 'M': - return 'egy' + (isFuture || withoutSuffix ? ' hónap' : ' hónapja'); - case 'MM': - return num + (isFuture || withoutSuffix ? ' hónap' : ' hónapja'); - case 'y': - return 'egy' + (isFuture || withoutSuffix ? ' év' : ' éve'); - case 'yy': - return num + (isFuture || withoutSuffix ? ' év' : ' éve'); - } - return ''; - } - function week(isFuture) { - return (isFuture ? '' : '[múlt] ') + '[' + weekEndings[this.day()] + '] LT[-kor]'; - } - - var hu = moment.defineLocale('hu', { - months : 'január_február_március_április_május_június_július_augusztus_szeptember_október_november_december'.split('_'), - monthsShort : 'jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec'.split('_'), - weekdays : 'vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat'.split('_'), - weekdaysShort : 'vas_hét_kedd_sze_csüt_pén_szo'.split('_'), - weekdaysMin : 'v_h_k_sze_cs_p_szo'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'YYYY.MM.DD.', - LL : 'YYYY. MMMM D.', - LLL : 'YYYY. MMMM D. H:mm', - LLLL : 'YYYY. MMMM D., dddd H:mm' - }, - meridiemParse: /de|du/i, - isPM: function (input) { - return input.charAt(1).toLowerCase() === 'u'; - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 12) { - return isLower === true ? 'de' : 'DE'; - } else { - return isLower === true ? 'du' : 'DU'; - } - }, - calendar : { - sameDay : '[ma] LT[-kor]', - nextDay : '[holnap] LT[-kor]', - nextWeek : function () { - return week.call(this, true); - }, - lastDay : '[tegnap] LT[-kor]', - lastWeek : function () { - return week.call(this, false); - }, - sameElse : 'L' - }, - relativeTime : { - future : '%s múlva', - past : '%s', - s : translate, - ss : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : translate, - dd : translate, - M : translate, - MM : translate, - y : translate, - yy : translate - }, - 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 hu; - -}))); diff --git a/locale/hy-am.js b/locale/hy-am.js deleted file mode 100644 index 1be1d85f18..0000000000 --- a/locale/hy-am.js +++ /dev/null @@ -1,94 +0,0 @@ -//! 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 hyAm = moment.defineLocale('hy-am', { - months : { - format: 'հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի'.split('_'), - standalone: 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split('_') - }, - monthsShort : 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_'), - weekdays : 'կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ'.split('_'), - weekdaysShort : 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'), - weekdaysMin : 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.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: '[այսօր] LT', - nextDay: '[վաղը] LT', - lastDay: '[երեկ] LT', - nextWeek: function () { - return 'dddd [օրը ժամը] LT'; - }, - lastWeek: function () { - return '[անցած] dddd [օրը ժամը] LT'; - }, - sameElse: 'L' - }, - relativeTime : { - future : '%s հետո', - past : '%s առաջ', - s : 'մի քանի վայրկյան', - ss : '%d վայրկյան', - m : 'րոպե', - mm : '%d րոպե', - h : 'ժամ', - hh : '%d ժամ', - d : 'օր', - dd : '%d օր', - M : 'ամիս', - MM : '%d ամիս', - y : 'տարի', - yy : '%d տարի' - }, - meridiemParse: /գիշերվա|առավոտվա|ցերեկվա|երեկոյան/, - isPM: function (input) { - return /^(ցերեկվա|երեկոյան)$/.test(input); - }, - meridiem : function (hour) { - if (hour < 4) { - return 'գիշերվա'; - } else if (hour < 12) { - return 'առավոտվա'; - } else if (hour < 17) { - return 'ցերեկվա'; - } else { - return 'երեկոյան'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}|\d{1,2}-(ին|րդ)/, - ordinal: function (number, period) { - switch (period) { - case 'DDD': - case 'w': - case 'W': - case 'DDDo': - if (number === 1) { - return number + '-ին'; - } - return number + '-րդ'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return hyAm; - -}))); diff --git a/locale/id.js b/locale/id.js deleted file mode 100644 index c3e8b9e354..0000000000 --- a/locale/id.js +++ /dev/null @@ -1,81 +0,0 @@ -//! 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 id = moment.defineLocale('id', { - months : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Agt_Sep_Okt_Nov_Des'.split('_'), - weekdays : 'Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu'.split('_'), - weekdaysShort : 'Min_Sen_Sel_Rab_Kam_Jum_Sab'.split('_'), - weekdaysMin : 'Mg_Sn_Sl_Rb_Km_Jm_Sb'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /pagi|siang|sore|malam/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'pagi') { - return hour; - } else if (meridiem === 'siang') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'sore' || meridiem === 'malam') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'pagi'; - } else if (hours < 15) { - return 'siang'; - } else if (hours < 19) { - return 'sore'; - } else { - return 'malam'; - } - }, - calendar : { - sameDay : '[Hari ini pukul] LT', - nextDay : '[Besok pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kemarin pukul] LT', - lastWeek : 'dddd [lalu pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dalam %s', - past : '%s yang lalu', - s : 'beberapa detik', - ss : '%d detik', - m : 'semenit', - mm : '%d menit', - h : 'sejam', - hh : '%d jam', - d : 'sehari', - dd : '%d hari', - M : 'sebulan', - MM : '%d bulan', - y : 'setahun', - yy : '%d tahun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return id; - -}))); diff --git a/locale/is.js b/locale/is.js deleted file mode 100644 index 9856e927ab..0000000000 --- a/locale/is.js +++ /dev/null @@ -1,131 +0,0 @@ -//! 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'; - - - function plural(n) { - if (n % 100 === 11) { - return true; - } else if (n % 10 === 1) { - return false; - } - return true; - } - function translate(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': - return withoutSuffix || isFuture ? 'nokkrar sekúndur' : 'nokkrum sekúndum'; - case 'ss': - if (plural(number)) { - return result + (withoutSuffix || isFuture ? 'sekúndur' : 'sekúndum'); - } - return result + 'sekúnda'; - case 'm': - return withoutSuffix ? 'mínúta' : 'mínútu'; - case 'mm': - if (plural(number)) { - return result + (withoutSuffix || isFuture ? 'mínútur' : 'mínútum'); - } else if (withoutSuffix) { - return result + 'mínúta'; - } - return result + 'mínútu'; - case 'hh': - if (plural(number)) { - return result + (withoutSuffix || isFuture ? 'klukkustundir' : 'klukkustundum'); - } - return result + 'klukkustund'; - case 'd': - if (withoutSuffix) { - return 'dagur'; - } - return isFuture ? 'dag' : 'degi'; - case 'dd': - if (plural(number)) { - if (withoutSuffix) { - return result + 'dagar'; - } - return result + (isFuture ? 'daga' : 'dögum'); - } else if (withoutSuffix) { - return result + 'dagur'; - } - return result + (isFuture ? 'dag' : 'degi'); - case 'M': - if (withoutSuffix) { - return 'mánuður'; - } - return isFuture ? 'mánuð' : 'mánuði'; - case 'MM': - if (plural(number)) { - if (withoutSuffix) { - return result + 'mánuðir'; - } - return result + (isFuture ? 'mánuði' : 'mánuðum'); - } else if (withoutSuffix) { - return result + 'mánuður'; - } - return result + (isFuture ? 'mánuð' : 'mánuði'); - case 'y': - return withoutSuffix || isFuture ? 'ár' : 'ári'; - case 'yy': - if (plural(number)) { - return result + (withoutSuffix || isFuture ? 'ár' : 'árum'); - } - return result + (withoutSuffix || isFuture ? 'ár' : 'ári'); - } - } - - var is = moment.defineLocale('is', { - months : 'janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember'.split('_'), - monthsShort : 'jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des'.split('_'), - weekdays : 'sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur'.split('_'), - weekdaysShort : 'sun_mán_þri_mið_fim_fös_lau'.split('_'), - weekdaysMin : 'Su_Má_Þr_Mi_Fi_Fö_La'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY [kl.] H:mm', - LLLL : 'dddd, D. MMMM YYYY [kl.] H:mm' - }, - calendar : { - sameDay : '[í dag kl.] LT', - nextDay : '[á morgun kl.] LT', - nextWeek : 'dddd [kl.] LT', - lastDay : '[í gær kl.] LT', - lastWeek : '[síðasta] dddd [kl.] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'eftir %s', - past : 'fyrir %s síðan', - s : translate, - ss : translate, - m : translate, - mm : translate, - h : 'klukkustund', - hh : translate, - d : translate, - dd : translate, - M : translate, - MM : translate, - y : translate, - yy : translate - }, - 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 is; - -}))); diff --git a/locale/it-ch.js b/locale/it-ch.js deleted file mode 100644 index fcf2d4b03f..0000000000 --- a/locale/it-ch.js +++ /dev/null @@ -1,68 +0,0 @@ -//! 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/it.js b/locale/it.js deleted file mode 100644 index f42ff8fa5b..0000000000 --- a/locale/it.js +++ /dev/null @@ -1,68 +0,0 @@ -//! 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 it = 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('_'), - 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 it; - -}))); diff --git a/locale/ja.js b/locale/ja.js deleted file mode 100644 index 4e4efd6ae4..0000000000 --- a/locale/ja.js +++ /dev/null @@ -1,91 +0,0 @@ -//! 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 ja = moment.defineLocale('ja', { - months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日'.split('_'), - weekdaysShort : '日_月_火_水_木_金_土'.split('_'), - weekdaysMin : '日_月_火_水_木_金_土'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY/MM/DD', - LL : 'YYYY年M月D日', - LLL : 'YYYY年M月D日 HH:mm', - LLLL : 'YYYY年M月D日 dddd HH:mm', - l : 'YYYY/MM/DD', - ll : 'YYYY年M月D日', - lll : 'YYYY年M月D日 HH:mm', - llll : 'YYYY年M月D日(ddd) HH:mm' - }, - meridiemParse: /午前|午後/i, - isPM : function (input) { - return input === '午後'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return '午前'; - } else { - return '午後'; - } - }, - calendar : { - sameDay : '[今日] LT', - nextDay : '[明日] LT', - nextWeek : function (now) { - if (now.week() < this.week()) { - return '[来週]dddd LT'; - } else { - return 'dddd LT'; - } - }, - lastDay : '[昨日] LT', - lastWeek : function (now) { - if (this.week() < now.week()) { - return '[先週]dddd LT'; - } else { - return 'dddd LT'; - } - }, - sameElse : 'L' - }, - dayOfMonthOrdinalParse : /\d{1,2}日/, - ordinal : function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '日'; - default: - return number; - } - }, - relativeTime : { - future : '%s後', - past : '%s前', - s : '数秒', - ss : '%d秒', - m : '1分', - mm : '%d分', - h : '1時間', - hh : '%d時間', - d : '1日', - dd : '%d日', - M : '1ヶ月', - MM : '%dヶ月', - y : '1年', - yy : '%d年' - } - }); - - return ja; - -}))); diff --git a/locale/jv.js b/locale/jv.js deleted file mode 100644 index b2bb4f41c8..0000000000 --- a/locale/jv.js +++ /dev/null @@ -1,81 +0,0 @@ -//! 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 jv = moment.defineLocale('jv', { - months : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des'.split('_'), - weekdays : 'Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu'.split('_'), - weekdaysShort : 'Min_Sen_Sel_Reb_Kem_Jem_Sep'.split('_'), - weekdaysMin : 'Mg_Sn_Sl_Rb_Km_Jm_Sp'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /enjing|siyang|sonten|ndalu/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'enjing') { - return hour; - } else if (meridiem === 'siyang') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'sonten' || meridiem === 'ndalu') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'enjing'; - } else if (hours < 15) { - return 'siyang'; - } else if (hours < 19) { - return 'sonten'; - } else { - return 'ndalu'; - } - }, - calendar : { - sameDay : '[Dinten puniko pukul] LT', - nextDay : '[Mbenjang pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kala wingi pukul] LT', - lastWeek : 'dddd [kepengker pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'wonten ing %s', - past : '%s ingkang kepengker', - s : 'sawetawis detik', - ss : '%d detik', - m : 'setunggal menit', - mm : '%d menit', - h : 'setunggal jam', - hh : '%d jam', - d : 'sedinten', - dd : '%d dinten', - M : 'sewulan', - MM : '%d wulan', - y : 'setaun', - yy : '%d taun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return jv; - -}))); diff --git a/locale/ka.js b/locale/ka.js deleted file mode 100644 index 0ec5eb24eb..0000000000 --- a/locale/ka.js +++ /dev/null @@ -1,88 +0,0 @@ -//! 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 ka = moment.defineLocale('ka', { - months : { - standalone: 'იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი'.split('_'), - format: 'იანვარს_თებერვალს_მარტს_აპრილის_მაისს_ივნისს_ივლისს_აგვისტს_სექტემბერს_ოქტომბერს_ნოემბერს_დეკემბერს'.split('_') - }, - monthsShort : 'იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ'.split('_'), - weekdays : { - standalone: 'კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი'.split('_'), - format: 'კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს'.split('_'), - isFormat: /(წინა|შემდეგ)/ - }, - weekdaysShort : 'კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ'.split('_'), - weekdaysMin : 'კვ_ორ_სა_ოთ_ხუ_პა_შა'.split('_'), - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[დღეს] LT[-ზე]', - nextDay : '[ხვალ] LT[-ზე]', - lastDay : '[გუშინ] LT[-ზე]', - nextWeek : '[შემდეგ] dddd LT[-ზე]', - lastWeek : '[წინა] dddd LT-ზე', - sameElse : 'L' - }, - relativeTime : { - future : function (s) { - return (/(წამი|წუთი|საათი|წელი)/).test(s) ? - s.replace(/ი$/, 'ში') : - s + 'ში'; - }, - past : function (s) { - if ((/(წამი|წუთი|საათი|დღე|თვე)/).test(s)) { - return s.replace(/(ი|ე)$/, 'ის წინ'); - } - if ((/წელი/).test(s)) { - return s.replace(/წელი$/, 'წლის წინ'); - } - }, - s : 'რამდენიმე წამი', - ss : '%d წამი', - m : 'წუთი', - mm : '%d წუთი', - h : 'საათი', - hh : '%d საათი', - d : 'დღე', - dd : '%d დღე', - M : 'თვე', - MM : '%d თვე', - y : 'წელი', - yy : '%d წელი' - }, - dayOfMonthOrdinalParse: /0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/, - ordinal : function (number) { - if (number === 0) { - return number; - } - if (number === 1) { - return number + '-ლი'; - } - if ((number < 20) || (number <= 100 && (number % 20 === 0)) || (number % 100 === 0)) { - return 'მე-' + number; - } - return number + '-ე'; - }, - week : { - dow : 1, - doy : 7 - } - }); - - return ka; - -}))); diff --git a/locale/kk.js b/locale/kk.js deleted file mode 100644 index c468f6701f..0000000000 --- a/locale/kk.js +++ /dev/null @@ -1,86 +0,0 @@ -//! 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 suffixes = { - 0: '-ші', - 1: '-ші', - 2: '-ші', - 3: '-ші', - 4: '-ші', - 5: '-ші', - 6: '-шы', - 7: '-ші', - 8: '-ші', - 9: '-шы', - 10: '-шы', - 20: '-шы', - 30: '-шы', - 40: '-шы', - 50: '-ші', - 60: '-шы', - 70: '-ші', - 80: '-ші', - 90: '-шы', - 100: '-ші' - }; - - var kk = moment.defineLocale('kk', { - months : 'қаңтар_ақпан_наурыз_сәуір_мамыр_маусым_шілде_тамыз_қыркүйек_қазан_қараша_желтоқсан'.split('_'), - monthsShort : 'қаң_ақп_нау_сәу_мам_мау_шіл_там_қыр_қаз_қар_жел'.split('_'), - weekdays : 'жексенбі_дүйсенбі_сейсенбі_сәрсенбі_бейсенбі_жұма_сенбі'.split('_'), - weekdaysShort : 'жек_дүй_сей_сәр_бей_жұм_сен'.split('_'), - weekdaysMin : 'жк_дй_сй_ср_бй_жм_сн'.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 : '[Бүгін сағат] LT', - nextDay : '[Ертең сағат] LT', - nextWeek : 'dddd [сағат] LT', - lastDay : '[Кеше сағат] LT', - lastWeek : '[Өткен аптаның] dddd [сағат] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ішінде', - past : '%s бұрын', - s : 'бірнеше секунд', - ss : '%d секунд', - m : 'бір минут', - mm : '%d минут', - h : 'бір сағат', - hh : '%d сағат', - d : 'бір күн', - dd : '%d күн', - M : 'бір ай', - MM : '%d ай', - y : 'бір жыл', - yy : '%d жыл' - }, - dayOfMonthOrdinalParse: /\d{1,2}-(ші|шы)/, - ordinal : function (number) { - var a = number % 10, - b = number >= 100 ? 100 : null; - return number + (suffixes[number] || suffixes[a] || suffixes[b]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return kk; - -}))); diff --git a/locale/km.js b/locale/km.js deleted file mode 100644 index fee36238ab..0000000000 --- a/locale/km.js +++ /dev/null @@ -1,109 +0,0 @@ -//! 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 symbolMap = { - '1': '១', - '2': '២', - '3': '៣', - '4': '៤', - '5': '៥', - '6': '៦', - '7': '៧', - '8': '៨', - '9': '៩', - '0': '០' - }, numberMap = { - '១': '1', - '២': '2', - '៣': '3', - '៤': '4', - '៥': '5', - '៦': '6', - '៧': '7', - '៨': '8', - '៩': '9', - '០': '0' - }; - - var km = moment.defineLocale('km', { - months: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split( - '_' - ), - monthsShort: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split( - '_' - ), - weekdays: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'), - weekdaysShort: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'), - weekdaysMin: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'), - weekdaysParseExact: true, - 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: /ព្រឹក|ល្ងាច/, - isPM: function (input) { - return input === 'ល្ងាច'; - }, - meridiem: function (hour, minute, isLower) { - if (hour < 12) { - return 'ព្រឹក'; - } else { - return 'ល្ងាច'; - } - }, - calendar: { - sameDay: '[ថ្ងៃនេះ ម៉ោង] LT', - nextDay: '[ស្អែក ម៉ោង] LT', - nextWeek: 'dddd [ម៉ោង] LT', - lastDay: '[ម្សិលមិញ ម៉ោង] LT', - lastWeek: 'dddd [សប្តាហ៍មុន] [ម៉ោង] LT', - sameElse: 'L' - }, - relativeTime: { - future: '%sទៀត', - past: '%sមុន', - s: 'ប៉ុន្មានវិនាទី', - ss: '%d វិនាទី', - m: 'មួយនាទី', - mm: '%d នាទី', - h: 'មួយម៉ោង', - hh: '%d ម៉ោង', - d: 'មួយថ្ងៃ', - dd: '%d ថ្ងៃ', - M: 'មួយខែ', - MM: '%d ខែ', - y: 'មួយឆ្នាំ', - yy: '%d ឆ្នាំ' - }, - dayOfMonthOrdinalParse : /ទី\d{1,2}/, - ordinal : 'ទី%d', - preparse: function (string) { - return string.replace(/[១២៣៤៥៦៧៨៩០]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - 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 km; - -}))); diff --git a/locale/kn.js b/locale/kn.js deleted file mode 100644 index 8d0ae9d874..0000000000 --- a/locale/kn.js +++ /dev/null @@ -1,125 +0,0 @@ -//! 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 symbolMap = { - '1': '೧', - '2': '೨', - '3': '೩', - '4': '೪', - '5': '೫', - '6': '೬', - '7': '೭', - '8': '೮', - '9': '೯', - '0': '೦' - }, - numberMap = { - '೧': '1', - '೨': '2', - '೩': '3', - '೪': '4', - '೫': '5', - '೬': '6', - '೭': '7', - '೮': '8', - '೯': '9', - '೦': '0' - }; - - var kn = moment.defineLocale('kn', { - months : 'ಜನವರಿ_ಫೆಬ್ರವರಿ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂಬರ್_ಅಕ್ಟೋಬರ್_ನವೆಂಬರ್_ಡಿಸೆಂಬರ್'.split('_'), - monthsShort : 'ಜನ_ಫೆಬ್ರ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂ_ಅಕ್ಟೋ_ನವೆಂ_ಡಿಸೆಂ'.split('_'), - monthsParseExact: true, - weekdays : 'ಭಾನುವಾರ_ಸೋಮವಾರ_ಮಂಗಳವಾರ_ಬುಧವಾರ_ಗುರುವಾರ_ಶುಕ್ರವಾರ_ಶನಿವಾರ'.split('_'), - weekdaysShort : 'ಭಾನು_ಸೋಮ_ಮಂಗಳ_ಬುಧ_ಗುರು_ಶುಕ್ರ_ಶನಿ'.split('_'), - weekdaysMin : 'ಭಾ_ಸೋ_ಮಂ_ಬು_ಗು_ಶು_ಶ'.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 : '[ಇಂದು] LT', - nextDay : '[ನಾಳೆ] LT', - nextWeek : 'dddd, LT', - lastDay : '[ನಿನ್ನೆ] LT', - lastWeek : '[ಕೊನೆಯ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ನಂತರ', - past : '%s ಹಿಂದೆ', - s : 'ಕೆಲವು ಕ್ಷಣಗಳು', - ss : '%d ಸೆಕೆಂಡುಗಳು', - m : 'ಒಂದು ನಿಮಿಷ', - mm : '%d ನಿಮಿಷ', - h : 'ಒಂದು ಗಂಟೆ', - hh : '%d ಗಂಟೆ', - d : 'ಒಂದು ದಿನ', - dd : '%d ದಿನ', - M : 'ಒಂದು ತಿಂಗಳು', - MM : '%d ತಿಂಗಳು', - y : 'ಒಂದು ವರ್ಷ', - yy : '%d ವರ್ಷ' - }, - preparse: function (string) { - return string.replace(/[೧೨೩೪೫೬೭೮೯೦]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - meridiemParse: /ರಾತ್ರಿ|ಬೆಳಿಗ್ಗೆ|ಮಧ್ಯಾಹ್ನ|ಸಂಜೆ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'ರಾತ್ರಿ') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'ಬೆಳಿಗ್ಗೆ') { - return hour; - } else if (meridiem === 'ಮಧ್ಯಾಹ್ನ') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'ಸಂಜೆ') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ರಾತ್ರಿ'; - } else if (hour < 10) { - return 'ಬೆಳಿಗ್ಗೆ'; - } else if (hour < 17) { - return 'ಮಧ್ಯಾಹ್ನ'; - } else if (hour < 20) { - return 'ಸಂಜೆ'; - } else { - return 'ರಾತ್ರಿ'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}(ನೇ)/, - ordinal : function (number) { - return number + 'ನೇ'; - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - return kn; - -}))); diff --git a/locale/ko.js b/locale/ko.js deleted file mode 100644 index 40f1bb5dc5..0000000000 --- a/locale/ko.js +++ /dev/null @@ -1,80 +0,0 @@ -//! 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 ko = moment.defineLocale('ko', { - months : '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'), - monthsShort : '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'), - weekdays : '일요일_월요일_화요일_수요일_목요일_금요일_토요일'.split('_'), - weekdaysShort : '일_월_화_수_목_금_토'.split('_'), - weekdaysMin : '일_월_화_수_목_금_토'.split('_'), - longDateFormat : { - LT : 'A h:mm', - LTS : 'A h:mm:ss', - L : 'YYYY.MM.DD.', - LL : 'YYYY년 MMMM D일', - LLL : 'YYYY년 MMMM D일 A h:mm', - LLLL : 'YYYY년 MMMM D일 dddd A h:mm', - l : 'YYYY.MM.DD.', - ll : 'YYYY년 MMMM D일', - lll : 'YYYY년 MMMM D일 A h:mm', - llll : 'YYYY년 MMMM D일 dddd A h:mm' - }, - calendar : { - sameDay : '오늘 LT', - nextDay : '내일 LT', - nextWeek : 'dddd LT', - lastDay : '어제 LT', - lastWeek : '지난주 dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s 후', - past : '%s 전', - s : '몇 초', - ss : '%d초', - m : '1분', - mm : '%d분', - h : '한 시간', - hh : '%d시간', - d : '하루', - dd : '%d일', - M : '한 달', - MM : '%d달', - y : '일 년', - yy : '%d년' - }, - dayOfMonthOrdinalParse : /\d{1,2}(일|월|주)/, - ordinal : function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '일'; - case 'M': - return number + '월'; - case 'w': - case 'W': - return number + '주'; - default: - return number; - } - }, - meridiemParse : /오전|오후/, - isPM : function (token) { - return token === '오후'; - }, - meridiem : function (hour, minute, isUpper) { - return hour < 12 ? '오전' : '오후'; - } - }); - - return ko; - -}))); diff --git a/locale/ku.js b/locale/ku.js deleted file mode 100644 index 05b9dbe2e7..0000000000 --- a/locale/ku.js +++ /dev/null @@ -1,118 +0,0 @@ -//! 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 symbolMap = { - '1': '١', - '2': '٢', - '3': '٣', - '4': '٤', - '5': '٥', - '6': '٦', - '7': '٧', - '8': '٨', - '9': '٩', - '0': '٠' - }, numberMap = { - '١': '1', - '٢': '2', - '٣': '3', - '٤': '4', - '٥': '5', - '٦': '6', - '٧': '7', - '٨': '8', - '٩': '9', - '٠': '0' - }, - months = [ - 'کانونی دووەم', - 'شوبات', - 'ئازار', - 'نیسان', - 'ئایار', - 'حوزەیران', - 'تەمموز', - 'ئاب', - 'ئەیلوول', - 'تشرینی یەكەم', - 'تشرینی دووەم', - 'كانونی یەکەم' - ]; - - - var ku = moment.defineLocale('ku', { - months : months, - monthsShort : months, - weekdays : 'یه‌كشه‌ممه‌_دووشه‌ممه‌_سێشه‌ممه‌_چوارشه‌ممه‌_پێنجشه‌ممه‌_هه‌ینی_شه‌ممه‌'.split('_'), - weekdaysShort : 'یه‌كشه‌م_دووشه‌م_سێشه‌م_چوارشه‌م_پێنجشه‌م_هه‌ینی_شه‌ممه‌'.split('_'), - weekdaysMin : 'ی_د_س_چ_پ_ه_ش'.split('_'), - weekdaysParseExact : true, - 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: /ئێواره‌|به‌یانی/, - isPM: function (input) { - return /ئێواره‌/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'به‌یانی'; - } else { - return 'ئێواره‌'; - } - }, - calendar : { - sameDay : '[ئه‌مرۆ كاتژمێر] LT', - nextDay : '[به‌یانی كاتژمێر] LT', - nextWeek : 'dddd [كاتژمێر] LT', - lastDay : '[دوێنێ كاتژمێر] LT', - lastWeek : 'dddd [كاتژمێر] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'له‌ %s', - past : '%s', - s : 'چه‌ند چركه‌یه‌ك', - ss : 'چركه‌ %d', - m : 'یه‌ك خوله‌ك', - mm : '%d خوله‌ك', - h : 'یه‌ك كاتژمێر', - hh : '%d كاتژمێر', - d : 'یه‌ك ڕۆژ', - dd : '%d ڕۆژ', - M : 'یه‌ك مانگ', - MM : '%d مانگ', - y : 'یه‌ك ساڵ', - yy : '%d ساڵ' - }, - preparse: function (string) { - return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { - return numberMap[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }).replace(/,/g, '،'); - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } - }); - - return ku; - -}))); diff --git a/locale/ky.js b/locale/ky.js deleted file mode 100644 index 8bd29a3653..0000000000 --- a/locale/ky.js +++ /dev/null @@ -1,86 +0,0 @@ -//! 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 suffixes = { - 0: '-чү', - 1: '-чи', - 2: '-чи', - 3: '-чү', - 4: '-чү', - 5: '-чи', - 6: '-чы', - 7: '-чи', - 8: '-чи', - 9: '-чу', - 10: '-чу', - 20: '-чы', - 30: '-чу', - 40: '-чы', - 50: '-чү', - 60: '-чы', - 70: '-чи', - 80: '-чи', - 90: '-чу', - 100: '-чү' - }; - - var ky = moment.defineLocale('ky', { - months : 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_'), - monthsShort : 'янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек'.split('_'), - weekdays : 'Жекшемби_Дүйшөмбү_Шейшемби_Шаршемби_Бейшемби_Жума_Ишемби'.split('_'), - weekdaysShort : 'Жек_Дүй_Шей_Шар_Бей_Жум_Ише'.split('_'), - weekdaysMin : 'Жк_Дй_Шй_Шр_Бй_Жм_Иш'.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 : '[Бүгүн саат] LT', - nextDay : '[Эртең саат] LT', - nextWeek : 'dddd [саат] LT', - lastDay : '[Кечээ саат] LT', - lastWeek : '[Өткөн аптанын] dddd [күнү] [саат] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ичинде', - past : '%s мурун', - s : 'бирнече секунд', - ss : '%d секунд', - m : 'бир мүнөт', - mm : '%d мүнөт', - h : 'бир саат', - hh : '%d саат', - d : 'бир күн', - dd : '%d күн', - M : 'бир ай', - MM : '%d ай', - y : 'бир жыл', - yy : '%d жыл' - }, - dayOfMonthOrdinalParse: /\d{1,2}-(чи|чы|чү|чу)/, - ordinal : function (number) { - var a = number % 10, - b = number >= 100 ? 100 : null; - return number + (suffixes[number] || suffixes[a] || suffixes[b]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return ky; - -}))); diff --git a/locale/lb.js b/locale/lb.js deleted file mode 100644 index 599a6e58b3..0000000000 --- a/locale/lb.js +++ /dev/null @@ -1,135 +0,0 @@ -//! 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'; - - - function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eng Minutt', 'enger Minutt'], - 'h': ['eng Stonn', 'enger Stonn'], - 'd': ['een Dag', 'engem Dag'], - 'M': ['ee Mount', 'engem Mount'], - 'y': ['ee Joer', 'engem Joer'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } - function processFutureTime(string) { - var number = string.substr(0, string.indexOf(' ')); - if (eifelerRegelAppliesToNumber(number)) { - return 'a ' + string; - } - return 'an ' + string; - } - function processPastTime(string) { - var number = string.substr(0, string.indexOf(' ')); - if (eifelerRegelAppliesToNumber(number)) { - return 'viru ' + string; - } - return 'virun ' + string; - } - /** - * Returns true if the word before the given number loses the '-n' ending. - * e.g. 'an 10 Deeg' but 'a 5 Deeg' - * - * @param number {integer} - * @returns {boolean} - */ - function eifelerRegelAppliesToNumber(number) { - number = parseInt(number, 10); - if (isNaN(number)) { - return false; - } - if (number < 0) { - // Negative Number --> always true - return true; - } else if (number < 10) { - // Only 1 digit - if (4 <= number && number <= 7) { - return true; - } - return false; - } else if (number < 100) { - // 2 digits - var lastDigit = number % 10, firstDigit = number / 10; - if (lastDigit === 0) { - return eifelerRegelAppliesToNumber(firstDigit); - } - return eifelerRegelAppliesToNumber(lastDigit); - } else if (number < 10000) { - // 3 or 4 digits --> recursively check first digit - while (number >= 10) { - number = number / 10; - } - return eifelerRegelAppliesToNumber(number); - } else { - // Anything larger than 4 digits: recursively check first n-3 digits - number = number / 1000; - return eifelerRegelAppliesToNumber(number); - } - } - - var lb = moment.defineLocale('lb', { - months: 'Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort: 'Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays: 'Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg'.split('_'), - weekdaysShort: 'So._Mé._Dë._Më._Do._Fr._Sa.'.split('_'), - weekdaysMin: 'So_Mé_Dë_Më_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm [Auer]', - LTS: 'H:mm:ss [Auer]', - L: 'DD.MM.YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm [Auer]', - LLLL: 'dddd, D. MMMM YYYY H:mm [Auer]' - }, - calendar: { - sameDay: '[Haut um] LT', - sameElse: 'L', - nextDay: '[Muer um] LT', - nextWeek: 'dddd [um] LT', - lastDay: '[Gëschter um] LT', - lastWeek: function () { - // Different date string for 'Dënschdeg' (Tuesday) and 'Donneschdeg' (Thursday) due to phonological rule - switch (this.day()) { - case 2: - case 4: - return '[Leschten] dddd [um] LT'; - default: - return '[Leschte] dddd [um] LT'; - } - } - }, - relativeTime : { - future : processFutureTime, - past : processPastTime, - s : 'e puer Sekonnen', - ss : '%d Sekonnen', - m : processRelativeTime, - mm : '%d Minutten', - h : processRelativeTime, - hh : '%d Stonnen', - d : processRelativeTime, - dd : '%d Deeg', - M : processRelativeTime, - MM : '%d Méint', - y : processRelativeTime, - yy : '%d Joer' - }, - 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 lb; - -}))); diff --git a/locale/lo.js b/locale/lo.js deleted file mode 100644 index 7cd6cfc8d2..0000000000 --- a/locale/lo.js +++ /dev/null @@ -1,69 +0,0 @@ -//! 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 lo = moment.defineLocale('lo', { - months : 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split('_'), - monthsShort : 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split('_'), - weekdays : 'ອາທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'), - weekdaysShort : 'ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'), - weekdaysMin : 'ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ'.split('_'), - weekdaysParseExact : true, - 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: /ຕອນເຊົ້າ|ຕອນແລງ/, - isPM: function (input) { - return input === 'ຕອນແລງ'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ຕອນເຊົ້າ'; - } else { - return 'ຕອນແລງ'; - } - }, - calendar : { - sameDay : '[ມື້ນີ້ເວລາ] LT', - nextDay : '[ມື້ອື່ນເວລາ] LT', - nextWeek : '[ວັນ]dddd[ໜ້າເວລາ] LT', - lastDay : '[ມື້ວານນີ້ເວລາ] LT', - lastWeek : '[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ອີກ %s', - past : '%sຜ່ານມາ', - s : 'ບໍ່ເທົ່າໃດວິນາທີ', - ss : '%d ວິນາທີ' , - m : '1 ນາທີ', - mm : '%d ນາທີ', - h : '1 ຊົ່ວໂມງ', - hh : '%d ຊົ່ວໂມງ', - d : '1 ມື້', - dd : '%d ມື້', - M : '1 ເດືອນ', - MM : '%d ເດືອນ', - y : '1 ປີ', - yy : '%d ປີ' - }, - dayOfMonthOrdinalParse: /(ທີ່)\d{1,2}/, - ordinal : function (number) { - return 'ທີ່' + number; - } - }); - - return lo; - -}))); diff --git a/locale/lt.js b/locale/lt.js deleted file mode 100644 index bc7d7e7a0a..0000000000 --- a/locale/lt.js +++ /dev/null @@ -1,117 +0,0 @@ -//! 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 units = { - 'ss' : 'sekundė_sekundžių_sekundes', - 'm' : 'minutė_minutės_minutę', - 'mm': 'minutės_minučių_minutes', - 'h' : 'valanda_valandos_valandą', - 'hh': 'valandos_valandų_valandas', - 'd' : 'diena_dienos_dieną', - 'dd': 'dienos_dienų_dienas', - 'M' : 'mėnuo_mėnesio_mėnesį', - 'MM': 'mėnesiai_mėnesių_mėnesius', - 'y' : 'metai_metų_metus', - 'yy': 'metai_metų_metus' - }; - function translateSeconds(number, withoutSuffix, key, isFuture) { - if (withoutSuffix) { - return 'kelios sekundės'; - } else { - return isFuture ? 'kelių sekundžių' : 'kelias sekundes'; - } - } - function translateSingular(number, withoutSuffix, key, isFuture) { - return withoutSuffix ? forms(key)[0] : (isFuture ? forms(key)[1] : forms(key)[2]); - } - function special(number) { - return number % 10 === 0 || (number > 10 && number < 20); - } - function forms(key) { - return units[key].split('_'); - } - function translate(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - if (number === 1) { - return result + translateSingular(number, withoutSuffix, key[0], isFuture); - } else if (withoutSuffix) { - return result + (special(number) ? forms(key)[1] : forms(key)[0]); - } else { - if (isFuture) { - return result + forms(key)[1]; - } else { - return result + (special(number) ? forms(key)[1] : forms(key)[2]); - } - } - } - var lt = moment.defineLocale('lt', { - months : { - format: 'sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio'.split('_'), - standalone: 'sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis'.split('_'), - isFormat: /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|MMMM?(\[[^\[\]]*\]|\s)+D[oD]?/ - }, - monthsShort : 'sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd'.split('_'), - weekdays : { - format: 'sekmadienį_pirmadienį_antradienį_trečiadienį_ketvirtadienį_penktadienį_šeštadienį'.split('_'), - standalone: 'sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis'.split('_'), - isFormat: /dddd HH:mm/ - }, - weekdaysShort : 'Sek_Pir_Ant_Tre_Ket_Pen_Šeš'.split('_'), - weekdaysMin : 'S_P_A_T_K_Pn_Š'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'YYYY [m.] MMMM D [d.]', - LLL : 'YYYY [m.] MMMM D [d.], HH:mm [val.]', - LLLL : 'YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]', - l : 'YYYY-MM-DD', - ll : 'YYYY [m.] MMMM D [d.]', - lll : 'YYYY [m.] MMMM D [d.], HH:mm [val.]', - llll : 'YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]' - }, - calendar : { - sameDay : '[Šiandien] LT', - nextDay : '[Rytoj] LT', - nextWeek : 'dddd LT', - lastDay : '[Vakar] LT', - lastWeek : '[Praėjusį] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : 'po %s', - past : 'prieš %s', - s : translateSeconds, - ss : translate, - m : translateSingular, - mm : translate, - h : translateSingular, - hh : translate, - d : translateSingular, - dd : translate, - M : translateSingular, - MM : translate, - y : translateSingular, - yy : translate - }, - dayOfMonthOrdinalParse: /\d{1,2}-oji/, - ordinal : function (number) { - return number + '-oji'; - }, - 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 lt; - -}))); diff --git a/locale/lv.js b/locale/lv.js deleted file mode 100644 index b5b8ea8430..0000000000 --- a/locale/lv.js +++ /dev/null @@ -1,96 +0,0 @@ -//! 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 units = { - 'ss': 'sekundes_sekundēm_sekunde_sekundes'.split('_'), - 'm': 'minūtes_minūtēm_minūte_minūtes'.split('_'), - 'mm': 'minūtes_minūtēm_minūte_minūtes'.split('_'), - 'h': 'stundas_stundām_stunda_stundas'.split('_'), - 'hh': 'stundas_stundām_stunda_stundas'.split('_'), - 'd': 'dienas_dienām_diena_dienas'.split('_'), - 'dd': 'dienas_dienām_diena_dienas'.split('_'), - 'M': 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'), - 'MM': 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'), - 'y': 'gada_gadiem_gads_gadi'.split('_'), - 'yy': 'gada_gadiem_gads_gadi'.split('_') - }; - /** - * @param withoutSuffix boolean true = a length of time; false = before/after a period of time. - */ - function format(forms, number, withoutSuffix) { - if (withoutSuffix) { - // E.g. "21 minūte", "3 minūtes". - return number % 10 === 1 && number % 100 !== 11 ? forms[2] : forms[3]; - } else { - // E.g. "21 minūtes" as in "pēc 21 minūtes". - // E.g. "3 minūtēm" as in "pēc 3 minūtēm". - return number % 10 === 1 && number % 100 !== 11 ? forms[0] : forms[1]; - } - } - function relativeTimeWithPlural(number, withoutSuffix, key) { - return number + ' ' + format(units[key], number, withoutSuffix); - } - function relativeTimeWithSingular(number, withoutSuffix, key) { - return format(units[key], number, withoutSuffix); - } - function relativeSeconds(number, withoutSuffix) { - return withoutSuffix ? 'dažas sekundes' : 'dažām sekundēm'; - } - - var lv = moment.defineLocale('lv', { - months : 'janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris'.split('_'), - monthsShort : 'jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec'.split('_'), - weekdays : 'svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena'.split('_'), - weekdaysShort : 'Sv_P_O_T_C_Pk_S'.split('_'), - weekdaysMin : 'Sv_P_O_T_C_Pk_S'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY.', - LL : 'YYYY. [gada] D. MMMM', - LLL : 'YYYY. [gada] D. MMMM, HH:mm', - LLLL : 'YYYY. [gada] D. MMMM, dddd, HH:mm' - }, - calendar : { - sameDay : '[Šodien pulksten] LT', - nextDay : '[Rīt pulksten] LT', - nextWeek : 'dddd [pulksten] LT', - lastDay : '[Vakar pulksten] LT', - lastWeek : '[Pagājušā] dddd [pulksten] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'pēc %s', - past : 'pirms %s', - s : relativeSeconds, - ss : relativeTimeWithPlural, - m : relativeTimeWithSingular, - mm : relativeTimeWithPlural, - h : relativeTimeWithSingular, - hh : relativeTimeWithPlural, - d : relativeTimeWithSingular, - dd : relativeTimeWithPlural, - M : relativeTimeWithSingular, - MM : relativeTimeWithPlural, - y : relativeTimeWithSingular, - yy : relativeTimeWithPlural - }, - 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 lv; - -}))); diff --git a/locale/me.js b/locale/me.js deleted file mode 100644 index 6608d0959d..0000000000 --- a/locale/me.js +++ /dev/null @@ -1,111 +0,0 @@ -//! 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 translator = { - words: { //Different grammatical cases - ss: ['sekund', 'sekunda', 'sekundi'], - m: ['jedan minut', 'jednog minuta'], - mm: ['minut', 'minuta', 'minuta'], - h: ['jedan sat', 'jednog sata'], - hh: ['sat', 'sata', 'sati'], - dd: ['dan', 'dana', 'dana'], - MM: ['mjesec', 'mjeseca', 'mjeseci'], - yy: ['godina', 'godine', 'godina'] - }, - correctGrammaticalCase: function (number, wordKey) { - return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]); - }, - translate: function (number, withoutSuffix, key) { - var wordKey = translator.words[key]; - if (key.length === 1) { - return withoutSuffix ? wordKey[0] : wordKey[1]; - } else { - return number + ' ' + translator.correctGrammaticalCase(number, wordKey); - } - } - }; - - var me = moment.defineLocale('me', { - months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split('_'), - monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'), - monthsParseExact : true, - weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), - weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), - weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm', - LTS : 'H:mm:ss', - L: 'DD.MM.YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm', - LLLL: 'dddd, D. MMMM YYYY H:mm' - }, - calendar: { - sameDay: '[danas u] LT', - nextDay: '[sjutra u] LT', - - nextWeek: function () { - switch (this.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'; - } - }, - lastDay : '[juče u] LT', - lastWeek : function () { - var lastWeekDays = [ - '[prošle] [nedjelje] [u] LT', - '[prošlog] [ponedjeljka] [u] LT', - '[prošlog] [utorka] [u] LT', - '[prošle] [srijede] [u] LT', - '[prošlog] [četvrtka] [u] LT', - '[prošlog] [petka] [u] LT', - '[prošle] [subote] [u] LT' - ]; - return lastWeekDays[this.day()]; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'prije %s', - s : 'nekoliko sekundi', - ss : translator.translate, - m : translator.translate, - mm : translator.translate, - h : translator.translate, - hh : translator.translate, - d : 'dan', - dd : translator.translate, - M : 'mjesec', - MM : translator.translate, - y : 'godinu', - yy : translator.translate - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return me; - -}))); diff --git a/locale/mi.js b/locale/mi.js deleted file mode 100644 index 29f1c7a383..0000000000 --- a/locale/mi.js +++ /dev/null @@ -1,63 +0,0 @@ -//! 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 mi = moment.defineLocale('mi', { - months: 'Kohi-tāte_Hui-tanguru_Poutū-te-rangi_Paenga-whāwhā_Haratua_Pipiri_Hōngoingoi_Here-turi-kōkā_Mahuru_Whiringa-ā-nuku_Whiringa-ā-rangi_Hakihea'.split('_'), - monthsShort: 'Kohi_Hui_Pou_Pae_Hara_Pipi_Hōngoi_Here_Mahu_Whi-nu_Whi-ra_Haki'.split('_'), - monthsRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i, - monthsStrictRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i, - monthsShortRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i, - monthsShortStrictRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,2}/i, - weekdays: 'Rātapu_Mane_Tūrei_Wenerei_Tāite_Paraire_Hātarei'.split('_'), - weekdaysShort: 'Ta_Ma_Tū_We_Tāi_Pa_Hā'.split('_'), - weekdaysMin: 'Ta_Ma_Tū_We_Tāi_Pa_Hā'.split('_'), - longDateFormat: { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L: 'DD/MM/YYYY', - LL: 'D MMMM YYYY', - LLL: 'D MMMM YYYY [i] HH:mm', - LLLL: 'dddd, D MMMM YYYY [i] HH:mm' - }, - calendar: { - sameDay: '[i teie mahana, i] LT', - nextDay: '[apopo i] LT', - nextWeek: 'dddd [i] LT', - lastDay: '[inanahi i] LT', - lastWeek: 'dddd [whakamutunga i] LT', - sameElse: 'L' - }, - relativeTime: { - future: 'i roto i %s', - past: '%s i mua', - s: 'te hēkona ruarua', - ss: '%d hēkona', - m: 'he meneti', - mm: '%d meneti', - h: 'te haora', - hh: '%d haora', - d: 'he ra', - dd: '%d ra', - M: 'he marama', - MM: '%d marama', - y: 'he tau', - yy: '%d tau' - }, - 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 mi; - -}))); diff --git a/locale/mk.js b/locale/mk.js deleted file mode 100644 index 051f683ffd..0000000000 --- a/locale/mk.js +++ /dev/null @@ -1,89 +0,0 @@ -//! 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 mk = moment.defineLocale('mk', { - months : 'јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември'.split('_'), - monthsShort : 'јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек'.split('_'), - weekdays : 'недела_понеделник_вторник_среда_четврток_петок_сабота'.split('_'), - weekdaysShort : 'нед_пон_вто_сре_чет_пет_саб'.split('_'), - weekdaysMin : 'нe_пo_вт_ср_че_пе_сa'.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 : '[Денес во] LT', - nextDay : '[Утре во] LT', - nextWeek : '[Во] dddd [во] LT', - lastDay : '[Вчера во] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - case 3: - case 6: - return '[Изминатата] dddd [во] LT'; - case 1: - case 2: - case 4: - case 5: - return '[Изминатиот] dddd [во] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'после %s', - past : 'пред %s', - s : 'неколку секунди', - ss : '%d секунди', - m : 'минута', - mm : '%d минути', - h : 'час', - hh : '%d часа', - d : 'ден', - dd : '%d дена', - M : 'месец', - MM : '%d месеци', - y : 'година', - yy : '%d години' - }, - dayOfMonthOrdinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/, - ordinal : function (number) { - var lastDigit = number % 10, - last2Digits = number % 100; - if (number === 0) { - return number + '-ев'; - } else if (last2Digits === 0) { - return number + '-ен'; - } else if (last2Digits > 10 && last2Digits < 20) { - return number + '-ти'; - } else if (lastDigit === 1) { - return number + '-ви'; - } else if (lastDigit === 2) { - return number + '-ри'; - } else if (lastDigit === 7 || lastDigit === 8) { - return number + '-ми'; - } else { - return number + '-ти'; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return mk; - -}))); diff --git a/locale/ml.js b/locale/ml.js deleted file mode 100644 index 806db47b9f..0000000000 --- a/locale/ml.js +++ /dev/null @@ -1,80 +0,0 @@ -//! 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 ml = moment.defineLocale('ml', { - months : 'ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ'.split('_'), - monthsShort : 'ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.'.split('_'), - monthsParseExact : true, - weekdays : 'ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച'.split('_'), - weekdaysShort : 'ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി'.split('_'), - weekdaysMin : 'ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ'.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 : '[ഇന്ന്] LT', - nextDay : '[നാളെ] LT', - nextWeek : 'dddd, LT', - lastDay : '[ഇന്നലെ] LT', - lastWeek : '[കഴിഞ്ഞ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s കഴിഞ്ഞ്', - past : '%s മുൻപ്', - s : 'അൽപ നിമിഷങ്ങൾ', - ss : '%d സെക്കൻഡ്', - m : 'ഒരു മിനിറ്റ്', - mm : '%d മിനിറ്റ്', - h : 'ഒരു മണിക്കൂർ', - hh : '%d മണിക്കൂർ', - d : 'ഒരു ദിവസം', - dd : '%d ദിവസം', - M : 'ഒരു മാസം', - MM : '%d മാസം', - y : 'ഒരു വർഷം', - yy : '%d വർഷം' - }, - meridiemParse: /രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ((meridiem === 'രാത്രി' && hour >= 4) || - meridiem === 'ഉച്ച കഴിഞ്ഞ്' || - meridiem === 'വൈകുന്നേരം') { - return hour + 12; - } else { - return hour; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'രാത്രി'; - } else if (hour < 12) { - return 'രാവിലെ'; - } else if (hour < 17) { - return 'ഉച്ച കഴിഞ്ഞ്'; - } else if (hour < 20) { - return 'വൈകുന്നേരം'; - } else { - return 'രാത്രി'; - } - } - }); - - return ml; - -}))); diff --git a/locale/mn.js b/locale/mn.js deleted file mode 100644 index f4b95c816e..0000000000 --- a/locale/mn.js +++ /dev/null @@ -1,103 +0,0 @@ -//! 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'; - - - function translate(number, withoutSuffix, key, isFuture) { - switch (key) { - case 's': - return withoutSuffix ? 'хэдхэн секунд' : 'хэдхэн секундын'; - case 'ss': - return number + (withoutSuffix ? ' секунд' : ' секундын'); - case 'm': - case 'mm': - return number + (withoutSuffix ? ' минут' : ' минутын'); - case 'h': - case 'hh': - return number + (withoutSuffix ? ' цаг' : ' цагийн'); - case 'd': - case 'dd': - return number + (withoutSuffix ? ' өдөр' : ' өдрийн'); - case 'M': - case 'MM': - return number + (withoutSuffix ? ' сар' : ' сарын'); - case 'y': - case 'yy': - return number + (withoutSuffix ? ' жил' : ' жилийн'); - default: - return number; - } - } - - var mn = moment.defineLocale('mn', { - months : 'Нэгдүгээр сар_Хоёрдугаар сар_Гуравдугаар сар_Дөрөвдүгээр сар_Тавдугаар сар_Зургадугаар сар_Долдугаар сар_Наймдугаар сар_Есдүгээр сар_Аравдугаар сар_Арван нэгдүгээр сар_Арван хоёрдугаар сар'.split('_'), - monthsShort : '1 сар_2 сар_3 сар_4 сар_5 сар_6 сар_7 сар_8 сар_9 сар_10 сар_11 сар_12 сар'.split('_'), - monthsParseExact : true, - weekdays : 'Ням_Даваа_Мягмар_Лхагва_Пүрэв_Баасан_Бямба'.split('_'), - weekdaysShort : 'Ням_Дав_Мяг_Лха_Пүр_Баа_Бям'.split('_'), - weekdaysMin : 'Ня_Да_Мя_Лх_Пү_Ба_Бя'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'YYYY оны MMMMын D', - LLL : 'YYYY оны MMMMын D HH:mm', - LLLL : 'dddd, YYYY оны MMMMын D HH:mm' - }, - meridiemParse: /ҮӨ|ҮХ/i, - isPM : function (input) { - return input === 'ҮХ'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ҮӨ'; - } else { - return 'ҮХ'; - } - }, - calendar : { - sameDay : '[Өнөөдөр] LT', - nextDay : '[Маргааш] LT', - nextWeek : '[Ирэх] dddd LT', - lastDay : '[Өчигдөр] LT', - lastWeek : '[Өнгөрсөн] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s дараа', - past : '%s өмнө', - s : translate, - ss : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : translate, - dd : translate, - M : translate, - MM : translate, - y : translate, - yy : translate - }, - dayOfMonthOrdinalParse: /\d{1,2} өдөр/, - ordinal : function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + ' өдөр'; - default: - return number; - } - } - }); - - return mn; - -}))); diff --git a/locale/mr.js b/locale/mr.js deleted file mode 100644 index 984559fdfa..0000000000 --- a/locale/mr.js +++ /dev/null @@ -1,159 +0,0 @@ -//! 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 symbolMap = { - '1': '१', - '2': '२', - '3': '३', - '4': '४', - '5': '५', - '6': '६', - '7': '७', - '8': '८', - '9': '९', - '0': '०' - }, - numberMap = { - '१': '1', - '२': '2', - '३': '3', - '४': '4', - '५': '5', - '६': '6', - '७': '7', - '८': '8', - '९': '9', - '०': '0' - }; - - function relativeTimeMr(number, withoutSuffix, string, isFuture) - { - var output = ''; - if (withoutSuffix) { - switch (string) { - case 's': output = 'काही सेकंद'; break; - case 'ss': output = '%d सेकंद'; break; - case 'm': output = 'एक मिनिट'; break; - case 'mm': output = '%d मिनिटे'; break; - case 'h': output = 'एक तास'; break; - case 'hh': output = '%d तास'; break; - case 'd': output = 'एक दिवस'; break; - case 'dd': output = '%d दिवस'; break; - case 'M': output = 'एक महिना'; break; - case 'MM': output = '%d महिने'; break; - case 'y': output = 'एक वर्ष'; break; - case 'yy': output = '%d वर्षे'; break; - } - } - else { - switch (string) { - case 's': output = 'काही सेकंदां'; break; - case 'ss': output = '%d सेकंदां'; break; - case 'm': output = 'एका मिनिटा'; break; - case 'mm': output = '%d मिनिटां'; break; - case 'h': output = 'एका तासा'; break; - case 'hh': output = '%d तासां'; break; - case 'd': output = 'एका दिवसा'; break; - case 'dd': output = '%d दिवसां'; break; - case 'M': output = 'एका महिन्या'; break; - case 'MM': output = '%d महिन्यां'; break; - case 'y': output = 'एका वर्षा'; break; - case 'yy': output = '%d वर्षां'; break; - } - } - return output.replace(/%d/i, number); - } - - var mr = moment.defineLocale('mr', { - months : 'जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर'.split('_'), - monthsShort: 'जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.'.split('_'), - monthsParseExact : true, - weekdays : 'रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'), - weekdaysShort : 'रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि'.split('_'), - weekdaysMin : 'र_सो_मं_बु_गु_शु_श'.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 : '[आज] LT', - nextDay : '[उद्या] LT', - nextWeek : 'dddd, LT', - lastDay : '[काल] LT', - lastWeek: '[मागील] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future: '%sमध्ये', - past: '%sपूर्वी', - s: relativeTimeMr, - ss: relativeTimeMr, - m: relativeTimeMr, - mm: relativeTimeMr, - h: relativeTimeMr, - hh: relativeTimeMr, - d: relativeTimeMr, - dd: relativeTimeMr, - M: relativeTimeMr, - MM: relativeTimeMr, - y: relativeTimeMr, - yy: relativeTimeMr - }, - preparse: function (string) { - return string.replace(/[१२३४५६७८९०]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - meridiemParse: /रात्री|सकाळी|दुपारी|सायंकाळी/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'रात्री') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'सकाळी') { - return hour; - } else if (meridiem === 'दुपारी') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'सायंकाळी') { - return hour + 12; - } - }, - meridiem: function (hour, minute, isLower) { - if (hour < 4) { - return 'रात्री'; - } else if (hour < 10) { - return 'सकाळी'; - } else if (hour < 17) { - return 'दुपारी'; - } else if (hour < 20) { - return 'सायंकाळी'; - } else { - return 'रात्री'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - return mr; - -}))); diff --git a/locale/ms-my.js b/locale/ms-my.js deleted file mode 100644 index 92014be240..0000000000 --- a/locale/ms-my.js +++ /dev/null @@ -1,81 +0,0 @@ -//! 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 msMy = moment.defineLocale('ms-my', { - months : 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split('_'), - monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'), - weekdays : 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'), - weekdaysShort : 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'), - weekdaysMin : 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /pagi|tengahari|petang|malam/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'pagi') { - return hour; - } else if (meridiem === 'tengahari') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'petang' || meridiem === 'malam') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'pagi'; - } else if (hours < 15) { - return 'tengahari'; - } else if (hours < 19) { - return 'petang'; - } else { - return 'malam'; - } - }, - calendar : { - sameDay : '[Hari ini pukul] LT', - nextDay : '[Esok pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kelmarin pukul] LT', - lastWeek : 'dddd [lepas pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dalam %s', - past : '%s yang lepas', - s : 'beberapa saat', - ss : '%d saat', - m : 'seminit', - mm : '%d minit', - h : 'sejam', - hh : '%d jam', - d : 'sehari', - dd : '%d hari', - M : 'sebulan', - MM : '%d bulan', - y : 'setahun', - yy : '%d tahun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return msMy; - -}))); diff --git a/locale/ms.js b/locale/ms.js deleted file mode 100644 index b499b5c53b..0000000000 --- a/locale/ms.js +++ /dev/null @@ -1,81 +0,0 @@ -//! 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 ms = moment.defineLocale('ms', { - months : 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split('_'), - monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'), - weekdays : 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'), - weekdaysShort : 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'), - weekdaysMin : 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /pagi|tengahari|petang|malam/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'pagi') { - return hour; - } else if (meridiem === 'tengahari') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'petang' || meridiem === 'malam') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'pagi'; - } else if (hours < 15) { - return 'tengahari'; - } else if (hours < 19) { - return 'petang'; - } else { - return 'malam'; - } - }, - calendar : { - sameDay : '[Hari ini pukul] LT', - nextDay : '[Esok pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kelmarin pukul] LT', - lastWeek : 'dddd [lepas pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dalam %s', - past : '%s yang lepas', - s : 'beberapa saat', - ss : '%d saat', - m : 'seminit', - mm : '%d minit', - h : 'sejam', - hh : '%d jam', - d : 'sehari', - dd : '%d hari', - M : 'sebulan', - MM : '%d bulan', - y : 'setahun', - yy : '%d tahun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return ms; - -}))); diff --git a/locale/mt.js b/locale/mt.js deleted file mode 100644 index 4a34c5deb2..0000000000 --- a/locale/mt.js +++ /dev/null @@ -1,59 +0,0 @@ -//! 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 mt = moment.defineLocale('mt', { - months : 'Jannar_Frar_Marzu_April_Mejju_Ġunju_Lulju_Awwissu_Settembru_Ottubru_Novembru_Diċembru'.split('_'), - monthsShort : 'Jan_Fra_Mar_Apr_Mej_Ġun_Lul_Aww_Set_Ott_Nov_Diċ'.split('_'), - weekdays : 'Il-Ħadd_It-Tnejn_It-Tlieta_L-Erbgħa_Il-Ħamis_Il-Ġimgħa_Is-Sibt'.split('_'), - weekdaysShort : 'Ħad_Tne_Tli_Erb_Ħam_Ġim_Sib'.split('_'), - weekdaysMin : 'Ħa_Tn_Tl_Er_Ħa_Ġi_Si'.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 : '[Illum fil-]LT', - nextDay : '[Għada fil-]LT', - nextWeek : 'dddd [fil-]LT', - lastDay : '[Il-bieraħ fil-]LT', - lastWeek : 'dddd [li għadda] [fil-]LT', - sameElse : 'L' - }, - relativeTime : { - future : 'f’ %s', - past : '%s ilu', - s : 'ftit sekondi', - ss : '%d sekondi', - m : 'minuta', - mm : '%d minuti', - h : 'siegħa', - hh : '%d siegħat', - d : 'ġurnata', - dd : '%d ġranet', - M : 'xahar', - MM : '%d xhur', - y : 'sena', - yy : '%d sni' - }, - 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 mt; - -}))); diff --git a/locale/my.js b/locale/my.js deleted file mode 100644 index ca3102a4a9..0000000000 --- a/locale/my.js +++ /dev/null @@ -1,92 +0,0 @@ -//! 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 symbolMap = { - '1': '၁', - '2': '၂', - '3': '၃', - '4': '၄', - '5': '၅', - '6': '၆', - '7': '၇', - '8': '၈', - '9': '၉', - '0': '၀' - }, numberMap = { - '၁': '1', - '၂': '2', - '၃': '3', - '၄': '4', - '၅': '5', - '၆': '6', - '၇': '7', - '၈': '8', - '၉': '9', - '၀': '0' - }; - - var my = moment.defineLocale('my', { - months: 'ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ'.split('_'), - monthsShort: 'ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ'.split('_'), - weekdays: 'တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ'.split('_'), - weekdaysShort: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'), - weekdaysMin: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.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: '[ယနေ.] LT [မှာ]', - nextDay: '[မနက်ဖြန်] LT [မှာ]', - nextWeek: 'dddd LT [မှာ]', - lastDay: '[မနေ.က] LT [မှာ]', - lastWeek: '[ပြီးခဲ့သော] dddd LT [မှာ]', - sameElse: 'L' - }, - relativeTime: { - future: 'လာမည့် %s မှာ', - past: 'လွန်ခဲ့သော %s က', - s: 'စက္ကန်.အနည်းငယ်', - ss : '%d စက္ကန့်', - m: 'တစ်မိနစ်', - mm: '%d မိနစ်', - h: 'တစ်နာရီ', - hh: '%d နာရီ', - d: 'တစ်ရက်', - dd: '%d ရက်', - M: 'တစ်လ', - MM: '%d လ', - y: 'တစ်နှစ်', - yy: '%d နှစ်' - }, - preparse: function (string) { - return string.replace(/[၁၂၃၄၅၆၇၈၉၀]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - 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 my; - -}))); diff --git a/locale/nb.js b/locale/nb.js deleted file mode 100644 index f22981042e..0000000000 --- a/locale/nb.js +++ /dev/null @@ -1,61 +0,0 @@ -//! 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 nb = moment.defineLocale('nb', { - months : 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split('_'), - monthsShort : 'jan._feb._mars_april_mai_juni_juli_aug._sep._okt._nov._des.'.split('_'), - monthsParseExact : true, - weekdays : 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'), - weekdaysShort : 'sø._ma._ti._on._to._fr._lø.'.split('_'), - weekdaysMin : 'sø_ma_ti_on_to_fr_lø'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY [kl.] HH:mm', - LLLL : 'dddd D. MMMM YYYY [kl.] HH:mm' - }, - calendar : { - sameDay: '[i dag kl.] LT', - nextDay: '[i morgen kl.] LT', - nextWeek: 'dddd [kl.] LT', - lastDay: '[i går kl.] LT', - lastWeek: '[forrige] dddd [kl.] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'om %s', - past : '%s siden', - s : 'noen sekunder', - ss : '%d sekunder', - m : 'ett minutt', - mm : '%d minutter', - h : 'en time', - hh : '%d timer', - d : 'en dag', - dd : '%d dager', - M : 'en måned', - MM : '%d måneder', - y : 'ett år', - yy : '%d år' - }, - 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 nb; - -}))); diff --git a/locale/ne.js b/locale/ne.js deleted file mode 100644 index 21c03a85b8..0000000000 --- a/locale/ne.js +++ /dev/null @@ -1,122 +0,0 @@ -//! 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 symbolMap = { - '1': '१', - '2': '२', - '3': '३', - '4': '४', - '5': '५', - '6': '६', - '7': '७', - '8': '८', - '9': '९', - '0': '०' - }, - numberMap = { - '१': '1', - '२': '2', - '३': '3', - '४': '4', - '५': '5', - '६': '6', - '७': '7', - '८': '8', - '९': '9', - '०': '0' - }; - - var ne = moment.defineLocale('ne', { - months : 'जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर'.split('_'), - monthsShort : 'जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.'.split('_'), - monthsParseExact : true, - weekdays : 'आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार'.split('_'), - weekdaysShort : 'आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.'.split('_'), - weekdaysMin : 'आ._सो._मं._बु._बि._शु._श.'.split('_'), - weekdaysParseExact : true, - 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 बजे' - }, - preparse: function (string) { - return string.replace(/[१२३४५६७८९०]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - meridiemParse: /राति|बिहान|दिउँसो|साँझ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'राति') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'बिहान') { - return hour; - } else if (meridiem === 'दिउँसो') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'साँझ') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 3) { - return 'राति'; - } else if (hour < 12) { - return 'बिहान'; - } else if (hour < 16) { - return 'दिउँसो'; - } else if (hour < 20) { - return 'साँझ'; - } else { - return 'राति'; - } - }, - calendar : { - sameDay : '[आज] LT', - nextDay : '[भोलि] LT', - nextWeek : '[आउँदो] dddd[,] LT', - lastDay : '[हिजो] LT', - lastWeek : '[गएको] dddd[,] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%sमा', - past : '%s अगाडि', - s : 'केही क्षण', - ss : '%d सेकेण्ड', - m : 'एक मिनेट', - mm : '%d मिनेट', - h : 'एक घण्टा', - hh : '%d घण्टा', - d : 'एक दिन', - dd : '%d दिन', - M : 'एक महिना', - MM : '%d महिना', - y : 'एक बर्ष', - yy : '%d बर्ष' - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - return ne; - -}))); diff --git a/locale/nl-be.js b/locale/nl-be.js deleted file mode 100644 index 479e291393..0000000000 --- a/locale/nl-be.js +++ /dev/null @@ -1,86 +0,0 @@ -//! 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 monthsShortWithDots = 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'), - monthsShortWithoutDots = 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_'); - - var monthsParse = [/^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 = /^(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 nlBe = moment.defineLocale('nl-be', { - months : 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split('_'), - monthsShort : function (m, format) { - if (!m) { - return monthsShortWithDots; - } else if (/-MMM-/.test(format)) { - return monthsShortWithoutDots[m.month()]; - } else { - return monthsShortWithDots[m.month()]; - } - }, - - monthsRegex: monthsRegex, - monthsShortRegex: monthsRegex, - 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, - longMonthsParse : monthsParse, - shortMonthsParse : monthsParse, - - weekdays : 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split('_'), - weekdaysShort : 'zo._ma._di._wo._do._vr._za.'.split('_'), - weekdaysMin : 'zo_ma_di_wo_do_vr_za'.split('_'), - weekdaysParseExact : true, - 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: '[vandaag om] LT', - nextDay: '[morgen om] LT', - nextWeek: 'dddd [om] LT', - lastDay: '[gisteren om] LT', - lastWeek: '[afgelopen] dddd [om] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'over %s', - past : '%s geleden', - s : 'een paar seconden', - ss : '%d seconden', - m : 'één minuut', - mm : '%d minuten', - h : 'één uur', - hh : '%d uur', - d : 'één dag', - dd : '%d dagen', - M : 'één maand', - MM : '%d maanden', - y : 'één jaar', - yy : '%d jaar' - }, - dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/, - ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); - }, - 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 nlBe; - -}))); diff --git a/locale/nl.js b/locale/nl.js deleted file mode 100644 index 11e78b9a30..0000000000 --- a/locale/nl.js +++ /dev/null @@ -1,86 +0,0 @@ -//! 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 monthsShortWithDots = 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'), - monthsShortWithoutDots = 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_'); - - var monthsParse = [/^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 = /^(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 nl = moment.defineLocale('nl', { - months : 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split('_'), - monthsShort : function (m, format) { - if (!m) { - return monthsShortWithDots; - } else if (/-MMM-/.test(format)) { - return monthsShortWithoutDots[m.month()]; - } else { - return monthsShortWithDots[m.month()]; - } - }, - - monthsRegex: monthsRegex, - monthsShortRegex: monthsRegex, - 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, - longMonthsParse : monthsParse, - shortMonthsParse : monthsParse, - - weekdays : 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split('_'), - weekdaysShort : 'zo._ma._di._wo._do._vr._za.'.split('_'), - weekdaysMin : 'zo_ma_di_wo_do_vr_za'.split('_'), - weekdaysParseExact : true, - 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: '[vandaag om] LT', - nextDay: '[morgen om] LT', - nextWeek: 'dddd [om] LT', - lastDay: '[gisteren om] LT', - lastWeek: '[afgelopen] dddd [om] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'over %s', - past : '%s geleden', - s : 'een paar seconden', - ss : '%d seconden', - m : 'één minuut', - mm : '%d minuten', - h : 'één uur', - hh : '%d uur', - d : 'één dag', - dd : '%d dagen', - M : 'één maand', - MM : '%d maanden', - y : 'één jaar', - yy : '%d jaar' - }, - dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/, - ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); - }, - 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 nl; - -}))); diff --git a/locale/nn.js b/locale/nn.js deleted file mode 100644 index 5fa355043f..0000000000 --- a/locale/nn.js +++ /dev/null @@ -1,59 +0,0 @@ -//! 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 nn = moment.defineLocale('nn', { - months : 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split('_'), - monthsShort : 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'), - weekdays : 'sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag'.split('_'), - weekdaysShort : 'sun_mån_tys_ons_tor_fre_lau'.split('_'), - weekdaysMin : 'su_må_ty_on_to_fr_lø'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY [kl.] H:mm', - LLLL : 'dddd D. MMMM YYYY [kl.] HH:mm' - }, - calendar : { - sameDay: '[I dag klokka] LT', - nextDay: '[I morgon klokka] LT', - nextWeek: 'dddd [klokka] LT', - lastDay: '[I går klokka] LT', - lastWeek: '[Føregåande] dddd [klokka] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'om %s', - past : '%s sidan', - s : 'nokre sekund', - ss : '%d sekund', - m : 'eit minutt', - mm : '%d minutt', - h : 'ein time', - hh : '%d timar', - d : 'ein dag', - dd : '%d dagar', - M : 'ein månad', - MM : '%d månader', - y : 'eit år', - yy : '%d år' - }, - 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 nn; - -}))); diff --git a/locale/pa-in.js b/locale/pa-in.js deleted file mode 100644 index 58ae128367..0000000000 --- a/locale/pa-in.js +++ /dev/null @@ -1,123 +0,0 @@ -//! 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 symbolMap = { - '1': '੧', - '2': '੨', - '3': '੩', - '4': '੪', - '5': '੫', - '6': '੬', - '7': '੭', - '8': '੮', - '9': '੯', - '0': '੦' - }, - numberMap = { - '੧': '1', - '੨': '2', - '੩': '3', - '੪': '4', - '੫': '5', - '੬': '6', - '੭': '7', - '੮': '8', - '੯': '9', - '੦': '0' - }; - - var paIn = moment.defineLocale('pa-in', { - // There are months name as per Nanakshahi Calendar but they are not used as rigidly in modern Punjabi. - months : 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split('_'), - monthsShort : 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split('_'), - weekdays : 'ਐਤਵਾਰ_ਸੋਮਵਾਰ_ਮੰਗਲਵਾਰ_ਬੁਧਵਾਰ_ਵੀਰਵਾਰ_ਸ਼ੁੱਕਰਵਾਰ_ਸ਼ਨੀਚਰਵਾਰ'.split('_'), - weekdaysShort : 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'), - weekdaysMin : 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.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 : '[ਅਜ] LT', - nextDay : '[ਕਲ] LT', - nextWeek : '[ਅਗਲਾ] dddd, LT', - lastDay : '[ਕਲ] LT', - lastWeek : '[ਪਿਛਲੇ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ਵਿੱਚ', - past : '%s ਪਿਛਲੇ', - s : 'ਕੁਝ ਸਕਿੰਟ', - ss : '%d ਸਕਿੰਟ', - m : 'ਇਕ ਮਿੰਟ', - mm : '%d ਮਿੰਟ', - h : 'ਇੱਕ ਘੰਟਾ', - hh : '%d ਘੰਟੇ', - d : 'ਇੱਕ ਦਿਨ', - dd : '%d ਦਿਨ', - M : 'ਇੱਕ ਮਹੀਨਾ', - MM : '%d ਮਹੀਨੇ', - y : 'ਇੱਕ ਸਾਲ', - yy : '%d ਸਾਲ' - }, - preparse: function (string) { - return string.replace(/[੧੨੩੪੫੬੭੮੯੦]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - // Punjabi notation for meridiems are quite fuzzy in practice. While there exists - // a rigid notion of a 'Pahar' it is not used as rigidly in modern Punjabi. - meridiemParse: /ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'ਰਾਤ') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'ਸਵੇਰ') { - return hour; - } else if (meridiem === 'ਦੁਪਹਿਰ') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'ਸ਼ਾਮ') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ਰਾਤ'; - } else if (hour < 10) { - return 'ਸਵੇਰ'; - } else if (hour < 17) { - return 'ਦੁਪਹਿਰ'; - } else if (hour < 20) { - return 'ਸ਼ਾਮ'; - } else { - return 'ਰਾਤ'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - return paIn; - -}))); diff --git a/locale/pl.js b/locale/pl.js deleted file mode 100644 index 4c9c71a0c6..0000000000 --- a/locale/pl.js +++ /dev/null @@ -1,125 +0,0 @@ -//! 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 monthsNominative = 'styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień'.split('_'), - monthsSubjective = 'stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia'.split('_'); - function plural(n) { - return (n % 10 < 5) && (n % 10 > 1) && ((~~(n / 10) % 10) !== 1); - } - function translate(number, withoutSuffix, key) { - var result = number + ' '; - switch (key) { - case 'ss': - return result + (plural(number) ? 'sekundy' : 'sekund'); - case 'm': - return withoutSuffix ? 'minuta' : 'minutę'; - case 'mm': - return result + (plural(number) ? 'minuty' : 'minut'); - case 'h': - return withoutSuffix ? 'godzina' : 'godzinę'; - case 'hh': - return result + (plural(number) ? 'godziny' : 'godzin'); - case 'MM': - return result + (plural(number) ? 'miesiące' : 'miesięcy'); - case 'yy': - return result + (plural(number) ? 'lata' : 'lat'); - } - } - - var pl = moment.defineLocale('pl', { - months : function (momentToFormat, format) { - if (!momentToFormat) { - return monthsNominative; - } else if (format === '') { - // Hack: if format empty we know this is used to generate - // RegExp by moment. Give then back both valid forms of months - // in RegExp ready format. - return '(' + monthsSubjective[momentToFormat.month()] + '|' + monthsNominative[momentToFormat.month()] + ')'; - } else if (/D MMMM/.test(format)) { - return monthsSubjective[momentToFormat.month()]; - } else { - return monthsNominative[momentToFormat.month()]; - } - }, - monthsShort : 'sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru'.split('_'), - weekdays : 'niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota'.split('_'), - weekdaysShort : 'ndz_pon_wt_śr_czw_pt_sob'.split('_'), - weekdaysMin : 'Nd_Pn_Wt_Śr_Cz_Pt_So'.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: '[Dziś o] LT', - nextDay: '[Jutro o] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[W niedzielę o] LT'; - - case 2: - return '[We wtorek o] LT'; - - case 3: - return '[W środę o] LT'; - - case 6: - return '[W sobotę o] LT'; - - default: - return '[W] dddd [o] LT'; - } - }, - lastDay: '[Wczoraj o] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[W zeszłą niedzielę o] LT'; - case 3: - return '[W zeszłą środę o] LT'; - case 6: - return '[W zeszłą sobotę o] LT'; - default: - return '[W zeszły] dddd [o] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'za %s', - past : '%s temu', - s : 'kilka sekund', - ss : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : '1 dzień', - dd : '%d dni', - M : 'miesiąc', - MM : translate, - y : 'rok', - yy : translate - }, - 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 pl; - -}))); diff --git a/locale/ro.js b/locale/ro.js deleted file mode 100644 index 15bea092d8..0000000000 --- a/locale/ro.js +++ /dev/null @@ -1,74 +0,0 @@ -//! 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'; - - - function relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'ss': 'secunde', - 'mm': 'minute', - 'hh': 'ore', - 'dd': 'zile', - 'MM': 'luni', - 'yy': 'ani' - }, - separator = ' '; - if (number % 100 >= 20 || (number >= 100 && number % 100 === 0)) { - separator = ' de '; - } - return number + separator + format[key]; - } - - var ro = moment.defineLocale('ro', { - months : 'ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie'.split('_'), - monthsShort : 'ian._febr._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'duminică_luni_marți_miercuri_joi_vineri_sâmbătă'.split('_'), - weekdaysShort : 'Dum_Lun_Mar_Mie_Joi_Vin_Sâm'.split('_'), - weekdaysMin : 'Du_Lu_Ma_Mi_Jo_Vi_Sâ'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY H:mm', - LLLL : 'dddd, D MMMM YYYY H:mm' - }, - calendar : { - sameDay: '[azi la] LT', - nextDay: '[mâine la] LT', - nextWeek: 'dddd [la] LT', - lastDay: '[ieri la] LT', - lastWeek: '[fosta] dddd [la] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'peste %s', - past : '%s în urmă', - s : 'câteva secunde', - ss : relativeTimeWithPlural, - m : 'un minut', - mm : relativeTimeWithPlural, - h : 'o oră', - hh : relativeTimeWithPlural, - d : 'o zi', - dd : relativeTimeWithPlural, - M : 'o lună', - MM : relativeTimeWithPlural, - y : 'un an', - yy : relativeTimeWithPlural - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return ro; - -}))); diff --git a/locale/ru.js b/locale/ru.js deleted file mode 100644 index 7afb7b5d54..0000000000 --- a/locale/ru.js +++ /dev/null @@ -1,181 +0,0 @@ -//! 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'; - - - function plural(word, num) { - var forms = word.split('_'); - return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]); - } - function relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'ss': withoutSuffix ? 'секунда_секунды_секунд' : 'секунду_секунды_секунд', - 'mm': withoutSuffix ? 'минута_минуты_минут' : 'минуту_минуты_минут', - 'hh': 'час_часа_часов', - 'dd': 'день_дня_дней', - 'MM': 'месяц_месяца_месяцев', - 'yy': 'год_года_лет' - }; - if (key === 'm') { - return withoutSuffix ? 'минута' : 'минуту'; - } - else { - return number + ' ' + plural(format[key], +number); - } - } - var monthsParse = [/^янв/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 - // CLDR data: http://www.unicode.org/cldr/charts/28/summary/ru.html#1753 - var ru = moment.defineLocale('ru', { - months : { - format: 'января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря'.split('_'), - standalone: 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_') - }, - monthsShort : { - // по CLDR именно "июл." и "июн.", но какой смысл менять букву на точку ? - format: 'янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.'.split('_'), - standalone: 'янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.'.split('_') - }, - weekdays : { - standalone: 'воскресенье_понедельник_вторник_среда_четверг_пятница_суббота'.split('_'), - format: 'воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу'.split('_'), - isFormat: /\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?\] ?dddd/ - }, - weekdaysShort : 'вс_пн_вт_ср_чт_пт_сб'.split('_'), - weekdaysMin : 'вс_пн_вт_ср_чт_пт_сб'.split('_'), - monthsParse : monthsParse, - longMonthsParse : monthsParse, - shortMonthsParse : monthsParse, - - // полные названия с падежами, по три буквы, для некоторых, по 4 буквы, сокращения с точкой и без точки - monthsRegex: /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i, - - // копия предыдущего - monthsShortRegex: /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i, - - // полные названия с падежами - monthsStrictRegex: /^(январ[яь]|феврал[яь]|марта?|апрел[яь]|ма[яй]|июн[яь]|июл[яь]|августа?|сентябр[яь]|октябр[яь]|ноябр[яь]|декабр[яь])/i, - - // Выражение, которое соотвествует только сокращённым формам - monthsShortStrictRegex: /^(янв\.|февр?\.|мар[т.]|апр\.|ма[яй]|июн[ья.]|июл[ья.]|авг\.|сент?\.|окт\.|нояб?\.|дек\.)/i, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY г.', - LLL : 'D MMMM YYYY г., H:mm', - LLLL : 'dddd, D MMMM YYYY г., H:mm' - }, - calendar : { - sameDay: '[Сегодня, в] LT', - nextDay: '[Завтра, в] LT', - lastDay: '[Вчера, в] LT', - nextWeek: function (now) { - if (now.week() !== this.week()) { - switch (this.day()) { - case 0: - return '[В следующее] dddd, [в] LT'; - case 1: - case 2: - case 4: - return '[В следующий] dddd, [в] LT'; - case 3: - case 5: - case 6: - return '[В следующую] dddd, [в] LT'; - } - } else { - if (this.day() === 2) { - return '[Во] dddd, [в] LT'; - } else { - return '[В] dddd, [в] LT'; - } - } - }, - lastWeek: function (now) { - if (now.week() !== this.week()) { - switch (this.day()) { - case 0: - return '[В прошлое] dddd, [в] LT'; - case 1: - case 2: - case 4: - return '[В прошлый] dddd, [в] LT'; - case 3: - case 5: - case 6: - return '[В прошлую] dddd, [в] LT'; - } - } else { - if (this.day() === 2) { - return '[Во] dddd, [в] LT'; - } else { - return '[В] dddd, [в] LT'; - } - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'через %s', - past : '%s назад', - s : 'несколько секунд', - ss : relativeTimeWithPlural, - m : relativeTimeWithPlural, - mm : relativeTimeWithPlural, - h : 'час', - hh : relativeTimeWithPlural, - d : 'день', - dd : relativeTimeWithPlural, - M : 'месяц', - MM : relativeTimeWithPlural, - y : 'год', - yy : relativeTimeWithPlural - }, - meridiemParse: /ночи|утра|дня|вечера/i, - isPM : function (input) { - return /^(дня|вечера)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ночи'; - } else if (hour < 12) { - return 'утра'; - } else if (hour < 17) { - return 'дня'; - } else { - return 'вечера'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}-(й|го|я)/, - ordinal: function (number, period) { - switch (period) { - case 'M': - case 'd': - case 'DDD': - return number + '-й'; - case 'D': - return number + '-го'; - case 'w': - case 'W': - return number + '-я'; - default: - return number; - } - }, - 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 ru; - -}))); diff --git a/locale/sd.js b/locale/sd.js deleted file mode 100644 index 12992382b6..0000000000 --- a/locale/sd.js +++ /dev/null @@ -1,97 +0,0 @@ -//! 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 = [ - 'جنوري', - 'فيبروري', - 'مارچ', - 'اپريل', - 'مئي', - 'جون', - 'جولاءِ', - 'آگسٽ', - 'سيپٽمبر', - 'آڪٽوبر', - 'نومبر', - 'ڊسمبر' - ]; - var days = [ - 'آچر', - 'سومر', - 'اڱارو', - 'اربع', - 'خميس', - 'جمع', - 'ڇنڇر' - ]; - - var sd = moment.defineLocale('sd', { - months : months, - monthsShort : months, - weekdays : days, - weekdaysShort : days, - weekdaysMin : days, - 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: /صبح|شام/, - isPM : function (input) { - return 'شام' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'صبح'; - } - return 'شام'; - }, - calendar : { - sameDay : '[اڄ] LT', - nextDay : '[سڀاڻي] LT', - nextWeek : 'dddd [اڳين هفتي تي] LT', - lastDay : '[ڪالهه] LT', - lastWeek : '[گزريل هفتي] dddd [تي] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s پوء', - past : '%s اڳ', - s : 'چند سيڪنڊ', - ss : '%d سيڪنڊ', - m : 'هڪ منٽ', - mm : '%d منٽ', - h : 'هڪ ڪلاڪ', - hh : '%d ڪلاڪ', - d : 'هڪ ڏينهن', - dd : '%d ڏينهن', - M : 'هڪ مهينو', - MM : '%d مهينا', - y : 'هڪ سال', - yy : '%d سال' - }, - preparse: function (string) { - return string.replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/,/g, '،'); - }, - 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 sd; - -}))); diff --git a/locale/se.js b/locale/se.js deleted file mode 100644 index 4b04678038..0000000000 --- a/locale/se.js +++ /dev/null @@ -1,59 +0,0 @@ -//! 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 se = moment.defineLocale('se', { - months : 'ođđajagemánnu_guovvamánnu_njukčamánnu_cuoŋománnu_miessemánnu_geassemánnu_suoidnemánnu_borgemánnu_čakčamánnu_golggotmánnu_skábmamánnu_juovlamánnu'.split('_'), - monthsShort : 'ođđj_guov_njuk_cuo_mies_geas_suoi_borg_čakč_golg_skáb_juov'.split('_'), - weekdays : 'sotnabeaivi_vuossárga_maŋŋebárga_gaskavahkku_duorastat_bearjadat_lávvardat'.split('_'), - weekdaysShort : 'sotn_vuos_maŋ_gask_duor_bear_láv'.split('_'), - weekdaysMin : 's_v_m_g_d_b_L'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'MMMM D. [b.] YYYY', - LLL : 'MMMM D. [b.] YYYY [ti.] HH:mm', - LLLL : 'dddd, MMMM D. [b.] YYYY [ti.] HH:mm' - }, - calendar : { - sameDay: '[otne ti] LT', - nextDay: '[ihttin ti] LT', - nextWeek: 'dddd [ti] LT', - lastDay: '[ikte ti] LT', - lastWeek: '[ovddit] dddd [ti] LT', - sameElse: 'L' - }, - relativeTime : { - future : '%s geažes', - past : 'maŋit %s', - s : 'moadde sekunddat', - ss: '%d sekunddat', - m : 'okta minuhta', - mm : '%d minuhtat', - h : 'okta diimmu', - hh : '%d diimmut', - d : 'okta beaivi', - dd : '%d beaivvit', - M : 'okta mánnu', - MM : '%d mánut', - y : 'okta jahki', - yy : '%d jagit' - }, - 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 se; - -}))); diff --git a/locale/si.js b/locale/si.js deleted file mode 100644 index 52dc60807d..0000000000 --- a/locale/si.js +++ /dev/null @@ -1,70 +0,0 @@ -//! 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'; - - - /*jshint -W100*/ - var si = moment.defineLocale('si', { - months : 'ජනවාරි_පෙබරවාරි_මාර්තු_අප්‍රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්'.split('_'), - monthsShort : 'ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ'.split('_'), - weekdays : 'ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්‍රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා'.split('_'), - weekdaysShort : 'ඉරි_සඳු_අඟ_බදා_බ්‍රහ_සිකු_සෙන'.split('_'), - weekdaysMin : 'ඉ_ස_අ_බ_බ්‍ර_සි_සෙ'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'a h:mm', - LTS : 'a h:mm:ss', - L : 'YYYY/MM/DD', - LL : 'YYYY MMMM D', - LLL : 'YYYY MMMM D, a h:mm', - LLLL : 'YYYY MMMM D [වැනි] dddd, a h:mm:ss' - }, - calendar : { - sameDay : '[අද] LT[ට]', - nextDay : '[හෙට] LT[ට]', - nextWeek : 'dddd LT[ට]', - lastDay : '[ඊයේ] LT[ට]', - lastWeek : '[පසුගිය] dddd LT[ට]', - sameElse : 'L' - }, - relativeTime : { - future : '%sකින්', - past : '%sකට පෙර', - s : 'තත්පර කිහිපය', - ss : 'තත්පර %d', - m : 'මිනිත්තුව', - mm : 'මිනිත්තු %d', - h : 'පැය', - hh : 'පැය %d', - d : 'දිනය', - dd : 'දින %d', - M : 'මාසය', - MM : 'මාස %d', - y : 'වසර', - yy : 'වසර %d' - }, - dayOfMonthOrdinalParse: /\d{1,2} වැනි/, - ordinal : function (number) { - return number + ' වැනි'; - }, - meridiemParse : /පෙර වරු|පස් වරු|පෙ.ව|ප.ව./, - isPM : function (input) { - return input === 'ප.ව.' || input === 'පස් වරු'; - }, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'ප.ව.' : 'පස් වරු'; - } else { - return isLower ? 'පෙ.ව.' : 'පෙර වරු'; - } - } - }); - - return si; - -}))); diff --git a/locale/sk.js b/locale/sk.js deleted file mode 100644 index 6938f95e63..0000000000 --- a/locale/sk.js +++ /dev/null @@ -1,155 +0,0 @@ -//! 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 = 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split('_'), - monthsShort = 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_'); - function plural(n) { - return (n > 1) && (n < 5); - } - function translate(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': // a few seconds / in a few seconds / a few seconds ago - return (withoutSuffix || isFuture) ? 'pár sekúnd' : 'pár sekundami'; - case 'ss': // 9 seconds / in 9 seconds / 9 seconds ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'sekundy' : 'sekúnd'); - } else { - return result + 'sekundami'; - } - break; - case 'm': // a minute / in a minute / a minute ago - return withoutSuffix ? 'minúta' : (isFuture ? 'minútu' : 'minútou'); - case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'minúty' : 'minút'); - } else { - return result + 'minútami'; - } - break; - case 'h': // an hour / in an hour / an hour ago - return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou'); - case 'hh': // 9 hours / in 9 hours / 9 hours ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'hodiny' : 'hodín'); - } else { - return result + 'hodinami'; - } - break; - case 'd': // a day / in a day / a day ago - return (withoutSuffix || isFuture) ? 'deň' : 'dňom'; - case 'dd': // 9 days / in 9 days / 9 days ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'dni' : 'dní'); - } else { - return result + 'dňami'; - } - break; - case 'M': // a month / in a month / a month ago - return (withoutSuffix || isFuture) ? 'mesiac' : 'mesiacom'; - case 'MM': // 9 months / in 9 months / 9 months ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'mesiace' : 'mesiacov'); - } else { - return result + 'mesiacmi'; - } - break; - case 'y': // a year / in a year / a year ago - return (withoutSuffix || isFuture) ? 'rok' : 'rokom'; - case 'yy': // 9 years / in 9 years / 9 years ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'roky' : 'rokov'); - } else { - return result + 'rokmi'; - } - break; - } - } - - var sk = moment.defineLocale('sk', { - months : months, - monthsShort : monthsShort, - 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('_'), - longDateFormat : { - LT: 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd D. MMMM YYYY H:mm' - }, - calendar : { - sameDay: '[dnes o] LT', - nextDay: '[zajtra o] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[v nedeľu o] LT'; - case 1: - case 2: - return '[v] dddd [o] LT'; - case 3: - return '[v stredu o] LT'; - case 4: - return '[vo štvrtok o] LT'; - case 5: - return '[v piatok o] LT'; - case 6: - return '[v sobotu o] LT'; - } - }, - lastDay: '[včera o] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[minulú nedeľu o] LT'; - case 1: - case 2: - return '[minulý] dddd [o] LT'; - case 3: - return '[minulú stredu o] LT'; - case 4: - case 5: - return '[minulý] dddd [o] LT'; - case 6: - return '[minulú sobotu o] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'za %s', - past : 'pred %s', - s : translate, - ss : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : translate, - dd : translate, - M : translate, - MM : translate, - y : translate, - yy : translate - }, - 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 sk; - -}))); diff --git a/locale/sl.js b/locale/sl.js deleted file mode 100644 index ecdd0cb42c..0000000000 --- a/locale/sl.js +++ /dev/null @@ -1,172 +0,0 @@ -//! 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'; - - - function processRelativeTime(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': - return withoutSuffix || isFuture ? 'nekaj sekund' : 'nekaj sekundami'; - case 'ss': - if (number === 1) { - result += withoutSuffix ? 'sekundo' : 'sekundi'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'sekundi' : 'sekundah'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'sekunde' : 'sekundah'; - } else { - result += 'sekund'; - } - return result; - case 'm': - return withoutSuffix ? 'ena minuta' : 'eno minuto'; - case 'mm': - if (number === 1) { - result += withoutSuffix ? 'minuta' : 'minuto'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'minuti' : 'minutama'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'minute' : 'minutami'; - } else { - result += withoutSuffix || isFuture ? 'minut' : 'minutami'; - } - return result; - case 'h': - return withoutSuffix ? 'ena ura' : 'eno uro'; - case 'hh': - if (number === 1) { - result += withoutSuffix ? 'ura' : 'uro'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'uri' : 'urama'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'ure' : 'urami'; - } else { - result += withoutSuffix || isFuture ? 'ur' : 'urami'; - } - return result; - case 'd': - return withoutSuffix || isFuture ? 'en dan' : 'enim dnem'; - case 'dd': - if (number === 1) { - result += withoutSuffix || isFuture ? 'dan' : 'dnem'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'dni' : 'dnevoma'; - } else { - result += withoutSuffix || isFuture ? 'dni' : 'dnevi'; - } - return result; - case 'M': - return withoutSuffix || isFuture ? 'en mesec' : 'enim mesecem'; - case 'MM': - if (number === 1) { - result += withoutSuffix || isFuture ? 'mesec' : 'mesecem'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'meseca' : 'mesecema'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'mesece' : 'meseci'; - } else { - result += withoutSuffix || isFuture ? 'mesecev' : 'meseci'; - } - return result; - case 'y': - return withoutSuffix || isFuture ? 'eno leto' : 'enim letom'; - case 'yy': - if (number === 1) { - result += withoutSuffix || isFuture ? 'leto' : 'letom'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'leti' : 'letoma'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'leta' : 'leti'; - } else { - result += withoutSuffix || isFuture ? 'let' : 'leti'; - } - return result; - } - } - - var sl = moment.defineLocale('sl', { - months : 'januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december'.split('_'), - monthsShort : 'jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota'.split('_'), - weekdaysShort : 'ned._pon._tor._sre._čet._pet._sob.'.split('_'), - weekdaysMin : 'ne_po_to_sr_če_pe_so'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[danes ob] LT', - nextDay : '[jutri ob] LT', - - nextWeek : function () { - switch (this.day()) { - case 0: - return '[v] [nedeljo] [ob] LT'; - case 3: - return '[v] [sredo] [ob] LT'; - case 6: - return '[v] [soboto] [ob] LT'; - case 1: - case 2: - case 4: - case 5: - return '[v] dddd [ob] LT'; - } - }, - lastDay : '[včeraj ob] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - return '[prejšnjo] [nedeljo] [ob] LT'; - case 3: - return '[prejšnjo] [sredo] [ob] LT'; - case 6: - return '[prejšnjo] [soboto] [ob] LT'; - case 1: - case 2: - case 4: - case 5: - return '[prejšnji] dddd [ob] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'čez %s', - past : 'pred %s', - s : processRelativeTime, - ss : processRelativeTime, - m : processRelativeTime, - mm : processRelativeTime, - h : processRelativeTime, - hh : processRelativeTime, - d : processRelativeTime, - dd : processRelativeTime, - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return sl; - -}))); diff --git a/locale/sq.js b/locale/sq.js deleted file mode 100644 index eb081df060..0000000000 --- a/locale/sq.js +++ /dev/null @@ -1,67 +0,0 @@ -//! 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 sq = moment.defineLocale('sq', { - months : 'Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor'.split('_'), - monthsShort : 'Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj'.split('_'), - weekdays : 'E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë'.split('_'), - weekdaysShort : 'Die_Hën_Mar_Mër_Enj_Pre_Sht'.split('_'), - weekdaysMin : 'D_H_Ma_Më_E_P_Sh'.split('_'), - weekdaysParseExact : true, - meridiemParse: /PD|MD/, - isPM: function (input) { - return input.charAt(0) === 'M'; - }, - meridiem : function (hours, minutes, isLower) { - return hours < 12 ? 'PD' : 'MD'; - }, - 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 : '[Sot në] LT', - nextDay : '[Nesër në] LT', - nextWeek : 'dddd [në] LT', - lastDay : '[Dje në] LT', - lastWeek : 'dddd [e kaluar në] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'në %s', - past : '%s më parë', - s : 'disa sekonda', - ss : '%d sekonda', - m : 'një minutë', - mm : '%d minuta', - h : 'një orë', - hh : '%d orë', - d : 'një ditë', - dd : '%d ditë', - M : 'një muaj', - MM : '%d muaj', - y : 'një vit', - yy : '%d vite' - }, - 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 sq; - -}))); diff --git a/locale/sr-cyrl.js b/locale/sr-cyrl.js deleted file mode 100644 index e22a22fc8d..0000000000 --- a/locale/sr-cyrl.js +++ /dev/null @@ -1,110 +0,0 @@ -//! 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 translator = { - words: { //Different grammatical cases - ss: ['секунда', 'секунде', 'секунди'], - m: ['један минут', 'једне минуте'], - mm: ['минут', 'минуте', 'минута'], - h: ['један сат', 'једног сата'], - hh: ['сат', 'сата', 'сати'], - dd: ['дан', 'дана', 'дана'], - MM: ['месец', 'месеца', 'месеци'], - yy: ['година', 'године', 'година'] - }, - correctGrammaticalCase: function (number, wordKey) { - return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]); - }, - translate: function (number, withoutSuffix, key) { - var wordKey = translator.words[key]; - if (key.length === 1) { - return withoutSuffix ? wordKey[0] : wordKey[1]; - } else { - return number + ' ' + translator.correctGrammaticalCase(number, wordKey); - } - } - }; - - var srCyrl = moment.defineLocale('sr-cyrl', { - months: 'јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар'.split('_'), - monthsShort: 'јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.'.split('_'), - monthsParseExact: true, - weekdays: 'недеља_понедељак_уторак_среда_четвртак_петак_субота'.split('_'), - weekdaysShort: 'нед._пон._уто._сре._чет._пет._суб.'.split('_'), - weekdaysMin: 'не_по_ут_ср_че_пе_су'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm', - LTS : 'H:mm:ss', - L: 'DD.MM.YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm', - LLLL: 'dddd, D. MMMM YYYY H:mm' - }, - calendar: { - sameDay: '[данас у] LT', - nextDay: '[сутра у] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[у] [недељу] [у] LT'; - case 3: - return '[у] [среду] [у] LT'; - case 6: - return '[у] [суботу] [у] LT'; - case 1: - case 2: - case 4: - case 5: - return '[у] dddd [у] LT'; - } - }, - lastDay : '[јуче у] LT', - lastWeek : function () { - var lastWeekDays = [ - '[прошле] [недеље] [у] LT', - '[прошлог] [понедељка] [у] LT', - '[прошлог] [уторка] [у] LT', - '[прошле] [среде] [у] LT', - '[прошлог] [четвртка] [у] LT', - '[прошлог] [петка] [у] LT', - '[прошле] [суботе] [у] LT' - ]; - return lastWeekDays[this.day()]; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'за %s', - past : 'пре %s', - s : 'неколико секунди', - ss : translator.translate, - m : translator.translate, - mm : translator.translate, - h : translator.translate, - hh : translator.translate, - d : 'дан', - dd : translator.translate, - M : 'месец', - MM : translator.translate, - y : 'годину', - yy : translator.translate - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return srCyrl; - -}))); diff --git a/locale/sr.js b/locale/sr.js deleted file mode 100644 index cb0b7ec9ff..0000000000 --- a/locale/sr.js +++ /dev/null @@ -1,110 +0,0 @@ -//! 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 translator = { - words: { //Different grammatical cases - ss: ['sekunda', 'sekunde', 'sekundi'], - m: ['jedan minut', 'jedne minute'], - mm: ['minut', 'minute', 'minuta'], - h: ['jedan sat', 'jednog sata'], - hh: ['sat', 'sata', 'sati'], - dd: ['dan', 'dana', 'dana'], - MM: ['mesec', 'meseca', 'meseci'], - yy: ['godina', 'godine', 'godina'] - }, - correctGrammaticalCase: function (number, wordKey) { - return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]); - }, - translate: function (number, withoutSuffix, key) { - var wordKey = translator.words[key]; - if (key.length === 1) { - return withoutSuffix ? wordKey[0] : wordKey[1]; - } else { - return number + ' ' + translator.correctGrammaticalCase(number, wordKey); - } - } - }; - - var sr = moment.defineLocale('sr', { - months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split('_'), - monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays: 'nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota'.split('_'), - weekdaysShort: 'ned._pon._uto._sre._čet._pet._sub.'.split('_'), - weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm', - LTS : 'H:mm:ss', - L: 'DD.MM.YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm', - LLLL: 'dddd, D. MMMM YYYY H:mm' - }, - calendar: { - sameDay: '[danas u] LT', - nextDay: '[sutra u] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[u] [nedelju] [u] LT'; - case 3: - return '[u] [sredu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - }, - lastDay : '[juče u] LT', - lastWeek : function () { - var lastWeekDays = [ - '[prošle] [nedelje] [u] LT', - '[prošlog] [ponedeljka] [u] LT', - '[prošlog] [utorka] [u] LT', - '[prošle] [srede] [u] LT', - '[prošlog] [četvrtka] [u] LT', - '[prošlog] [petka] [u] LT', - '[prošle] [subote] [u] LT' - ]; - return lastWeekDays[this.day()]; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'pre %s', - s : 'nekoliko sekundi', - ss : translator.translate, - m : translator.translate, - mm : translator.translate, - h : translator.translate, - hh : translator.translate, - d : 'dan', - dd : translator.translate, - M : 'mesec', - MM : translator.translate, - y : 'godinu', - yy : translator.translate - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return sr; - -}))); diff --git a/locale/ss.js b/locale/ss.js deleted file mode 100644 index a401149c9b..0000000000 --- a/locale/ss.js +++ /dev/null @@ -1,87 +0,0 @@ -//! 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 ss = moment.defineLocale('ss', { - months : "Bhimbidvwane_Indlovana_Indlov'lenkhulu_Mabasa_Inkhwekhweti_Inhlaba_Kholwane_Ingci_Inyoni_Imphala_Lweti_Ingongoni".split('_'), - monthsShort : 'Bhi_Ina_Inu_Mab_Ink_Inh_Kho_Igc_Iny_Imp_Lwe_Igo'.split('_'), - weekdays : 'Lisontfo_Umsombuluko_Lesibili_Lesitsatfu_Lesine_Lesihlanu_Umgcibelo'.split('_'), - weekdaysShort : 'Lis_Umb_Lsb_Les_Lsi_Lsh_Umg'.split('_'), - weekdaysMin : 'Li_Us_Lb_Lt_Ls_Lh_Ug'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[Namuhla nga] LT', - nextDay : '[Kusasa nga] LT', - nextWeek : 'dddd [nga] LT', - lastDay : '[Itolo nga] LT', - lastWeek : 'dddd [leliphelile] [nga] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'nga %s', - past : 'wenteka nga %s', - s : 'emizuzwana lomcane', - ss : '%d mzuzwana', - m : 'umzuzu', - mm : '%d emizuzu', - h : 'lihora', - hh : '%d emahora', - d : 'lilanga', - dd : '%d emalanga', - M : 'inyanga', - MM : '%d tinyanga', - y : 'umnyaka', - yy : '%d iminyaka' - }, - meridiemParse: /ekuseni|emini|entsambama|ebusuku/, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'ekuseni'; - } else if (hours < 15) { - return 'emini'; - } else if (hours < 19) { - return 'entsambama'; - } else { - return 'ebusuku'; - } - }, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'ekuseni') { - return hour; - } else if (meridiem === 'emini') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'entsambama' || meridiem === 'ebusuku') { - if (hour === 0) { - return 0; - } - return hour + 12; - } - }, - 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 ss; - -}))); diff --git a/locale/sv.js b/locale/sv.js deleted file mode 100644 index 494fedba03..0000000000 --- a/locale/sv.js +++ /dev/null @@ -1,68 +0,0 @@ -//! 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 sv = moment.defineLocale('sv', { - months : 'januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december'.split('_'), - monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), - weekdays : 'söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag'.split('_'), - weekdaysShort : 'sön_mån_tis_ons_tor_fre_lör'.split('_'), - weekdaysMin : 'sö_må_ti_on_to_fr_lö'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [kl.] HH:mm', - LLLL : 'dddd D MMMM YYYY [kl.] HH:mm', - lll : 'D MMM YYYY HH:mm', - llll : 'ddd D MMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Idag] LT', - nextDay: '[Imorgon] LT', - lastDay: '[Igår] LT', - nextWeek: '[På] dddd LT', - lastWeek: '[I] dddd[s] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'om %s', - past : 'för %s sedan', - s : 'några sekunder', - ss : '%d sekunder', - m : 'en minut', - mm : '%d minuter', - h : 'en timme', - hh : '%d timmar', - d : 'en dag', - dd : '%d dagar', - M : 'en månad', - MM : '%d månader', - y : 'ett år', - yy : '%d år' - }, - dayOfMonthOrdinalParse: /\d{1,2}(e|a)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'e' : - (b === 1) ? 'a' : - (b === 2) ? 'a' : - (b === 3) ? 'e' : 'e'; - 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 sv; - -}))); diff --git a/locale/sw.js b/locale/sw.js deleted file mode 100644 index 2c066b6439..0000000000 --- a/locale/sw.js +++ /dev/null @@ -1,58 +0,0 @@ -//! 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 sw = moment.defineLocale('sw', { - months : 'Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba'.split('_'), - monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des'.split('_'), - weekdays : 'Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi'.split('_'), - weekdaysShort : 'Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos'.split('_'), - weekdaysMin : 'J2_J3_J4_J5_Al_Ij_J1'.split('_'), - weekdaysParseExact : true, - 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 : '[leo saa] LT', - nextDay : '[kesho saa] LT', - nextWeek : '[wiki ijayo] dddd [saat] LT', - lastDay : '[jana] LT', - lastWeek : '[wiki iliyopita] dddd [saat] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s baadaye', - past : 'tokea %s', - s : 'hivi punde', - ss : 'sekunde %d', - m : 'dakika moja', - mm : 'dakika %d', - h : 'saa limoja', - hh : 'masaa %d', - d : 'siku moja', - dd : 'masiku %d', - M : 'mwezi mmoja', - MM : 'miezi %d', - y : 'mwaka mmoja', - yy : 'miaka %d' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return sw; - -}))); diff --git a/locale/ta.js b/locale/ta.js deleted file mode 100644 index f7a87d7b00..0000000000 --- a/locale/ta.js +++ /dev/null @@ -1,128 +0,0 @@ -//! 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 symbolMap = { - '1': '௧', - '2': '௨', - '3': '௩', - '4': '௪', - '5': '௫', - '6': '௬', - '7': '௭', - '8': '௮', - '9': '௯', - '0': '௦' - }, numberMap = { - '௧': '1', - '௨': '2', - '௩': '3', - '௪': '4', - '௫': '5', - '௬': '6', - '௭': '7', - '௮': '8', - '௯': '9', - '௦': '0' - }; - - var ta = moment.defineLocale('ta', { - months : 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'), - monthsShort : 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'), - weekdays : 'ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை'.split('_'), - weekdaysShort : 'ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி'.split('_'), - weekdaysMin : 'ஞா_தி_செ_பு_வி_வெ_ச'.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 : '[இன்று] LT', - nextDay : '[நாளை] LT', - nextWeek : 'dddd, LT', - lastDay : '[நேற்று] LT', - lastWeek : '[கடந்த வாரம்] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s இல்', - past : '%s முன்', - s : 'ஒரு சில விநாடிகள்', - ss : '%d விநாடிகள்', - m : 'ஒரு நிமிடம்', - mm : '%d நிமிடங்கள்', - h : 'ஒரு மணி நேரம்', - hh : '%d மணி நேரம்', - d : 'ஒரு நாள்', - dd : '%d நாட்கள்', - M : 'ஒரு மாதம்', - MM : '%d மாதங்கள்', - y : 'ஒரு வருடம்', - yy : '%d ஆண்டுகள்' - }, - dayOfMonthOrdinalParse: /\d{1,2}வது/, - ordinal : function (number) { - return number + 'வது'; - }, - preparse: function (string) { - return string.replace(/[௧௨௩௪௫௬௭௮௯௦]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - // refer http://ta.wikipedia.org/s/1er1 - meridiemParse: /யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/, - meridiem : function (hour, minute, isLower) { - if (hour < 2) { - return ' யாமம்'; - } else if (hour < 6) { - return ' வைகறை'; // வைகறை - } else if (hour < 10) { - return ' காலை'; // காலை - } else if (hour < 14) { - return ' நண்பகல்'; // நண்பகல் - } else if (hour < 18) { - return ' எற்பாடு'; // எற்பாடு - } else if (hour < 22) { - return ' மாலை'; // மாலை - } else { - return ' யாமம்'; - } - }, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'யாமம்') { - return hour < 2 ? hour : hour + 12; - } else if (meridiem === 'வைகறை' || meridiem === 'காலை') { - return hour; - } else if (meridiem === 'நண்பகல்') { - return hour >= 10 ? hour : hour + 12; - } else { - return hour + 12; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - return ta; - -}))); diff --git a/locale/te.js b/locale/te.js deleted file mode 100644 index abb40bf1f9..0000000000 --- a/locale/te.js +++ /dev/null @@ -1,88 +0,0 @@ -//! 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 te = moment.defineLocale('te', { - months : 'జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జులై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్'.split('_'), - monthsShort : 'జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జులై_ఆగ._సెప్._అక్టో._నవ._డిసె.'.split('_'), - monthsParseExact : true, - weekdays : 'ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం'.split('_'), - weekdaysShort : 'ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని'.split('_'), - weekdaysMin : 'ఆ_సో_మం_బు_గు_శు_శ'.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 : '[నేడు] LT', - nextDay : '[రేపు] LT', - nextWeek : 'dddd, LT', - lastDay : '[నిన్న] LT', - lastWeek : '[గత] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s లో', - past : '%s క్రితం', - s : 'కొన్ని క్షణాలు', - ss : '%d సెకన్లు', - m : 'ఒక నిమిషం', - mm : '%d నిమిషాలు', - h : 'ఒక గంట', - hh : '%d గంటలు', - d : 'ఒక రోజు', - dd : '%d రోజులు', - M : 'ఒక నెల', - MM : '%d నెలలు', - y : 'ఒక సంవత్సరం', - yy : '%d సంవత్సరాలు' - }, - dayOfMonthOrdinalParse : /\d{1,2}వ/, - ordinal : '%dవ', - meridiemParse: /రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'రాత్రి') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'ఉదయం') { - return hour; - } else if (meridiem === 'మధ్యాహ్నం') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'సాయంత్రం') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'రాత్రి'; - } else if (hour < 10) { - return 'ఉదయం'; - } else if (hour < 17) { - return 'మధ్యాహ్నం'; - } else if (hour < 20) { - return 'సాయంత్రం'; - } else { - return 'రాత్రి'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - return te; - -}))); diff --git a/locale/tg.js b/locale/tg.js deleted file mode 100644 index c283368085..0000000000 --- a/locale/tg.js +++ /dev/null @@ -1,115 +0,0 @@ -//! 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 suffixes = { - 0: '-ум', - 1: '-ум', - 2: '-юм', - 3: '-юм', - 4: '-ум', - 5: '-ум', - 6: '-ум', - 7: '-ум', - 8: '-ум', - 9: '-ум', - 10: '-ум', - 12: '-ум', - 13: '-ум', - 20: '-ум', - 30: '-юм', - 40: '-ум', - 50: '-ум', - 60: '-ум', - 70: '-ум', - 80: '-ум', - 90: '-ум', - 100: '-ум' - }; - - var tg = moment.defineLocale('tg', { - months : 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split('_'), - monthsShort : 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'), - weekdays : 'якшанбе_душанбе_сешанбе_чоршанбе_панҷшанбе_ҷумъа_шанбе'.split('_'), - weekdaysShort : 'яшб_дшб_сшб_чшб_пшб_ҷум_шнб'.split('_'), - weekdaysMin : 'яш_дш_сш_чш_пш_ҷм_шб'.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 : '[Имрӯз соати] LT', - nextDay : '[Пагоҳ соати] LT', - lastDay : '[Дирӯз соати] LT', - nextWeek : 'dddd[и] [ҳафтаи оянда соати] LT', - lastWeek : 'dddd[и] [ҳафтаи гузашта соати] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'баъди %s', - past : '%s пеш', - s : 'якчанд сония', - m : 'як дақиқа', - mm : '%d дақиқа', - h : 'як соат', - hh : '%d соат', - d : 'як рӯз', - dd : '%d рӯз', - M : 'як моҳ', - MM : '%d моҳ', - y : 'як сол', - yy : '%d сол' - }, - meridiemParse: /шаб|субҳ|рӯз|бегоҳ/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'шаб') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'субҳ') { - return hour; - } else if (meridiem === 'рӯз') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'бегоҳ') { - return hour + 12; - } - }, - meridiem: function (hour, minute, isLower) { - if (hour < 4) { - return 'шаб'; - } else if (hour < 11) { - return 'субҳ'; - } else if (hour < 16) { - return 'рӯз'; - } else if (hour < 19) { - return 'бегоҳ'; - } else { - return 'шаб'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}-(ум|юм)/, - ordinal: function (number) { - var a = number % 10, - b = number >= 100 ? 100 : null; - return number + (suffixes[number] || suffixes[a] || suffixes[b]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1th is the first week of the year. - } - }); - - return tg; - -}))); diff --git a/locale/th.js b/locale/th.js deleted file mode 100644 index 87489a4e00..0000000000 --- a/locale/th.js +++ /dev/null @@ -1,66 +0,0 @@ -//! 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 th = moment.defineLocale('th', { - months : 'มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม'.split('_'), - monthsShort : 'ม.ค._ก.พ._มี.ค._เม.ย._พ.ค._มิ.ย._ก.ค._ส.ค._ก.ย._ต.ค._พ.ย._ธ.ค.'.split('_'), - monthsParseExact: true, - weekdays : 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์'.split('_'), - weekdaysShort : 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์'.split('_'), // yes, three characters difference - weekdaysMin : 'อา._จ._อ._พ._พฤ._ศ._ส.'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY เวลา H:mm', - LLLL : 'วันddddที่ D MMMM YYYY เวลา H:mm' - }, - meridiemParse: /ก่อนเที่ยง|หลังเที่ยง/, - isPM: function (input) { - return input === 'หลังเที่ยง'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ก่อนเที่ยง'; - } else { - return 'หลังเที่ยง'; - } - }, - calendar : { - sameDay : '[วันนี้ เวลา] LT', - nextDay : '[พรุ่งนี้ เวลา] LT', - nextWeek : 'dddd[หน้า เวลา] LT', - lastDay : '[เมื่อวานนี้ เวลา] LT', - lastWeek : '[วัน]dddd[ที่แล้ว เวลา] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'อีก %s', - past : '%sที่แล้ว', - s : 'ไม่กี่วินาที', - ss : '%d วินาที', - m : '1 นาที', - mm : '%d นาที', - h : '1 ชั่วโมง', - hh : '%d ชั่วโมง', - d : '1 วัน', - dd : '%d วัน', - M : '1 เดือน', - MM : '%d เดือน', - y : '1 ปี', - yy : '%d ปี' - } - }); - - return th; - -}))); diff --git a/locale/tl-ph.js b/locale/tl-ph.js deleted file mode 100644 index 3f7e45ee92..0000000000 --- a/locale/tl-ph.js +++ /dev/null @@ -1,61 +0,0 @@ -//! 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 tlPh = moment.defineLocale('tl-ph', { - months : 'Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre'.split('_'), - monthsShort : 'Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis'.split('_'), - weekdays : 'Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado'.split('_'), - weekdaysShort : 'Lin_Lun_Mar_Miy_Huw_Biy_Sab'.split('_'), - weekdaysMin : 'Li_Lu_Ma_Mi_Hu_Bi_Sab'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'MM/D/YYYY', - LL : 'MMMM D, YYYY', - LLL : 'MMMM D, YYYY HH:mm', - LLLL : 'dddd, MMMM DD, YYYY HH:mm' - }, - calendar : { - sameDay: 'LT [ngayong araw]', - nextDay: '[Bukas ng] LT', - nextWeek: 'LT [sa susunod na] dddd', - lastDay: 'LT [kahapon]', - lastWeek: 'LT [noong nakaraang] dddd', - sameElse: 'L' - }, - relativeTime : { - future : 'sa loob ng %s', - past : '%s ang nakalipas', - s : 'ilang segundo', - ss : '%d segundo', - m : 'isang minuto', - mm : '%d minuto', - h : 'isang oras', - hh : '%d oras', - d : 'isang araw', - dd : '%d araw', - M : 'isang buwan', - MM : '%d buwan', - y : 'isang taon', - yy : '%d taon' - }, - dayOfMonthOrdinalParse: /\d{1,2}/, - ordinal : function (number) { - return number; - }, - 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 tlPh; - -}))); diff --git a/locale/tlh.js b/locale/tlh.js deleted file mode 100644 index 7ea953b8aa..0000000000 --- a/locale/tlh.js +++ /dev/null @@ -1,121 +0,0 @@ -//! 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 numbersNouns = 'pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut'.split('_'); - - function translateFuture(output) { - var time = output; - time = (output.indexOf('jaj') !== -1) ? - time.slice(0, -3) + 'leS' : - (output.indexOf('jar') !== -1) ? - time.slice(0, -3) + 'waQ' : - (output.indexOf('DIS') !== -1) ? - time.slice(0, -3) + 'nem' : - time + ' pIq'; - return time; - } - - function translatePast(output) { - var time = output; - time = (output.indexOf('jaj') !== -1) ? - time.slice(0, -3) + 'Hu’' : - (output.indexOf('jar') !== -1) ? - time.slice(0, -3) + 'wen' : - (output.indexOf('DIS') !== -1) ? - time.slice(0, -3) + 'ben' : - time + ' ret'; - return time; - } - - function translate(number, withoutSuffix, string, isFuture) { - var numberNoun = numberAsNoun(number); - switch (string) { - case 'ss': - return numberNoun + ' lup'; - case 'mm': - return numberNoun + ' tup'; - case 'hh': - return numberNoun + ' rep'; - case 'dd': - return numberNoun + ' jaj'; - case 'MM': - return numberNoun + ' jar'; - case 'yy': - return numberNoun + ' DIS'; - } - } - - function numberAsNoun(number) { - var hundred = Math.floor((number % 1000) / 100), - ten = Math.floor((number % 100) / 10), - one = number % 10, - word = ''; - if (hundred > 0) { - word += numbersNouns[hundred] + 'vatlh'; - } - if (ten > 0) { - word += ((word !== '') ? ' ' : '') + numbersNouns[ten] + 'maH'; - } - if (one > 0) { - word += ((word !== '') ? ' ' : '') + numbersNouns[one]; - } - return (word === '') ? 'pagh' : word; - } - - var tlh = moment.defineLocale('tlh', { - months : 'tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’'.split('_'), - monthsShort : 'jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’'.split('_'), - monthsParseExact : true, - weekdays : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), - weekdaysShort : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), - weekdaysMin : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.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: '[DaHjaj] LT', - nextDay: '[wa’leS] LT', - nextWeek: 'LLL', - lastDay: '[wa’Hu’] LT', - lastWeek: 'LLL', - sameElse: 'L' - }, - relativeTime : { - future : translateFuture, - past : translatePast, - s : 'puS lup', - ss : translate, - m : 'wa’ tup', - mm : translate, - h : 'wa’ rep', - hh : translate, - d : 'wa’ jaj', - dd : translate, - M : 'wa’ jar', - MM : translate, - y : 'wa’ DIS', - yy : translate - }, - 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 tlh; - -}))); diff --git a/locale/tr.js b/locale/tr.js deleted file mode 100644 index e3fa275a11..0000000000 --- a/locale/tr.js +++ /dev/null @@ -1,93 +0,0 @@ - -;(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 suffixes = { - 1: '\'inci', - 5: '\'inci', - 8: '\'inci', - 70: '\'inci', - 80: '\'inci', - 2: '\'nci', - 7: '\'nci', - 20: '\'nci', - 50: '\'nci', - 3: '\'üncü', - 4: '\'üncü', - 100: '\'üncü', - 6: '\'ncı', - 9: '\'uncu', - 10: '\'uncu', - 30: '\'uncu', - 60: '\'ıncı', - 90: '\'ıncı' - }; - - var tr = moment.defineLocale('tr', { - months : 'Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık'.split('_'), - monthsShort : 'Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara'.split('_'), - weekdays : 'Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi'.split('_'), - weekdaysShort : 'Paz_Pts_Sal_Çar_Per_Cum_Cts'.split('_'), - weekdaysMin : 'Pz_Pt_Sa_Ça_Pe_Cu_Ct'.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 : '[bugün saat] LT', - nextDay : '[yarın saat] LT', - nextWeek : '[gelecek] dddd [saat] LT', - lastDay : '[dün] LT', - lastWeek : '[geçen] dddd [saat] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s sonra', - past : '%s önce', - s : 'birkaç saniye', - ss : '%d saniye', - m : 'bir dakika', - mm : '%d dakika', - h : 'bir saat', - hh : '%d saat', - d : 'bir gün', - dd : '%d gün', - M : 'bir ay', - MM : '%d ay', - y : 'bir yıl', - yy : '%d yıl' - }, - ordinal: function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'Do': - case 'DD': - return number; - default: - if (number === 0) { // special case for zero - return number + '\'ıncı'; - } - var a = number % 10, - b = number % 100 - a, - c = number >= 100 ? 100 : null; - return number + (suffixes[a] || suffixes[b] || suffixes[c]); - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return tr; - -}))); diff --git a/locale/tzl.js b/locale/tzl.js deleted file mode 100644 index d32601bc40..0000000000 --- a/locale/tzl.js +++ /dev/null @@ -1,90 +0,0 @@ -//! 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'; - - - // After the year there should be a slash and the amount of years since December 26, 1979 in Roman numerals. - // This is currently too difficult (maybe even impossible) to add. - var tzl = moment.defineLocale('tzl', { - months : 'Januar_Fevraglh_Març_Avrïu_Mai_Gün_Julia_Guscht_Setemvar_Listopäts_Noemvar_Zecemvar'.split('_'), - monthsShort : 'Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec'.split('_'), - weekdays : 'Súladi_Lúneçi_Maitzi_Márcuri_Xhúadi_Viénerçi_Sáturi'.split('_'), - weekdaysShort : 'Súl_Lún_Mai_Már_Xhú_Vié_Sát'.split('_'), - weekdaysMin : 'Sú_Lú_Ma_Má_Xh_Vi_Sá'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM [dallas] YYYY', - LLL : 'D. MMMM [dallas] YYYY HH.mm', - LLLL : 'dddd, [li] D. MMMM [dallas] YYYY HH.mm' - }, - meridiemParse: /d\'o|d\'a/i, - isPM : function (input) { - return 'd\'o' === input.toLowerCase(); - }, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'd\'o' : 'D\'O'; - } else { - return isLower ? 'd\'a' : 'D\'A'; - } - }, - calendar : { - sameDay : '[oxhi à] LT', - nextDay : '[demà à] LT', - nextWeek : 'dddd [à] LT', - lastDay : '[ieiri à] LT', - lastWeek : '[sür el] dddd [lasteu à] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'osprei %s', - past : 'ja%s', - s : processRelativeTime, - ss : processRelativeTime, - m : processRelativeTime, - mm : processRelativeTime, - h : processRelativeTime, - hh : processRelativeTime, - d : processRelativeTime, - dd : processRelativeTime, - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - 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. - } - }); - - function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 's': ['viensas secunds', '\'iensas secunds'], - 'ss': [number + ' secunds', '' + number + ' secunds'], - 'm': ['\'n míut', '\'iens míut'], - 'mm': [number + ' míuts', '' + number + ' míuts'], - 'h': ['\'n þora', '\'iensa þora'], - 'hh': [number + ' þoras', '' + number + ' þoras'], - 'd': ['\'n ziua', '\'iensa ziua'], - 'dd': [number + ' ziuas', '' + number + ' ziuas'], - 'M': ['\'n mes', '\'iens mes'], - 'MM': [number + ' mesen', '' + number + ' mesen'], - 'y': ['\'n ar', '\'iens ar'], - 'yy': [number + ' ars', '' + number + ' ars'] - }; - return isFuture ? format[key][0] : (withoutSuffix ? format[key][0] : format[key][1]); - } - - return tzl; - -}))); diff --git a/locale/tzm-latn.js b/locale/tzm-latn.js deleted file mode 100644 index b7a2aed1b5..0000000000 --- a/locale/tzm-latn.js +++ /dev/null @@ -1,57 +0,0 @@ -//! 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 tzmLatn = moment.defineLocale('tzm-latn', { - months : 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split('_'), - monthsShort : 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split('_'), - weekdays : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), - weekdaysShort : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), - weekdaysMin : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.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: '[asdkh g] LT', - nextDay: '[aska g] LT', - nextWeek: 'dddd [g] LT', - lastDay: '[assant g] LT', - lastWeek: 'dddd [g] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'dadkh s yan %s', - past : 'yan %s', - s : 'imik', - ss : '%d imik', - m : 'minuḍ', - mm : '%d minuḍ', - h : 'saɛa', - hh : '%d tassaɛin', - d : 'ass', - dd : '%d ossan', - M : 'ayowr', - MM : '%d iyyirn', - y : 'asgas', - yy : '%d isgasn' - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } - }); - - return tzmLatn; - -}))); diff --git a/locale/tzm.js b/locale/tzm.js deleted file mode 100644 index 48d712373d..0000000000 --- a/locale/tzm.js +++ /dev/null @@ -1,57 +0,0 @@ -//! 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 tzm = moment.defineLocale('tzm', { - months : 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split('_'), - monthsShort : 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split('_'), - weekdays : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), - weekdaysShort : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), - weekdaysMin : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.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: '[ⴰⵙⴷⵅ ⴴ] LT', - nextDay: '[ⴰⵙⴽⴰ ⴴ] LT', - nextWeek: 'dddd [ⴴ] LT', - lastDay: '[ⴰⵚⴰⵏⵜ ⴴ] LT', - lastWeek: 'dddd [ⴴ] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s', - past : 'ⵢⴰⵏ %s', - s : 'ⵉⵎⵉⴽ', - ss : '%d ⵉⵎⵉⴽ', - m : 'ⵎⵉⵏⵓⴺ', - mm : '%d ⵎⵉⵏⵓⴺ', - h : 'ⵙⴰⵄⴰ', - hh : '%d ⵜⴰⵙⵙⴰⵄⵉⵏ', - d : 'ⴰⵙⵙ', - dd : '%d oⵙⵙⴰⵏ', - M : 'ⴰⵢoⵓⵔ', - MM : '%d ⵉⵢⵢⵉⵔⵏ', - y : 'ⴰⵙⴳⴰⵙ', - yy : '%d ⵉⵙⴳⴰⵙⵏ' - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } - }); - - return tzm; - -}))); diff --git a/locale/ug-cn.js b/locale/ug-cn.js deleted file mode 100644 index d6c9d65495..0000000000 --- a/locale/ug-cn.js +++ /dev/null @@ -1,118 +0,0 @@ -//! moment.js language 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 ugCn = moment.defineLocale('ug-cn', { - months: 'يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر'.split( - '_' - ), - monthsShort: 'يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر'.split( - '_' - ), - weekdays: 'يەكشەنبە_دۈشەنبە_سەيشەنبە_چارشەنبە_پەيشەنبە_جۈمە_شەنبە'.split( - '_' - ), - weekdaysShort: 'يە_دۈ_سە_چا_پە_جۈ_شە'.split('_'), - weekdaysMin: 'يە_دۈ_سە_چا_پە_جۈ_شە'.split('_'), - longDateFormat: { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L: 'YYYY-MM-DD', - LL: 'YYYY-يىلىM-ئاينىڭD-كۈنى', - LLL: 'YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm', - LLLL: 'dddd، YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm' - }, - meridiemParse: /يېرىم كېچە|سەھەر|چۈشتىن بۇرۇن|چۈش|چۈشتىن كېيىن|كەچ/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ( - meridiem === 'يېرىم كېچە' || - meridiem === 'سەھەر' || - meridiem === 'چۈشتىن بۇرۇن' - ) { - return hour; - } else if (meridiem === 'چۈشتىن كېيىن' || meridiem === 'كەچ') { - return hour + 12; - } else { - return hour >= 11 ? hour : hour + 12; - } - }, - meridiem: function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 600) { - return 'يېرىم كېچە'; - } else if (hm < 900) { - return 'سەھەر'; - } else if (hm < 1130) { - return 'چۈشتىن بۇرۇن'; - } else if (hm < 1230) { - return 'چۈش'; - } else if (hm < 1800) { - return 'چۈشتىن كېيىن'; - } else { - return 'كەچ'; - } - }, - calendar: { - sameDay: '[بۈگۈن سائەت] LT', - nextDay: '[ئەتە سائەت] LT', - nextWeek: '[كېلەركى] dddd [سائەت] LT', - lastDay: '[تۆنۈگۈن] LT', - lastWeek: '[ئالدىنقى] dddd [سائەت] LT', - sameElse: 'L' - }, - relativeTime: { - future: '%s كېيىن', - past: '%s بۇرۇن', - s: 'نەچچە سېكونت', - ss: '%d سېكونت', - m: 'بىر مىنۇت', - mm: '%d مىنۇت', - h: 'بىر سائەت', - hh: '%d سائەت', - d: 'بىر كۈن', - dd: '%d كۈن', - M: 'بىر ئاي', - MM: '%d ئاي', - y: 'بىر يىل', - yy: '%d يىل' - }, - - dayOfMonthOrdinalParse: /\d{1,2}(-كۈنى|-ئاي|-ھەپتە)/, - ordinal: function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '-كۈنى'; - case 'w': - case 'W': - return number + '-ھەپتە'; - default: - return number; - } - }, - preparse: function (string) { - return string.replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/,/g, '،'); - }, - week: { - // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效 - dow: 1, // Monday is the first day of the week. - doy: 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return ugCn; - -}))); diff --git a/locale/uk.js b/locale/uk.js deleted file mode 100644 index 70761a180a..0000000000 --- a/locale/uk.js +++ /dev/null @@ -1,153 +0,0 @@ -//! 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'; - - - function plural(word, num) { - var forms = word.split('_'); - return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]); - } - function relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'ss': withoutSuffix ? 'секунда_секунди_секунд' : 'секунду_секунди_секунд', - 'mm': withoutSuffix ? 'хвилина_хвилини_хвилин' : 'хвилину_хвилини_хвилин', - 'hh': withoutSuffix ? 'година_години_годин' : 'годину_години_годин', - 'dd': 'день_дні_днів', - 'MM': 'місяць_місяці_місяців', - 'yy': 'рік_роки_років' - }; - if (key === 'm') { - return withoutSuffix ? 'хвилина' : 'хвилину'; - } - else if (key === 'h') { - return withoutSuffix ? 'година' : 'годину'; - } - else { - return number + ' ' + plural(format[key], +number); - } - } - function weekdaysCaseReplace(m, format) { - var weekdays = { - 'nominative': 'неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота'.split('_'), - 'accusative': 'неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу'.split('_'), - 'genitive': 'неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи'.split('_') - }; - - if (m === true) { - return weekdays['nominative'].slice(1, 7).concat(weekdays['nominative'].slice(0, 1)); - } - if (!m) { - return weekdays['nominative']; - } - - var nounCase = (/(\[[ВвУу]\]) ?dddd/).test(format) ? - 'accusative' : - ((/\[?(?:минулої|наступної)? ?\] ?dddd/).test(format) ? - 'genitive' : - 'nominative'); - return weekdays[nounCase][m.day()]; - } - function processHoursFunction(str) { - return function () { - return str + 'о' + (this.hours() === 11 ? 'б' : '') + '] LT'; - }; - } - - var uk = moment.defineLocale('uk', { - months : { - 'format': 'січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня'.split('_'), - 'standalone': 'січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень'.split('_') - }, - monthsShort : 'січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд'.split('_'), - weekdays : weekdaysCaseReplace, - weekdaysShort : 'нд_пн_вт_ср_чт_пт_сб'.split('_'), - weekdaysMin : 'нд_пн_вт_ср_чт_пт_сб'.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: processHoursFunction('[Сьогодні '), - nextDay: processHoursFunction('[Завтра '), - lastDay: processHoursFunction('[Вчора '), - nextWeek: processHoursFunction('[У] dddd ['), - lastWeek: function () { - switch (this.day()) { - case 0: - case 3: - case 5: - case 6: - return processHoursFunction('[Минулої] dddd [').call(this); - case 1: - case 2: - case 4: - return processHoursFunction('[Минулого] dddd [').call(this); - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'за %s', - past : '%s тому', - s : 'декілька секунд', - ss : relativeTimeWithPlural, - m : relativeTimeWithPlural, - mm : relativeTimeWithPlural, - h : 'годину', - hh : relativeTimeWithPlural, - d : 'день', - dd : relativeTimeWithPlural, - M : 'місяць', - MM : relativeTimeWithPlural, - y : 'рік', - yy : relativeTimeWithPlural - }, - // M. E.: those two are virtually unused but a user might want to implement them for his/her website for some reason - meridiemParse: /ночі|ранку|дня|вечора/, - isPM: function (input) { - return /^(дня|вечора)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ночі'; - } else if (hour < 12) { - return 'ранку'; - } else if (hour < 17) { - return 'дня'; - } else { - return 'вечора'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}-(й|го)/, - ordinal: function (number, period) { - switch (period) { - case 'M': - case 'd': - case 'DDD': - case 'w': - case 'W': - return number + '-й'; - case 'D': - return number + '-го'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return uk; - -}))); diff --git a/locale/ur.js b/locale/ur.js deleted file mode 100644 index 1609312581..0000000000 --- a/locale/ur.js +++ /dev/null @@ -1,97 +0,0 @@ -//! 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 = [ - 'جنوری', - 'فروری', - 'مارچ', - 'اپریل', - 'مئی', - 'جون', - 'جولائی', - 'اگست', - 'ستمبر', - 'اکتوبر', - 'نومبر', - 'دسمبر' - ]; - var days = [ - 'اتوار', - 'پیر', - 'منگل', - 'بدھ', - 'جمعرات', - 'جمعہ', - 'ہفتہ' - ]; - - var ur = moment.defineLocale('ur', { - months : months, - monthsShort : months, - weekdays : days, - weekdaysShort : days, - weekdaysMin : days, - 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: /صبح|شام/, - isPM : function (input) { - return 'شام' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'صبح'; - } - return 'شام'; - }, - calendar : { - sameDay : '[آج بوقت] LT', - nextDay : '[کل بوقت] LT', - nextWeek : 'dddd [بوقت] LT', - lastDay : '[گذشتہ روز بوقت] LT', - lastWeek : '[گذشتہ] dddd [بوقت] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s بعد', - past : '%s قبل', - s : 'چند سیکنڈ', - ss : '%d سیکنڈ', - m : 'ایک منٹ', - mm : '%d منٹ', - h : 'ایک گھنٹہ', - hh : '%d گھنٹے', - d : 'ایک دن', - dd : '%d دن', - M : 'ایک ماہ', - MM : '%d ماہ', - y : 'ایک سال', - yy : '%d سال' - }, - preparse: function (string) { - return string.replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/,/g, '،'); - }, - 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 ur; - -}))); diff --git a/locale/uz-latn.js b/locale/uz-latn.js deleted file mode 100644 index 41a348cbb9..0000000000 --- a/locale/uz-latn.js +++ /dev/null @@ -1,57 +0,0 @@ -//! 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 uzLatn = moment.defineLocale('uz-latn', { - months : 'Yanvar_Fevral_Mart_Aprel_May_Iyun_Iyul_Avgust_Sentabr_Oktabr_Noyabr_Dekabr'.split('_'), - monthsShort : 'Yan_Fev_Mar_Apr_May_Iyun_Iyul_Avg_Sen_Okt_Noy_Dek'.split('_'), - weekdays : 'Yakshanba_Dushanba_Seshanba_Chorshanba_Payshanba_Juma_Shanba'.split('_'), - weekdaysShort : 'Yak_Dush_Sesh_Chor_Pay_Jum_Shan'.split('_'), - weekdaysMin : 'Ya_Du_Se_Cho_Pa_Ju_Sha'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'D MMMM YYYY, dddd HH:mm' - }, - calendar : { - sameDay : '[Bugun soat] LT [da]', - nextDay : '[Ertaga] LT [da]', - nextWeek : 'dddd [kuni soat] LT [da]', - lastDay : '[Kecha soat] LT [da]', - lastWeek : '[O\'tgan] dddd [kuni soat] LT [da]', - sameElse : 'L' - }, - relativeTime : { - future : 'Yaqin %s ichida', - past : 'Bir necha %s oldin', - s : 'soniya', - ss : '%d soniya', - m : 'bir daqiqa', - mm : '%d daqiqa', - h : 'bir soat', - hh : '%d soat', - d : 'bir kun', - dd : '%d kun', - M : 'bir oy', - MM : '%d oy', - y : 'bir yil', - yy : '%d yil' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - return uzLatn; - -}))); diff --git a/locale/uz.js b/locale/uz.js deleted file mode 100644 index 0e4ad22d20..0000000000 --- a/locale/uz.js +++ /dev/null @@ -1,57 +0,0 @@ -//! 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 uz = moment.defineLocale('uz', { - months : 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split('_'), - monthsShort : 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'), - weekdays : 'Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба'.split('_'), - weekdaysShort : 'Якш_Душ_Сеш_Чор_Пай_Жум_Шан'.split('_'), - weekdaysMin : 'Як_Ду_Се_Чо_Па_Жу_Ша'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'D MMMM YYYY, dddd HH:mm' - }, - calendar : { - sameDay : '[Бугун соат] LT [да]', - nextDay : '[Эртага] LT [да]', - nextWeek : 'dddd [куни соат] LT [да]', - lastDay : '[Кеча соат] LT [да]', - lastWeek : '[Утган] dddd [куни соат] LT [да]', - sameElse : 'L' - }, - relativeTime : { - future : 'Якин %s ичида', - past : 'Бир неча %s олдин', - s : 'фурсат', - ss : '%d фурсат', - m : 'бир дакика', - mm : '%d дакика', - h : 'бир соат', - hh : '%d соат', - d : 'бир кун', - dd : '%d кун', - M : 'бир ой', - MM : '%d ой', - y : 'бир йил', - yy : '%d йил' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 4th is the first week of the year. - } - }); - - return uz; - -}))); diff --git a/locale/vi.js b/locale/vi.js deleted file mode 100644 index 6fcbeafc9a..0000000000 --- a/locale/vi.js +++ /dev/null @@ -1,78 +0,0 @@ -//! 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 vi = moment.defineLocale('vi', { - months : 'tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12'.split('_'), - monthsShort : 'Th01_Th02_Th03_Th04_Th05_Th06_Th07_Th08_Th09_Th10_Th11_Th12'.split('_'), - monthsParseExact : true, - weekdays : 'chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy'.split('_'), - weekdaysShort : 'CN_T2_T3_T4_T5_T6_T7'.split('_'), - weekdaysMin : 'CN_T2_T3_T4_T5_T6_T7'.split('_'), - weekdaysParseExact : true, - meridiemParse: /sa|ch/i, - isPM : function (input) { - return /^ch$/i.test(input); - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 12) { - return isLower ? 'sa' : 'SA'; - } else { - return isLower ? 'ch' : 'CH'; - } - }, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM [năm] YYYY', - LLL : 'D MMMM [năm] YYYY HH:mm', - LLLL : 'dddd, D MMMM [năm] YYYY HH:mm', - l : 'DD/M/YYYY', - ll : 'D MMM YYYY', - lll : 'D MMM YYYY HH:mm', - llll : 'ddd, D MMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Hôm nay lúc] LT', - nextDay: '[Ngày mai lúc] LT', - nextWeek: 'dddd [tuần tới lúc] LT', - lastDay: '[Hôm qua lúc] LT', - lastWeek: 'dddd [tuần rồi lúc] LT', - sameElse: 'L' - }, - relativeTime : { - future : '%s tới', - past : '%s trước', - s : 'vài giây', - ss : '%d giây' , - m : 'một phút', - mm : '%d phút', - h : 'một giờ', - hh : '%d giờ', - d : 'một ngày', - dd : '%d ngày', - M : 'một tháng', - MM : '%d tháng', - y : 'một năm', - yy : '%d năm' - }, - dayOfMonthOrdinalParse: /\d{1,2}/, - ordinal : function (number) { - return number; - }, - 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 vi; - -}))); diff --git a/locale/x-pseudo.js b/locale/x-pseudo.js deleted file mode 100644 index 9723c7ba42..0000000000 --- a/locale/x-pseudo.js +++ /dev/null @@ -1,67 +0,0 @@ -//! 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 xPseudo = moment.defineLocale('x-pseudo', { - months : 'J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér'.split('_'), - monthsShort : 'J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc'.split('_'), - monthsParseExact : true, - weekdays : 'S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý'.split('_'), - weekdaysShort : 'S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát'.split('_'), - weekdaysMin : 'S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[T~ódá~ý át] LT', - nextDay : '[T~ómó~rró~w át] LT', - nextWeek : 'dddd [át] LT', - lastDay : '[Ý~ést~érdá~ý át] LT', - lastWeek : '[L~ást] dddd [át] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'í~ñ %s', - past : '%s á~gó', - s : 'á ~féw ~sécó~ñds', - ss : '%d s~écóñ~ds', - m : 'á ~míñ~úté', - mm : '%d m~íñú~tés', - h : 'á~ñ hó~úr', - hh : '%d h~óúrs', - d : 'á ~dáý', - dd : '%d d~áýs', - M : 'á ~móñ~th', - MM : '%d m~óñt~hs', - y : 'á ~ýéár', - yy : '%d ý~éárs' - }, - dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, - 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 xPseudo; - -}))); diff --git a/locale/yo.js b/locale/yo.js deleted file mode 100644 index 1a356dcac4..0000000000 --- a/locale/yo.js +++ /dev/null @@ -1,59 +0,0 @@ -//! 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 yo = moment.defineLocale('yo', { - months : 'Sẹ́rẹ́_Èrèlè_Ẹrẹ̀nà_Ìgbé_Èbibi_Òkùdu_Agẹmo_Ògún_Owewe_Ọ̀wàrà_Bélú_Ọ̀pẹ̀̀'.split('_'), - monthsShort : 'Sẹ́r_Èrl_Ẹrn_Ìgb_Èbi_Òkù_Agẹ_Ògú_Owe_Ọ̀wà_Bél_Ọ̀pẹ̀̀'.split('_'), - weekdays : 'Àìkú_Ajé_Ìsẹ́gun_Ọjọ́rú_Ọjọ́bọ_Ẹtì_Àbámẹ́ta'.split('_'), - weekdaysShort : 'Àìk_Ajé_Ìsẹ́_Ọjr_Ọjb_Ẹtì_Àbá'.split('_'), - weekdaysMin : 'Àì_Aj_Ìs_Ọr_Ọb_Ẹt_Àb'.split('_'), - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[Ònì ni] LT', - nextDay : '[Ọ̀la ni] LT', - nextWeek : 'dddd [Ọsẹ̀ tón\'bọ] [ni] LT', - lastDay : '[Àna ni] LT', - lastWeek : 'dddd [Ọsẹ̀ tólọ́] [ni] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ní %s', - past : '%s kọjá', - s : 'ìsẹjú aayá die', - ss :'aayá %d', - m : 'ìsẹjú kan', - mm : 'ìsẹjú %d', - h : 'wákati kan', - hh : 'wákati %d', - d : 'ọjọ́ kan', - dd : 'ọjọ́ %d', - M : 'osù kan', - MM : 'osù %d', - y : 'ọdún kan', - yy : 'ọdún %d' - }, - dayOfMonthOrdinalParse : /ọjọ́\s\d{1,2}/, - ordinal : 'ọjọ́ %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 yo; - -}))); diff --git a/locale/zh-cn.js b/locale/zh-cn.js deleted file mode 100644 index b051f33c27..0000000000 --- a/locale/zh-cn.js +++ /dev/null @@ -1,109 +0,0 @@ -//! 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 zhCn = moment.defineLocale('zh-cn', { - months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), - weekdaysShort : '周日_周一_周二_周三_周四_周五_周六'.split('_'), - weekdaysMin : '日_一_二_三_四_五_六'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY/MM/DD', - LL : 'YYYY年M月D日', - LLL : 'YYYY年M月D日Ah点mm分', - LLLL : 'YYYY年M月D日ddddAh点mm分', - l : 'YYYY/M/D', - ll : 'YYYY年M月D日', - lll : 'YYYY年M月D日 HH:mm', - llll : 'YYYY年M月D日dddd HH:mm' - }, - meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === '凌晨' || meridiem === '早上' || - meridiem === '上午') { - return hour; - } else if (meridiem === '下午' || meridiem === '晚上') { - return hour + 12; - } else { - // '中午' - return hour >= 11 ? hour : hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 600) { - return '凌晨'; - } else if (hm < 900) { - return '早上'; - } else if (hm < 1130) { - return '上午'; - } else if (hm < 1230) { - return '中午'; - } else if (hm < 1800) { - return '下午'; - } else { - return '晚上'; - } - }, - calendar : { - sameDay : '[今天]LT', - nextDay : '[明天]LT', - nextWeek : '[下]ddddLT', - lastDay : '[昨天]LT', - lastWeek : '[上]ddddLT', - sameElse : 'L' - }, - dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/, - ordinal : function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '日'; - case 'M': - return number + '月'; - case 'w': - case 'W': - return number + '周'; - default: - return number; - } - }, - relativeTime : { - future : '%s内', - past : '%s前', - s : '几秒', - ss : '%d 秒', - m : '1 分钟', - mm : '%d 分钟', - h : '1 小时', - hh : '%d 小时', - d : '1 天', - dd : '%d 天', - M : '1 个月', - MM : '%d 个月', - y : '1 年', - yy : '%d 年' - }, - week : { - // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效 - 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 zhCn; - -}))); diff --git a/locale/zh-hk.js b/locale/zh-hk.js deleted file mode 100644 index 0ad0ae31ad..0000000000 --- a/locale/zh-hk.js +++ /dev/null @@ -1,102 +0,0 @@ -//! 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 zhHk = moment.defineLocale('zh-hk', { - months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), - weekdaysShort : '週日_週一_週二_週三_週四_週五_週六'.split('_'), - weekdaysMin : '日_一_二_三_四_五_六'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY/MM/DD', - LL : 'YYYY年M月D日', - LLL : 'YYYY年M月D日 HH:mm', - LLLL : 'YYYY年M月D日dddd HH:mm', - l : 'YYYY/M/D', - ll : 'YYYY年M月D日', - lll : 'YYYY年M月D日 HH:mm', - llll : 'YYYY年M月D日dddd HH:mm' - }, - meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') { - return hour; - } else if (meridiem === '中午') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === '下午' || meridiem === '晚上') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 600) { - return '凌晨'; - } else if (hm < 900) { - return '早上'; - } else if (hm < 1130) { - return '上午'; - } else if (hm < 1230) { - return '中午'; - } else if (hm < 1800) { - return '下午'; - } else { - return '晚上'; - } - }, - calendar : { - sameDay : '[今天]LT', - nextDay : '[明天]LT', - nextWeek : '[下]ddddLT', - lastDay : '[昨天]LT', - lastWeek : '[上]ddddLT', - sameElse : 'L' - }, - dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/, - ordinal : function (number, period) { - switch (period) { - case 'd' : - case 'D' : - case 'DDD' : - return number + '日'; - case 'M' : - return number + '月'; - case 'w' : - case 'W' : - return number + '週'; - default : - return number; - } - }, - relativeTime : { - future : '%s內', - past : '%s前', - s : '幾秒', - ss : '%d 秒', - m : '1 分鐘', - mm : '%d 分鐘', - h : '1 小時', - hh : '%d 小時', - d : '1 天', - dd : '%d 天', - M : '1 個月', - MM : '%d 個月', - y : '1 年', - yy : '%d 年' - } - }); - - return zhHk; - -}))); diff --git a/locale/zh-tw.js b/locale/zh-tw.js deleted file mode 100644 index 6875cfed18..0000000000 --- a/locale/zh-tw.js +++ /dev/null @@ -1,102 +0,0 @@ -//! 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 zhTw = moment.defineLocale('zh-tw', { - months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), - weekdaysShort : '週日_週一_週二_週三_週四_週五_週六'.split('_'), - weekdaysMin : '日_一_二_三_四_五_六'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY/MM/DD', - LL : 'YYYY年M月D日', - LLL : 'YYYY年M月D日 HH:mm', - LLLL : 'YYYY年M月D日dddd HH:mm', - l : 'YYYY/M/D', - ll : 'YYYY年M月D日', - lll : 'YYYY年M月D日 HH:mm', - llll : 'YYYY年M月D日dddd HH:mm' - }, - meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') { - return hour; - } else if (meridiem === '中午') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === '下午' || meridiem === '晚上') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 600) { - return '凌晨'; - } else if (hm < 900) { - return '早上'; - } else if (hm < 1130) { - return '上午'; - } else if (hm < 1230) { - return '中午'; - } else if (hm < 1800) { - return '下午'; - } else { - return '晚上'; - } - }, - calendar : { - sameDay : '[今天] LT', - nextDay : '[明天] LT', - nextWeek : '[下]dddd LT', - lastDay : '[昨天] LT', - lastWeek : '[上]dddd LT', - sameElse : 'L' - }, - dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/, - ordinal : function (number, period) { - switch (period) { - case 'd' : - case 'D' : - case 'DDD' : - return number + '日'; - case 'M' : - return number + '月'; - case 'w' : - case 'W' : - return number + '週'; - default : - return number; - } - }, - relativeTime : { - future : '%s內', - past : '%s前', - s : '幾秒', - ss : '%d 秒', - m : '1 分鐘', - mm : '%d 分鐘', - h : '1 小時', - hh : '%d 小時', - d : '1 天', - dd : '%d 天', - M : '1 個月', - MM : '%d 個月', - y : '1 年', - yy : '%d 年' - } - }); - - return zhTw; - -}))); diff --git a/min/locales.js b/min/locales.js index 9b8b20617c..f59386ca4f 100644 --- a/min/locales.js +++ b/min/locales.js @@ -7,10170 +7,723 @@ //! moment.js locale configuration - moment.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 (input) { - return /^nm$/i.test(input); - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 12) { - return isLower ? 'vm' : 'VM'; - } else { - return isLower ? 'nm' : 'NM'; - } - }, + 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('_'), + 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', + LT : 'h:mm A', + LTS : 'h:mm:ss A', L : 'DD/MM/YYYY', LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' + LLL : 'D MMMM YYYY h:mm A', + LLLL : 'dddd, D MMMM YYYY h:mm A' }, calendar : { - sameDay : '[Vandag om] LT', - nextDay : '[Môre om] LT', - nextWeek : 'dddd [om] LT', - lastDay : '[Gister om] LT', - lastWeek : '[Laas] dddd [om] LT', + 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 : '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' + 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}(ste|de)/, + dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); // Thanks to Joris Röling : https://github.com/jjupiter + 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, // Maandag is die eerste dag van die week. - doy : 4 // Die week wat die 4de Januarie bevat is die eerste week van die jaar. + 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('ar-dz', { - months : 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - monthsShort : 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'احد_اثنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'أح_إث_ثلا_أر_خم_جم_سب'.split('_'), - weekdaysParseExact : true, + moment.defineLocale('en-ca', { + 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' + LT : 'h:mm A', + LTS : 'h:mm:ss A', + L : 'YYYY-MM-DD', + LL : 'MMMM D, YYYY', + LLL : 'MMMM D, YYYY h:mm A', + LLLL : 'dddd, MMMM D, YYYY h:mm A' }, calendar : { - sameDay: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' + 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 : 'في %s', - past : 'منذ %s', - s : 'ثوان', - ss : '%d ثانية', - m : 'دقيقة', - mm : '%d دقائق', - h : 'ساعة', - hh : '%d ساعات', - d : 'يوم', - dd : '%d أيام', - M : 'شهر', - MM : '%d أشهر', - y : 'سنة', - yy : '%d سنوات' + 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' }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. + 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; } }); //! moment.js locale configuration - moment.defineLocale('ar-kw', { - months : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), - monthsShort : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), - weekdays : 'الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, + moment.defineLocale('en-gb', { + 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' + LLLL : 'dddd, D MMMM YYYY HH:mm' }, calendar : { - sameDay: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' + 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 : 'في %s', - past : 'منذ %s', - s : 'ثوان', - ss : '%d ثانية', - m : 'دقيقة', - mm : '%d دقائق', - h : 'ساعة', - hh : '%d ساعات', - d : 'يوم', - dd : '%d أيام', - M : 'شهر', - MM : '%d أشهر', - y : 'سنة', - yy : '%d سنوات' + 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 : 0, // Sunday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. + 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 symbolMap = { - '1': '1', - '2': '2', - '3': '3', - '4': '4', - '5': '5', - '6': '6', - '7': '7', - '8': '8', - '9': '9', - '0': '0' - }, pluralForm = function (n) { - return n === 0 ? 0 : n === 1 ? 1 : n === 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5; - }, plurals = { - s : ['أقل من ثانية', 'ثانية واحدة', ['ثانيتان', 'ثانيتين'], '%d ثوان', '%d ثانية', '%d ثانية'], - m : ['أقل من دقيقة', 'دقيقة واحدة', ['دقيقتان', 'دقيقتين'], '%d دقائق', '%d دقيقة', '%d دقيقة'], - h : ['أقل من ساعة', 'ساعة واحدة', ['ساعتان', 'ساعتين'], '%d ساعات', '%d ساعة', '%d ساعة'], - d : ['أقل من يوم', 'يوم واحد', ['يومان', 'يومين'], '%d أيام', '%d يومًا', '%d يوم'], - M : ['أقل من شهر', 'شهر واحد', ['شهران', 'شهرين'], '%d أشهر', '%d شهرا', '%d شهر'], - y : ['أقل من عام', 'عام واحد', ['عامان', 'عامين'], '%d أعوام', '%d عامًا', '%d عام'] - }, pluralize = function (u) { - return function (number, withoutSuffix, string, isFuture) { - var f = pluralForm(number), - str = plurals[u][pluralForm(number)]; - if (f === 2) { - str = str[withoutSuffix ? 0 : 1]; - } - return str.replace(/%d/i, number); - }; - }, months = [ - 'يناير', - 'فبراير', - 'مارس', - 'أبريل', - 'مايو', - 'يونيو', - 'يوليو', - 'أغسطس', - 'سبتمبر', - 'أكتوبر', - 'نوفمبر', - 'ديسمبر' - ]; - - moment.defineLocale('ar-ly', { - months : months, - monthsShort : months, - weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, + moment.defineLocale('en-ie', { + 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 : 'D/\u200FM/\u200FYYYY', + L : 'DD/MM/YYYY', LL : 'D MMMM YYYY', LLL : 'D MMMM YYYY HH:mm', LLLL : 'dddd D MMMM YYYY HH:mm' }, - meridiemParse: /ص|م/, - isPM : function (input) { - return 'م' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ص'; - } else { - return 'م'; - } - }, calendar : { - sameDay: '[اليوم عند الساعة] LT', - nextDay: '[غدًا عند الساعة] LT', - nextWeek: 'dddd [عند الساعة] LT', - lastDay: '[أمس عند الساعة] LT', - lastWeek: 'dddd [عند الساعة] LT', - sameElse: 'L' + 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 : 'بعد %s', - past : 'منذ %s', - s : pluralize('s'), - ss : pluralize('s'), - m : pluralize('m'), - mm : pluralize('m'), - h : pluralize('h'), - hh : pluralize('h'), - d : pluralize('d'), - dd : pluralize('d'), - M : pluralize('M'), - MM : pluralize('M'), - y : pluralize('y'), - yy : pluralize('y') - }, - preparse: function (string) { - return string.replace(/،/g, ','); + 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' }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }).replace(/,/g, '،'); + 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 : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. + 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('ar-ma', { - months : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), - monthsShort : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), - weekdays : 'الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, + moment.defineLocale('en-il', { + 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' + LLLL : 'dddd, D MMMM YYYY HH:mm' }, calendar : { - sameDay: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' + 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 : 'في %s', - past : 'منذ %s', - s : 'ثوان', - ss : '%d ثانية', - m : 'دقيقة', - mm : '%d دقائق', - h : 'ساعة', - hh : '%d ساعات', - d : 'يوم', - dd : '%d أيام', - M : 'شهر', - MM : '%d أشهر', - y : 'سنة', - yy : '%d سنوات' + future : 'in %s', + past : '%s ago', + s : 'a few seconds', + m : 'a minute', + mm : '%d minutes', + h : 'an hour', + hh : '%d hours', + d : 'a day', + dd : '%d days', + M : 'a month', + MM : '%d months', + y : 'a year', + yy : '%d years' }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. + 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; } }); //! moment.js locale configuration - var symbolMap$1 = { - '1': '١', - '2': '٢', - '3': '٣', - '4': '٤', - '5': '٥', - '6': '٦', - '7': '٧', - '8': '٨', - '9': '٩', - '0': '٠' - }, numberMap = { - '١': '1', - '٢': '2', - '٣': '3', - '٤': '4', - '٥': '5', - '٦': '6', - '٧': '7', - '٨': '8', - '٩': '9', - '٠': '0' - }; - - moment.defineLocale('ar-sa', { - months : 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - monthsShort : 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, + moment.defineLocale('en-nz', { + 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', + LT : 'h:mm A', + LTS : 'h:mm:ss A', L : 'DD/MM/YYYY', LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - meridiemParse: /ص|م/, - isPM : function (input) { - return 'م' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ص'; - } else { - return 'م'; - } + LLL : 'D MMMM YYYY h:mm A', + LLLL : 'dddd, D MMMM YYYY h:mm A' }, calendar : { - sameDay: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' + 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 : 'في %s', - past : 'منذ %s', - s : 'ثوان', - ss : '%d ثانية', - m : 'دقيقة', - mm : '%d دقائق', - h : 'ساعة', - hh : '%d ساعات', - d : 'يوم', - dd : '%d أيام', - M : 'شهر', - MM : '%d أشهر', - y : 'سنة', - yy : '%d سنوات' - }, - preparse: function (string) { - return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { - return numberMap[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$1[match]; - }).replace(/,/g, '،'); - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - //! moment.js locale configuration - - moment.defineLocale('ar-tn', { - months: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - monthsShort: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - 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: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' - }, - relativeTime: { - future: 'في %s', - past: 'منذ %s', - s: 'ثوان', - ss : '%d ثانية', - m: 'دقيقة', - mm: '%d دقائق', - h: 'ساعة', - hh: '%d ساعات', - d: 'يوم', - dd: '%d أيام', - M: 'شهر', - MM: '%d أشهر', - y: 'سنة', - yy: '%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 - - var symbolMap$2 = { - '1': '١', - '2': '٢', - '3': '٣', - '4': '٤', - '5': '٥', - '6': '٦', - '7': '٧', - '8': '٨', - '9': '٩', - '0': '٠' - }, numberMap$1 = { - '١': '1', - '٢': '2', - '٣': '3', - '٤': '4', - '٥': '5', - '٦': '6', - '٧': '7', - '٨': '8', - '٩': '9', - '٠': '0' - }, pluralForm$1 = function (n) { - return n === 0 ? 0 : n === 1 ? 1 : n === 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5; - }, plurals$1 = { - s : ['أقل من ثانية', 'ثانية واحدة', ['ثانيتان', 'ثانيتين'], '%d ثوان', '%d ثانية', '%d ثانية'], - m : ['أقل من دقيقة', 'دقيقة واحدة', ['دقيقتان', 'دقيقتين'], '%d دقائق', '%d دقيقة', '%d دقيقة'], - h : ['أقل من ساعة', 'ساعة واحدة', ['ساعتان', 'ساعتين'], '%d ساعات', '%d ساعة', '%d ساعة'], - d : ['أقل من يوم', 'يوم واحد', ['يومان', 'يومين'], '%d أيام', '%d يومًا', '%d يوم'], - M : ['أقل من شهر', 'شهر واحد', ['شهران', 'شهرين'], '%d أشهر', '%d شهرا', '%d شهر'], - y : ['أقل من عام', 'عام واحد', ['عامان', 'عامين'], '%d أعوام', '%d عامًا', '%d عام'] - }, pluralize$1 = function (u) { - return function (number, withoutSuffix, string, isFuture) { - var f = pluralForm$1(number), - str = plurals$1[u][pluralForm$1(number)]; - if (f === 2) { - str = str[withoutSuffix ? 0 : 1]; - } - return str.replace(/%d/i, number); - }; - }, months$1 = [ - 'يناير', - 'فبراير', - 'مارس', - 'أبريل', - 'مايو', - 'يونيو', - 'يوليو', - 'أغسطس', - 'سبتمبر', - 'أكتوبر', - 'نوفمبر', - 'ديسمبر' - ]; - - moment.defineLocale('ar', { - months : months$1, - monthsShort : months$1, - weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - 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: /ص|م/, - isPM : function (input) { - return 'م' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ص'; - } else { - return 'م'; - } - }, - calendar : { - sameDay: '[اليوم عند الساعة] LT', - nextDay: '[غدًا عند الساعة] LT', - nextWeek: 'dddd [عند الساعة] LT', - lastDay: '[أمس عند الساعة] LT', - lastWeek: 'dddd [عند الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'بعد %s', - past : 'منذ %s', - s : pluralize$1('s'), - ss : pluralize$1('s'), - m : pluralize$1('m'), - mm : pluralize$1('m'), - h : pluralize$1('h'), - hh : pluralize$1('h'), - d : pluralize$1('d'), - dd : pluralize$1('d'), - M : pluralize$1('M'), - MM : pluralize$1('M'), - y : pluralize$1('y'), - yy : pluralize$1('y') - }, - preparse: function (string) { - return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { - return numberMap$1[match]; - }).replace(/،/g, ','); + 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' }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$2[match]; - }).replace(/,/g, '،'); + 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 : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. + 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 suffixes = { - 1: '-inci', - 5: '-inci', - 8: '-inci', - 70: '-inci', - 80: '-inci', - 2: '-nci', - 7: '-nci', - 20: '-nci', - 50: '-nci', - 3: '-üncü', - 4: '-üncü', - 100: '-üncü', - 6: '-ncı', - 9: '-uncu', - 10: '-uncu', - 30: '-uncu', - 60: '-ıncı', - 90: '-ıncı' - }; - - moment.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əsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə'.split('_'), - weekdaysShort : 'Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən'.split('_'), - weekdaysMin : 'Bz_BE_ÇA_Çə_CA_Cü_Şə'.split('_'), - weekdaysParseExact : true, + 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', + L : 'DD/MM/YYYY', LL : 'D MMMM YYYY', LLL : 'D MMMM YYYY HH:mm', LLLL : 'dddd, D MMMM YYYY HH:mm' }, calendar : { - sameDay : '[bugün saat] LT', - nextDay : '[sabah saat] LT', - nextWeek : '[gələn həftə] dddd [saat] LT', - lastDay : '[dünən] LT', - lastWeek : '[keçən həftə] dddd [saat] LT', + 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 : '%s sonra', - past : '%s əvvəl', - s : 'birneçə saniyə', - ss : '%d saniyə', - m : 'bir dəqiqə', - mm : '%d dəqiqə', - h : 'bir saat', - hh : '%d saat', - d : 'bir gün', - dd : '%d gün', - M : 'bir ay', - MM : '%d ay', - y : 'bir il', - yy : '%d il' - }, - meridiemParse: /gecə|səhər|gündüz|axşam/, - isPM : function (input) { - return /^(gündüz|axşam)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'gecə'; - } else if (hour < 12) { - return 'səhər'; - } else if (hour < 17) { - return 'gündüz'; - } else { - return 'axşam'; - } + 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}-(ıncı|inci|nci|üncü|ncı|uncu)/, + dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, ordinal : function (number) { - if (number === 0) { // special case for zero - return number + '-ıncı'; - } - var a = number % 10, - b = number % 100 - a, - c = number >= 100 ? 100 : null; - return number + (suffixes[a] || suffixes[b] || suffixes[c]); + 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 : 7 // The week that contains Jan 7th is the first week of the year. + doy : 4 // The week that contains Jan 4th is the first week of the year. } }); //! moment.js locale configuration - function plural(word, num) { - var forms = word.split('_'); - return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]); - } - function relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'ss': withoutSuffix ? 'секунда_секунды_секунд' : 'секунду_секунды_секунд', - 'mm': withoutSuffix ? 'хвіліна_хвіліны_хвілін' : 'хвіліну_хвіліны_хвілін', - 'hh': withoutSuffix ? 'гадзіна_гадзіны_гадзін' : 'гадзіну_гадзіны_гадзін', - 'dd': 'дзень_дні_дзён', - 'MM': 'месяц_месяцы_месяцаў', - 'yy': 'год_гады_гадоў' - }; - if (key === 'm') { - return withoutSuffix ? 'хвіліна' : 'хвіліну'; - } - else if (key === 'h') { - return withoutSuffix ? 'гадзіна' : 'гадзіну'; - } - else { - return number + ' ' + plural(format[key], +number); - } - } + 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('_'); - moment.defineLocale('be', { - months : { - format: 'студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня'.split('_'), - standalone: 'студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань'.split('_') - }, - monthsShort : 'студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж'.split('_'), - weekdays : { - format: 'нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу'.split('_'), - standalone: 'нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота'.split('_'), - isFormat: /\[ ?[Ууў] ?(?:мінулую|наступную)? ?\] ?dddd/ - }, - weekdaysShort : 'нд_пн_ат_ср_чц_пт_сб'.split('_'), - weekdaysMin : 'нд_пн_ат_ср_чц_пт_сб'.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: '[Сёння ў] LT', - nextDay: '[Заўтра ў] LT', - lastDay: '[Учора ў] LT', - nextWeek: function () { - return '[У] dddd [ў] LT'; - }, - lastWeek: function () { - switch (this.day()) { - case 0: - case 3: - case 5: - case 6: - return '[У мінулую] dddd [ў] LT'; - case 1: - case 2: - case 4: - return '[У мінулы] dddd [ў] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'праз %s', - past : '%s таму', - s : 'некалькі секунд', - m : relativeTimeWithPlural, - mm : relativeTimeWithPlural, - h : relativeTimeWithPlural, - hh : relativeTimeWithPlural, - d : 'дзень', - dd : relativeTimeWithPlural, - M : 'месяц', - MM : relativeTimeWithPlural, - y : 'год', - yy : relativeTimeWithPlural - }, - meridiemParse: /ночы|раніцы|дня|вечара/, - isPM : function (input) { - return /^(дня|вечара)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ночы'; - } else if (hour < 12) { - return 'раніцы'; - } else if (hour < 17) { - return 'дня'; + 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; + + moment.defineLocale('es-do', { + months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'), + monthsShort : function (m, format) { + if (!m) { + return monthsShortDot; + } else if (/-MMM-/.test(format)) { + return monthsShort[m.month()]; } else { - return 'вечара'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}-(і|ы|га)/, - ordinal: function (number, period) { - switch (period) { - case 'M': - case 'd': - case 'DDD': - case 'w': - case 'W': - return (number % 10 === 2 || number % 10 === 3) && (number % 100 !== 12 && number % 100 !== 13) ? number + '-і' : number + '-ы'; - case 'D': - return number + '-га'; - default: - return number; + return monthsShortDot[m.month()]; } }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - moment.defineLocale('bg', { - months : 'януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември'.split('_'), - monthsShort : 'янр_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек'.split('_'), - weekdays : 'неделя_понеделник_вторник_сряда_четвъртък_петък_събота'.split('_'), - weekdaysShort : 'нед_пон_вто_сря_чет_пет_съб'.split('_'), - weekdaysMin : 'нд_пн_вт_ср_чт_пт_сб'.split('_'), + 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('_'), + weekdaysParseExact : true, 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' + LT : 'h:mm A', + LTS : 'h:mm:ss A', + L : 'DD/MM/YYYY', + 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 : '[Днес в] LT', - nextDay : '[Утре в] LT', - nextWeek : 'dddd [в] LT', - lastDay : '[Вчера в] LT', + sameDay : function () { + return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; + }, + nextDay : function () { + return '[mañana a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; + }, + nextWeek : function () { + return 'dddd [a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; + }, + lastDay : function () { + return '[ayer a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; + }, lastWeek : function () { - switch (this.day()) { - case 0: - case 3: - case 6: - return '[В изминалата] dddd [в] LT'; - case 1: - case 2: - case 4: - case 5: - return '[В изминалия] dddd [в] LT'; - } + return '[el] dddd [pasado a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; }, sameElse : 'L' }, relativeTime : { - future : 'след %s', - past : 'преди %s', - s : 'няколко секунди', - ss : '%d секунди', - m : 'минута', - mm : '%d минути', - h : 'час', - hh : '%d часа', - d : 'ден', - dd : '%d дни', - M : 'месец', - MM : '%d месеца', - y : 'година', - yy : '%d години' - }, - dayOfMonthOrdinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/, - ordinal : function (number) { - var lastDigit = number % 10, - last2Digits = number % 100; - if (number === 0) { - return number + '-ев'; - } else if (last2Digits === 0) { - return number + '-ен'; - } else if (last2Digits > 10 && last2Digits < 20) { - return number + '-ти'; - } else if (lastDigit === 1) { - return number + '-ви'; - } else if (lastDigit === 2) { - return number + '-ри'; - } else if (lastDigit === 7 || lastDigit === 8) { - return number + '-ми'; - } else { - return number + '-ти'; - } + future : 'en %s', + past : 'hace %s', + s : 'unos segundos', + ss : '%d segundos', + m : 'un minuto', + mm : '%d minutos', + h : 'una hora', + hh : '%d horas', + d : 'un día', + dd : '%d días', + M : 'un mes', + MM : '%d meses', + y : 'un año', + yy : '%d años' }, + dayOfMonthOrdinalParse : /\d{1,2}º/, + ordinal : '%dº', week : { dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. + doy : 4 // The week that contains Jan 4th is the first week of the year. } }); //! moment.js locale configuration - moment.defineLocale('bm', { - months : 'Zanwuyekalo_Fewuruyekalo_Marisikalo_Awirilikalo_Mɛkalo_Zuwɛnkalo_Zuluyekalo_Utikalo_Sɛtanburukalo_ɔkutɔburukalo_Nowanburukalo_Desanburukalo'.split('_'), - monthsShort : 'Zan_Few_Mar_Awi_Mɛ_Zuw_Zul_Uti_Sɛt_ɔku_Now_Des'.split('_'), - weekdays : 'Kari_Ntɛnɛn_Tarata_Araba_Alamisa_Juma_Sibiri'.split('_'), - weekdaysShort : 'Kar_Ntɛ_Tar_Ara_Ala_Jum_Sib'.split('_'), - weekdaysMin : 'Ka_Nt_Ta_Ar_Al_Ju_Si'.split('_'), + var monthsShortDot$1 = '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$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-us', { + months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'), + monthsShort : function (m, format) { + if (!m) { + return monthsShortDot$1; + } else if (/-MMM-/.test(format)) { + return monthsShort$1[m.month()]; + } else { + return monthsShortDot$1[m.month()]; + } + }, + 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$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('_'), + weekdaysParseExact : true, 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ɛrɛ] HH:mm', - LLLL : 'dddd MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm' + LT : 'h:mm A', + LTS : 'h:mm:ss A', + L : 'MM/DD/YYYY', + 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 : '[Bi lɛrɛ] LT', - nextDay : '[Sini lɛrɛ] LT', - nextWeek : 'dddd [don lɛrɛ] LT', - lastDay : '[Kunu lɛrɛ] LT', - lastWeek : 'dddd [tɛmɛnen lɛrɛ] LT', + sameDay : function () { + return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; + }, + nextDay : function () { + return '[mañana a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; + }, + nextWeek : function () { + return 'dddd [a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; + }, + lastDay : function () { + return '[ayer a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; + }, + lastWeek : function () { + return '[el] dddd [pasado a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; + }, sameElse : 'L' }, relativeTime : { - future : '%s kɔnɔ', - past : 'a bɛ %s bɔ', - s : 'sanga dama dama', - ss : 'sekondi %d', - m : 'miniti kelen', - mm : 'miniti %d', - h : 'lɛrɛ kelen', - hh : 'lɛrɛ %d', - d : 'tile kelen', - dd : 'tile %d', - M : 'kalo kelen', - MM : 'kalo %d', - y : 'san kelen', - yy : 'san %d' + future : 'en %s', + past : 'hace %s', + s : 'unos segundos', + ss : '%d segundos', + m : 'un minuto', + mm : '%d minutos', + h : 'una hora', + hh : '%d horas', + d : 'un día', + dd : '%d días', + M : 'un mes', + MM : '%d meses', + y : 'un año', + yy : '%d años' }, + 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. + dow : 0, // Sunday is the first day of the week. + doy : 6 // The week that contains Jan 6th is the first week of the year. } }); //! moment.js locale configuration - var symbolMap$3 = { - '1': '১', - '2': '২', - '3': '৩', - '4': '৪', - '5': '৫', - '6': '৬', - '7': '৭', - '8': '৮', - '9': '৯', - '0': '০' - }, - numberMap$2 = { - '১': '1', - '২': '2', - '৩': '3', - '৪': '4', - '৫': '5', - '৬': '6', - '৭': '7', - '৮': '8', - '৯': '9', - '০': '0' - }; - - moment.defineLocale('bn', { - months : 'জানুয়ারী_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর'.split('_'), - monthsShort : 'জানু_ফেব_মার্চ_এপ্র_মে_জুন_জুল_আগ_সেপ্ট_অক্টো_নভে_ডিসে'.split('_'), - weekdays : 'রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার'.split('_'), - weekdaysShort : 'রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি'.split('_'), - weekdaysMin : 'রবি_সোম_মঙ্গ_বুধ_বৃহঃ_শুক্র_শনি'.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 : '[আজ] LT', - nextDay : '[আগামীকাল] LT', - nextWeek : 'dddd, LT', - lastDay : '[গতকাল] LT', - lastWeek : '[গত] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s পরে', - past : '%s আগে', - s : 'কয়েক সেকেন্ড', - ss : '%d সেকেন্ড', - m : 'এক মিনিট', - mm : '%d মিনিট', - h : 'এক ঘন্টা', - hh : '%d ঘন্টা', - d : 'এক দিন', - dd : '%d দিন', - M : 'এক মাস', - MM : '%d মাস', - y : 'এক বছর', - yy : '%d বছর' - }, - preparse: function (string) { - return string.replace(/[১২৩৪৫৬৭৮৯০]/g, function (match) { - return numberMap$2[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$3[match]; - }); - }, - meridiemParse: /রাত|সকাল|দুপুর|বিকাল|রাত/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ((meridiem === 'রাত' && hour >= 4) || - (meridiem === 'দুপুর' && hour < 5) || - meridiem === 'বিকাল') { - return hour + 12; - } else { - return hour; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'রাত'; - } else if (hour < 10) { - return 'সকাল'; - } else if (hour < 17) { - return 'দুপুর'; - } else if (hour < 20) { - return 'বিকাল'; - } else { - return 'রাত'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - //! moment.js locale configuration + var monthsShortDot$2 = '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 symbolMap$4 = { - '1': '༡', - '2': '༢', - '3': '༣', - '4': '༤', - '5': '༥', - '6': '༦', - '7': '༧', - '8': '༨', - '9': '༩', - '0': '༠' - }, - numberMap$3 = { - '༡': '1', - '༢': '2', - '༣': '3', - '༤': '4', - '༥': '5', - '༦': '6', - '༧': '7', - '༨': '8', - '༩': '9', - '༠': '0' - }; + 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('bo', { - months : 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split('_'), - monthsShort : 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split('_'), - weekdays : 'གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་'.split('_'), - weekdaysShort : 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split('_'), - weekdaysMin : 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.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 : '[དི་རིང] LT', - nextDay : '[སང་ཉིན] LT', - nextWeek : '[བདུན་ཕྲག་རྗེས་མ], LT', - lastDay : '[ཁ་སང] LT', - lastWeek : '[བདུན་ཕྲག་མཐའ་མ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ལ་', - past : '%s སྔན་ལ', - s : 'ལམ་སང', - ss : '%d སྐར་ཆ།', - m : 'སྐར་མ་གཅིག', - mm : '%d སྐར་མ', - h : 'ཆུ་ཚོད་གཅིག', - hh : '%d ཆུ་ཚོད', - d : 'ཉིན་གཅིག', - dd : '%d ཉིན་', - M : 'ཟླ་བ་གཅིག', - MM : '%d ཟླ་བ', - y : 'ལོ་གཅིག', - yy : '%d ལོ' - }, - preparse: function (string) { - return string.replace(/[༡༢༣༤༥༦༧༨༩༠]/g, function (match) { - return numberMap$3[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$4[match]; - }); - }, - meridiemParse: /མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ((meridiem === 'མཚན་མོ' && hour >= 4) || - (meridiem === 'ཉིན་གུང' && hour < 5) || - meridiem === 'དགོང་དག') { - return hour + 12; - } else { - return hour; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'མཚན་མོ'; - } else if (hour < 10) { - return 'ཞོགས་ཀས'; - } else if (hour < 17) { - return 'ཉིན་གུང'; - } else if (hour < 20) { - return 'དགོང་དག'; + moment.defineLocale('es', { + months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'), + monthsShort : function (m, format) { + if (!m) { + return monthsShortDot$2; + } else if (/-MMM-/.test(format)) { + return monthsShort$2[m.month()]; } else { - return 'མཚན་མོ'; + return monthsShortDot$2[m.month()]; } }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - //! moment.js locale configuration - - function relativeTimeWithMutation(number, withoutSuffix, key) { - var format = { - 'mm': 'munutenn', - 'MM': 'miz', - 'dd': 'devezh' - }; - return number + ' ' + mutation(format[key], number); - } - function specialMutationForYears(number) { - switch (lastNumber(number)) { - case 1: - case 3: - case 4: - case 5: - case 9: - return number + ' bloaz'; - default: - return number + ' vloaz'; - } - } - function lastNumber(number) { - if (number > 9) { - return lastNumber(number % 10); - } - return number; - } - function mutation(text, number) { - if (number === 2) { - return softMutation(text); - } - return text; - } - function softMutation(text) { - var mutationTable = { - 'm': 'v', - 'b': 'v', - 'd': 'z' - }; - if (mutationTable[text.charAt(0)] === undefined) { - return text; - } - return mutationTable[text.charAt(0)] + text.substring(1); - } - - moment.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 : true, - 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ù', - ss : '%d eilenn', - m : 'ur vunutenn', - mm : relativeTimeWithMutation, - h : 'un eur', - hh : '%d eur', - d : 'un devezh', - dd : relativeTimeWithMutation, - M : 'ur miz', - MM : relativeTimeWithMutation, - y : 'ur bloaz', - yy : specialMutationForYears - }, - dayOfMonthOrdinalParse: /\d{1,2}(añ|vet)/, - ordinal : function (number) { - var output = (number === 1) ? 'añ' : 'vet'; - 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 - - function translate(number, withoutSuffix, key) { - var result = number + ' '; - switch (key) { - case 'ss': - if (number === 1) { - result += 'sekunda'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'sekunde'; - } else { - result += 'sekundi'; - } - return result; - case 'm': - return withoutSuffix ? 'jedna minuta' : 'jedne minute'; - case 'mm': - if (number === 1) { - result += 'minuta'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'minute'; - } else { - result += 'minuta'; - } - return result; - case 'h': - return withoutSuffix ? 'jedan sat' : 'jednog sata'; - case 'hh': - if (number === 1) { - result += 'sat'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'sata'; - } else { - result += 'sati'; - } - return result; - case 'dd': - if (number === 1) { - result += 'dan'; - } else { - result += 'dana'; - } - return result; - case 'MM': - if (number === 1) { - result += 'mjesec'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'mjeseca'; - } else { - result += 'mjeseci'; - } - return result; - case 'yy': - if (number === 1) { - result += 'godina'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'godine'; - } else { - result += 'godina'; - } - return result; - } - } - - moment.defineLocale('bs', { - months : 'januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar'.split('_'), - monthsShort : 'jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), - weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), - weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[danas u] LT', - nextDay : '[sutra u] LT', - nextWeek : function () { - switch (this.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'; - } - }, - lastDay : '[jučer u] LT', - lastWeek : function () { - switch (this.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'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'prije %s', - s : 'par sekundi', - ss : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : 'dan', - dd : translate, - M : 'mjesec', - MM : translate, - y : 'godinu', - yy : translate - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - moment.defineLocale('ca', { - months : { - standalone: 'gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre'.split('_'), - format: 'de gener_de febrer_de març_d\'abril_de maig_de juny_de juliol_d\'agost_de setembre_d\'octubre_de novembre_de desembre'.split('_'), - isFormat: /D[oD]?(\s)+MMMM/ - }, - monthsShort : 'gen._febr._març_abr._maig_juny_jul._ag._set._oct._nov._des.'.split('_'), - monthsParseExact : true, - weekdays : 'diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte'.split('_'), - weekdaysShort : 'dg._dl._dt._dc._dj._dv._ds.'.split('_'), - weekdaysMin : 'dg_dl_dt_dc_dj_dv_ds'.split('_'), + 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('_'), weekdaysParseExact : true, longDateFormat : { LT : 'H:mm', LTS : 'H:mm:ss', L : 'DD/MM/YYYY', - LL : 'D MMMM [de] YYYY', - ll : 'D MMM YYYY', - LLL : 'D MMMM [de] YYYY [a les] H:mm', - lll : 'D MMM YYYY, H:mm', - LLLL : 'dddd D MMMM [de] YYYY [a les] H:mm', - llll : 'ddd D MMM YYYY, H:mm' + LL : 'D [de] MMMM [de] YYYY', + LLL : 'D [de] MMMM [de] YYYY H:mm', + LLLL : 'dddd, D [de] MMMM [de] YYYY H:mm' }, calendar : { sameDay : function () { - return '[avui a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; + return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; }, nextDay : function () { - return '[demà a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; + return '[mañana a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; }, nextWeek : function () { - return 'dddd [a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; + return 'dddd [a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; }, lastDay : function () { - return '[ahir a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; + return '[ayer a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; }, lastWeek : function () { - return '[el] dddd [passat a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; + return '[el] dddd [pasado a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; }, sameElse : 'L' }, relativeTime : { - future : 'd\'aquí %s', - past : 'fa %s', - s : 'uns segons', - ss : '%d segons', - m : 'un minut', - mm : '%d minuts', + future : 'en %s', + past : 'hace %s', + s : 'unos segundos', + ss : '%d segundos', + m : 'un minuto', + mm : '%d minutos', h : 'una hora', - hh : '%d hores', - d : 'un dia', - dd : '%d dies', + hh : '%d horas', + d : 'un día', + dd : '%d días', M : 'un mes', - MM : '%d mesos', - y : 'un any', - yy : '%d anys' - }, - dayOfMonthOrdinalParse: /\d{1,2}(r|n|t|è|a)/, - ordinal : function (number, period) { - var output = (number === 1) ? 'r' : - (number === 2) ? 'n' : - (number === 3) ? 'r' : - (number === 4) ? 't' : 'è'; - if (period === 'w' || period === 'W') { - output = 'a'; - } - return number + output; + MM : '%d meses', + y : 'un año', + yy : '%d años' }, + 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 - - 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); - } - function translate$1(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': // a few seconds / in a few seconds / a few seconds ago - return (withoutSuffix || isFuture) ? 'pár sekund' : 'pár sekundami'; - case 'ss': // 9 seconds / in 9 seconds / 9 seconds ago - if (withoutSuffix || isFuture) { - return result + (plural$1(number) ? 'sekundy' : 'sekund'); - } else { - return result + 'sekundami'; - } - break; - case 'm': // a minute / in a minute / a minute ago - return withoutSuffix ? 'minuta' : (isFuture ? 'minutu' : 'minutou'); - case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago - if (withoutSuffix || isFuture) { - return result + (plural$1(number) ? 'minuty' : 'minut'); - } else { - return result + 'minutami'; - } - break; - case 'h': // an hour / in an hour / an hour ago - return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou'); - case 'hh': // 9 hours / in 9 hours / 9 hours ago - if (withoutSuffix || isFuture) { - return result + (plural$1(number) ? 'hodiny' : 'hodin'); - } else { - return result + 'hodinami'; - } - break; - case 'd': // a day / in a day / a day ago - return (withoutSuffix || isFuture) ? 'den' : 'dnem'; - case 'dd': // 9 days / in 9 days / 9 days ago - if (withoutSuffix || isFuture) { - return result + (plural$1(number) ? 'dny' : 'dní'); - } else { - return result + 'dny'; - } - break; - case 'M': // a month / in a month / a month ago - return (withoutSuffix || isFuture) ? 'měsíc' : 'měsícem'; - case 'MM': // 9 months / in 9 months / 9 months ago - if (withoutSuffix || isFuture) { - return result + (plural$1(number) ? 'měsíce' : 'měsíců'); - } else { - return result + 'měsíci'; - } - break; - case 'y': // a year / in a year / a year ago - return (withoutSuffix || isFuture) ? 'rok' : 'rokem'; - case 'yy': // 9 years / in 9 years / 9 years ago - if (withoutSuffix || isFuture) { - return result + (plural$1(number) ? 'roky' : 'let'); - } else { - return result + 'lety'; - } - break; - } - } - - moment.defineLocale('cs', { - months : months$2, - monthsShort : monthsShort, - 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('_'), - longDateFormat : { - LT: 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd D. MMMM YYYY H:mm', - l : 'D. M. YYYY' - }, - calendar : { - sameDay: '[dnes v] LT', - nextDay: '[zítra v] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[v neděli v] LT'; - case 1: - case 2: - return '[v] dddd [v] LT'; - case 3: - return '[ve středu v] LT'; - case 4: - return '[ve čtvrtek v] LT'; - case 5: - return '[v pátek v] LT'; - case 6: - return '[v sobotu v] LT'; - } - }, - lastDay: '[včera v] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[minulou neděli v] LT'; - case 1: - case 2: - return '[minulé] dddd [v] LT'; - case 3: - return '[minulou středu v] LT'; - case 4: - case 5: - return '[minulý] dddd [v] LT'; - case 6: - return '[minulou sobotu v] LT'; - } - }, - sameElse: 'L' }, - relativeTime : { - future : 'za %s', - past : 'před %s', - s : translate$1, - ss : translate$1, - m : translate$1, - mm : translate$1, - h : translate$1, - hh : translate$1, - d : translate$1, - dd : translate$1, - M : translate$1, - MM : translate$1, - y : translate$1, - yy : translate$1 - }, - 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. - } + invalidDate: 'Fecha invalida' }); //! moment.js locale configuration - moment.defineLocale('cv', { - months : 'кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав'.split('_'), - monthsShort : 'кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш'.split('_'), - weekdays : 'вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун'.split('_'), - weekdaysShort : 'выр_тун_ытл_юн_кӗҫ_эрн_шӑм'.split('_'), - weekdaysMin : 'вр_тн_ыт_юн_кҫ_эр_шм'.split('_'), + 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('_'), + 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('_'), + weekdaysParseExact : true, longDateFormat : { LT : 'HH:mm', LTS : 'HH:mm:ss', - L : 'DD-MM-YYYY', - LL : 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]', - LLL : 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm', - LLLL : 'dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm' + L : 'DD/MM/YYYY', + LL : 'D [de] MMMM [de] YYYY', + LLL : 'D [de] MMMM [de] YYYY [às] HH:mm', + LLLL : 'dddd, D [de] MMMM [de] YYYY [às] HH:mm' }, calendar : { - sameDay: '[Паян] LT [сехетре]', - nextDay: '[Ыран] LT [сехетре]', - lastDay: '[Ӗнер] LT [сехетре]', - nextWeek: '[Ҫитес] dddd LT [сехетре]', - lastWeek: '[Иртнӗ] dddd LT [сехетре]', + sameDay: '[Hoje às] LT', + nextDay: '[Amanhã às] LT', + nextWeek: 'dddd [às] LT', + lastDay: '[Ontem às] LT', + lastWeek: function () { + return (this.day() === 0 || this.day() === 6) ? + '[Último] dddd [às] LT' : // Saturday + Sunday + '[Última] dddd [às] LT'; // Monday - Friday + }, sameElse: 'L' }, relativeTime : { - future : function (output) { - var affix = /сехет$/i.exec(output) ? 'рен' : /ҫул$/i.exec(output) ? 'тан' : 'ран'; - return output + affix; - }, - past : '%s каялла', - s : 'пӗр-ик ҫеккунт', - ss : '%d ҫеккунт', - m : 'пӗр минут', - mm : '%d минут', - h : 'пӗр сехет', - hh : '%d сехет', - d : 'пӗр кун', - dd : '%d кун', - M : 'пӗр уйӑх', - MM : '%d уйӑх', - y : 'пӗр ҫул', - yy : '%d ҫул' + future : 'em %s', + past : 'há %s', + s : 'poucos segundos', + ss : '%d segundos', + m : 'um minuto', + mm : '%d minutos', + h : 'uma hora', + hh : '%d horas', + d : 'um dia', + dd : '%d dias', + M : 'um mês', + MM : '%d meses', + y : 'um ano', + yy : '%d anos' }, - dayOfMonthOrdinalParse: /\d{1,2}-мӗш/, - ordinal : '%d-мӗш', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal : '%dº' }); //! moment.js locale configuration - moment.defineLocale('cy', { - months: 'Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr'.split('_'), - monthsShort: 'Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag'.split('_'), - weekdays: 'Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn'.split('_'), - weekdaysShort: 'Sul_Llun_Maw_Mer_Iau_Gwe_Sad'.split('_'), - weekdaysMin: 'Su_Ll_Ma_Me_Ia_Gw_Sa'.split('_'), + 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('_'), + 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('_'), weekdaysParseExact : true, - // time formats are the same as en-gb - 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: '[Heddiw am] LT', - nextDay: '[Yfory am] LT', - nextWeek: 'dddd [am] LT', - lastDay: '[Ddoe am] LT', - lastWeek: 'dddd [diwethaf am] LT', - sameElse: 'L' - }, - relativeTime: { - future: 'mewn %s', - past: '%s yn ôl', - s: 'ychydig eiliadau', - ss: '%d eiliad', - m: 'munud', - mm: '%d munud', - h: 'awr', - hh: '%d awr', - d: 'diwrnod', - dd: '%d diwrnod', - M: 'mis', - MM: '%d mis', - y: 'blwyddyn', - yy: '%d flynedd' - }, - dayOfMonthOrdinalParse: /\d{1,2}(fed|ain|af|il|ydd|ed|eg)/, - // traditional ordinal numbers above 31 are not commonly used in colloquial Welsh - ordinal: function (number) { - var b = number, - output = '', - lookup = [ - '', 'af', 'il', 'ydd', 'ydd', 'ed', 'ed', 'ed', 'fed', 'fed', 'fed', // 1af to 10fed - 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'fed' // 11eg to 20fed - ]; - if (b > 20) { - if (b === 40 || b === 50 || b === 60 || b === 80 || b === 100) { - output = 'fed'; // not 30ain, 70ain or 90ain - } else { - output = 'ain'; - } - } else if (b > 0) { - output = lookup[b]; - } - 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('da', { - months : 'januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december'.split('_'), - monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), - weekdays : 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'), - weekdaysShort : 'søn_man_tir_ons_tor_fre_lør'.split('_'), - weekdaysMin : 'sø_ma_ti_on_to_fr_lø'.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.] D. MMMM YYYY [kl.] HH:mm' + L : 'DD/MM/YYYY', + LL : 'D [de] MMMM [de] YYYY', + LLL : 'D [de] MMMM [de] YYYY HH:mm', + LLLL : 'dddd, D [de] MMMM [de] YYYY HH:mm' }, calendar : { - sameDay : '[i dag kl.] LT', - nextDay : '[i morgen kl.] LT', - nextWeek : 'på dddd [kl.] LT', - lastDay : '[i går kl.] LT', - lastWeek : '[i] dddd[s kl.] LT', - sameElse : 'L' + sameDay: '[Hoje às] LT', + nextDay: '[Amanhã às] LT', + nextWeek: 'dddd [às] LT', + lastDay: '[Ontem às] LT', + lastWeek: function () { + return (this.day() === 0 || this.day() === 6) ? + '[Último] dddd [às] LT' : // Saturday + Sunday + '[Última] dddd [às] LT'; // Monday - Friday + }, + sameElse: 'L' }, relativeTime : { - future : 'om %s', - past : '%s siden', - s : 'få sekunder', - ss : '%d sekunder', - m : 'et minut', - mm : '%d minutter', - h : 'en time', - hh : '%d timer', - d : 'en dag', - dd : '%d dage', - M : 'en måned', - MM : '%d måneder', - y : 'et år', - yy : '%d år' + future : 'em %s', + past : 'há %s', + s : 'segundos', + ss : '%d segundos', + m : 'um minuto', + mm : '%d minutos', + h : 'uma hora', + hh : '%d horas', + d : 'um dia', + dd : '%d dias', + M : 'um mês', + MM : '%d meses', + y : 'um ano', + yy : '%d anos' }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', + 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 - - function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eine Minute', 'einer Minute'], - 'h': ['eine Stunde', 'einer Stunde'], - 'd': ['ein Tag', 'einem Tag'], - 'dd': [number + ' Tage', number + ' Tagen'], - 'M': ['ein Monat', 'einem Monat'], - 'MM': [number + ' Monate', number + ' Monaten'], - 'y': ['ein Jahr', 'einem Jahr'], - 'yy': [number + ' Jahre', number + ' Jahren'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } - - moment.defineLocale('de-at', { - months : 'Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort : 'Jän._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'), - weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), - weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - 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: '[heute um] LT [Uhr]', - sameElse: 'L', - nextDay: '[morgen um] LT [Uhr]', - nextWeek: 'dddd [um] LT [Uhr]', - lastDay: '[gestern um] LT [Uhr]', - lastWeek: '[letzten] dddd [um] LT [Uhr]' - }, - relativeTime : { - future : 'in %s', - past : 'vor %s', - s : 'ein paar Sekunden', - ss : '%d Sekunden', - m : processRelativeTime, - mm : '%d Minuten', - h : processRelativeTime, - hh : '%d Stunden', - d : processRelativeTime, - dd : processRelativeTime, - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - 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 - - function processRelativeTime$1(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eine Minute', 'einer Minute'], - 'h': ['eine Stunde', 'einer Stunde'], - 'd': ['ein Tag', 'einem Tag'], - 'dd': [number + ' Tage', number + ' Tagen'], - 'M': ['ein Monat', 'einem Monat'], - 'MM': [number + ' Monate', number + ' Monaten'], - 'y': ['ein Jahr', 'einem Jahr'], - 'yy': [number + ' Jahre', number + ' Jahren'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } - - moment.defineLocale('de-ch', { - months : 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort : 'Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'), - weekdaysShort : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - 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: '[heute um] LT [Uhr]', - sameElse: 'L', - nextDay: '[morgen um] LT [Uhr]', - nextWeek: 'dddd [um] LT [Uhr]', - lastDay: '[gestern um] LT [Uhr]', - lastWeek: '[letzten] dddd [um] LT [Uhr]' - }, - relativeTime : { - future : 'in %s', - past : 'vor %s', - s : 'ein paar Sekunden', - ss : '%d Sekunden', - m : processRelativeTime$1, - mm : '%d Minuten', - h : processRelativeTime$1, - hh : '%d Stunden', - d : processRelativeTime$1, - dd : processRelativeTime$1, - M : processRelativeTime$1, - MM : processRelativeTime$1, - y : processRelativeTime$1, - yy : processRelativeTime$1 - }, - 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 - - function processRelativeTime$2(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eine Minute', 'einer Minute'], - 'h': ['eine Stunde', 'einer Stunde'], - 'd': ['ein Tag', 'einem Tag'], - 'dd': [number + ' Tage', number + ' Tagen'], - 'M': ['ein Monat', 'einem Monat'], - 'MM': [number + ' Monate', number + ' Monaten'], - 'y': ['ein Jahr', 'einem Jahr'], - 'yy': [number + ' Jahre', number + ' Jahren'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } - - moment.defineLocale('de', { - months : 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort : 'Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'), - weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), - weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - 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: '[heute um] LT [Uhr]', - sameElse: 'L', - nextDay: '[morgen um] LT [Uhr]', - nextWeek: 'dddd [um] LT [Uhr]', - lastDay: '[gestern um] LT [Uhr]', - lastWeek: '[letzten] dddd [um] LT [Uhr]' - }, - relativeTime : { - future : 'in %s', - past : 'vor %s', - s : 'ein paar Sekunden', - ss : '%d Sekunden', - m : processRelativeTime$2, - mm : '%d Minuten', - h : processRelativeTime$2, - hh : '%d Stunden', - d : processRelativeTime$2, - dd : processRelativeTime$2, - M : processRelativeTime$2, - MM : processRelativeTime$2, - y : processRelativeTime$2, - yy : processRelativeTime$2 - }, - 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 - - var months$3 = [ - 'ޖެނުއަރީ', - 'ފެބްރުއަރީ', - 'މާރިޗު', - 'އޭޕްރީލު', - 'މޭ', - 'ޖޫން', - 'ޖުލައި', - 'އޯގަސްޓު', - 'ސެޕްޓެމްބަރު', - 'އޮކްޓޯބަރު', - 'ނޮވެމްބަރު', - 'ޑިސެމްބަރު' - ], weekdays = [ - 'އާދިއްތަ', - 'ހޯމަ', - 'އަންގާރަ', - 'ބުދަ', - 'ބުރާސްފަތި', - 'ހުކުރު', - 'ހޮނިހިރު' - ]; - - moment.defineLocale('dv', { - months : months$3, - monthsShort : months$3, - weekdays : weekdays, - weekdaysShort : weekdays, - weekdaysMin : 'އާދި_ހޯމަ_އަން_ބުދަ_ބުރާ_ހުކު_ހޮނި'.split('_'), - longDateFormat : { - - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'D/M/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - meridiemParse: /މކ|މފ/, - isPM : function (input) { - return 'މފ' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'މކ'; - } else { - return 'މފ'; - } - }, - calendar : { - sameDay : '[މިއަދު] LT', - nextDay : '[މާދަމާ] LT', - nextWeek : 'dddd LT', - lastDay : '[އިއްޔެ] LT', - lastWeek : '[ފާއިތުވި] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ތެރޭގައި %s', - past : 'ކުރިން %s', - s : 'ސިކުންތުކޮޅެއް', - ss : 'd% ސިކުންތު', - m : 'މިނިޓެއް', - mm : 'މިނިޓު %d', - h : 'ގަޑިއިރެއް', - hh : 'ގަޑިއިރު %d', - d : 'ދުވަހެއް', - dd : 'ދުވަސް %d', - M : 'މަހެއް', - MM : 'މަސް %d', - y : 'އަހަރެއް', - yy : 'އަހަރު %d' - }, - preparse: function (string) { - return string.replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/,/g, '،'); - }, - week : { - dow : 7, // Sunday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } - }); - - function isFunction(input) { - return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; - } - - //! moment.js locale configuration - - moment.defineLocale('el', { - monthsNominativeEl : 'Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος'.split('_'), - monthsGenitiveEl : 'Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου'.split('_'), - months : function (momentToFormat, format) { - if (!momentToFormat) { - return this._monthsNominativeEl; - } else if (typeof format === 'string' && /D/.test(format.substring(0, format.indexOf('MMMM')))) { // if there is a day number before 'MMMM' - return this._monthsGenitiveEl[momentToFormat.month()]; - } else { - return this._monthsNominativeEl[momentToFormat.month()]; - } - }, - monthsShort : 'Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ'.split('_'), - weekdays : 'Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο'.split('_'), - weekdaysShort : 'Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ'.split('_'), - weekdaysMin : 'Κυ_Δε_Τρ_Τε_Πε_Πα_Σα'.split('_'), - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'μμ' : 'ΜΜ'; - } else { - return isLower ? 'πμ' : 'ΠΜ'; - } - }, - isPM : function (input) { - return ((input + '').toLowerCase()[0] === 'μ'); - }, - meridiemParse : /[ΠΜ]\.?Μ?\.?/i, - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendarEl : { - sameDay : '[Σήμερα {}] LT', - nextDay : '[Αύριο {}] LT', - nextWeek : 'dddd [{}] LT', - lastDay : '[Χθες {}] LT', - lastWeek : function () { - switch (this.day()) { - case 6: - return '[το προηγούμενο] dddd [{}] LT'; - default: - return '[την προηγούμενη] dddd [{}] LT'; - } - }, - sameElse : 'L' - }, - calendar : function (key, mom) { - var output = this._calendarEl[key], - hours = mom && mom.hours(); - if (isFunction(output)) { - output = output.apply(mom); - } - return output.replace('{}', (hours % 12 === 1 ? 'στη' : 'στις')); - }, - relativeTime : { - future : 'σε %s', - past : '%s πριν', - s : 'λίγα δευτερόλεπτα', - ss : '%d δευτερόλεπτα', - m : 'ένα λεπτό', - mm : '%d λεπτά', - h : 'μία ώρα', - hh : '%d ώρες', - d : 'μία μέρα', - dd : '%d μέρες', - M : 'ένας μήνας', - MM : '%d μήνες', - y : 'ένας χρόνος', - yy : '%d χρόνια' - }, - dayOfMonthOrdinalParse: /\d{1,2}η/, - ordinal: '%dη', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4st is the first week of the year. - } - }); - - //! 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('_'), - 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 : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - 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-ca', { - 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 : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'YYYY-MM-DD', - LL : 'MMMM D, YYYY', - LLL : 'MMMM D, YYYY h:mm A', - LLLL : 'dddd, MMMM D, YYYY h:mm A' - }, - 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; - } - }); - - //! moment.js locale configuration - - moment.defineLocale('en-gb', { - 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-ie', { - 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-il', { - 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', - 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; - } - }); - - //! moment.js locale configuration - - moment.defineLocale('en-nz', { - 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 : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - 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('eo', { - months : 'januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro'.split('_'), - monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aŭg_sep_okt_nov_dec'.split('_'), - weekdays : 'dimanĉo_lundo_mardo_merkredo_ĵaŭdo_vendredo_sabato'.split('_'), - weekdaysShort : 'dim_lun_mard_merk_ĵaŭ_ven_sab'.split('_'), - weekdaysMin : 'di_lu_ma_me_ĵa_ve_sa'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'D[-a de] MMMM, YYYY', - LLL : 'D[-a de] MMMM, YYYY HH:mm', - LLLL : 'dddd, [la] D[-a de] MMMM, YYYY HH:mm' - }, - meridiemParse: /[ap]\.t\.m/i, - isPM: function (input) { - return input.charAt(0).toLowerCase() === 'p'; - }, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'p.t.m.' : 'P.T.M.'; - } else { - return isLower ? 'a.t.m.' : 'A.T.M.'; - } - }, - calendar : { - sameDay : '[Hodiaŭ je] LT', - nextDay : '[Morgaŭ je] LT', - nextWeek : 'dddd [je] LT', - lastDay : '[Hieraŭ je] LT', - lastWeek : '[pasinta] dddd [je] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'post %s', - past : 'antaŭ %s', - s : 'sekundoj', - ss : '%d sekundoj', - m : 'minuto', - mm : '%d minutoj', - h : 'horo', - hh : '%d horoj', - d : 'tago',//ne 'diurno', ĉar estas uzita por proksimumo - dd : '%d tagoj', - M : 'monato', - MM : '%d monatoj', - y : 'jaro', - yy : '%d jaroj' - }, - dayOfMonthOrdinalParse: /\d{1,2}a/, - ordinal : '%da', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - 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$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('_'), - monthsShort : function (m, format) { - if (!m) { - return monthsShortDot; - } else if (/-MMM-/.test(format)) { - return monthsShort$1[m.month()]; - } else { - return monthsShortDot[m.month()]; - } - }, - 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$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('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - 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 () { - return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - nextDay : function () { - return '[mañana a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - nextWeek : function () { - return 'dddd [a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - lastDay : function () { - return '[ayer a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - lastWeek : function () { - return '[el] dddd [pasado a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'en %s', - past : 'hace %s', - s : 'unos segundos', - ss : '%d segundos', - m : 'un minuto', - mm : '%d minutos', - h : 'una hora', - hh : '%d horas', - d : 'un día', - dd : '%d días', - M : 'un mes', - MM : '%d meses', - y : 'un año', - yy : '%d años' - }, - 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 - - 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) { - if (!m) { - return monthsShortDot$1; - } else if (/-MMM-/.test(format)) { - return monthsShort$2[m.month()]; - } else { - return monthsShortDot$1[m.month()]; - } - }, - 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('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'MM/DD/YYYY', - 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 () { - return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - nextDay : function () { - return '[mañana a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - nextWeek : function () { - return 'dddd [a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - lastDay : function () { - return '[ayer a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - lastWeek : function () { - return '[el] dddd [pasado a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'en %s', - past : 'hace %s', - s : 'unos segundos', - ss : '%d segundos', - m : 'un minuto', - mm : '%d minutos', - h : 'una hora', - hh : '%d horas', - d : 'un día', - dd : '%d días', - M : 'un mes', - MM : '%d meses', - y : 'un año', - yy : '%d años' - }, - dayOfMonthOrdinalParse : /\d{1,2}º/, - ordinal : '%dº', - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - //! moment.js locale configuration - - 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$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('_'), - monthsShort : function (m, format) { - if (!m) { - return monthsShortDot$2; - } else if (/-MMM-/.test(format)) { - return monthsShort$3[m.month()]; - } else { - return monthsShortDot$2[m.month()]; - } - }, - 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$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('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [de] MMMM [de] YYYY', - LLL : 'D [de] MMMM [de] YYYY H:mm', - LLLL : 'dddd, D [de] MMMM [de] YYYY H:mm' - }, - calendar : { - sameDay : function () { - return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - nextDay : function () { - return '[mañana a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - nextWeek : function () { - return 'dddd [a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - lastDay : function () { - return '[ayer a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - lastWeek : function () { - return '[el] dddd [pasado a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'en %s', - past : 'hace %s', - s : 'unos segundos', - ss : '%d segundos', - m : 'un minuto', - mm : '%d minutos', - h : 'una hora', - hh : '%d horas', - d : 'un día', - dd : '%d días', - M : 'un mes', - MM : '%d meses', - y : 'un año', - yy : '%d años' - }, - 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 - - function processRelativeTime$3(number, withoutSuffix, key, isFuture) { - var format = { - 's' : ['mõne sekundi', 'mõni sekund', 'paar sekundit'], - 'ss': [number + 'sekundi', number + 'sekundit'], - 'm' : ['ühe minuti', 'üks minut'], - 'mm': [number + ' minuti', number + ' minutit'], - 'h' : ['ühe tunni', 'tund aega', 'üks tund'], - 'hh': [number + ' tunni', number + ' tundi'], - 'd' : ['ühe päeva', 'üks päev'], - 'M' : ['kuu aja', 'kuu aega', 'üks kuu'], - 'MM': [number + ' kuu', number + ' kuud'], - 'y' : ['ühe aasta', 'aasta', 'üks aasta'], - 'yy': [number + ' aasta', number + ' aastat'] - }; - if (withoutSuffix) { - return format[key][2] ? format[key][2] : format[key][1]; - } - return isFuture ? format[key][0] : format[key][1]; - } - - moment.defineLocale('et', { - months : 'jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember'.split('_'), - monthsShort : 'jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets'.split('_'), - weekdays : 'pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev'.split('_'), - weekdaysShort : 'P_E_T_K_N_R_L'.split('_'), - weekdaysMin : 'P_E_T_K_N_R_L'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[Täna,] LT', - nextDay : '[Homme,] LT', - nextWeek : '[Järgmine] dddd LT', - lastDay : '[Eile,] LT', - lastWeek : '[Eelmine] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s pärast', - past : '%s tagasi', - s : processRelativeTime$3, - ss : processRelativeTime$3, - m : processRelativeTime$3, - mm : processRelativeTime$3, - h : processRelativeTime$3, - hh : processRelativeTime$3, - d : processRelativeTime$3, - dd : '%d päeva', - M : processRelativeTime$3, - MM : processRelativeTime$3, - y : processRelativeTime$3, - yy : processRelativeTime$3 - }, - 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('eu', { - months : 'urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua'.split('_'), - monthsShort : 'urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.'.split('_'), - monthsParseExact : true, - weekdays : 'igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata'.split('_'), - weekdaysShort : 'ig._al._ar._az._og._ol._lr.'.split('_'), - weekdaysMin : 'ig_al_ar_az_og_ol_lr'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'YYYY[ko] MMMM[ren] D[a]', - LLL : 'YYYY[ko] MMMM[ren] D[a] HH:mm', - LLLL : 'dddd, YYYY[ko] MMMM[ren] D[a] HH:mm', - l : 'YYYY-M-D', - ll : 'YYYY[ko] MMM D[a]', - lll : 'YYYY[ko] MMM D[a] HH:mm', - llll : 'ddd, YYYY[ko] MMM D[a] HH:mm' - }, - calendar : { - sameDay : '[gaur] LT[etan]', - nextDay : '[bihar] LT[etan]', - nextWeek : 'dddd LT[etan]', - lastDay : '[atzo] LT[etan]', - lastWeek : '[aurreko] dddd LT[etan]', - sameElse : 'L' - }, - relativeTime : { - future : '%s barru', - past : 'duela %s', - s : 'segundo batzuk', - ss : '%d segundo', - m : 'minutu bat', - mm : '%d minutu', - h : 'ordu bat', - hh : '%d ordu', - d : 'egun bat', - dd : '%d egun', - M : 'hilabete bat', - MM : '%d hilabete', - y : 'urte bat', - yy : '%d urte' - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - var symbolMap$5 = { - '1': '۱', - '2': '۲', - '3': '۳', - '4': '۴', - '5': '۵', - '6': '۶', - '7': '۷', - '8': '۸', - '9': '۹', - '0': '۰' - }, numberMap$4 = { - '۱': '1', - '۲': '2', - '۳': '3', - '۴': '4', - '۵': '5', - '۶': '6', - '۷': '7', - '۸': '8', - '۹': '9', - '۰': '0' - }; - - moment.defineLocale('fa', { - months : 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), - monthsShort : 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), - weekdays : 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'), - weekdaysShort : 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'), - weekdaysMin : 'ی_د_س_چ_پ_ج_ش'.split('_'), - weekdaysParseExact : true, - 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: /قبل از ظهر|بعد از ظهر/, - isPM: function (input) { - return /بعد از ظهر/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'قبل از ظهر'; - } else { - return 'بعد از ظهر'; - } - }, - calendar : { - sameDay : '[امروز ساعت] LT', - nextDay : '[فردا ساعت] LT', - nextWeek : 'dddd [ساعت] LT', - lastDay : '[دیروز ساعت] LT', - lastWeek : 'dddd [پیش] [ساعت] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'در %s', - past : '%s پیش', - s : 'چند ثانیه', - ss : 'ثانیه d%', - m : 'یک دقیقه', - mm : '%d دقیقه', - h : 'یک ساعت', - hh : '%d ساعت', - d : 'یک روز', - dd : '%d روز', - M : 'یک ماه', - MM : '%d ماه', - y : 'یک سال', - yy : '%d سال' - }, - preparse: function (string) { - return string.replace(/[۰-۹]/g, function (match) { - return numberMap$4[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$5[match]; - }).replace(/,/g, '،'); - }, - dayOfMonthOrdinalParse: /\d{1,2}م/, - ordinal : '%dم', - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } - }); - - //! moment.js locale configuration - - var numbersPast = 'nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän'.split(' '), - numbersFuture = [ - 'nolla', 'yhden', 'kahden', 'kolmen', 'neljän', 'viiden', 'kuuden', - numbersPast[7], numbersPast[8], numbersPast[9] - ]; - function translate$2(number, withoutSuffix, key, isFuture) { - var result = ''; - switch (key) { - case 's': - return isFuture ? 'muutaman sekunnin' : 'muutama sekunti'; - case 'ss': - return isFuture ? 'sekunnin' : 'sekuntia'; - case 'm': - return isFuture ? 'minuutin' : 'minuutti'; - case 'mm': - result = isFuture ? 'minuutin' : 'minuuttia'; - break; - case 'h': - return isFuture ? 'tunnin' : 'tunti'; - case 'hh': - result = isFuture ? 'tunnin' : 'tuntia'; - break; - case 'd': - return isFuture ? 'päivän' : 'päivä'; - case 'dd': - result = isFuture ? 'päivän' : 'päivää'; - break; - case 'M': - return isFuture ? 'kuukauden' : 'kuukausi'; - case 'MM': - result = isFuture ? 'kuukauden' : 'kuukautta'; - break; - case 'y': - return isFuture ? 'vuoden' : 'vuosi'; - case 'yy': - result = isFuture ? 'vuoden' : 'vuotta'; - break; - } - result = verbalNumber(number, isFuture) + ' ' + result; - return result; - } - function verbalNumber(number, isFuture) { - return number < 10 ? (isFuture ? numbersFuture[number] : numbersPast[number]) : number; - } - - moment.defineLocale('fi', { - months : 'tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu'.split('_'), - monthsShort : 'tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu'.split('_'), - weekdays : 'sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai'.split('_'), - weekdaysShort : 'su_ma_ti_ke_to_pe_la'.split('_'), - weekdaysMin : 'su_ma_ti_ke_to_pe_la'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD.MM.YYYY', - LL : 'Do MMMM[ta] YYYY', - LLL : 'Do MMMM[ta] YYYY, [klo] HH.mm', - LLLL : 'dddd, Do MMMM[ta] YYYY, [klo] HH.mm', - l : 'D.M.YYYY', - ll : 'Do MMM YYYY', - lll : 'Do MMM YYYY, [klo] HH.mm', - llll : 'ddd, Do MMM YYYY, [klo] HH.mm' - }, - calendar : { - sameDay : '[tänään] [klo] LT', - nextDay : '[huomenna] [klo] LT', - nextWeek : 'dddd [klo] LT', - lastDay : '[eilen] [klo] LT', - lastWeek : '[viime] dddd[na] [klo] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s päästä', - past : '%s sitten', - s : translate$2, - ss : translate$2, - m : translate$2, - mm : translate$2, - h : translate$2, - hh : translate$2, - d : translate$2, - dd : translate$2, - M : translate$2, - MM : translate$2, - y : translate$2, - yy : translate$2 - }, - 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('fo', { - months : 'januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember'.split('_'), - monthsShort : 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'), - weekdays : 'sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur'.split('_'), - weekdaysShort : 'sun_mán_týs_mik_hós_frí_ley'.split('_'), - weekdaysMin : 'su_má_tý_mi_hó_fr_le'.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 : '[Í dag kl.] LT', - nextDay : '[Í morgin kl.] LT', - nextWeek : 'dddd [kl.] LT', - lastDay : '[Í gjár kl.] LT', - lastWeek : '[síðstu] dddd [kl] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'um %s', - past : '%s síðani', - s : 'fá sekund', - ss : '%d sekundir', - m : 'ein minuttur', - mm : '%d minuttir', - h : 'ein tími', - hh : '%d tímar', - d : 'ein dagur', - dd : '%d dagar', - M : 'ein mánaður', - MM : '%d mánaðir', - y : 'eitt ár', - yy : '%d ár' - }, - 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('fr-ca', { - months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), - monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), - monthsParseExact : true, - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'di_lu_ma_me_je_ve_sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Aujourd’hui à] LT', - nextDay : '[Demain à] LT', - nextWeek : 'dddd [à] LT', - lastDay : '[Hier à] LT', - lastWeek : 'dddd [dernier à] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dans %s', - past : 'il y a %s', - s : 'quelques secondes', - ss : '%d secondes', - m : 'une minute', - mm : '%d minutes', - h : 'une heure', - hh : '%d heures', - d : 'un jour', - dd : '%d jours', - M : 'un mois', - MM : '%d mois', - y : 'un an', - yy : '%d ans' - }, - dayOfMonthOrdinalParse: /\d{1,2}(er|e)/, - ordinal : function (number, period) { - switch (period) { - // Words with masculine grammatical gender: mois, trimestre, jour - default: - case 'M': - case 'Q': - case 'D': - case 'DDD': - case 'd': - return number + (number === 1 ? 'er' : 'e'); - - // Words with feminine grammatical gender: semaine - case 'w': - case 'W': - return number + (number === 1 ? 're' : 'e'); - } - } - }); - - //! moment.js locale configuration - - moment.defineLocale('fr-ch', { - months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), - monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), - monthsParseExact : true, - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'di_lu_ma_me_je_ve_sa'.split('_'), - weekdaysParseExact : true, - 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 : '[Aujourd’hui à] LT', - nextDay : '[Demain à] LT', - nextWeek : 'dddd [à] LT', - lastDay : '[Hier à] LT', - lastWeek : 'dddd [dernier à] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dans %s', - past : 'il y a %s', - s : 'quelques secondes', - ss : '%d secondes', - m : 'une minute', - mm : '%d minutes', - h : 'une heure', - hh : '%d heures', - d : 'un jour', - dd : '%d jours', - M : 'un mois', - MM : '%d mois', - y : 'un an', - yy : '%d ans' - }, - dayOfMonthOrdinalParse: /\d{1,2}(er|e)/, - ordinal : function (number, period) { - switch (period) { - // Words with masculine grammatical gender: mois, trimestre, jour - default: - case 'M': - case 'Q': - case 'D': - case 'DDD': - case 'd': - return number + (number === 1 ? 'er' : 'e'); - - // Words with feminine grammatical gender: semaine - case 'w': - case 'W': - return number + (number === 1 ? 're' : 'e'); - } - }, - 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('fr', { - months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), - monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), - monthsParseExact : true, - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'di_lu_ma_me_je_ve_sa'.split('_'), - weekdaysParseExact : true, - 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 : '[Aujourd’hui à] LT', - nextDay : '[Demain à] LT', - nextWeek : 'dddd [à] LT', - lastDay : '[Hier à] LT', - lastWeek : 'dddd [dernier à] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dans %s', - past : 'il y a %s', - s : 'quelques secondes', - ss : '%d secondes', - m : 'une minute', - mm : '%d minutes', - h : 'une heure', - hh : '%d heures', - d : 'un jour', - dd : '%d jours', - M : 'un mois', - MM : '%d mois', - y : 'un an', - yy : '%d ans' - }, - dayOfMonthOrdinalParse: /\d{1,2}(er|)/, - ordinal : function (number, period) { - switch (period) { - // TODO: Return 'e' when day of month > 1. Move this case inside - // block for masculine words below. - // See https://github.com/moment/moment/issues/3375 - case 'D': - return number + (number === 1 ? 'er' : ''); - - // Words with masculine grammatical gender: mois, trimestre, jour - default: - case 'M': - case 'Q': - case 'DDD': - case 'd': - return number + (number === 1 ? 'er' : 'e'); - - // Words with feminine grammatical gender: semaine - case 'w': - case 'W': - return number + (number === 1 ? 're' : 'e'); - } - }, - 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 monthsShortWithDots = 'jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.'.split('_'), - monthsShortWithoutDots = 'jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'); - - moment.defineLocale('fy', { - months : 'jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber'.split('_'), - monthsShort : function (m, format) { - if (!m) { - return monthsShortWithDots; - } else if (/-MMM-/.test(format)) { - return monthsShortWithoutDots[m.month()]; - } else { - return monthsShortWithDots[m.month()]; - } - }, - monthsParseExact : true, - weekdays : 'snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon'.split('_'), - weekdaysShort : 'si._mo._ti._wo._to._fr._so.'.split('_'), - weekdaysMin : 'Si_Mo_Ti_Wo_To_Fr_So'.split('_'), - weekdaysParseExact : true, - 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: '[hjoed om] LT', - nextDay: '[moarn om] LT', - nextWeek: 'dddd [om] LT', - lastDay: '[juster om] LT', - lastWeek: '[ôfrûne] dddd [om] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'oer %s', - past : '%s lyn', - s : 'in pear sekonden', - ss : '%d sekonden', - m : 'ien minút', - mm : '%d minuten', - h : 'ien oere', - hh : '%d oeren', - d : 'ien dei', - dd : '%d dagen', - M : 'ien moanne', - MM : '%d moannen', - y : 'ien jier', - yy : '%d jierren' - }, - dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/, - ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); - }, - 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$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$5 = ['Faoi', 'Gear', 'Màrt', 'Gibl', 'Cèit', 'Ògmh', 'Iuch', 'Lùn', 'Sult', 'Dàmh', 'Samh', 'Dùbh']; - - var weekdays$2 = ['Didòmhnaich', 'Diluain', 'Dimàirt', 'Diciadain', 'Diardaoin', 'Dihaoine', 'Disathairne']; - - var weekdaysShort$1 = ['Did', 'Dil', 'Dim', 'Dic', 'Dia', 'Dih', 'Dis']; - - var weekdaysMin$1 = ['Dò', 'Lu', 'Mà', 'Ci', 'Ar', 'Ha', 'Sa']; - - moment.defineLocale('gd', { - months : months$5, - monthsShort : monthsShort$5, - monthsParseExact : true, - weekdays : weekdays$2, - weekdaysShort : weekdaysShort$1, - weekdaysMin : weekdaysMin$1, - 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 : '[An-diugh aig] LT', - nextDay : '[A-màireach aig] LT', - nextWeek : 'dddd [aig] LT', - lastDay : '[An-dè aig] LT', - lastWeek : 'dddd [seo chaidh] [aig] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ann an %s', - past : 'bho chionn %s', - s : 'beagan diogan', - ss : '%d diogan', - m : 'mionaid', - mm : '%d mionaidean', - h : 'uair', - hh : '%d uairean', - d : 'latha', - dd : '%d latha', - M : 'mìos', - MM : '%d mìosan', - y : 'bliadhna', - yy : '%d bliadhna' - }, - 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 - - moment.defineLocale('gl', { - months : 'xaneiro_febreiro_marzo_abril_maio_xuño_xullo_agosto_setembro_outubro_novembro_decembro'.split('_'), - monthsShort : 'xan._feb._mar._abr._mai._xuñ._xul._ago._set._out._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'domingo_luns_martes_mércores_xoves_venres_sábado'.split('_'), - weekdaysShort : 'dom._lun._mar._mér._xov._ven._sáb.'.split('_'), - weekdaysMin : 'do_lu_ma_mé_xo_ve_sá'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [de] MMMM [de] YYYY', - LLL : 'D [de] MMMM [de] YYYY H:mm', - LLLL : 'dddd, D [de] MMMM [de] YYYY H:mm' - }, - calendar : { - sameDay : function () { - return '[hoxe ' + ((this.hours() !== 1) ? 'ás' : 'á') + '] LT'; - }, - nextDay : function () { - return '[mañá ' + ((this.hours() !== 1) ? 'ás' : 'á') + '] LT'; - }, - nextWeek : function () { - return 'dddd [' + ((this.hours() !== 1) ? 'ás' : 'a') + '] LT'; - }, - lastDay : function () { - return '[onte ' + ((this.hours() !== 1) ? 'á' : 'a') + '] LT'; - }, - lastWeek : function () { - return '[o] dddd [pasado ' + ((this.hours() !== 1) ? 'ás' : 'a') + '] LT'; - }, - sameElse : 'L' - }, - relativeTime : { - future : function (str) { - if (str.indexOf('un') === 0) { - return 'n' + str; - } - return 'en ' + str; - }, - past : 'hai %s', - s : 'uns segundos', - ss : '%d segundos', - m : 'un minuto', - mm : '%d minutos', - h : 'unha hora', - hh : '%d horas', - d : 'un día', - dd : '%d días', - M : 'un mes', - MM : '%d meses', - y : 'un ano', - yy : '%d anos' - }, - 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 - - function processRelativeTime$4(number, withoutSuffix, key, isFuture) { - var format = { - 's': ['thodde secondanim', 'thodde second'], - 'ss': [number + ' secondanim', number + ' second'], - 'm': ['eka mintan', 'ek minute'], - 'mm': [number + ' mintanim', number + ' mintam'], - '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'], - 'MM': [number + ' mhoineanim', number + ' mhoine'], - 'y': ['eka vorsan', 'ek voros'], - 'yy': [number + ' vorsanim', number + ' vorsam'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } - - moment.defineLocale('gom-latn', { - months : 'Janer_Febrer_Mars_Abril_Mai_Jun_Julai_Agost_Setembr_Otubr_Novembr_Dezembr'.split('_'), - monthsShort : 'Jan._Feb._Mars_Abr._Mai_Jun_Jul._Ago._Set._Otu._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays : 'Aitar_Somar_Mongllar_Budvar_Brestar_Sukrar_Son\'var'.split('_'), - weekdaysShort : 'Ait._Som._Mon._Bud._Bre._Suk._Son.'.split('_'), - weekdaysMin : 'Ai_Sm_Mo_Bu_Br_Su_Sn'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'A h:mm [vazta]', - LTS : 'A h:mm:ss [vazta]', - L : 'DD-MM-YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY A h:mm [vazta]', - LLLL : 'dddd, MMMM[achea] Do, YYYY, A h:mm [vazta]', - llll: 'ddd, D MMM YYYY, A h:mm [vazta]' - }, - calendar : { - sameDay: '[Aiz] LT', - nextDay: '[Faleam] LT', - nextWeek: '[Ieta to] dddd[,] LT', - lastDay: '[Kal] LT', - lastWeek: '[Fatlo] dddd[,] LT', - sameElse: 'L' - }, - relativeTime : { - future : '%s', - past : '%s adim', - s : processRelativeTime$4, - ss : processRelativeTime$4, - m : processRelativeTime$4, - mm : processRelativeTime$4, - h : processRelativeTime$4, - hh : processRelativeTime$4, - d : processRelativeTime$4, - dd : processRelativeTime$4, - M : processRelativeTime$4, - MM : processRelativeTime$4, - y : processRelativeTime$4, - yy : processRelativeTime$4 - }, - dayOfMonthOrdinalParse : /\d{1,2}(er)/, - ordinal : function (number, period) { - switch (period) { - // the ordinal 'er' only applies to day of the month - case 'D': - return number + 'er'; - default: - case 'M': - case 'Q': - case 'DDD': - case 'd': - case 'w': - case 'W': - return number; - } - }, - 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. - }, - meridiemParse: /rati|sokalli|donparam|sanje/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'rati') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'sokalli') { - return hour; - } else if (meridiem === 'donparam') { - return hour > 12 ? hour : hour + 12; - } else if (meridiem === 'sanje') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'rati'; - } else if (hour < 12) { - return 'sokalli'; - } else if (hour < 16) { - return 'donparam'; - } else if (hour < 20) { - return 'sanje'; - } else { - return 'rati'; - } - } - }); - - //! moment.js locale configuration - - var symbolMap$6 = { - '1': '૧', - '2': '૨', - '3': '૩', - '4': '૪', - '5': '૫', - '6': '૬', - '7': '૭', - '8': '૮', - '9': '૯', - '0': '૦' - }, - numberMap$5 = { - '૧': '1', - '૨': '2', - '૩': '3', - '૪': '4', - '૫': '5', - '૬': '6', - '૭': '7', - '૮': '8', - '૯': '9', - '૦': '0' - }; - - moment.defineLocale('gu', { - months: 'જાન્યુઆરી_ફેબ્રુઆરી_માર્ચ_એપ્રિલ_મે_જૂન_જુલાઈ_ઑગસ્ટ_સપ્ટેમ્બર_ઑક્ટ્બર_નવેમ્બર_ડિસેમ્બર'.split('_'), - monthsShort: 'જાન્યુ._ફેબ્રુ._માર્ચ_એપ્રિ._મે_જૂન_જુલા._ઑગ._સપ્ટે._ઑક્ટ્._નવે._ડિસે.'.split('_'), - monthsParseExact: true, - weekdays: 'રવિવાર_સોમવાર_મંગળવાર_બુધ્વાર_ગુરુવાર_શુક્રવાર_શનિવાર'.split('_'), - weekdaysShort: 'રવિ_સોમ_મંગળ_બુધ્_ગુરુ_શુક્ર_શનિ'.split('_'), - weekdaysMin: 'ર_સો_મં_બુ_ગુ_શુ_શ'.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: '[આજ] LT', - nextDay: '[કાલે] LT', - nextWeek: 'dddd, LT', - lastDay: '[ગઇકાલે] LT', - lastWeek: '[પાછલા] dddd, LT', - sameElse: 'L' - }, - relativeTime: { - future: '%s મા', - past: '%s પેહલા', - s: 'અમુક પળો', - ss: '%d સેકંડ', - m: 'એક મિનિટ', - mm: '%d મિનિટ', - h: 'એક કલાક', - hh: '%d કલાક', - d: 'એક દિવસ', - dd: '%d દિવસ', - M: 'એક મહિનો', - MM: '%d મહિનો', - y: 'એક વર્ષ', - yy: '%d વર્ષ' - }, - preparse: function (string) { - return string.replace(/[૧૨૩૪૫૬૭૮૯૦]/g, function (match) { - return numberMap$5[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$6[match]; - }); - }, - // Gujarati notation for meridiems are quite fuzzy in practice. While there exists - // a rigid notion of a 'Pahar' it is not used as rigidly in modern Gujarati. - meridiemParse: /રાત|બપોર|સવાર|સાંજ/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'રાત') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'સવાર') { - return hour; - } else if (meridiem === 'બપોર') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'સાંજ') { - return hour + 12; - } - }, - meridiem: function (hour, minute, isLower) { - if (hour < 4) { - return 'રાત'; - } else if (hour < 10) { - return 'સવાર'; - } else if (hour < 17) { - return 'બપોર'; - } else if (hour < 20) { - return 'સાંજ'; - } else { - return 'રાત'; - } - }, - week: { - dow: 0, // Sunday is the first day of the week. - doy: 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - //! moment.js locale configuration - - moment.defineLocale('he', { - months : 'ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר'.split('_'), - monthsShort : 'ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳'.split('_'), - weekdays : 'ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת'.split('_'), - weekdaysShort : 'א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳'.split('_'), - weekdaysMin : 'א_ב_ג_ד_ה_ו_ש'.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', - l : 'D/M/YYYY', - ll : 'D MMM YYYY', - lll : 'D MMM YYYY HH:mm', - llll : 'ddd, D MMM YYYY HH:mm' - }, - calendar : { - sameDay : '[היום ב־]LT', - nextDay : '[מחר ב־]LT', - nextWeek : 'dddd [בשעה] LT', - lastDay : '[אתמול ב־]LT', - lastWeek : '[ביום] dddd [האחרון בשעה] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'בעוד %s', - past : 'לפני %s', - s : 'מספר שניות', - ss : '%d שניות', - m : 'דקה', - mm : '%d דקות', - h : 'שעה', - hh : function (number) { - if (number === 2) { - return 'שעתיים'; - } - return number + ' שעות'; - }, - d : 'יום', - dd : function (number) { - if (number === 2) { - return 'יומיים'; - } - return number + ' ימים'; - }, - M : 'חודש', - MM : function (number) { - if (number === 2) { - return 'חודשיים'; - } - return number + ' חודשים'; - }, - y : 'שנה', - yy : function (number) { - if (number === 2) { - return 'שנתיים'; - } else if (number % 10 === 0 && number !== 10) { - return number + ' שנה'; - } - return number + ' שנים'; - } - }, - meridiemParse: /אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i, - isPM : function (input) { - return /^(אחה"צ|אחרי הצהריים|בערב)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 5) { - return 'לפנות בוקר'; - } else if (hour < 10) { - return 'בבוקר'; - } else if (hour < 12) { - return isLower ? 'לפנה"צ' : 'לפני הצהריים'; - } else if (hour < 18) { - return isLower ? 'אחה"צ' : 'אחרי הצהריים'; - } else { - return 'בערב'; - } - } - }); - - //! moment.js locale configuration - - var symbolMap$7 = { - '1': '१', - '2': '२', - '3': '३', - '4': '४', - '5': '५', - '6': '६', - '7': '७', - '8': '८', - '9': '९', - '0': '०' - }, - numberMap$6 = { - '१': '1', - '२': '2', - '३': '3', - '४': '4', - '५': '5', - '६': '6', - '७': '7', - '८': '8', - '९': '9', - '०': '0' - }; - - moment.defineLocale('hi', { - months : 'जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर'.split('_'), - monthsShort : 'जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.'.split('_'), - monthsParseExact: true, - weekdays : 'रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'), - weekdaysShort : 'रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि'.split('_'), - weekdaysMin : 'र_सो_मं_बु_गु_शु_श'.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 : '[आज] LT', - nextDay : '[कल] LT', - nextWeek : 'dddd, LT', - lastDay : '[कल] LT', - lastWeek : '[पिछले] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s में', - past : '%s पहले', - s : 'कुछ ही क्षण', - ss : '%d सेकंड', - m : 'एक मिनट', - mm : '%d मिनट', - h : 'एक घंटा', - hh : '%d घंटे', - d : 'एक दिन', - dd : '%d दिन', - M : 'एक महीने', - MM : '%d महीने', - y : 'एक वर्ष', - yy : '%d वर्ष' - }, - preparse: function (string) { - return string.replace(/[१२३४५६७८९०]/g, function (match) { - return numberMap$6[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$7[match]; - }); - }, - // Hindi notation for meridiems are quite fuzzy in practice. While there exists - // a rigid notion of a 'Pahar' it is not used as rigidly in modern Hindi. - meridiemParse: /रात|सुबह|दोपहर|शाम/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'रात') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'सुबह') { - return hour; - } else if (meridiem === 'दोपहर') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'शाम') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'रात'; - } else if (hour < 10) { - return 'सुबह'; - } else if (hour < 17) { - return 'दोपहर'; - } else if (hour < 20) { - return 'शाम'; - } else { - return 'रात'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - //! moment.js locale configuration - - function translate$3(number, withoutSuffix, key) { - var result = number + ' '; - switch (key) { - case 'ss': - if (number === 1) { - result += 'sekunda'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'sekunde'; - } else { - result += 'sekundi'; - } - return result; - case 'm': - return withoutSuffix ? 'jedna minuta' : 'jedne minute'; - case 'mm': - if (number === 1) { - result += 'minuta'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'minute'; - } else { - result += 'minuta'; - } - return result; - case 'h': - return withoutSuffix ? 'jedan sat' : 'jednog sata'; - case 'hh': - if (number === 1) { - result += 'sat'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'sata'; - } else { - result += 'sati'; - } - return result; - case 'dd': - if (number === 1) { - result += 'dan'; - } else { - result += 'dana'; - } - return result; - case 'MM': - if (number === 1) { - result += 'mjesec'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'mjeseca'; - } else { - result += 'mjeseci'; - } - return result; - case 'yy': - if (number === 1) { - result += 'godina'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'godine'; - } else { - result += 'godina'; - } - return result; - } - } - - moment.defineLocale('hr', { - months : { - format: 'siječnja_veljače_ožujka_travnja_svibnja_lipnja_srpnja_kolovoza_rujna_listopada_studenoga_prosinca'.split('_'), - standalone: 'siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac'.split('_') - }, - monthsShort : 'sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.'.split('_'), - monthsParseExact: true, - weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), - weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), - weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[danas u] LT', - nextDay : '[sutra u] LT', - nextWeek : function () { - switch (this.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'; - } - }, - lastDay : '[jučer u] LT', - lastWeek : function () { - switch (this.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'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'prije %s', - s : 'par sekundi', - ss : translate$3, - m : translate$3, - mm : translate$3, - h : translate$3, - hh : translate$3, - d : 'dan', - dd : translate$3, - M : 'mjesec', - MM : translate$3, - y : 'godinu', - yy : translate$3 - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - var weekEndings = 'vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton'.split(' '); - function translate$4(number, withoutSuffix, key, isFuture) { - var num = number; - switch (key) { - case 's': - return (isFuture || withoutSuffix) ? 'néhány másodperc' : 'néhány másodperce'; - case 'ss': - return num + (isFuture || withoutSuffix) ? ' másodperc' : ' másodperce'; - case 'm': - return 'egy' + (isFuture || withoutSuffix ? ' perc' : ' perce'); - case 'mm': - return num + (isFuture || withoutSuffix ? ' perc' : ' perce'); - case 'h': - return 'egy' + (isFuture || withoutSuffix ? ' óra' : ' órája'); - case 'hh': - return num + (isFuture || withoutSuffix ? ' óra' : ' órája'); - case 'd': - return 'egy' + (isFuture || withoutSuffix ? ' nap' : ' napja'); - case 'dd': - return num + (isFuture || withoutSuffix ? ' nap' : ' napja'); - case 'M': - return 'egy' + (isFuture || withoutSuffix ? ' hónap' : ' hónapja'); - case 'MM': - return num + (isFuture || withoutSuffix ? ' hónap' : ' hónapja'); - case 'y': - return 'egy' + (isFuture || withoutSuffix ? ' év' : ' éve'); - case 'yy': - return num + (isFuture || withoutSuffix ? ' év' : ' éve'); - } - return ''; - } - function week(isFuture) { - return (isFuture ? '' : '[múlt] ') + '[' + weekEndings[this.day()] + '] LT[-kor]'; - } - - moment.defineLocale('hu', { - months : 'január_február_március_április_május_június_július_augusztus_szeptember_október_november_december'.split('_'), - monthsShort : 'jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec'.split('_'), - weekdays : 'vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat'.split('_'), - weekdaysShort : 'vas_hét_kedd_sze_csüt_pén_szo'.split('_'), - weekdaysMin : 'v_h_k_sze_cs_p_szo'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'YYYY.MM.DD.', - LL : 'YYYY. MMMM D.', - LLL : 'YYYY. MMMM D. H:mm', - LLLL : 'YYYY. MMMM D., dddd H:mm' - }, - meridiemParse: /de|du/i, - isPM: function (input) { - return input.charAt(1).toLowerCase() === 'u'; - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 12) { - return isLower === true ? 'de' : 'DE'; - } else { - return isLower === true ? 'du' : 'DU'; - } - }, - calendar : { - sameDay : '[ma] LT[-kor]', - nextDay : '[holnap] LT[-kor]', - nextWeek : function () { - return week.call(this, true); - }, - lastDay : '[tegnap] LT[-kor]', - lastWeek : function () { - return week.call(this, false); - }, - sameElse : 'L' - }, - relativeTime : { - future : '%s múlva', - past : '%s', - s : translate$4, - ss : translate$4, - m : translate$4, - mm : translate$4, - h : translate$4, - hh : translate$4, - d : translate$4, - dd : translate$4, - M : translate$4, - MM : translate$4, - y : translate$4, - yy : translate$4 - }, - 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('hy-am', { - months : { - format: 'հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի'.split('_'), - standalone: 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split('_') - }, - monthsShort : 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_'), - weekdays : 'կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ'.split('_'), - weekdaysShort : 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'), - weekdaysMin : 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.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: '[այսօր] LT', - nextDay: '[վաղը] LT', - lastDay: '[երեկ] LT', - nextWeek: function () { - return 'dddd [օրը ժամը] LT'; - }, - lastWeek: function () { - return '[անցած] dddd [օրը ժամը] LT'; - }, - sameElse: 'L' - }, - relativeTime : { - future : '%s հետո', - past : '%s առաջ', - s : 'մի քանի վայրկյան', - ss : '%d վայրկյան', - m : 'րոպե', - mm : '%d րոպե', - h : 'ժամ', - hh : '%d ժամ', - d : 'օր', - dd : '%d օր', - M : 'ամիս', - MM : '%d ամիս', - y : 'տարի', - yy : '%d տարի' - }, - meridiemParse: /գիշերվա|առավոտվա|ցերեկվա|երեկոյան/, - isPM: function (input) { - return /^(ցերեկվա|երեկոյան)$/.test(input); - }, - meridiem : function (hour) { - if (hour < 4) { - return 'գիշերվա'; - } else if (hour < 12) { - return 'առավոտվա'; - } else if (hour < 17) { - return 'ցերեկվա'; - } else { - return 'երեկոյան'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}|\d{1,2}-(ին|րդ)/, - ordinal: function (number, period) { - switch (period) { - case 'DDD': - case 'w': - case 'W': - case 'DDDo': - if (number === 1) { - return number + '-ին'; - } - return number + '-րդ'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - moment.defineLocale('id', { - months : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Agt_Sep_Okt_Nov_Des'.split('_'), - weekdays : 'Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu'.split('_'), - weekdaysShort : 'Min_Sen_Sel_Rab_Kam_Jum_Sab'.split('_'), - weekdaysMin : 'Mg_Sn_Sl_Rb_Km_Jm_Sb'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /pagi|siang|sore|malam/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'pagi') { - return hour; - } else if (meridiem === 'siang') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'sore' || meridiem === 'malam') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'pagi'; - } else if (hours < 15) { - return 'siang'; - } else if (hours < 19) { - return 'sore'; - } else { - return 'malam'; - } - }, - calendar : { - sameDay : '[Hari ini pukul] LT', - nextDay : '[Besok pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kemarin pukul] LT', - lastWeek : 'dddd [lalu pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dalam %s', - past : '%s yang lalu', - s : 'beberapa detik', - ss : '%d detik', - m : 'semenit', - mm : '%d menit', - h : 'sejam', - hh : '%d jam', - d : 'sehari', - dd : '%d hari', - M : 'sebulan', - MM : '%d bulan', - y : 'setahun', - yy : '%d tahun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - function plural$2(n) { - if (n % 100 === 11) { - return true; - } else if (n % 10 === 1) { - return false; - } - return true; - } - function translate$5(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': - return withoutSuffix || isFuture ? 'nokkrar sekúndur' : 'nokkrum sekúndum'; - case 'ss': - if (plural$2(number)) { - return result + (withoutSuffix || isFuture ? 'sekúndur' : 'sekúndum'); - } - return result + 'sekúnda'; - case 'm': - return withoutSuffix ? 'mínúta' : 'mínútu'; - case 'mm': - if (plural$2(number)) { - return result + (withoutSuffix || isFuture ? 'mínútur' : 'mínútum'); - } else if (withoutSuffix) { - return result + 'mínúta'; - } - return result + 'mínútu'; - case 'hh': - if (plural$2(number)) { - return result + (withoutSuffix || isFuture ? 'klukkustundir' : 'klukkustundum'); - } - return result + 'klukkustund'; - case 'd': - if (withoutSuffix) { - return 'dagur'; - } - return isFuture ? 'dag' : 'degi'; - case 'dd': - if (plural$2(number)) { - if (withoutSuffix) { - return result + 'dagar'; - } - return result + (isFuture ? 'daga' : 'dögum'); - } else if (withoutSuffix) { - return result + 'dagur'; - } - return result + (isFuture ? 'dag' : 'degi'); - case 'M': - if (withoutSuffix) { - return 'mánuður'; - } - return isFuture ? 'mánuð' : 'mánuði'; - case 'MM': - if (plural$2(number)) { - if (withoutSuffix) { - return result + 'mánuðir'; - } - return result + (isFuture ? 'mánuði' : 'mánuðum'); - } else if (withoutSuffix) { - return result + 'mánuður'; - } - return result + (isFuture ? 'mánuð' : 'mánuði'); - case 'y': - return withoutSuffix || isFuture ? 'ár' : 'ári'; - case 'yy': - if (plural$2(number)) { - return result + (withoutSuffix || isFuture ? 'ár' : 'árum'); - } - return result + (withoutSuffix || isFuture ? 'ár' : 'ári'); - } - } - - moment.defineLocale('is', { - months : 'janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember'.split('_'), - monthsShort : 'jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des'.split('_'), - weekdays : 'sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur'.split('_'), - weekdaysShort : 'sun_mán_þri_mið_fim_fös_lau'.split('_'), - weekdaysMin : 'Su_Má_Þr_Mi_Fi_Fö_La'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY [kl.] H:mm', - LLLL : 'dddd, D. MMMM YYYY [kl.] H:mm' - }, - calendar : { - sameDay : '[í dag kl.] LT', - nextDay : '[á morgun kl.] LT', - nextWeek : 'dddd [kl.] LT', - lastDay : '[í gær kl.] LT', - lastWeek : '[síðasta] dddd [kl.] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'eftir %s', - past : 'fyrir %s síðan', - s : translate$5, - ss : translate$5, - m : translate$5, - mm : translate$5, - h : 'klukkustund', - hh : translate$5, - d : translate$5, - dd : translate$5, - M : translate$5, - MM : translate$5, - y : translate$5, - yy : translate$5 - }, - 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-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('_'), - 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('ja', { - months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日'.split('_'), - weekdaysShort : '日_月_火_水_木_金_土'.split('_'), - weekdaysMin : '日_月_火_水_木_金_土'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY/MM/DD', - LL : 'YYYY年M月D日', - LLL : 'YYYY年M月D日 HH:mm', - LLLL : 'YYYY年M月D日 dddd HH:mm', - l : 'YYYY/MM/DD', - ll : 'YYYY年M月D日', - lll : 'YYYY年M月D日 HH:mm', - llll : 'YYYY年M月D日(ddd) HH:mm' - }, - meridiemParse: /午前|午後/i, - isPM : function (input) { - return input === '午後'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return '午前'; - } else { - return '午後'; - } - }, - calendar : { - sameDay : '[今日] LT', - nextDay : '[明日] LT', - nextWeek : function (now) { - if (now.week() < this.week()) { - return '[来週]dddd LT'; - } else { - return 'dddd LT'; - } - }, - lastDay : '[昨日] LT', - lastWeek : function (now) { - if (this.week() < now.week()) { - return '[先週]dddd LT'; - } else { - return 'dddd LT'; - } - }, - sameElse : 'L' - }, - dayOfMonthOrdinalParse : /\d{1,2}日/, - ordinal : function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '日'; - default: - return number; - } - }, - relativeTime : { - future : '%s後', - past : '%s前', - s : '数秒', - ss : '%d秒', - m : '1分', - mm : '%d分', - h : '1時間', - hh : '%d時間', - d : '1日', - dd : '%d日', - M : '1ヶ月', - MM : '%dヶ月', - y : '1年', - yy : '%d年' - } - }); - - //! moment.js locale configuration - - moment.defineLocale('jv', { - months : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des'.split('_'), - weekdays : 'Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu'.split('_'), - weekdaysShort : 'Min_Sen_Sel_Reb_Kem_Jem_Sep'.split('_'), - weekdaysMin : 'Mg_Sn_Sl_Rb_Km_Jm_Sp'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /enjing|siyang|sonten|ndalu/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'enjing') { - return hour; - } else if (meridiem === 'siyang') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'sonten' || meridiem === 'ndalu') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'enjing'; - } else if (hours < 15) { - return 'siyang'; - } else if (hours < 19) { - return 'sonten'; - } else { - return 'ndalu'; - } - }, - calendar : { - sameDay : '[Dinten puniko pukul] LT', - nextDay : '[Mbenjang pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kala wingi pukul] LT', - lastWeek : 'dddd [kepengker pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'wonten ing %s', - past : '%s ingkang kepengker', - s : 'sawetawis detik', - ss : '%d detik', - m : 'setunggal menit', - mm : '%d menit', - h : 'setunggal jam', - hh : '%d jam', - d : 'sedinten', - dd : '%d dinten', - M : 'sewulan', - MM : '%d wulan', - y : 'setaun', - yy : '%d taun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - moment.defineLocale('ka', { - months : { - standalone: 'იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი'.split('_'), - format: 'იანვარს_თებერვალს_მარტს_აპრილის_მაისს_ივნისს_ივლისს_აგვისტს_სექტემბერს_ოქტომბერს_ნოემბერს_დეკემბერს'.split('_') - }, - monthsShort : 'იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ'.split('_'), - weekdays : { - standalone: 'კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი'.split('_'), - format: 'კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს'.split('_'), - isFormat: /(წინა|შემდეგ)/ - }, - weekdaysShort : 'კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ'.split('_'), - weekdaysMin : 'კვ_ორ_სა_ოთ_ხუ_პა_შა'.split('_'), - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[დღეს] LT[-ზე]', - nextDay : '[ხვალ] LT[-ზე]', - lastDay : '[გუშინ] LT[-ზე]', - nextWeek : '[შემდეგ] dddd LT[-ზე]', - lastWeek : '[წინა] dddd LT-ზე', - sameElse : 'L' - }, - relativeTime : { - future : function (s) { - return (/(წამი|წუთი|საათი|წელი)/).test(s) ? - s.replace(/ი$/, 'ში') : - s + 'ში'; - }, - past : function (s) { - if ((/(წამი|წუთი|საათი|დღე|თვე)/).test(s)) { - return s.replace(/(ი|ე)$/, 'ის წინ'); - } - if ((/წელი/).test(s)) { - return s.replace(/წელი$/, 'წლის წინ'); - } - }, - s : 'რამდენიმე წამი', - ss : '%d წამი', - m : 'წუთი', - mm : '%d წუთი', - h : 'საათი', - hh : '%d საათი', - d : 'დღე', - dd : '%d დღე', - M : 'თვე', - MM : '%d თვე', - y : 'წელი', - yy : '%d წელი' - }, - dayOfMonthOrdinalParse: /0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/, - ordinal : function (number) { - if (number === 0) { - return number; - } - if (number === 1) { - return number + '-ლი'; - } - if ((number < 20) || (number <= 100 && (number % 20 === 0)) || (number % 100 === 0)) { - return 'მე-' + number; - } - return number + '-ე'; - }, - week : { - dow : 1, - doy : 7 - } - }); - - //! moment.js locale configuration - - var suffixes$1 = { - 0: '-ші', - 1: '-ші', - 2: '-ші', - 3: '-ші', - 4: '-ші', - 5: '-ші', - 6: '-шы', - 7: '-ші', - 8: '-ші', - 9: '-шы', - 10: '-шы', - 20: '-шы', - 30: '-шы', - 40: '-шы', - 50: '-ші', - 60: '-шы', - 70: '-ші', - 80: '-ші', - 90: '-шы', - 100: '-ші' - }; - - moment.defineLocale('kk', { - months : 'қаңтар_ақпан_наурыз_сәуір_мамыр_маусым_шілде_тамыз_қыркүйек_қазан_қараша_желтоқсан'.split('_'), - monthsShort : 'қаң_ақп_нау_сәу_мам_мау_шіл_там_қыр_қаз_қар_жел'.split('_'), - weekdays : 'жексенбі_дүйсенбі_сейсенбі_сәрсенбі_бейсенбі_жұма_сенбі'.split('_'), - weekdaysShort : 'жек_дүй_сей_сәр_бей_жұм_сен'.split('_'), - weekdaysMin : 'жк_дй_сй_ср_бй_жм_сн'.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 : '[Бүгін сағат] LT', - nextDay : '[Ертең сағат] LT', - nextWeek : 'dddd [сағат] LT', - lastDay : '[Кеше сағат] LT', - lastWeek : '[Өткен аптаның] dddd [сағат] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ішінде', - past : '%s бұрын', - s : 'бірнеше секунд', - ss : '%d секунд', - m : 'бір минут', - mm : '%d минут', - h : 'бір сағат', - hh : '%d сағат', - d : 'бір күн', - dd : '%d күн', - M : 'бір ай', - MM : '%d ай', - y : 'бір жыл', - yy : '%d жыл' - }, - dayOfMonthOrdinalParse: /\d{1,2}-(ші|шы)/, - ordinal : function (number) { - var a = number % 10, - b = number >= 100 ? 100 : null; - return number + (suffixes$1[number] || suffixes$1[a] || suffixes$1[b]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - var symbolMap$8 = { - '1': '១', - '2': '២', - '3': '៣', - '4': '៤', - '5': '៥', - '6': '៦', - '7': '៧', - '8': '៨', - '9': '៩', - '0': '០' - }, numberMap$7 = { - '១': '1', - '២': '2', - '៣': '3', - '៤': '4', - '៥': '5', - '៦': '6', - '៧': '7', - '៨': '8', - '៩': '9', - '០': '0' - }; - - moment.defineLocale('km', { - months: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split( - '_' - ), - monthsShort: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split( - '_' - ), - weekdays: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'), - weekdaysShort: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'), - weekdaysMin: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'), - weekdaysParseExact: true, - 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: /ព្រឹក|ល្ងាច/, - isPM: function (input) { - return input === 'ល្ងាច'; - }, - meridiem: function (hour, minute, isLower) { - if (hour < 12) { - return 'ព្រឹក'; - } else { - return 'ល្ងាច'; - } - }, - calendar: { - sameDay: '[ថ្ងៃនេះ ម៉ោង] LT', - nextDay: '[ស្អែក ម៉ោង] LT', - nextWeek: 'dddd [ម៉ោង] LT', - lastDay: '[ម្សិលមិញ ម៉ោង] LT', - lastWeek: 'dddd [សប្តាហ៍មុន] [ម៉ោង] LT', - sameElse: 'L' - }, - relativeTime: { - future: '%sទៀត', - past: '%sមុន', - s: 'ប៉ុន្មានវិនាទី', - ss: '%d វិនាទី', - m: 'មួយនាទី', - mm: '%d នាទី', - h: 'មួយម៉ោង', - hh: '%d ម៉ោង', - d: 'មួយថ្ងៃ', - dd: '%d ថ្ងៃ', - M: 'មួយខែ', - MM: '%d ខែ', - y: 'មួយឆ្នាំ', - yy: '%d ឆ្នាំ' - }, - dayOfMonthOrdinalParse : /ទី\d{1,2}/, - ordinal : 'ទី%d', - preparse: function (string) { - return string.replace(/[១២៣៤៥៦៧៨៩០]/g, function (match) { - return numberMap$7[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$8[match]; - }); - }, - 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 symbolMap$9 = { - '1': '೧', - '2': '೨', - '3': '೩', - '4': '೪', - '5': '೫', - '6': '೬', - '7': '೭', - '8': '೮', - '9': '೯', - '0': '೦' - }, - numberMap$8 = { - '೧': '1', - '೨': '2', - '೩': '3', - '೪': '4', - '೫': '5', - '೬': '6', - '೭': '7', - '೮': '8', - '೯': '9', - '೦': '0' - }; - - moment.defineLocale('kn', { - months : 'ಜನವರಿ_ಫೆಬ್ರವರಿ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂಬರ್_ಅಕ್ಟೋಬರ್_ನವೆಂಬರ್_ಡಿಸೆಂಬರ್'.split('_'), - monthsShort : 'ಜನ_ಫೆಬ್ರ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂ_ಅಕ್ಟೋ_ನವೆಂ_ಡಿಸೆಂ'.split('_'), - monthsParseExact: true, - weekdays : 'ಭಾನುವಾರ_ಸೋಮವಾರ_ಮಂಗಳವಾರ_ಬುಧವಾರ_ಗುರುವಾರ_ಶುಕ್ರವಾರ_ಶನಿವಾರ'.split('_'), - weekdaysShort : 'ಭಾನು_ಸೋಮ_ಮಂಗಳ_ಬುಧ_ಗುರು_ಶುಕ್ರ_ಶನಿ'.split('_'), - weekdaysMin : 'ಭಾ_ಸೋ_ಮಂ_ಬು_ಗು_ಶು_ಶ'.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 : '[ಇಂದು] LT', - nextDay : '[ನಾಳೆ] LT', - nextWeek : 'dddd, LT', - lastDay : '[ನಿನ್ನೆ] LT', - lastWeek : '[ಕೊನೆಯ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ನಂತರ', - past : '%s ಹಿಂದೆ', - s : 'ಕೆಲವು ಕ್ಷಣಗಳು', - ss : '%d ಸೆಕೆಂಡುಗಳು', - m : 'ಒಂದು ನಿಮಿಷ', - mm : '%d ನಿಮಿಷ', - h : 'ಒಂದು ಗಂಟೆ', - hh : '%d ಗಂಟೆ', - d : 'ಒಂದು ದಿನ', - dd : '%d ದಿನ', - M : 'ಒಂದು ತಿಂಗಳು', - MM : '%d ತಿಂಗಳು', - y : 'ಒಂದು ವರ್ಷ', - yy : '%d ವರ್ಷ' - }, - preparse: function (string) { - return string.replace(/[೧೨೩೪೫೬೭೮೯೦]/g, function (match) { - return numberMap$8[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$9[match]; - }); - }, - meridiemParse: /ರಾತ್ರಿ|ಬೆಳಿಗ್ಗೆ|ಮಧ್ಯಾಹ್ನ|ಸಂಜೆ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'ರಾತ್ರಿ') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'ಬೆಳಿಗ್ಗೆ') { - return hour; - } else if (meridiem === 'ಮಧ್ಯಾಹ್ನ') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'ಸಂಜೆ') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ರಾತ್ರಿ'; - } else if (hour < 10) { - return 'ಬೆಳಿಗ್ಗೆ'; - } else if (hour < 17) { - return 'ಮಧ್ಯಾಹ್ನ'; - } else if (hour < 20) { - return 'ಸಂಜೆ'; - } else { - return 'ರಾತ್ರಿ'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}(ನೇ)/, - ordinal : function (number) { - return number + 'ನೇ'; - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - //! moment.js locale configuration - - moment.defineLocale('ko', { - months : '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'), - monthsShort : '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'), - weekdays : '일요일_월요일_화요일_수요일_목요일_금요일_토요일'.split('_'), - weekdaysShort : '일_월_화_수_목_금_토'.split('_'), - weekdaysMin : '일_월_화_수_목_금_토'.split('_'), - longDateFormat : { - LT : 'A h:mm', - LTS : 'A h:mm:ss', - L : 'YYYY.MM.DD.', - LL : 'YYYY년 MMMM D일', - LLL : 'YYYY년 MMMM D일 A h:mm', - LLLL : 'YYYY년 MMMM D일 dddd A h:mm', - l : 'YYYY.MM.DD.', - ll : 'YYYY년 MMMM D일', - lll : 'YYYY년 MMMM D일 A h:mm', - llll : 'YYYY년 MMMM D일 dddd A h:mm' - }, - calendar : { - sameDay : '오늘 LT', - nextDay : '내일 LT', - nextWeek : 'dddd LT', - lastDay : '어제 LT', - lastWeek : '지난주 dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s 후', - past : '%s 전', - s : '몇 초', - ss : '%d초', - m : '1분', - mm : '%d분', - h : '한 시간', - hh : '%d시간', - d : '하루', - dd : '%d일', - M : '한 달', - MM : '%d달', - y : '일 년', - yy : '%d년' - }, - dayOfMonthOrdinalParse : /\d{1,2}(일|월|주)/, - ordinal : function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '일'; - case 'M': - return number + '월'; - case 'w': - case 'W': - return number + '주'; - default: - return number; - } - }, - meridiemParse : /오전|오후/, - isPM : function (token) { - return token === '오후'; - }, - meridiem : function (hour, minute, isUpper) { - return hour < 12 ? '오전' : '오후'; - } - }); - - //! moment.js locale configuration - - var symbolMap$a = { - '1': '١', - '2': '٢', - '3': '٣', - '4': '٤', - '5': '٥', - '6': '٦', - '7': '٧', - '8': '٨', - '9': '٩', - '0': '٠' - }, numberMap$9 = { - '١': '1', - '٢': '2', - '٣': '3', - '٤': '4', - '٥': '5', - '٦': '6', - '٧': '7', - '٨': '8', - '٩': '9', - '٠': '0' - }, - months$6 = [ - 'کانونی دووەم', - 'شوبات', - 'ئازار', - 'نیسان', - 'ئایار', - 'حوزەیران', - 'تەمموز', - 'ئاب', - 'ئەیلوول', - 'تشرینی یەكەم', - 'تشرینی دووەم', - 'كانونی یەکەم' - ]; - - - moment.defineLocale('ku', { - months : months$6, - monthsShort : months$6, - weekdays : 'یه‌كشه‌ممه‌_دووشه‌ممه‌_سێشه‌ممه‌_چوارشه‌ممه‌_پێنجشه‌ممه‌_هه‌ینی_شه‌ممه‌'.split('_'), - weekdaysShort : 'یه‌كشه‌م_دووشه‌م_سێشه‌م_چوارشه‌م_پێنجشه‌م_هه‌ینی_شه‌ممه‌'.split('_'), - weekdaysMin : 'ی_د_س_چ_پ_ه_ش'.split('_'), - weekdaysParseExact : true, - 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: /ئێواره‌|به‌یانی/, - isPM: function (input) { - return /ئێواره‌/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'به‌یانی'; - } else { - return 'ئێواره‌'; - } - }, - calendar : { - sameDay : '[ئه‌مرۆ كاتژمێر] LT', - nextDay : '[به‌یانی كاتژمێر] LT', - nextWeek : 'dddd [كاتژمێر] LT', - lastDay : '[دوێنێ كاتژمێر] LT', - lastWeek : 'dddd [كاتژمێر] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'له‌ %s', - past : '%s', - s : 'چه‌ند چركه‌یه‌ك', - ss : 'چركه‌ %d', - m : 'یه‌ك خوله‌ك', - mm : '%d خوله‌ك', - h : 'یه‌ك كاتژمێر', - hh : '%d كاتژمێر', - d : 'یه‌ك ڕۆژ', - dd : '%d ڕۆژ', - M : 'یه‌ك مانگ', - MM : '%d مانگ', - y : 'یه‌ك ساڵ', - yy : '%d ساڵ' - }, - preparse: function (string) { - return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { - return numberMap$9[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$a[match]; - }).replace(/,/g, '،'); - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } - }); - - //! moment.js locale configuration - - var suffixes$2 = { - 0: '-чү', - 1: '-чи', - 2: '-чи', - 3: '-чү', - 4: '-чү', - 5: '-чи', - 6: '-чы', - 7: '-чи', - 8: '-чи', - 9: '-чу', - 10: '-чу', - 20: '-чы', - 30: '-чу', - 40: '-чы', - 50: '-чү', - 60: '-чы', - 70: '-чи', - 80: '-чи', - 90: '-чу', - 100: '-чү' - }; - - moment.defineLocale('ky', { - months : 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_'), - monthsShort : 'янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек'.split('_'), - weekdays : 'Жекшемби_Дүйшөмбү_Шейшемби_Шаршемби_Бейшемби_Жума_Ишемби'.split('_'), - weekdaysShort : 'Жек_Дүй_Шей_Шар_Бей_Жум_Ише'.split('_'), - weekdaysMin : 'Жк_Дй_Шй_Шр_Бй_Жм_Иш'.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 : '[Бүгүн саат] LT', - nextDay : '[Эртең саат] LT', - nextWeek : 'dddd [саат] LT', - lastDay : '[Кечээ саат] LT', - lastWeek : '[Өткөн аптанын] dddd [күнү] [саат] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ичинде', - past : '%s мурун', - s : 'бирнече секунд', - ss : '%d секунд', - m : 'бир мүнөт', - mm : '%d мүнөт', - h : 'бир саат', - hh : '%d саат', - d : 'бир күн', - dd : '%d күн', - M : 'бир ай', - MM : '%d ай', - y : 'бир жыл', - yy : '%d жыл' - }, - dayOfMonthOrdinalParse: /\d{1,2}-(чи|чы|чү|чу)/, - ordinal : function (number) { - var a = number % 10, - b = number >= 100 ? 100 : null; - return number + (suffixes$2[number] || suffixes$2[a] || suffixes$2[b]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - function processRelativeTime$5(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eng Minutt', 'enger Minutt'], - 'h': ['eng Stonn', 'enger Stonn'], - 'd': ['een Dag', 'engem Dag'], - 'M': ['ee Mount', 'engem Mount'], - 'y': ['ee Joer', 'engem Joer'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } - function processFutureTime(string) { - var number = string.substr(0, string.indexOf(' ')); - if (eifelerRegelAppliesToNumber(number)) { - return 'a ' + string; - } - return 'an ' + string; - } - function processPastTime(string) { - var number = string.substr(0, string.indexOf(' ')); - if (eifelerRegelAppliesToNumber(number)) { - return 'viru ' + string; - } - return 'virun ' + string; - } - /** - * Returns true if the word before the given number loses the '-n' ending. - * e.g. 'an 10 Deeg' but 'a 5 Deeg' - * - * @param number {integer} - * @returns {boolean} - */ - function eifelerRegelAppliesToNumber(number) { - number = parseInt(number, 10); - if (isNaN(number)) { - return false; - } - if (number < 0) { - // Negative Number --> always true - return true; - } else if (number < 10) { - // Only 1 digit - if (4 <= number && number <= 7) { - return true; - } - return false; - } else if (number < 100) { - // 2 digits - var lastDigit = number % 10, firstDigit = number / 10; - if (lastDigit === 0) { - return eifelerRegelAppliesToNumber(firstDigit); - } - return eifelerRegelAppliesToNumber(lastDigit); - } else if (number < 10000) { - // 3 or 4 digits --> recursively check first digit - while (number >= 10) { - number = number / 10; - } - return eifelerRegelAppliesToNumber(number); - } else { - // Anything larger than 4 digits: recursively check first n-3 digits - number = number / 1000; - return eifelerRegelAppliesToNumber(number); - } - } - - moment.defineLocale('lb', { - months: 'Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort: 'Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays: 'Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg'.split('_'), - weekdaysShort: 'So._Mé._Dë._Më._Do._Fr._Sa.'.split('_'), - weekdaysMin: 'So_Mé_Dë_Më_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm [Auer]', - LTS: 'H:mm:ss [Auer]', - L: 'DD.MM.YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm [Auer]', - LLLL: 'dddd, D. MMMM YYYY H:mm [Auer]' - }, - calendar: { - sameDay: '[Haut um] LT', - sameElse: 'L', - nextDay: '[Muer um] LT', - nextWeek: 'dddd [um] LT', - lastDay: '[Gëschter um] LT', - lastWeek: function () { - // Different date string for 'Dënschdeg' (Tuesday) and 'Donneschdeg' (Thursday) due to phonological rule - switch (this.day()) { - case 2: - case 4: - return '[Leschten] dddd [um] LT'; - default: - return '[Leschte] dddd [um] LT'; - } - } - }, - relativeTime : { - future : processFutureTime, - past : processPastTime, - s : 'e puer Sekonnen', - ss : '%d Sekonnen', - m : processRelativeTime$5, - mm : '%d Minutten', - h : processRelativeTime$5, - hh : '%d Stonnen', - d : processRelativeTime$5, - dd : '%d Deeg', - M : processRelativeTime$5, - MM : '%d Méint', - y : processRelativeTime$5, - yy : '%d Joer' - }, - 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('lo', { - months : 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split('_'), - monthsShort : 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split('_'), - weekdays : 'ອາທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'), - weekdaysShort : 'ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'), - weekdaysMin : 'ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ'.split('_'), - weekdaysParseExact : true, - 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: /ຕອນເຊົ້າ|ຕອນແລງ/, - isPM: function (input) { - return input === 'ຕອນແລງ'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ຕອນເຊົ້າ'; - } else { - return 'ຕອນແລງ'; - } - }, - calendar : { - sameDay : '[ມື້ນີ້ເວລາ] LT', - nextDay : '[ມື້ອື່ນເວລາ] LT', - nextWeek : '[ວັນ]dddd[ໜ້າເວລາ] LT', - lastDay : '[ມື້ວານນີ້ເວລາ] LT', - lastWeek : '[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ອີກ %s', - past : '%sຜ່ານມາ', - s : 'ບໍ່ເທົ່າໃດວິນາທີ', - ss : '%d ວິນາທີ' , - m : '1 ນາທີ', - mm : '%d ນາທີ', - h : '1 ຊົ່ວໂມງ', - hh : '%d ຊົ່ວໂມງ', - d : '1 ມື້', - dd : '%d ມື້', - M : '1 ເດືອນ', - MM : '%d ເດືອນ', - y : '1 ປີ', - yy : '%d ປີ' - }, - dayOfMonthOrdinalParse: /(ທີ່)\d{1,2}/, - ordinal : function (number) { - return 'ທີ່' + number; - } - }); - - //! moment.js locale configuration - - var units = { - 'ss' : 'sekundė_sekundžių_sekundes', - 'm' : 'minutė_minutės_minutę', - 'mm': 'minutės_minučių_minutes', - 'h' : 'valanda_valandos_valandą', - 'hh': 'valandos_valandų_valandas', - 'd' : 'diena_dienos_dieną', - 'dd': 'dienos_dienų_dienas', - 'M' : 'mėnuo_mėnesio_mėnesį', - 'MM': 'mėnesiai_mėnesių_mėnesius', - 'y' : 'metai_metų_metus', - 'yy': 'metai_metų_metus' - }; - function translateSeconds(number, withoutSuffix, key, isFuture) { - if (withoutSuffix) { - return 'kelios sekundės'; - } else { - return isFuture ? 'kelių sekundžių' : 'kelias sekundes'; - } - } - function translateSingular(number, withoutSuffix, key, isFuture) { - return withoutSuffix ? forms(key)[0] : (isFuture ? forms(key)[1] : forms(key)[2]); - } - function special(number) { - return number % 10 === 0 || (number > 10 && number < 20); - } - function forms(key) { - return units[key].split('_'); - } - function translate$6(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - if (number === 1) { - return result + translateSingular(number, withoutSuffix, key[0], isFuture); - } else if (withoutSuffix) { - return result + (special(number) ? forms(key)[1] : forms(key)[0]); - } else { - if (isFuture) { - return result + forms(key)[1]; - } else { - return result + (special(number) ? forms(key)[1] : forms(key)[2]); - } - } - } - moment.defineLocale('lt', { - months : { - format: 'sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio'.split('_'), - standalone: 'sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis'.split('_'), - isFormat: /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|MMMM?(\[[^\[\]]*\]|\s)+D[oD]?/ - }, - monthsShort : 'sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd'.split('_'), - weekdays : { - format: 'sekmadienį_pirmadienį_antradienį_trečiadienį_ketvirtadienį_penktadienį_šeštadienį'.split('_'), - standalone: 'sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis'.split('_'), - isFormat: /dddd HH:mm/ - }, - weekdaysShort : 'Sek_Pir_Ant_Tre_Ket_Pen_Šeš'.split('_'), - weekdaysMin : 'S_P_A_T_K_Pn_Š'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'YYYY [m.] MMMM D [d.]', - LLL : 'YYYY [m.] MMMM D [d.], HH:mm [val.]', - LLLL : 'YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]', - l : 'YYYY-MM-DD', - ll : 'YYYY [m.] MMMM D [d.]', - lll : 'YYYY [m.] MMMM D [d.], HH:mm [val.]', - llll : 'YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]' - }, - calendar : { - sameDay : '[Šiandien] LT', - nextDay : '[Rytoj] LT', - nextWeek : 'dddd LT', - lastDay : '[Vakar] LT', - lastWeek : '[Praėjusį] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : 'po %s', - past : 'prieš %s', - s : translateSeconds, - ss : translate$6, - m : translateSingular, - mm : translate$6, - h : translateSingular, - hh : translate$6, - d : translateSingular, - dd : translate$6, - M : translateSingular, - MM : translate$6, - y : translateSingular, - yy : translate$6 - }, - dayOfMonthOrdinalParse: /\d{1,2}-oji/, - ordinal : function (number) { - return number + '-oji'; - }, - 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 units$1 = { - 'ss': 'sekundes_sekundēm_sekunde_sekundes'.split('_'), - 'm': 'minūtes_minūtēm_minūte_minūtes'.split('_'), - 'mm': 'minūtes_minūtēm_minūte_minūtes'.split('_'), - 'h': 'stundas_stundām_stunda_stundas'.split('_'), - 'hh': 'stundas_stundām_stunda_stundas'.split('_'), - 'd': 'dienas_dienām_diena_dienas'.split('_'), - 'dd': 'dienas_dienām_diena_dienas'.split('_'), - 'M': 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'), - 'MM': 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'), - 'y': 'gada_gadiem_gads_gadi'.split('_'), - 'yy': 'gada_gadiem_gads_gadi'.split('_') - }; - /** - * @param withoutSuffix boolean true = a length of time; false = before/after a period of time. - */ - function format(forms, number, withoutSuffix) { - if (withoutSuffix) { - // E.g. "21 minūte", "3 minūtes". - return number % 10 === 1 && number % 100 !== 11 ? forms[2] : forms[3]; - } else { - // E.g. "21 minūtes" as in "pēc 21 minūtes". - // E.g. "3 minūtēm" as in "pēc 3 minūtēm". - return number % 10 === 1 && number % 100 !== 11 ? forms[0] : forms[1]; - } - } - function relativeTimeWithPlural$1(number, withoutSuffix, key) { - return number + ' ' + format(units$1[key], number, withoutSuffix); - } - function relativeTimeWithSingular(number, withoutSuffix, key) { - return format(units$1[key], number, withoutSuffix); - } - function relativeSeconds(number, withoutSuffix) { - return withoutSuffix ? 'dažas sekundes' : 'dažām sekundēm'; - } - - moment.defineLocale('lv', { - months : 'janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris'.split('_'), - monthsShort : 'jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec'.split('_'), - weekdays : 'svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena'.split('_'), - weekdaysShort : 'Sv_P_O_T_C_Pk_S'.split('_'), - weekdaysMin : 'Sv_P_O_T_C_Pk_S'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY.', - LL : 'YYYY. [gada] D. MMMM', - LLL : 'YYYY. [gada] D. MMMM, HH:mm', - LLLL : 'YYYY. [gada] D. MMMM, dddd, HH:mm' - }, - calendar : { - sameDay : '[Šodien pulksten] LT', - nextDay : '[Rīt pulksten] LT', - nextWeek : 'dddd [pulksten] LT', - lastDay : '[Vakar pulksten] LT', - lastWeek : '[Pagājušā] dddd [pulksten] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'pēc %s', - past : 'pirms %s', - s : relativeSeconds, - ss : relativeTimeWithPlural$1, - m : relativeTimeWithSingular, - mm : relativeTimeWithPlural$1, - h : relativeTimeWithSingular, - hh : relativeTimeWithPlural$1, - d : relativeTimeWithSingular, - dd : relativeTimeWithPlural$1, - M : relativeTimeWithSingular, - MM : relativeTimeWithPlural$1, - y : relativeTimeWithSingular, - yy : relativeTimeWithPlural$1 - }, - 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 - - var translator = { - words: { //Different grammatical cases - ss: ['sekund', 'sekunda', 'sekundi'], - m: ['jedan minut', 'jednog minuta'], - mm: ['minut', 'minuta', 'minuta'], - h: ['jedan sat', 'jednog sata'], - hh: ['sat', 'sata', 'sati'], - dd: ['dan', 'dana', 'dana'], - MM: ['mjesec', 'mjeseca', 'mjeseci'], - yy: ['godina', 'godine', 'godina'] - }, - correctGrammaticalCase: function (number, wordKey) { - return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]); - }, - translate: function (number, withoutSuffix, key) { - var wordKey = translator.words[key]; - if (key.length === 1) { - return withoutSuffix ? wordKey[0] : wordKey[1]; - } else { - return number + ' ' + translator.correctGrammaticalCase(number, wordKey); - } - } - }; - - moment.defineLocale('me', { - months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split('_'), - monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'), - monthsParseExact : true, - weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), - weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), - weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm', - LTS : 'H:mm:ss', - L: 'DD.MM.YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm', - LLLL: 'dddd, D. MMMM YYYY H:mm' - }, - calendar: { - sameDay: '[danas u] LT', - nextDay: '[sjutra u] LT', - - nextWeek: function () { - switch (this.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'; - } - }, - lastDay : '[juče u] LT', - lastWeek : function () { - var lastWeekDays = [ - '[prošle] [nedjelje] [u] LT', - '[prošlog] [ponedjeljka] [u] LT', - '[prošlog] [utorka] [u] LT', - '[prošle] [srijede] [u] LT', - '[prošlog] [četvrtka] [u] LT', - '[prošlog] [petka] [u] LT', - '[prošle] [subote] [u] LT' - ]; - return lastWeekDays[this.day()]; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'prije %s', - s : 'nekoliko sekundi', - ss : translator.translate, - m : translator.translate, - mm : translator.translate, - h : translator.translate, - hh : translator.translate, - d : 'dan', - dd : translator.translate, - M : 'mjesec', - MM : translator.translate, - y : 'godinu', - yy : translator.translate - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - moment.defineLocale('mi', { - months: 'Kohi-tāte_Hui-tanguru_Poutū-te-rangi_Paenga-whāwhā_Haratua_Pipiri_Hōngoingoi_Here-turi-kōkā_Mahuru_Whiringa-ā-nuku_Whiringa-ā-rangi_Hakihea'.split('_'), - monthsShort: 'Kohi_Hui_Pou_Pae_Hara_Pipi_Hōngoi_Here_Mahu_Whi-nu_Whi-ra_Haki'.split('_'), - monthsRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i, - monthsStrictRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i, - monthsShortRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i, - monthsShortStrictRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,2}/i, - weekdays: 'Rātapu_Mane_Tūrei_Wenerei_Tāite_Paraire_Hātarei'.split('_'), - weekdaysShort: 'Ta_Ma_Tū_We_Tāi_Pa_Hā'.split('_'), - weekdaysMin: 'Ta_Ma_Tū_We_Tāi_Pa_Hā'.split('_'), - longDateFormat: { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L: 'DD/MM/YYYY', - LL: 'D MMMM YYYY', - LLL: 'D MMMM YYYY [i] HH:mm', - LLLL: 'dddd, D MMMM YYYY [i] HH:mm' - }, - calendar: { - sameDay: '[i teie mahana, i] LT', - nextDay: '[apopo i] LT', - nextWeek: 'dddd [i] LT', - lastDay: '[inanahi i] LT', - lastWeek: 'dddd [whakamutunga i] LT', - sameElse: 'L' - }, - relativeTime: { - future: 'i roto i %s', - past: '%s i mua', - s: 'te hēkona ruarua', - ss: '%d hēkona', - m: 'he meneti', - mm: '%d meneti', - h: 'te haora', - hh: '%d haora', - d: 'he ra', - dd: '%d ra', - M: 'he marama', - MM: '%d marama', - y: 'he tau', - yy: '%d tau' - }, - 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('mk', { - months : 'јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември'.split('_'), - monthsShort : 'јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек'.split('_'), - weekdays : 'недела_понеделник_вторник_среда_четврток_петок_сабота'.split('_'), - weekdaysShort : 'нед_пон_вто_сре_чет_пет_саб'.split('_'), - weekdaysMin : 'нe_пo_вт_ср_че_пе_сa'.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 : '[Денес во] LT', - nextDay : '[Утре во] LT', - nextWeek : '[Во] dddd [во] LT', - lastDay : '[Вчера во] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - case 3: - case 6: - return '[Изминатата] dddd [во] LT'; - case 1: - case 2: - case 4: - case 5: - return '[Изминатиот] dddd [во] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'после %s', - past : 'пред %s', - s : 'неколку секунди', - ss : '%d секунди', - m : 'минута', - mm : '%d минути', - h : 'час', - hh : '%d часа', - d : 'ден', - dd : '%d дена', - M : 'месец', - MM : '%d месеци', - y : 'година', - yy : '%d години' - }, - dayOfMonthOrdinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/, - ordinal : function (number) { - var lastDigit = number % 10, - last2Digits = number % 100; - if (number === 0) { - return number + '-ев'; - } else if (last2Digits === 0) { - return number + '-ен'; - } else if (last2Digits > 10 && last2Digits < 20) { - return number + '-ти'; - } else if (lastDigit === 1) { - return number + '-ви'; - } else if (lastDigit === 2) { - return number + '-ри'; - } else if (lastDigit === 7 || lastDigit === 8) { - return number + '-ми'; - } else { - return number + '-ти'; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - moment.defineLocale('ml', { - months : 'ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ'.split('_'), - monthsShort : 'ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.'.split('_'), - monthsParseExact : true, - weekdays : 'ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച'.split('_'), - weekdaysShort : 'ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി'.split('_'), - weekdaysMin : 'ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ'.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 : '[ഇന്ന്] LT', - nextDay : '[നാളെ] LT', - nextWeek : 'dddd, LT', - lastDay : '[ഇന്നലെ] LT', - lastWeek : '[കഴിഞ്ഞ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s കഴിഞ്ഞ്', - past : '%s മുൻപ്', - s : 'അൽപ നിമിഷങ്ങൾ', - ss : '%d സെക്കൻഡ്', - m : 'ഒരു മിനിറ്റ്', - mm : '%d മിനിറ്റ്', - h : 'ഒരു മണിക്കൂർ', - hh : '%d മണിക്കൂർ', - d : 'ഒരു ദിവസം', - dd : '%d ദിവസം', - M : 'ഒരു മാസം', - MM : '%d മാസം', - y : 'ഒരു വർഷം', - yy : '%d വർഷം' - }, - meridiemParse: /രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ((meridiem === 'രാത്രി' && hour >= 4) || - meridiem === 'ഉച്ച കഴിഞ്ഞ്' || - meridiem === 'വൈകുന്നേരം') { - return hour + 12; - } else { - return hour; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'രാത്രി'; - } else if (hour < 12) { - return 'രാവിലെ'; - } else if (hour < 17) { - return 'ഉച്ച കഴിഞ്ഞ്'; - } else if (hour < 20) { - return 'വൈകുന്നേരം'; - } else { - return 'രാത്രി'; - } - } - }); - - //! moment.js locale configuration - - function translate$7(number, withoutSuffix, key, isFuture) { - switch (key) { - case 's': - return withoutSuffix ? 'хэдхэн секунд' : 'хэдхэн секундын'; - case 'ss': - return number + (withoutSuffix ? ' секунд' : ' секундын'); - case 'm': - case 'mm': - return number + (withoutSuffix ? ' минут' : ' минутын'); - case 'h': - case 'hh': - return number + (withoutSuffix ? ' цаг' : ' цагийн'); - case 'd': - case 'dd': - return number + (withoutSuffix ? ' өдөр' : ' өдрийн'); - case 'M': - case 'MM': - return number + (withoutSuffix ? ' сар' : ' сарын'); - case 'y': - case 'yy': - return number + (withoutSuffix ? ' жил' : ' жилийн'); - default: - return number; - } - } - - moment.defineLocale('mn', { - months : 'Нэгдүгээр сар_Хоёрдугаар сар_Гуравдугаар сар_Дөрөвдүгээр сар_Тавдугаар сар_Зургадугаар сар_Долдугаар сар_Наймдугаар сар_Есдүгээр сар_Аравдугаар сар_Арван нэгдүгээр сар_Арван хоёрдугаар сар'.split('_'), - monthsShort : '1 сар_2 сар_3 сар_4 сар_5 сар_6 сар_7 сар_8 сар_9 сар_10 сар_11 сар_12 сар'.split('_'), - monthsParseExact : true, - weekdays : 'Ням_Даваа_Мягмар_Лхагва_Пүрэв_Баасан_Бямба'.split('_'), - weekdaysShort : 'Ням_Дав_Мяг_Лха_Пүр_Баа_Бям'.split('_'), - weekdaysMin : 'Ня_Да_Мя_Лх_Пү_Ба_Бя'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'YYYY оны MMMMын D', - LLL : 'YYYY оны MMMMын D HH:mm', - LLLL : 'dddd, YYYY оны MMMMын D HH:mm' - }, - meridiemParse: /ҮӨ|ҮХ/i, - isPM : function (input) { - return input === 'ҮХ'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ҮӨ'; - } else { - return 'ҮХ'; - } - }, - calendar : { - sameDay : '[Өнөөдөр] LT', - nextDay : '[Маргааш] LT', - nextWeek : '[Ирэх] dddd LT', - lastDay : '[Өчигдөр] LT', - lastWeek : '[Өнгөрсөн] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s дараа', - past : '%s өмнө', - s : translate$7, - ss : translate$7, - m : translate$7, - mm : translate$7, - h : translate$7, - hh : translate$7, - d : translate$7, - dd : translate$7, - M : translate$7, - MM : translate$7, - y : translate$7, - yy : translate$7 - }, - dayOfMonthOrdinalParse: /\d{1,2} өдөр/, - ordinal : function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + ' өдөр'; - default: - return number; - } - } - }); - - //! moment.js locale configuration - - var symbolMap$b = { - '1': '१', - '2': '२', - '3': '३', - '4': '४', - '5': '५', - '6': '६', - '7': '७', - '8': '८', - '9': '९', - '0': '०' - }, - numberMap$a = { - '१': '1', - '२': '2', - '३': '3', - '४': '4', - '५': '5', - '६': '6', - '७': '7', - '८': '8', - '९': '9', - '०': '0' - }; - - function relativeTimeMr(number, withoutSuffix, string, isFuture) - { - var output = ''; - if (withoutSuffix) { - switch (string) { - case 's': output = 'काही सेकंद'; break; - case 'ss': output = '%d सेकंद'; break; - case 'm': output = 'एक मिनिट'; break; - case 'mm': output = '%d मिनिटे'; break; - case 'h': output = 'एक तास'; break; - case 'hh': output = '%d तास'; break; - case 'd': output = 'एक दिवस'; break; - case 'dd': output = '%d दिवस'; break; - case 'M': output = 'एक महिना'; break; - case 'MM': output = '%d महिने'; break; - case 'y': output = 'एक वर्ष'; break; - case 'yy': output = '%d वर्षे'; break; - } - } - else { - switch (string) { - case 's': output = 'काही सेकंदां'; break; - case 'ss': output = '%d सेकंदां'; break; - case 'm': output = 'एका मिनिटा'; break; - case 'mm': output = '%d मिनिटां'; break; - case 'h': output = 'एका तासा'; break; - case 'hh': output = '%d तासां'; break; - case 'd': output = 'एका दिवसा'; break; - case 'dd': output = '%d दिवसां'; break; - case 'M': output = 'एका महिन्या'; break; - case 'MM': output = '%d महिन्यां'; break; - case 'y': output = 'एका वर्षा'; break; - case 'yy': output = '%d वर्षां'; break; - } - } - return output.replace(/%d/i, number); - } - - moment.defineLocale('mr', { - months : 'जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर'.split('_'), - monthsShort: 'जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.'.split('_'), - monthsParseExact : true, - weekdays : 'रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'), - weekdaysShort : 'रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि'.split('_'), - weekdaysMin : 'र_सो_मं_बु_गु_शु_श'.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 : '[आज] LT', - nextDay : '[उद्या] LT', - nextWeek : 'dddd, LT', - lastDay : '[काल] LT', - lastWeek: '[मागील] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future: '%sमध्ये', - past: '%sपूर्वी', - s: relativeTimeMr, - ss: relativeTimeMr, - m: relativeTimeMr, - mm: relativeTimeMr, - h: relativeTimeMr, - hh: relativeTimeMr, - d: relativeTimeMr, - dd: relativeTimeMr, - M: relativeTimeMr, - MM: relativeTimeMr, - y: relativeTimeMr, - yy: relativeTimeMr - }, - preparse: function (string) { - return string.replace(/[१२३४५६७८९०]/g, function (match) { - return numberMap$a[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$b[match]; - }); - }, - meridiemParse: /रात्री|सकाळी|दुपारी|सायंकाळी/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'रात्री') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'सकाळी') { - return hour; - } else if (meridiem === 'दुपारी') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'सायंकाळी') { - return hour + 12; - } - }, - meridiem: function (hour, minute, isLower) { - if (hour < 4) { - return 'रात्री'; - } else if (hour < 10) { - return 'सकाळी'; - } else if (hour < 17) { - return 'दुपारी'; - } else if (hour < 20) { - return 'सायंकाळी'; - } else { - return 'रात्री'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - //! moment.js locale configuration - - moment.defineLocale('ms-my', { - months : 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split('_'), - monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'), - weekdays : 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'), - weekdaysShort : 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'), - weekdaysMin : 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /pagi|tengahari|petang|malam/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'pagi') { - return hour; - } else if (meridiem === 'tengahari') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'petang' || meridiem === 'malam') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'pagi'; - } else if (hours < 15) { - return 'tengahari'; - } else if (hours < 19) { - return 'petang'; - } else { - return 'malam'; - } - }, - calendar : { - sameDay : '[Hari ini pukul] LT', - nextDay : '[Esok pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kelmarin pukul] LT', - lastWeek : 'dddd [lepas pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dalam %s', - past : '%s yang lepas', - s : 'beberapa saat', - ss : '%d saat', - m : 'seminit', - mm : '%d minit', - h : 'sejam', - hh : '%d jam', - d : 'sehari', - dd : '%d hari', - M : 'sebulan', - MM : '%d bulan', - y : 'setahun', - yy : '%d tahun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - moment.defineLocale('ms', { - months : 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split('_'), - monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'), - weekdays : 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'), - weekdaysShort : 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'), - weekdaysMin : 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /pagi|tengahari|petang|malam/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'pagi') { - return hour; - } else if (meridiem === 'tengahari') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'petang' || meridiem === 'malam') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'pagi'; - } else if (hours < 15) { - return 'tengahari'; - } else if (hours < 19) { - return 'petang'; - } else { - return 'malam'; - } - }, - calendar : { - sameDay : '[Hari ini pukul] LT', - nextDay : '[Esok pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kelmarin pukul] LT', - lastWeek : 'dddd [lepas pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dalam %s', - past : '%s yang lepas', - s : 'beberapa saat', - ss : '%d saat', - m : 'seminit', - mm : '%d minit', - h : 'sejam', - hh : '%d jam', - d : 'sehari', - dd : '%d hari', - M : 'sebulan', - MM : '%d bulan', - y : 'setahun', - yy : '%d tahun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - moment.defineLocale('mt', { - months : 'Jannar_Frar_Marzu_April_Mejju_Ġunju_Lulju_Awwissu_Settembru_Ottubru_Novembru_Diċembru'.split('_'), - monthsShort : 'Jan_Fra_Mar_Apr_Mej_Ġun_Lul_Aww_Set_Ott_Nov_Diċ'.split('_'), - weekdays : 'Il-Ħadd_It-Tnejn_It-Tlieta_L-Erbgħa_Il-Ħamis_Il-Ġimgħa_Is-Sibt'.split('_'), - weekdaysShort : 'Ħad_Tne_Tli_Erb_Ħam_Ġim_Sib'.split('_'), - weekdaysMin : 'Ħa_Tn_Tl_Er_Ħa_Ġi_Si'.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 : '[Illum fil-]LT', - nextDay : '[Għada fil-]LT', - nextWeek : 'dddd [fil-]LT', - lastDay : '[Il-bieraħ fil-]LT', - lastWeek : 'dddd [li għadda] [fil-]LT', - sameElse : 'L' - }, - relativeTime : { - future : 'f’ %s', - past : '%s ilu', - s : 'ftit sekondi', - ss : '%d sekondi', - m : 'minuta', - mm : '%d minuti', - h : 'siegħa', - hh : '%d siegħat', - d : 'ġurnata', - dd : '%d ġranet', - M : 'xahar', - MM : '%d xhur', - y : 'sena', - yy : '%d sni' - }, - 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 - - var symbolMap$c = { - '1': '၁', - '2': '၂', - '3': '၃', - '4': '၄', - '5': '၅', - '6': '၆', - '7': '၇', - '8': '၈', - '9': '၉', - '0': '၀' - }, numberMap$b = { - '၁': '1', - '၂': '2', - '၃': '3', - '၄': '4', - '၅': '5', - '၆': '6', - '၇': '7', - '၈': '8', - '၉': '9', - '၀': '0' - }; - - moment.defineLocale('my', { - months: 'ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ'.split('_'), - monthsShort: 'ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ'.split('_'), - weekdays: 'တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ'.split('_'), - weekdaysShort: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'), - weekdaysMin: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.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: '[ယနေ.] LT [မှာ]', - nextDay: '[မနက်ဖြန်] LT [မှာ]', - nextWeek: 'dddd LT [မှာ]', - lastDay: '[မနေ.က] LT [မှာ]', - lastWeek: '[ပြီးခဲ့သော] dddd LT [မှာ]', - sameElse: 'L' - }, - relativeTime: { - future: 'လာမည့် %s မှာ', - past: 'လွန်ခဲ့သော %s က', - s: 'စက္ကန်.အနည်းငယ်', - ss : '%d စက္ကန့်', - m: 'တစ်မိနစ်', - mm: '%d မိနစ်', - h: 'တစ်နာရီ', - hh: '%d နာရီ', - d: 'တစ်ရက်', - dd: '%d ရက်', - M: 'တစ်လ', - MM: '%d လ', - y: 'တစ်နှစ်', - yy: '%d နှစ်' - }, - preparse: function (string) { - return string.replace(/[၁၂၃၄၅၆၇၈၉၀]/g, function (match) { - return numberMap$b[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$c[match]; - }); - }, - 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('nb', { - months : 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split('_'), - monthsShort : 'jan._feb._mars_april_mai_juni_juli_aug._sep._okt._nov._des.'.split('_'), - monthsParseExact : true, - weekdays : 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'), - weekdaysShort : 'sø._ma._ti._on._to._fr._lø.'.split('_'), - weekdaysMin : 'sø_ma_ti_on_to_fr_lø'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY [kl.] HH:mm', - LLLL : 'dddd D. MMMM YYYY [kl.] HH:mm' - }, - calendar : { - sameDay: '[i dag kl.] LT', - nextDay: '[i morgen kl.] LT', - nextWeek: 'dddd [kl.] LT', - lastDay: '[i går kl.] LT', - lastWeek: '[forrige] dddd [kl.] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'om %s', - past : '%s siden', - s : 'noen sekunder', - ss : '%d sekunder', - m : 'ett minutt', - mm : '%d minutter', - h : 'en time', - hh : '%d timer', - d : 'en dag', - dd : '%d dager', - M : 'en måned', - MM : '%d måneder', - y : 'ett år', - yy : '%d år' - }, - 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 - - var symbolMap$d = { - '1': '१', - '2': '२', - '3': '३', - '4': '४', - '5': '५', - '6': '६', - '7': '७', - '8': '८', - '9': '९', - '0': '०' - }, - numberMap$c = { - '१': '1', - '२': '2', - '३': '3', - '४': '4', - '५': '5', - '६': '6', - '७': '7', - '८': '8', - '९': '9', - '०': '0' - }; - - moment.defineLocale('ne', { - months : 'जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर'.split('_'), - monthsShort : 'जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.'.split('_'), - monthsParseExact : true, - weekdays : 'आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार'.split('_'), - weekdaysShort : 'आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.'.split('_'), - weekdaysMin : 'आ._सो._मं._बु._बि._शु._श.'.split('_'), - weekdaysParseExact : true, - 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 बजे' - }, - preparse: function (string) { - return string.replace(/[१२३४५६७८९०]/g, function (match) { - return numberMap$c[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$d[match]; - }); - }, - meridiemParse: /राति|बिहान|दिउँसो|साँझ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'राति') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'बिहान') { - return hour; - } else if (meridiem === 'दिउँसो') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'साँझ') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 3) { - return 'राति'; - } else if (hour < 12) { - return 'बिहान'; - } else if (hour < 16) { - return 'दिउँसो'; - } else if (hour < 20) { - return 'साँझ'; - } else { - return 'राति'; - } - }, - calendar : { - sameDay : '[आज] LT', - nextDay : '[भोलि] LT', - nextWeek : '[आउँदो] dddd[,] LT', - lastDay : '[हिजो] LT', - lastWeek : '[गएको] dddd[,] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%sमा', - past : '%s अगाडि', - s : 'केही क्षण', - ss : '%d सेकेण्ड', - m : 'एक मिनेट', - mm : '%d मिनेट', - h : 'एक घण्टा', - hh : '%d घण्टा', - d : 'एक दिन', - dd : '%d दिन', - M : 'एक महिना', - MM : '%d महिना', - y : 'एक बर्ष', - yy : '%d बर्ष' - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - //! moment.js locale configuration - - 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$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('_'), - monthsShort : function (m, format) { - if (!m) { - return monthsShortWithDots$1; - } else if (/-MMM-/.test(format)) { - return monthsShortWithoutDots$1[m.month()]; - } else { - return monthsShortWithDots$1[m.month()]; - } - }, - - 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$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('_'), - weekdaysMin : 'zo_ma_di_wo_do_vr_za'.split('_'), - weekdaysParseExact : true, - 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: '[vandaag om] LT', - nextDay: '[morgen om] LT', - nextWeek: 'dddd [om] LT', - lastDay: '[gisteren om] LT', - lastWeek: '[afgelopen] dddd [om] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'over %s', - past : '%s geleden', - s : 'een paar seconden', - ss : '%d seconden', - m : 'één minuut', - mm : '%d minuten', - h : 'één uur', - hh : '%d uur', - d : 'één dag', - dd : '%d dagen', - M : 'één maand', - MM : '%d maanden', - y : 'één jaar', - yy : '%d jaar' - }, - dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/, - ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); - }, - 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 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$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('_'), - monthsShort : function (m, format) { - if (!m) { - return monthsShortWithDots$2; - } else if (/-MMM-/.test(format)) { - return monthsShortWithoutDots$2[m.month()]; - } else { - return monthsShortWithDots$2[m.month()]; - } - }, - - 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$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('_'), - weekdaysMin : 'zo_ma_di_wo_do_vr_za'.split('_'), - weekdaysParseExact : true, - 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: '[vandaag om] LT', - nextDay: '[morgen om] LT', - nextWeek: 'dddd [om] LT', - lastDay: '[gisteren om] LT', - lastWeek: '[afgelopen] dddd [om] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'over %s', - past : '%s geleden', - s : 'een paar seconden', - ss : '%d seconden', - m : 'één minuut', - mm : '%d minuten', - h : 'één uur', - hh : '%d uur', - d : 'één dag', - dd : '%d dagen', - M : 'één maand', - MM : '%d maanden', - y : 'één jaar', - yy : '%d jaar' - }, - dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/, - ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); - }, - 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('nn', { - months : 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split('_'), - monthsShort : 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'), - weekdays : 'sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag'.split('_'), - weekdaysShort : 'sun_mån_tys_ons_tor_fre_lau'.split('_'), - weekdaysMin : 'su_må_ty_on_to_fr_lø'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY [kl.] H:mm', - LLLL : 'dddd D. MMMM YYYY [kl.] HH:mm' - }, - calendar : { - sameDay: '[I dag klokka] LT', - nextDay: '[I morgon klokka] LT', - nextWeek: 'dddd [klokka] LT', - lastDay: '[I går klokka] LT', - lastWeek: '[Føregåande] dddd [klokka] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'om %s', - past : '%s sidan', - s : 'nokre sekund', - ss : '%d sekund', - m : 'eit minutt', - mm : '%d minutt', - h : 'ein time', - hh : '%d timar', - d : 'ein dag', - dd : '%d dagar', - M : 'ein månad', - MM : '%d månader', - y : 'eit år', - yy : '%d år' - }, - 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 - - var symbolMap$e = { - '1': '੧', - '2': '੨', - '3': '੩', - '4': '੪', - '5': '੫', - '6': '੬', - '7': '੭', - '8': '੮', - '9': '੯', - '0': '੦' - }, - numberMap$d = { - '੧': '1', - '੨': '2', - '੩': '3', - '੪': '4', - '੫': '5', - '੬': '6', - '੭': '7', - '੮': '8', - '੯': '9', - '੦': '0' - }; - - moment.defineLocale('pa-in', { - // There are months name as per Nanakshahi Calendar but they are not used as rigidly in modern Punjabi. - months : 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split('_'), - monthsShort : 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split('_'), - weekdays : 'ਐਤਵਾਰ_ਸੋਮਵਾਰ_ਮੰਗਲਵਾਰ_ਬੁਧਵਾਰ_ਵੀਰਵਾਰ_ਸ਼ੁੱਕਰਵਾਰ_ਸ਼ਨੀਚਰਵਾਰ'.split('_'), - weekdaysShort : 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'), - weekdaysMin : 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.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 : '[ਅਜ] LT', - nextDay : '[ਕਲ] LT', - nextWeek : '[ਅਗਲਾ] dddd, LT', - lastDay : '[ਕਲ] LT', - lastWeek : '[ਪਿਛਲੇ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ਵਿੱਚ', - past : '%s ਪਿਛਲੇ', - s : 'ਕੁਝ ਸਕਿੰਟ', - ss : '%d ਸਕਿੰਟ', - m : 'ਇਕ ਮਿੰਟ', - mm : '%d ਮਿੰਟ', - h : 'ਇੱਕ ਘੰਟਾ', - hh : '%d ਘੰਟੇ', - d : 'ਇੱਕ ਦਿਨ', - dd : '%d ਦਿਨ', - M : 'ਇੱਕ ਮਹੀਨਾ', - MM : '%d ਮਹੀਨੇ', - y : 'ਇੱਕ ਸਾਲ', - yy : '%d ਸਾਲ' - }, - preparse: function (string) { - return string.replace(/[੧੨੩੪੫੬੭੮੯੦]/g, function (match) { - return numberMap$d[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$e[match]; - }); - }, - // Punjabi notation for meridiems are quite fuzzy in practice. While there exists - // a rigid notion of a 'Pahar' it is not used as rigidly in modern Punjabi. - meridiemParse: /ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'ਰਾਤ') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'ਸਵੇਰ') { - return hour; - } else if (meridiem === 'ਦੁਪਹਿਰ') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'ਸ਼ਾਮ') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ਰਾਤ'; - } else if (hour < 10) { - return 'ਸਵੇਰ'; - } else if (hour < 17) { - return 'ਦੁਪਹਿਰ'; - } else if (hour < 20) { - return 'ਸ਼ਾਮ'; - } else { - return 'ਰਾਤ'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - //! moment.js locale configuration - - var monthsNominative = 'styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień'.split('_'), - monthsSubjective = 'stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia'.split('_'); - function plural$3(n) { - return (n % 10 < 5) && (n % 10 > 1) && ((~~(n / 10) % 10) !== 1); - } - function translate$8(number, withoutSuffix, key) { - var result = number + ' '; - switch (key) { - case 'ss': - return result + (plural$3(number) ? 'sekundy' : 'sekund'); - case 'm': - return withoutSuffix ? 'minuta' : 'minutę'; - case 'mm': - return result + (plural$3(number) ? 'minuty' : 'minut'); - case 'h': - return withoutSuffix ? 'godzina' : 'godzinę'; - case 'hh': - return result + (plural$3(number) ? 'godziny' : 'godzin'); - case 'MM': - return result + (plural$3(number) ? 'miesiące' : 'miesięcy'); - case 'yy': - return result + (plural$3(number) ? 'lata' : 'lat'); - } - } - - moment.defineLocale('pl', { - months : function (momentToFormat, format) { - if (!momentToFormat) { - return monthsNominative; - } else if (format === '') { - // Hack: if format empty we know this is used to generate - // RegExp by moment. Give then back both valid forms of months - // in RegExp ready format. - return '(' + monthsSubjective[momentToFormat.month()] + '|' + monthsNominative[momentToFormat.month()] + ')'; - } else if (/D MMMM/.test(format)) { - return monthsSubjective[momentToFormat.month()]; - } else { - return monthsNominative[momentToFormat.month()]; - } - }, - monthsShort : 'sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru'.split('_'), - weekdays : 'niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota'.split('_'), - weekdaysShort : 'ndz_pon_wt_śr_czw_pt_sob'.split('_'), - weekdaysMin : 'Nd_Pn_Wt_Śr_Cz_Pt_So'.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: '[Dziś o] LT', - nextDay: '[Jutro o] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[W niedzielę o] LT'; - - case 2: - return '[We wtorek o] LT'; - - case 3: - return '[W środę o] LT'; - - case 6: - return '[W sobotę o] LT'; - - default: - return '[W] dddd [o] LT'; - } - }, - lastDay: '[Wczoraj o] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[W zeszłą niedzielę o] LT'; - case 3: - return '[W zeszłą środę o] LT'; - case 6: - return '[W zeszłą sobotę o] LT'; - default: - return '[W zeszły] dddd [o] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'za %s', - past : '%s temu', - s : 'kilka sekund', - ss : translate$8, - m : translate$8, - mm : translate$8, - h : translate$8, - hh : translate$8, - d : '1 dzień', - dd : '%d dni', - M : 'miesiąc', - MM : translate$8, - y : 'rok', - yy : translate$8 - }, - 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('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('_'), - 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('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [de] MMMM [de] YYYY', - LLL : 'D [de] MMMM [de] YYYY [às] HH:mm', - LLLL : 'dddd, D [de] MMMM [de] YYYY [às] HH:mm' - }, - calendar : { - sameDay: '[Hoje às] LT', - nextDay: '[Amanhã às] LT', - nextWeek: 'dddd [às] LT', - lastDay: '[Ontem às] LT', - lastWeek: function () { - return (this.day() === 0 || this.day() === 6) ? - '[Último] dddd [às] LT' : // Saturday + Sunday - '[Última] dddd [às] LT'; // Monday - Friday - }, - sameElse: 'L' - }, - relativeTime : { - future : 'em %s', - past : 'há %s', - s : 'poucos segundos', - ss : '%d segundos', - m : 'um minuto', - mm : '%d minutos', - h : 'uma hora', - hh : '%d horas', - d : 'um dia', - dd : '%d dias', - M : 'um mês', - MM : '%d meses', - y : 'um ano', - yy : '%d anos' - }, - dayOfMonthOrdinalParse: /\d{1,2}º/, - ordinal : '%dº' - }); - - //! 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('_'), - 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('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [de] MMMM [de] YYYY', - LLL : 'D [de] MMMM [de] YYYY HH:mm', - LLLL : 'dddd, D [de] MMMM [de] YYYY HH:mm' - }, - calendar : { - sameDay: '[Hoje às] LT', - nextDay: '[Amanhã às] LT', - nextWeek: 'dddd [às] LT', - lastDay: '[Ontem às] LT', - lastWeek: function () { - return (this.day() === 0 || this.day() === 6) ? - '[Último] dddd [às] LT' : // Saturday + Sunday - '[Última] dddd [às] LT'; // Monday - Friday - }, - sameElse: 'L' - }, - relativeTime : { - future : 'em %s', - past : 'há %s', - s : 'segundos', - ss : '%d segundos', - m : 'um minuto', - mm : '%d minutos', - h : 'uma hora', - hh : '%d horas', - d : 'um dia', - dd : '%d dias', - M : 'um mês', - MM : '%d meses', - y : 'um ano', - yy : '%d anos' - }, - 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 - - function relativeTimeWithPlural$2(number, withoutSuffix, key) { - var format = { - 'ss': 'secunde', - 'mm': 'minute', - 'hh': 'ore', - 'dd': 'zile', - 'MM': 'luni', - 'yy': 'ani' - }, - separator = ' '; - if (number % 100 >= 20 || (number >= 100 && number % 100 === 0)) { - separator = ' de '; - } - return number + separator + format[key]; - } - - moment.defineLocale('ro', { - months : 'ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie'.split('_'), - monthsShort : 'ian._febr._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'duminică_luni_marți_miercuri_joi_vineri_sâmbătă'.split('_'), - weekdaysShort : 'Dum_Lun_Mar_Mie_Joi_Vin_Sâm'.split('_'), - weekdaysMin : 'Du_Lu_Ma_Mi_Jo_Vi_Sâ'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY H:mm', - LLLL : 'dddd, D MMMM YYYY H:mm' - }, - calendar : { - sameDay: '[azi la] LT', - nextDay: '[mâine la] LT', - nextWeek: 'dddd [la] LT', - lastDay: '[ieri la] LT', - lastWeek: '[fosta] dddd [la] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'peste %s', - past : '%s în urmă', - s : 'câteva secunde', - ss : relativeTimeWithPlural$2, - m : 'un minut', - mm : relativeTimeWithPlural$2, - h : 'o oră', - hh : relativeTimeWithPlural$2, - d : 'o zi', - dd : relativeTimeWithPlural$2, - M : 'o lună', - MM : relativeTimeWithPlural$2, - y : 'un an', - yy : relativeTimeWithPlural$2 - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - function plural$4(word, num) { - var forms = word.split('_'); - return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]); - } - function relativeTimeWithPlural$3(number, withoutSuffix, key) { - var format = { - 'ss': withoutSuffix ? 'секунда_секунды_секунд' : 'секунду_секунды_секунд', - 'mm': withoutSuffix ? 'минута_минуты_минут' : 'минуту_минуты_минут', - 'hh': 'час_часа_часов', - 'dd': 'день_дня_дней', - 'MM': 'месяц_месяца_месяцев', - 'yy': 'год_года_лет' - }; - if (key === 'm') { - return withoutSuffix ? 'минута' : 'минуту'; - } - else { - return number + ' ' + plural$4(format[key], +number); - } - } - 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 - // CLDR data: http://www.unicode.org/cldr/charts/28/summary/ru.html#1753 - moment.defineLocale('ru', { - months : { - format: 'января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря'.split('_'), - standalone: 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_') - }, - monthsShort : { - // по CLDR именно "июл." и "июн.", но какой смысл менять букву на точку ? - format: 'янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.'.split('_'), - standalone: 'янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.'.split('_') - }, - weekdays : { - standalone: 'воскресенье_понедельник_вторник_среда_четверг_пятница_суббота'.split('_'), - format: 'воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу'.split('_'), - isFormat: /\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?\] ?dddd/ - }, - weekdaysShort : 'вс_пн_вт_ср_чт_пт_сб'.split('_'), - weekdaysMin : 'вс_пн_вт_ср_чт_пт_сб'.split('_'), - monthsParse : monthsParse$6, - longMonthsParse : monthsParse$6, - shortMonthsParse : monthsParse$6, - - // полные названия с падежами, по три буквы, для некоторых, по 4 буквы, сокращения с точкой и без точки - monthsRegex: /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i, - - // копия предыдущего - monthsShortRegex: /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i, - - // полные названия с падежами - monthsStrictRegex: /^(январ[яь]|феврал[яь]|марта?|апрел[яь]|ма[яй]|июн[яь]|июл[яь]|августа?|сентябр[яь]|октябр[яь]|ноябр[яь]|декабр[яь])/i, - - // Выражение, которое соотвествует только сокращённым формам - monthsShortStrictRegex: /^(янв\.|февр?\.|мар[т.]|апр\.|ма[яй]|июн[ья.]|июл[ья.]|авг\.|сент?\.|окт\.|нояб?\.|дек\.)/i, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY г.', - LLL : 'D MMMM YYYY г., H:mm', - LLLL : 'dddd, D MMMM YYYY г., H:mm' - }, - calendar : { - sameDay: '[Сегодня, в] LT', - nextDay: '[Завтра, в] LT', - lastDay: '[Вчера, в] LT', - nextWeek: function (now) { - if (now.week() !== this.week()) { - switch (this.day()) { - case 0: - return '[В следующее] dddd, [в] LT'; - case 1: - case 2: - case 4: - return '[В следующий] dddd, [в] LT'; - case 3: - case 5: - case 6: - return '[В следующую] dddd, [в] LT'; - } - } else { - if (this.day() === 2) { - return '[Во] dddd, [в] LT'; - } else { - return '[В] dddd, [в] LT'; - } - } - }, - lastWeek: function (now) { - if (now.week() !== this.week()) { - switch (this.day()) { - case 0: - return '[В прошлое] dddd, [в] LT'; - case 1: - case 2: - case 4: - return '[В прошлый] dddd, [в] LT'; - case 3: - case 5: - case 6: - return '[В прошлую] dddd, [в] LT'; - } - } else { - if (this.day() === 2) { - return '[Во] dddd, [в] LT'; - } else { - return '[В] dddd, [в] LT'; - } - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'через %s', - past : '%s назад', - s : 'несколько секунд', - ss : relativeTimeWithPlural$3, - m : relativeTimeWithPlural$3, - mm : relativeTimeWithPlural$3, - h : 'час', - hh : relativeTimeWithPlural$3, - d : 'день', - dd : relativeTimeWithPlural$3, - M : 'месяц', - MM : relativeTimeWithPlural$3, - y : 'год', - yy : relativeTimeWithPlural$3 - }, - meridiemParse: /ночи|утра|дня|вечера/i, - isPM : function (input) { - return /^(дня|вечера)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ночи'; - } else if (hour < 12) { - return 'утра'; - } else if (hour < 17) { - return 'дня'; - } else { - return 'вечера'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}-(й|го|я)/, - ordinal: function (number, period) { - switch (period) { - case 'M': - case 'd': - case 'DDD': - return number + '-й'; - case 'D': - return number + '-го'; - case 'w': - case 'W': - return number + '-я'; - default: - return number; - } - }, - 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$7 = [ - 'جنوري', - 'فيبروري', - 'مارچ', - 'اپريل', - 'مئي', - 'جون', - 'جولاءِ', - 'آگسٽ', - 'سيپٽمبر', - 'آڪٽوبر', - 'نومبر', - 'ڊسمبر' - ]; - var days = [ - 'آچر', - 'سومر', - 'اڱارو', - 'اربع', - 'خميس', - 'جمع', - 'ڇنڇر' - ]; - - moment.defineLocale('sd', { - months : months$7, - monthsShort : months$7, - weekdays : days, - weekdaysShort : days, - weekdaysMin : days, - 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: /صبح|شام/, - isPM : function (input) { - return 'شام' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'صبح'; - } - return 'شام'; - }, - calendar : { - sameDay : '[اڄ] LT', - nextDay : '[سڀاڻي] LT', - nextWeek : 'dddd [اڳين هفتي تي] LT', - lastDay : '[ڪالهه] LT', - lastWeek : '[گزريل هفتي] dddd [تي] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s پوء', - past : '%s اڳ', - s : 'چند سيڪنڊ', - ss : '%d سيڪنڊ', - m : 'هڪ منٽ', - mm : '%d منٽ', - h : 'هڪ ڪلاڪ', - hh : '%d ڪلاڪ', - d : 'هڪ ڏينهن', - dd : '%d ڏينهن', - M : 'هڪ مهينو', - MM : '%d مهينا', - y : 'هڪ سال', - yy : '%d سال' - }, - preparse: function (string) { - return string.replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/,/g, '،'); - }, - 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('se', { - months : 'ođđajagemánnu_guovvamánnu_njukčamánnu_cuoŋománnu_miessemánnu_geassemánnu_suoidnemánnu_borgemánnu_čakčamánnu_golggotmánnu_skábmamánnu_juovlamánnu'.split('_'), - monthsShort : 'ođđj_guov_njuk_cuo_mies_geas_suoi_borg_čakč_golg_skáb_juov'.split('_'), - weekdays : 'sotnabeaivi_vuossárga_maŋŋebárga_gaskavahkku_duorastat_bearjadat_lávvardat'.split('_'), - weekdaysShort : 'sotn_vuos_maŋ_gask_duor_bear_láv'.split('_'), - weekdaysMin : 's_v_m_g_d_b_L'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'MMMM D. [b.] YYYY', - LLL : 'MMMM D. [b.] YYYY [ti.] HH:mm', - LLLL : 'dddd, MMMM D. [b.] YYYY [ti.] HH:mm' - }, - calendar : { - sameDay: '[otne ti] LT', - nextDay: '[ihttin ti] LT', - nextWeek: 'dddd [ti] LT', - lastDay: '[ikte ti] LT', - lastWeek: '[ovddit] dddd [ti] LT', - sameElse: 'L' - }, - relativeTime : { - future : '%s geažes', - past : 'maŋit %s', - s : 'moadde sekunddat', - ss: '%d sekunddat', - m : 'okta minuhta', - mm : '%d minuhtat', - h : 'okta diimmu', - hh : '%d diimmut', - d : 'okta beaivi', - dd : '%d beaivvit', - M : 'okta mánnu', - MM : '%d mánut', - y : 'okta jahki', - yy : '%d jagit' - }, - 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 - - /*jshint -W100*/ - moment.defineLocale('si', { - months : 'ජනවාරි_පෙබරවාරි_මාර්තු_අප්‍රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්'.split('_'), - monthsShort : 'ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ'.split('_'), - weekdays : 'ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්‍රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා'.split('_'), - weekdaysShort : 'ඉරි_සඳු_අඟ_බදා_බ්‍රහ_සිකු_සෙන'.split('_'), - weekdaysMin : 'ඉ_ස_අ_බ_බ්‍ර_සි_සෙ'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'a h:mm', - LTS : 'a h:mm:ss', - L : 'YYYY/MM/DD', - LL : 'YYYY MMMM D', - LLL : 'YYYY MMMM D, a h:mm', - LLLL : 'YYYY MMMM D [වැනි] dddd, a h:mm:ss' - }, - calendar : { - sameDay : '[අද] LT[ට]', - nextDay : '[හෙට] LT[ට]', - nextWeek : 'dddd LT[ට]', - lastDay : '[ඊයේ] LT[ට]', - lastWeek : '[පසුගිය] dddd LT[ට]', - sameElse : 'L' - }, - relativeTime : { - future : '%sකින්', - past : '%sකට පෙර', - s : 'තත්පර කිහිපය', - ss : 'තත්පර %d', - m : 'මිනිත්තුව', - mm : 'මිනිත්තු %d', - h : 'පැය', - hh : 'පැය %d', - d : 'දිනය', - dd : 'දින %d', - M : 'මාසය', - MM : 'මාස %d', - y : 'වසර', - yy : 'වසර %d' - }, - dayOfMonthOrdinalParse: /\d{1,2} වැනි/, - ordinal : function (number) { - return number + ' වැනි'; - }, - meridiemParse : /පෙර වරු|පස් වරු|පෙ.ව|ප.ව./, - isPM : function (input) { - return input === 'ප.ව.' || input === 'පස් වරු'; - }, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'ප.ව.' : 'පස් වරු'; - } else { - return isLower ? 'පෙ.ව.' : 'පෙර වරු'; - } - } - }); - - //! 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$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); - } - function translate$9(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': // a few seconds / in a few seconds / a few seconds ago - return (withoutSuffix || isFuture) ? 'pár sekúnd' : 'pár sekundami'; - case 'ss': // 9 seconds / in 9 seconds / 9 seconds ago - if (withoutSuffix || isFuture) { - return result + (plural$5(number) ? 'sekundy' : 'sekúnd'); - } else { - return result + 'sekundami'; - } - break; - case 'm': // a minute / in a minute / a minute ago - return withoutSuffix ? 'minúta' : (isFuture ? 'minútu' : 'minútou'); - case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago - if (withoutSuffix || isFuture) { - return result + (plural$5(number) ? 'minúty' : 'minút'); - } else { - return result + 'minútami'; - } - break; - case 'h': // an hour / in an hour / an hour ago - return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou'); - case 'hh': // 9 hours / in 9 hours / 9 hours ago - if (withoutSuffix || isFuture) { - return result + (plural$5(number) ? 'hodiny' : 'hodín'); - } else { - return result + 'hodinami'; - } - break; - case 'd': // a day / in a day / a day ago - return (withoutSuffix || isFuture) ? 'deň' : 'dňom'; - case 'dd': // 9 days / in 9 days / 9 days ago - if (withoutSuffix || isFuture) { - return result + (plural$5(number) ? 'dni' : 'dní'); - } else { - return result + 'dňami'; - } - break; - case 'M': // a month / in a month / a month ago - return (withoutSuffix || isFuture) ? 'mesiac' : 'mesiacom'; - case 'MM': // 9 months / in 9 months / 9 months ago - if (withoutSuffix || isFuture) { - return result + (plural$5(number) ? 'mesiace' : 'mesiacov'); - } else { - return result + 'mesiacmi'; - } - break; - case 'y': // a year / in a year / a year ago - return (withoutSuffix || isFuture) ? 'rok' : 'rokom'; - case 'yy': // 9 years / in 9 years / 9 years ago - if (withoutSuffix || isFuture) { - return result + (plural$5(number) ? 'roky' : 'rokov'); - } else { - return result + 'rokmi'; - } - break; - } - } - - moment.defineLocale('sk', { - 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('_'), - longDateFormat : { - LT: 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd D. MMMM YYYY H:mm' - }, - calendar : { - sameDay: '[dnes o] LT', - nextDay: '[zajtra o] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[v nedeľu o] LT'; - case 1: - case 2: - return '[v] dddd [o] LT'; - case 3: - return '[v stredu o] LT'; - case 4: - return '[vo štvrtok o] LT'; - case 5: - return '[v piatok o] LT'; - case 6: - return '[v sobotu o] LT'; - } - }, - lastDay: '[včera o] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[minulú nedeľu o] LT'; - case 1: - case 2: - return '[minulý] dddd [o] LT'; - case 3: - return '[minulú stredu o] LT'; - case 4: - case 5: - return '[minulý] dddd [o] LT'; - case 6: - return '[minulú sobotu o] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'za %s', - past : 'pred %s', - s : translate$9, - ss : translate$9, - m : translate$9, - mm : translate$9, - h : translate$9, - hh : translate$9, - d : translate$9, - dd : translate$9, - M : translate$9, - MM : translate$9, - y : translate$9, - yy : translate$9 - }, - 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 - - function processRelativeTime$6(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': - return withoutSuffix || isFuture ? 'nekaj sekund' : 'nekaj sekundami'; - case 'ss': - if (number === 1) { - result += withoutSuffix ? 'sekundo' : 'sekundi'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'sekundi' : 'sekundah'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'sekunde' : 'sekundah'; - } else { - result += 'sekund'; - } - return result; - case 'm': - return withoutSuffix ? 'ena minuta' : 'eno minuto'; - case 'mm': - if (number === 1) { - result += withoutSuffix ? 'minuta' : 'minuto'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'minuti' : 'minutama'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'minute' : 'minutami'; - } else { - result += withoutSuffix || isFuture ? 'minut' : 'minutami'; - } - return result; - case 'h': - return withoutSuffix ? 'ena ura' : 'eno uro'; - case 'hh': - if (number === 1) { - result += withoutSuffix ? 'ura' : 'uro'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'uri' : 'urama'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'ure' : 'urami'; - } else { - result += withoutSuffix || isFuture ? 'ur' : 'urami'; - } - return result; - case 'd': - return withoutSuffix || isFuture ? 'en dan' : 'enim dnem'; - case 'dd': - if (number === 1) { - result += withoutSuffix || isFuture ? 'dan' : 'dnem'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'dni' : 'dnevoma'; - } else { - result += withoutSuffix || isFuture ? 'dni' : 'dnevi'; - } - return result; - case 'M': - return withoutSuffix || isFuture ? 'en mesec' : 'enim mesecem'; - case 'MM': - if (number === 1) { - result += withoutSuffix || isFuture ? 'mesec' : 'mesecem'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'meseca' : 'mesecema'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'mesece' : 'meseci'; - } else { - result += withoutSuffix || isFuture ? 'mesecev' : 'meseci'; - } - return result; - case 'y': - return withoutSuffix || isFuture ? 'eno leto' : 'enim letom'; - case 'yy': - if (number === 1) { - result += withoutSuffix || isFuture ? 'leto' : 'letom'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'leti' : 'letoma'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'leta' : 'leti'; - } else { - result += withoutSuffix || isFuture ? 'let' : 'leti'; - } - return result; - } - } - - moment.defineLocale('sl', { - months : 'januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december'.split('_'), - monthsShort : 'jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota'.split('_'), - weekdaysShort : 'ned._pon._tor._sre._čet._pet._sob.'.split('_'), - weekdaysMin : 'ne_po_to_sr_če_pe_so'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[danes ob] LT', - nextDay : '[jutri ob] LT', - - nextWeek : function () { - switch (this.day()) { - case 0: - return '[v] [nedeljo] [ob] LT'; - case 3: - return '[v] [sredo] [ob] LT'; - case 6: - return '[v] [soboto] [ob] LT'; - case 1: - case 2: - case 4: - case 5: - return '[v] dddd [ob] LT'; - } - }, - lastDay : '[včeraj ob] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - return '[prejšnjo] [nedeljo] [ob] LT'; - case 3: - return '[prejšnjo] [sredo] [ob] LT'; - case 6: - return '[prejšnjo] [soboto] [ob] LT'; - case 1: - case 2: - case 4: - case 5: - return '[prejšnji] dddd [ob] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'čez %s', - past : 'pred %s', - s : processRelativeTime$6, - ss : processRelativeTime$6, - m : processRelativeTime$6, - mm : processRelativeTime$6, - h : processRelativeTime$6, - hh : processRelativeTime$6, - d : processRelativeTime$6, - dd : processRelativeTime$6, - M : processRelativeTime$6, - MM : processRelativeTime$6, - y : processRelativeTime$6, - yy : processRelativeTime$6 - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - moment.defineLocale('sq', { - months : 'Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor'.split('_'), - monthsShort : 'Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj'.split('_'), - weekdays : 'E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë'.split('_'), - weekdaysShort : 'Die_Hën_Mar_Mër_Enj_Pre_Sht'.split('_'), - weekdaysMin : 'D_H_Ma_Më_E_P_Sh'.split('_'), - weekdaysParseExact : true, - meridiemParse: /PD|MD/, - isPM: function (input) { - return input.charAt(0) === 'M'; - }, - meridiem : function (hours, minutes, isLower) { - return hours < 12 ? 'PD' : 'MD'; - }, - 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 : '[Sot në] LT', - nextDay : '[Nesër në] LT', - nextWeek : 'dddd [në] LT', - lastDay : '[Dje në] LT', - lastWeek : 'dddd [e kaluar në] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'në %s', - past : '%s më parë', - s : 'disa sekonda', - ss : '%d sekonda', - m : 'një minutë', - mm : '%d minuta', - h : 'një orë', - hh : '%d orë', - d : 'një ditë', - dd : '%d ditë', - M : 'një muaj', - MM : '%d muaj', - y : 'një vit', - yy : '%d vite' - }, - 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 - - var translator$1 = { - words: { //Different grammatical cases - ss: ['секунда', 'секунде', 'секунди'], - m: ['један минут', 'једне минуте'], - mm: ['минут', 'минуте', 'минута'], - h: ['један сат', 'једног сата'], - hh: ['сат', 'сата', 'сати'], - dd: ['дан', 'дана', 'дана'], - MM: ['месец', 'месеца', 'месеци'], - yy: ['година', 'године', 'година'] - }, - correctGrammaticalCase: function (number, wordKey) { - return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]); - }, - translate: function (number, withoutSuffix, key) { - var wordKey = translator$1.words[key]; - if (key.length === 1) { - return withoutSuffix ? wordKey[0] : wordKey[1]; - } else { - return number + ' ' + translator$1.correctGrammaticalCase(number, wordKey); - } - } - }; - - moment.defineLocale('sr-cyrl', { - months: 'јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар'.split('_'), - monthsShort: 'јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.'.split('_'), - monthsParseExact: true, - weekdays: 'недеља_понедељак_уторак_среда_четвртак_петак_субота'.split('_'), - weekdaysShort: 'нед._пон._уто._сре._чет._пет._суб.'.split('_'), - weekdaysMin: 'не_по_ут_ср_че_пе_су'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm', - LTS : 'H:mm:ss', - L: 'DD.MM.YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm', - LLLL: 'dddd, D. MMMM YYYY H:mm' - }, - calendar: { - sameDay: '[данас у] LT', - nextDay: '[сутра у] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[у] [недељу] [у] LT'; - case 3: - return '[у] [среду] [у] LT'; - case 6: - return '[у] [суботу] [у] LT'; - case 1: - case 2: - case 4: - case 5: - return '[у] dddd [у] LT'; - } - }, - lastDay : '[јуче у] LT', - lastWeek : function () { - var lastWeekDays = [ - '[прошле] [недеље] [у] LT', - '[прошлог] [понедељка] [у] LT', - '[прошлог] [уторка] [у] LT', - '[прошле] [среде] [у] LT', - '[прошлог] [четвртка] [у] LT', - '[прошлог] [петка] [у] LT', - '[прошле] [суботе] [у] LT' - ]; - return lastWeekDays[this.day()]; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'за %s', - past : 'пре %s', - s : 'неколико секунди', - ss : translator$1.translate, - m : translator$1.translate, - mm : translator$1.translate, - h : translator$1.translate, - hh : translator$1.translate, - d : 'дан', - dd : translator$1.translate, - M : 'месец', - MM : translator$1.translate, - y : 'годину', - yy : translator$1.translate - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - var translator$2 = { - words: { //Different grammatical cases - ss: ['sekunda', 'sekunde', 'sekundi'], - m: ['jedan minut', 'jedne minute'], - mm: ['minut', 'minute', 'minuta'], - h: ['jedan sat', 'jednog sata'], - hh: ['sat', 'sata', 'sati'], - dd: ['dan', 'dana', 'dana'], - MM: ['mesec', 'meseca', 'meseci'], - yy: ['godina', 'godine', 'godina'] - }, - correctGrammaticalCase: function (number, wordKey) { - return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]); - }, - translate: function (number, withoutSuffix, key) { - var wordKey = translator$2.words[key]; - if (key.length === 1) { - return withoutSuffix ? wordKey[0] : wordKey[1]; - } else { - return number + ' ' + translator$2.correctGrammaticalCase(number, wordKey); - } - } - }; - - moment.defineLocale('sr', { - months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split('_'), - monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays: 'nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota'.split('_'), - weekdaysShort: 'ned._pon._uto._sre._čet._pet._sub.'.split('_'), - weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm', - LTS : 'H:mm:ss', - L: 'DD.MM.YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm', - LLLL: 'dddd, D. MMMM YYYY H:mm' - }, - calendar: { - sameDay: '[danas u] LT', - nextDay: '[sutra u] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[u] [nedelju] [u] LT'; - case 3: - return '[u] [sredu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - }, - lastDay : '[juče u] LT', - lastWeek : function () { - var lastWeekDays = [ - '[prošle] [nedelje] [u] LT', - '[prošlog] [ponedeljka] [u] LT', - '[prošlog] [utorka] [u] LT', - '[prošle] [srede] [u] LT', - '[prošlog] [četvrtka] [u] LT', - '[prošlog] [petka] [u] LT', - '[prošle] [subote] [u] LT' - ]; - return lastWeekDays[this.day()]; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'pre %s', - s : 'nekoliko sekundi', - ss : translator$2.translate, - m : translator$2.translate, - mm : translator$2.translate, - h : translator$2.translate, - hh : translator$2.translate, - d : 'dan', - dd : translator$2.translate, - M : 'mesec', - MM : translator$2.translate, - y : 'godinu', - yy : translator$2.translate - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - moment.defineLocale('ss', { - months : "Bhimbidvwane_Indlovana_Indlov'lenkhulu_Mabasa_Inkhwekhweti_Inhlaba_Kholwane_Ingci_Inyoni_Imphala_Lweti_Ingongoni".split('_'), - monthsShort : 'Bhi_Ina_Inu_Mab_Ink_Inh_Kho_Igc_Iny_Imp_Lwe_Igo'.split('_'), - weekdays : 'Lisontfo_Umsombuluko_Lesibili_Lesitsatfu_Lesine_Lesihlanu_Umgcibelo'.split('_'), - weekdaysShort : 'Lis_Umb_Lsb_Les_Lsi_Lsh_Umg'.split('_'), - weekdaysMin : 'Li_Us_Lb_Lt_Ls_Lh_Ug'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[Namuhla nga] LT', - nextDay : '[Kusasa nga] LT', - nextWeek : 'dddd [nga] LT', - lastDay : '[Itolo nga] LT', - lastWeek : 'dddd [leliphelile] [nga] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'nga %s', - past : 'wenteka nga %s', - s : 'emizuzwana lomcane', - ss : '%d mzuzwana', - m : 'umzuzu', - mm : '%d emizuzu', - h : 'lihora', - hh : '%d emahora', - d : 'lilanga', - dd : '%d emalanga', - M : 'inyanga', - MM : '%d tinyanga', - y : 'umnyaka', - yy : '%d iminyaka' - }, - meridiemParse: /ekuseni|emini|entsambama|ebusuku/, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'ekuseni'; - } else if (hours < 15) { - return 'emini'; - } else if (hours < 19) { - return 'entsambama'; - } else { - return 'ebusuku'; - } - }, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'ekuseni') { - return hour; - } else if (meridiem === 'emini') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'entsambama' || meridiem === 'ebusuku') { - if (hour === 0) { - return 0; - } - return hour + 12; - } - }, - 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('sv', { - months : 'januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december'.split('_'), - monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), - weekdays : 'söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag'.split('_'), - weekdaysShort : 'sön_mån_tis_ons_tor_fre_lör'.split('_'), - weekdaysMin : 'sö_må_ti_on_to_fr_lö'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [kl.] HH:mm', - LLLL : 'dddd D MMMM YYYY [kl.] HH:mm', - lll : 'D MMM YYYY HH:mm', - llll : 'ddd D MMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Idag] LT', - nextDay: '[Imorgon] LT', - lastDay: '[Igår] LT', - nextWeek: '[På] dddd LT', - lastWeek: '[I] dddd[s] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'om %s', - past : 'för %s sedan', - s : 'några sekunder', - ss : '%d sekunder', - m : 'en minut', - mm : '%d minuter', - h : 'en timme', - hh : '%d timmar', - d : 'en dag', - dd : '%d dagar', - M : 'en månad', - MM : '%d månader', - y : 'ett år', - yy : '%d år' - }, - dayOfMonthOrdinalParse: /\d{1,2}(e|a)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'e' : - (b === 1) ? 'a' : - (b === 2) ? 'a' : - (b === 3) ? 'e' : 'e'; - 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('sw', { - months : 'Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba'.split('_'), - monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des'.split('_'), - weekdays : 'Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi'.split('_'), - weekdaysShort : 'Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos'.split('_'), - weekdaysMin : 'J2_J3_J4_J5_Al_Ij_J1'.split('_'), - weekdaysParseExact : true, - 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 : '[leo saa] LT', - nextDay : '[kesho saa] LT', - nextWeek : '[wiki ijayo] dddd [saat] LT', - lastDay : '[jana] LT', - lastWeek : '[wiki iliyopita] dddd [saat] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s baadaye', - past : 'tokea %s', - s : 'hivi punde', - ss : 'sekunde %d', - m : 'dakika moja', - mm : 'dakika %d', - h : 'saa limoja', - hh : 'masaa %d', - d : 'siku moja', - dd : 'masiku %d', - M : 'mwezi mmoja', - MM : 'miezi %d', - y : 'mwaka mmoja', - yy : 'miaka %d' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - var symbolMap$f = { - '1': '௧', - '2': '௨', - '3': '௩', - '4': '௪', - '5': '௫', - '6': '௬', - '7': '௭', - '8': '௮', - '9': '௯', - '0': '௦' - }, numberMap$e = { - '௧': '1', - '௨': '2', - '௩': '3', - '௪': '4', - '௫': '5', - '௬': '6', - '௭': '7', - '௮': '8', - '௯': '9', - '௦': '0' - }; - - moment.defineLocale('ta', { - months : 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'), - monthsShort : 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'), - weekdays : 'ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை'.split('_'), - weekdaysShort : 'ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி'.split('_'), - weekdaysMin : 'ஞா_தி_செ_பு_வி_வெ_ச'.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 : '[இன்று] LT', - nextDay : '[நாளை] LT', - nextWeek : 'dddd, LT', - lastDay : '[நேற்று] LT', - lastWeek : '[கடந்த வாரம்] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s இல்', - past : '%s முன்', - s : 'ஒரு சில விநாடிகள்', - ss : '%d விநாடிகள்', - m : 'ஒரு நிமிடம்', - mm : '%d நிமிடங்கள்', - h : 'ஒரு மணி நேரம்', - hh : '%d மணி நேரம்', - d : 'ஒரு நாள்', - dd : '%d நாட்கள்', - M : 'ஒரு மாதம்', - MM : '%d மாதங்கள்', - y : 'ஒரு வருடம்', - yy : '%d ஆண்டுகள்' - }, - dayOfMonthOrdinalParse: /\d{1,2}வது/, - ordinal : function (number) { - return number + 'வது'; - }, - preparse: function (string) { - return string.replace(/[௧௨௩௪௫௬௭௮௯௦]/g, function (match) { - return numberMap$e[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$f[match]; - }); - }, - // refer http://ta.wikipedia.org/s/1er1 - meridiemParse: /யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/, - meridiem : function (hour, minute, isLower) { - if (hour < 2) { - return ' யாமம்'; - } else if (hour < 6) { - return ' வைகறை'; // வைகறை - } else if (hour < 10) { - return ' காலை'; // காலை - } else if (hour < 14) { - return ' நண்பகல்'; // நண்பகல் - } else if (hour < 18) { - return ' எற்பாடு'; // எற்பாடு - } else if (hour < 22) { - return ' மாலை'; // மாலை - } else { - return ' யாமம்'; - } - }, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'யாமம்') { - return hour < 2 ? hour : hour + 12; - } else if (meridiem === 'வைகறை' || meridiem === 'காலை') { - return hour; - } else if (meridiem === 'நண்பகல்') { - return hour >= 10 ? hour : hour + 12; - } else { - return hour + 12; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - //! moment.js locale configuration - - moment.defineLocale('te', { - months : 'జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జులై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్'.split('_'), - monthsShort : 'జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జులై_ఆగ._సెప్._అక్టో._నవ._డిసె.'.split('_'), - monthsParseExact : true, - weekdays : 'ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం'.split('_'), - weekdaysShort : 'ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని'.split('_'), - weekdaysMin : 'ఆ_సో_మం_బు_గు_శు_శ'.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 : '[నేడు] LT', - nextDay : '[రేపు] LT', - nextWeek : 'dddd, LT', - lastDay : '[నిన్న] LT', - lastWeek : '[గత] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s లో', - past : '%s క్రితం', - s : 'కొన్ని క్షణాలు', - ss : '%d సెకన్లు', - m : 'ఒక నిమిషం', - mm : '%d నిమిషాలు', - h : 'ఒక గంట', - hh : '%d గంటలు', - d : 'ఒక రోజు', - dd : '%d రోజులు', - M : 'ఒక నెల', - MM : '%d నెలలు', - y : 'ఒక సంవత్సరం', - yy : '%d సంవత్సరాలు' - }, - dayOfMonthOrdinalParse : /\d{1,2}వ/, - ordinal : '%dవ', - meridiemParse: /రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'రాత్రి') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'ఉదయం') { - return hour; - } else if (meridiem === 'మధ్యాహ్నం') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'సాయంత్రం') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'రాత్రి'; - } else if (hour < 10) { - return 'ఉదయం'; - } else if (hour < 17) { - return 'మధ్యాహ్నం'; - } else if (hour < 20) { - return 'సాయంత్రం'; - } else { - return 'రాత్రి'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - //! moment.js locale configuration - - moment.defineLocale('tet', { - months : 'Janeiru_Fevereiru_Marsu_Abril_Maiu_Juñu_Jullu_Agustu_Setembru_Outubru_Novembru_Dezembru'.split('_'), - monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'), - weekdays : 'Domingu_Segunda_Tersa_Kuarta_Kinta_Sesta_Sabadu'.split('_'), - weekdaysShort : 'Dom_Seg_Ters_Kua_Kint_Sest_Sab'.split('_'), - weekdaysMin : 'Do_Seg_Te_Ku_Ki_Ses_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: '[Ohin iha] LT', - nextDay: '[Aban iha] LT', - nextWeek: 'dddd [iha] LT', - lastDay: '[Horiseik iha] LT', - lastWeek: 'dddd [semana kotuk] [iha] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'iha %s', - past : '%s liuba', - s : 'minutu balun', - ss : 'minutu %d', - m : 'minutu ida', - mm : 'minutu %d', - h : 'oras ida', - hh : 'oras %d', - d : 'loron ida', - dd : 'loron %d', - M : 'fulan ida', - MM : 'fulan %d', - y : 'tinan ida', - yy : 'tinan %d' - }, - 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 - - var suffixes$3 = { - 0: '-ум', - 1: '-ум', - 2: '-юм', - 3: '-юм', - 4: '-ум', - 5: '-ум', - 6: '-ум', - 7: '-ум', - 8: '-ум', - 9: '-ум', - 10: '-ум', - 12: '-ум', - 13: '-ум', - 20: '-ум', - 30: '-юм', - 40: '-ум', - 50: '-ум', - 60: '-ум', - 70: '-ум', - 80: '-ум', - 90: '-ум', - 100: '-ум' - }; - - moment.defineLocale('tg', { - months : 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split('_'), - monthsShort : 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'), - weekdays : 'якшанбе_душанбе_сешанбе_чоршанбе_панҷшанбе_ҷумъа_шанбе'.split('_'), - weekdaysShort : 'яшб_дшб_сшб_чшб_пшб_ҷум_шнб'.split('_'), - weekdaysMin : 'яш_дш_сш_чш_пш_ҷм_шб'.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 : '[Имрӯз соати] LT', - nextDay : '[Пагоҳ соати] LT', - lastDay : '[Дирӯз соати] LT', - nextWeek : 'dddd[и] [ҳафтаи оянда соати] LT', - lastWeek : 'dddd[и] [ҳафтаи гузашта соати] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'баъди %s', - past : '%s пеш', - s : 'якчанд сония', - m : 'як дақиқа', - mm : '%d дақиқа', - h : 'як соат', - hh : '%d соат', - d : 'як рӯз', - dd : '%d рӯз', - M : 'як моҳ', - MM : '%d моҳ', - y : 'як сол', - yy : '%d сол' - }, - meridiemParse: /шаб|субҳ|рӯз|бегоҳ/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'шаб') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'субҳ') { - return hour; - } else if (meridiem === 'рӯз') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'бегоҳ') { - return hour + 12; - } - }, - meridiem: function (hour, minute, isLower) { - if (hour < 4) { - return 'шаб'; - } else if (hour < 11) { - return 'субҳ'; - } else if (hour < 16) { - return 'рӯз'; - } else if (hour < 19) { - return 'бегоҳ'; - } else { - return 'шаб'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}-(ум|юм)/, - ordinal: function (number) { - var a = number % 10, - b = number >= 100 ? 100 : null; - return number + (suffixes$3[number] || suffixes$3[a] || suffixes$3[b]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1th is the first week of the year. - } - }); - - //! moment.js locale configuration - - moment.defineLocale('th', { - months : 'มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม'.split('_'), - monthsShort : 'ม.ค._ก.พ._มี.ค._เม.ย._พ.ค._มิ.ย._ก.ค._ส.ค._ก.ย._ต.ค._พ.ย._ธ.ค.'.split('_'), - monthsParseExact: true, - weekdays : 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์'.split('_'), - weekdaysShort : 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์'.split('_'), // yes, three characters difference - weekdaysMin : 'อา._จ._อ._พ._พฤ._ศ._ส.'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY เวลา H:mm', - LLLL : 'วันddddที่ D MMMM YYYY เวลา H:mm' - }, - meridiemParse: /ก่อนเที่ยง|หลังเที่ยง/, - isPM: function (input) { - return input === 'หลังเที่ยง'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ก่อนเที่ยง'; - } else { - return 'หลังเที่ยง'; - } - }, - calendar : { - sameDay : '[วันนี้ เวลา] LT', - nextDay : '[พรุ่งนี้ เวลา] LT', - nextWeek : 'dddd[หน้า เวลา] LT', - lastDay : '[เมื่อวานนี้ เวลา] LT', - lastWeek : '[วัน]dddd[ที่แล้ว เวลา] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'อีก %s', - past : '%sที่แล้ว', - s : 'ไม่กี่วินาที', - ss : '%d วินาที', - m : '1 นาที', - mm : '%d นาที', - h : '1 ชั่วโมง', - hh : '%d ชั่วโมง', - d : '1 วัน', - dd : '%d วัน', - M : '1 เดือน', - MM : '%d เดือน', - y : '1 ปี', - yy : '%d ปี' - } - }); - - //! moment.js locale configuration - - moment.defineLocale('tl-ph', { - months : 'Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre'.split('_'), - monthsShort : 'Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis'.split('_'), - weekdays : 'Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado'.split('_'), - weekdaysShort : 'Lin_Lun_Mar_Miy_Huw_Biy_Sab'.split('_'), - weekdaysMin : 'Li_Lu_Ma_Mi_Hu_Bi_Sab'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'MM/D/YYYY', - LL : 'MMMM D, YYYY', - LLL : 'MMMM D, YYYY HH:mm', - LLLL : 'dddd, MMMM DD, YYYY HH:mm' - }, - calendar : { - sameDay: 'LT [ngayong araw]', - nextDay: '[Bukas ng] LT', - nextWeek: 'LT [sa susunod na] dddd', - lastDay: 'LT [kahapon]', - lastWeek: 'LT [noong nakaraang] dddd', - sameElse: 'L' - }, - relativeTime : { - future : 'sa loob ng %s', - past : '%s ang nakalipas', - s : 'ilang segundo', - ss : '%d segundo', - m : 'isang minuto', - mm : '%d minuto', - h : 'isang oras', - hh : '%d oras', - d : 'isang araw', - dd : '%d araw', - M : 'isang buwan', - MM : '%d buwan', - y : 'isang taon', - yy : '%d taon' - }, - dayOfMonthOrdinalParse: /\d{1,2}/, - ordinal : function (number) { - return number; - }, - 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 numbersNouns = 'pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut'.split('_'); - - function translateFuture(output) { - var time = output; - time = (output.indexOf('jaj') !== -1) ? - time.slice(0, -3) + 'leS' : - (output.indexOf('jar') !== -1) ? - time.slice(0, -3) + 'waQ' : - (output.indexOf('DIS') !== -1) ? - time.slice(0, -3) + 'nem' : - time + ' pIq'; - return time; - } - - function translatePast(output) { - var time = output; - time = (output.indexOf('jaj') !== -1) ? - time.slice(0, -3) + 'Hu’' : - (output.indexOf('jar') !== -1) ? - time.slice(0, -3) + 'wen' : - (output.indexOf('DIS') !== -1) ? - time.slice(0, -3) + 'ben' : - time + ' ret'; - return time; - } - - function translate$a(number, withoutSuffix, string, isFuture) { - var numberNoun = numberAsNoun(number); - switch (string) { - case 'ss': - return numberNoun + ' lup'; - case 'mm': - return numberNoun + ' tup'; - case 'hh': - return numberNoun + ' rep'; - case 'dd': - return numberNoun + ' jaj'; - case 'MM': - return numberNoun + ' jar'; - case 'yy': - return numberNoun + ' DIS'; - } - } - - function numberAsNoun(number) { - var hundred = Math.floor((number % 1000) / 100), - ten = Math.floor((number % 100) / 10), - one = number % 10, - word = ''; - if (hundred > 0) { - word += numbersNouns[hundred] + 'vatlh'; - } - if (ten > 0) { - word += ((word !== '') ? ' ' : '') + numbersNouns[ten] + 'maH'; - } - if (one > 0) { - word += ((word !== '') ? ' ' : '') + numbersNouns[one]; - } - return (word === '') ? 'pagh' : word; - } - - moment.defineLocale('tlh', { - months : 'tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’'.split('_'), - monthsShort : 'jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’'.split('_'), - monthsParseExact : true, - weekdays : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), - weekdaysShort : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), - weekdaysMin : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.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: '[DaHjaj] LT', - nextDay: '[wa’leS] LT', - nextWeek: 'LLL', - lastDay: '[wa’Hu’] LT', - lastWeek: 'LLL', - sameElse: 'L' - }, - relativeTime : { - future : translateFuture, - past : translatePast, - s : 'puS lup', - ss : translate$a, - m : 'wa’ tup', - mm : translate$a, - h : 'wa’ rep', - hh : translate$a, - d : 'wa’ jaj', - dd : translate$a, - M : 'wa’ jar', - MM : translate$a, - y : 'wa’ DIS', - yy : translate$a - }, - 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. - } - }); - - var suffixes$4 = { - 1: '\'inci', - 5: '\'inci', - 8: '\'inci', - 70: '\'inci', - 80: '\'inci', - 2: '\'nci', - 7: '\'nci', - 20: '\'nci', - 50: '\'nci', - 3: '\'üncü', - 4: '\'üncü', - 100: '\'üncü', - 6: '\'ncı', - 9: '\'uncu', - 10: '\'uncu', - 30: '\'uncu', - 60: '\'ıncı', - 90: '\'ıncı' - }; - - moment.defineLocale('tr', { - months : 'Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık'.split('_'), - monthsShort : 'Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara'.split('_'), - weekdays : 'Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi'.split('_'), - weekdaysShort : 'Paz_Pts_Sal_Çar_Per_Cum_Cts'.split('_'), - weekdaysMin : 'Pz_Pt_Sa_Ça_Pe_Cu_Ct'.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 : '[bugün saat] LT', - nextDay : '[yarın saat] LT', - nextWeek : '[gelecek] dddd [saat] LT', - lastDay : '[dün] LT', - lastWeek : '[geçen] dddd [saat] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s sonra', - past : '%s önce', - s : 'birkaç saniye', - ss : '%d saniye', - m : 'bir dakika', - mm : '%d dakika', - h : 'bir saat', - hh : '%d saat', - d : 'bir gün', - dd : '%d gün', - M : 'bir ay', - MM : '%d ay', - y : 'bir yıl', - yy : '%d yıl' - }, - ordinal: function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'Do': - case 'DD': - return number; - default: - if (number === 0) { // special case for zero - return number + '\'ıncı'; - } - var a = number % 10, - b = number % 100 - a, - c = number >= 100 ? 100 : null; - return number + (suffixes$4[a] || suffixes$4[b] || suffixes$4[c]); - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - // After the year there should be a slash and the amount of years since December 26, 1979 in Roman numerals. - // This is currently too difficult (maybe even impossible) to add. - moment.defineLocale('tzl', { - months : 'Januar_Fevraglh_Març_Avrïu_Mai_Gün_Julia_Guscht_Setemvar_Listopäts_Noemvar_Zecemvar'.split('_'), - monthsShort : 'Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec'.split('_'), - weekdays : 'Súladi_Lúneçi_Maitzi_Márcuri_Xhúadi_Viénerçi_Sáturi'.split('_'), - weekdaysShort : 'Súl_Lún_Mai_Már_Xhú_Vié_Sát'.split('_'), - weekdaysMin : 'Sú_Lú_Ma_Má_Xh_Vi_Sá'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM [dallas] YYYY', - LLL : 'D. MMMM [dallas] YYYY HH.mm', - LLLL : 'dddd, [li] D. MMMM [dallas] YYYY HH.mm' - }, - meridiemParse: /d\'o|d\'a/i, - isPM : function (input) { - return 'd\'o' === input.toLowerCase(); - }, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'd\'o' : 'D\'O'; - } else { - return isLower ? 'd\'a' : 'D\'A'; - } - }, - calendar : { - sameDay : '[oxhi à] LT', - nextDay : '[demà à] LT', - nextWeek : 'dddd [à] LT', - lastDay : '[ieiri à] LT', - lastWeek : '[sür el] dddd [lasteu à] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'osprei %s', - past : 'ja%s', - s : processRelativeTime$7, - ss : processRelativeTime$7, - m : processRelativeTime$7, - mm : processRelativeTime$7, - h : processRelativeTime$7, - hh : processRelativeTime$7, - d : processRelativeTime$7, - dd : processRelativeTime$7, - M : processRelativeTime$7, - MM : processRelativeTime$7, - y : processRelativeTime$7, - yy : processRelativeTime$7 - }, - 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. - } - }); - - function processRelativeTime$7(number, withoutSuffix, key, isFuture) { - var format = { - 's': ['viensas secunds', '\'iensas secunds'], - 'ss': [number + ' secunds', '' + number + ' secunds'], - 'm': ['\'n míut', '\'iens míut'], - 'mm': [number + ' míuts', '' + number + ' míuts'], - 'h': ['\'n þora', '\'iensa þora'], - 'hh': [number + ' þoras', '' + number + ' þoras'], - 'd': ['\'n ziua', '\'iensa ziua'], - 'dd': [number + ' ziuas', '' + number + ' ziuas'], - 'M': ['\'n mes', '\'iens mes'], - 'MM': [number + ' mesen', '' + number + ' mesen'], - 'y': ['\'n ar', '\'iens ar'], - 'yy': [number + ' ars', '' + number + ' ars'] - }; - return isFuture ? format[key][0] : (withoutSuffix ? format[key][0] : format[key][1]); - } - - //! moment.js locale configuration - - moment.defineLocale('tzm-latn', { - months : 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split('_'), - monthsShort : 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split('_'), - weekdays : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), - weekdaysShort : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), - weekdaysMin : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.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: '[asdkh g] LT', - nextDay: '[aska g] LT', - nextWeek: 'dddd [g] LT', - lastDay: '[assant g] LT', - lastWeek: 'dddd [g] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'dadkh s yan %s', - past : 'yan %s', - s : 'imik', - ss : '%d imik', - m : 'minuḍ', - mm : '%d minuḍ', - h : 'saɛa', - hh : '%d tassaɛin', - d : 'ass', - dd : '%d ossan', - M : 'ayowr', - MM : '%d iyyirn', - y : 'asgas', - yy : '%d isgasn' - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } - }); - - //! moment.js locale configuration - - moment.defineLocale('tzm', { - months : 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split('_'), - monthsShort : 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split('_'), - weekdays : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), - weekdaysShort : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), - weekdaysMin : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.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: '[ⴰⵙⴷⵅ ⴴ] LT', - nextDay: '[ⴰⵙⴽⴰ ⴴ] LT', - nextWeek: 'dddd [ⴴ] LT', - lastDay: '[ⴰⵚⴰⵏⵜ ⴴ] LT', - lastWeek: 'dddd [ⴴ] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s', - past : 'ⵢⴰⵏ %s', - s : 'ⵉⵎⵉⴽ', - ss : '%d ⵉⵎⵉⴽ', - m : 'ⵎⵉⵏⵓⴺ', - mm : '%d ⵎⵉⵏⵓⴺ', - h : 'ⵙⴰⵄⴰ', - hh : '%d ⵜⴰⵙⵙⴰⵄⵉⵏ', - d : 'ⴰⵙⵙ', - dd : '%d oⵙⵙⴰⵏ', - M : 'ⴰⵢoⵓⵔ', - MM : '%d ⵉⵢⵢⵉⵔⵏ', - y : 'ⴰⵙⴳⴰⵙ', - yy : '%d ⵉⵙⴳⴰⵙⵏ' - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } - }); - - //! moment.js language configuration - - moment.defineLocale('ug-cn', { - months: 'يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر'.split( - '_' - ), - monthsShort: 'يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر'.split( - '_' - ), - weekdays: 'يەكشەنبە_دۈشەنبە_سەيشەنبە_چارشەنبە_پەيشەنبە_جۈمە_شەنبە'.split( - '_' - ), - weekdaysShort: 'يە_دۈ_سە_چا_پە_جۈ_شە'.split('_'), - weekdaysMin: 'يە_دۈ_سە_چا_پە_جۈ_شە'.split('_'), - longDateFormat: { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L: 'YYYY-MM-DD', - LL: 'YYYY-يىلىM-ئاينىڭD-كۈنى', - LLL: 'YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm', - LLLL: 'dddd، YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm' - }, - meridiemParse: /يېرىم كېچە|سەھەر|چۈشتىن بۇرۇن|چۈش|چۈشتىن كېيىن|كەچ/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ( - meridiem === 'يېرىم كېچە' || - meridiem === 'سەھەر' || - meridiem === 'چۈشتىن بۇرۇن' - ) { - return hour; - } else if (meridiem === 'چۈشتىن كېيىن' || meridiem === 'كەچ') { - return hour + 12; - } else { - return hour >= 11 ? hour : hour + 12; - } - }, - meridiem: function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 600) { - return 'يېرىم كېچە'; - } else if (hm < 900) { - return 'سەھەر'; - } else if (hm < 1130) { - return 'چۈشتىن بۇرۇن'; - } else if (hm < 1230) { - return 'چۈش'; - } else if (hm < 1800) { - return 'چۈشتىن كېيىن'; - } else { - return 'كەچ'; - } - }, - calendar: { - sameDay: '[بۈگۈن سائەت] LT', - nextDay: '[ئەتە سائەت] LT', - nextWeek: '[كېلەركى] dddd [سائەت] LT', - lastDay: '[تۆنۈگۈن] LT', - lastWeek: '[ئالدىنقى] dddd [سائەت] LT', - sameElse: 'L' - }, - relativeTime: { - future: '%s كېيىن', - past: '%s بۇرۇن', - s: 'نەچچە سېكونت', - ss: '%d سېكونت', - m: 'بىر مىنۇت', - mm: '%d مىنۇت', - h: 'بىر سائەت', - hh: '%d سائەت', - d: 'بىر كۈن', - dd: '%d كۈن', - M: 'بىر ئاي', - MM: '%d ئاي', - y: 'بىر يىل', - yy: '%d يىل' - }, - - dayOfMonthOrdinalParse: /\d{1,2}(-كۈنى|-ئاي|-ھەپتە)/, - ordinal: function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '-كۈنى'; - case 'w': - case 'W': - return number + '-ھەپتە'; - default: - return number; - } - }, - preparse: function (string) { - return string.replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/,/g, '،'); - }, - week: { - // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效 - dow: 1, // Monday is the first day of the week. - doy: 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - - function plural$6(word, num) { - var forms = word.split('_'); - return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]); - } - function relativeTimeWithPlural$4(number, withoutSuffix, key) { - var format = { - 'ss': withoutSuffix ? 'секунда_секунди_секунд' : 'секунду_секунди_секунд', - 'mm': withoutSuffix ? 'хвилина_хвилини_хвилин' : 'хвилину_хвилини_хвилин', - 'hh': withoutSuffix ? 'година_години_годин' : 'годину_години_годин', - 'dd': 'день_дні_днів', - 'MM': 'місяць_місяці_місяців', - 'yy': 'рік_роки_років' - }; - if (key === 'm') { - return withoutSuffix ? 'хвилина' : 'хвилину'; - } - else if (key === 'h') { - return withoutSuffix ? 'година' : 'годину'; - } - else { - return number + ' ' + plural$6(format[key], +number); - } - } - function weekdaysCaseReplace(m, format) { - var weekdays = { - 'nominative': 'неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота'.split('_'), - 'accusative': 'неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу'.split('_'), - 'genitive': 'неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи'.split('_') - }; - - if (m === true) { - return weekdays['nominative'].slice(1, 7).concat(weekdays['nominative'].slice(0, 1)); - } - if (!m) { - return weekdays['nominative']; - } - - var nounCase = (/(\[[ВвУу]\]) ?dddd/).test(format) ? - 'accusative' : - ((/\[?(?:минулої|наступної)? ?\] ?dddd/).test(format) ? - 'genitive' : - 'nominative'); - return weekdays[nounCase][m.day()]; - } - function processHoursFunction(str) { - return function () { - return str + 'о' + (this.hours() === 11 ? 'б' : '') + '] LT'; - }; - } - - moment.defineLocale('uk', { - months : { - 'format': 'січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня'.split('_'), - 'standalone': 'січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень'.split('_') - }, - monthsShort : 'січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд'.split('_'), - weekdays : weekdaysCaseReplace, - weekdaysShort : 'нд_пн_вт_ср_чт_пт_сб'.split('_'), - weekdaysMin : 'нд_пн_вт_ср_чт_пт_сб'.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: processHoursFunction('[Сьогодні '), - nextDay: processHoursFunction('[Завтра '), - lastDay: processHoursFunction('[Вчора '), - nextWeek: processHoursFunction('[У] dddd ['), - lastWeek: function () { - switch (this.day()) { - case 0: - case 3: - case 5: - case 6: - return processHoursFunction('[Минулої] dddd [').call(this); - case 1: - case 2: - case 4: - return processHoursFunction('[Минулого] dddd [').call(this); - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'за %s', - past : '%s тому', - s : 'декілька секунд', - ss : relativeTimeWithPlural$4, - m : relativeTimeWithPlural$4, - mm : relativeTimeWithPlural$4, - h : 'годину', - hh : relativeTimeWithPlural$4, - d : 'день', - dd : relativeTimeWithPlural$4, - M : 'місяць', - MM : relativeTimeWithPlural$4, - y : 'рік', - yy : relativeTimeWithPlural$4 - }, - // M. E.: those two are virtually unused but a user might want to implement them for his/her website for some reason - meridiemParse: /ночі|ранку|дня|вечора/, - isPM: function (input) { - return /^(дня|вечора)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ночі'; - } else if (hour < 12) { - return 'ранку'; - } else if (hour < 17) { - return 'дня'; - } else { - return 'вечора'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}-(й|го)/, - ordinal: function (number, period) { - switch (period) { - case 'M': - case 'd': - case 'DDD': - case 'w': - case 'W': - return number + '-й'; - case 'D': - return number + '-го'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - var months$9 = [ - 'جنوری', - 'فروری', - 'مارچ', - 'اپریل', - 'مئی', - 'جون', - 'جولائی', - 'اگست', - 'ستمبر', - 'اکتوبر', - 'نومبر', - 'دسمبر' - ]; - var days$1 = [ - 'اتوار', - 'پیر', - 'منگل', - 'بدھ', - 'جمعرات', - 'جمعہ', - 'ہفتہ' - ]; - - moment.defineLocale('ur', { - months : months$9, - monthsShort : months$9, - weekdays : days$1, - weekdaysShort : days$1, - weekdaysMin : days$1, - 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: /صبح|شام/, - isPM : function (input) { - return 'شام' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'صبح'; - } - return 'شام'; - }, - calendar : { - sameDay : '[آج بوقت] LT', - nextDay : '[کل بوقت] LT', - nextWeek : 'dddd [بوقت] LT', - lastDay : '[گذشتہ روز بوقت] LT', - lastWeek : '[گذشتہ] dddd [بوقت] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s بعد', - past : '%s قبل', - s : 'چند سیکنڈ', - ss : '%d سیکنڈ', - m : 'ایک منٹ', - mm : '%d منٹ', - h : 'ایک گھنٹہ', - hh : '%d گھنٹے', - d : 'ایک دن', - dd : '%d دن', - M : 'ایک ماہ', - MM : '%d ماہ', - y : 'ایک سال', - yy : '%d سال' - }, - preparse: function (string) { - return string.replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/,/g, '،'); - }, - 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('uz-latn', { - months : 'Yanvar_Fevral_Mart_Aprel_May_Iyun_Iyul_Avgust_Sentabr_Oktabr_Noyabr_Dekabr'.split('_'), - monthsShort : 'Yan_Fev_Mar_Apr_May_Iyun_Iyul_Avg_Sen_Okt_Noy_Dek'.split('_'), - weekdays : 'Yakshanba_Dushanba_Seshanba_Chorshanba_Payshanba_Juma_Shanba'.split('_'), - weekdaysShort : 'Yak_Dush_Sesh_Chor_Pay_Jum_Shan'.split('_'), - weekdaysMin : 'Ya_Du_Se_Cho_Pa_Ju_Sha'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'D MMMM YYYY, dddd HH:mm' - }, - calendar : { - sameDay : '[Bugun soat] LT [da]', - nextDay : '[Ertaga] LT [da]', - nextWeek : 'dddd [kuni soat] LT [da]', - lastDay : '[Kecha soat] LT [da]', - lastWeek : '[O\'tgan] dddd [kuni soat] LT [da]', - sameElse : 'L' - }, - relativeTime : { - future : 'Yaqin %s ichida', - past : 'Bir necha %s oldin', - s : 'soniya', - ss : '%d soniya', - m : 'bir daqiqa', - mm : '%d daqiqa', - h : 'bir soat', - hh : '%d soat', - d : 'bir kun', - dd : '%d kun', - M : 'bir oy', - MM : '%d oy', - y : 'bir yil', - yy : '%d yil' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - moment.defineLocale('uz', { - months : 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split('_'), - monthsShort : 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'), - weekdays : 'Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба'.split('_'), - weekdaysShort : 'Якш_Душ_Сеш_Чор_Пай_Жум_Шан'.split('_'), - weekdaysMin : 'Як_Ду_Се_Чо_Па_Жу_Ша'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'D MMMM YYYY, dddd HH:mm' - }, - calendar : { - sameDay : '[Бугун соат] LT [да]', - nextDay : '[Эртага] LT [да]', - nextWeek : 'dddd [куни соат] LT [да]', - lastDay : '[Кеча соат] LT [да]', - lastWeek : '[Утган] dddd [куни соат] LT [да]', - sameElse : 'L' - }, - relativeTime : { - future : 'Якин %s ичида', - past : 'Бир неча %s олдин', - s : 'фурсат', - ss : '%d фурсат', - m : 'бир дакика', - mm : '%d дакика', - h : 'бир соат', - hh : '%d соат', - d : 'бир кун', - dd : '%d кун', - M : 'бир ой', - MM : '%d ой', - y : 'бир йил', - yy : '%d йил' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - - moment.defineLocale('vi', { - months : 'tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12'.split('_'), - monthsShort : 'Th01_Th02_Th03_Th04_Th05_Th06_Th07_Th08_Th09_Th10_Th11_Th12'.split('_'), - monthsParseExact : true, - weekdays : 'chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy'.split('_'), - weekdaysShort : 'CN_T2_T3_T4_T5_T6_T7'.split('_'), - weekdaysMin : 'CN_T2_T3_T4_T5_T6_T7'.split('_'), - weekdaysParseExact : true, - meridiemParse: /sa|ch/i, - isPM : function (input) { - return /^ch$/i.test(input); - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 12) { - return isLower ? 'sa' : 'SA'; - } else { - return isLower ? 'ch' : 'CH'; - } - }, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM [năm] YYYY', - LLL : 'D MMMM [năm] YYYY HH:mm', - LLLL : 'dddd, D MMMM [năm] YYYY HH:mm', - l : 'DD/M/YYYY', - ll : 'D MMM YYYY', - lll : 'D MMM YYYY HH:mm', - llll : 'ddd, D MMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Hôm nay lúc] LT', - nextDay: '[Ngày mai lúc] LT', - nextWeek: 'dddd [tuần tới lúc] LT', - lastDay: '[Hôm qua lúc] LT', - lastWeek: 'dddd [tuần rồi lúc] LT', - sameElse: 'L' - }, - relativeTime : { - future : '%s tới', - past : '%s trước', - s : 'vài giây', - ss : '%d giây' , - m : 'một phút', - mm : '%d phút', - h : 'một giờ', - hh : '%d giờ', - d : 'một ngày', - dd : '%d ngày', - M : 'một tháng', - MM : '%d tháng', - y : 'một năm', - yy : '%d năm' - }, - dayOfMonthOrdinalParse: /\d{1,2}/, - ordinal : function (number) { - return number; - }, - 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('x-pseudo', { - months : 'J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér'.split('_'), - monthsShort : 'J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc'.split('_'), - monthsParseExact : true, - weekdays : 'S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý'.split('_'), - weekdaysShort : 'S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát'.split('_'), - weekdaysMin : 'S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[T~ódá~ý át] LT', - nextDay : '[T~ómó~rró~w át] LT', - nextWeek : 'dddd [át] LT', - lastDay : '[Ý~ést~érdá~ý át] LT', - lastWeek : '[L~ást] dddd [át] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'í~ñ %s', - past : '%s á~gó', - s : 'á ~féw ~sécó~ñds', - ss : '%d s~écóñ~ds', - m : 'á ~míñ~úté', - mm : '%d m~íñú~tés', - h : 'á~ñ hó~úr', - hh : '%d h~óúrs', - d : 'á ~dáý', - dd : '%d d~áýs', - M : 'á ~móñ~th', - MM : '%d m~óñt~hs', - y : 'á ~ýéár', - yy : '%d ý~éárs' - }, - dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, - 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('yo', { - months : 'Sẹ́rẹ́_Èrèlè_Ẹrẹ̀nà_Ìgbé_Èbibi_Òkùdu_Agẹmo_Ògún_Owewe_Ọ̀wàrà_Bélú_Ọ̀pẹ̀̀'.split('_'), - monthsShort : 'Sẹ́r_Èrl_Ẹrn_Ìgb_Èbi_Òkù_Agẹ_Ògú_Owe_Ọ̀wà_Bél_Ọ̀pẹ̀̀'.split('_'), - weekdays : 'Àìkú_Ajé_Ìsẹ́gun_Ọjọ́rú_Ọjọ́bọ_Ẹtì_Àbámẹ́ta'.split('_'), - weekdaysShort : 'Àìk_Ajé_Ìsẹ́_Ọjr_Ọjb_Ẹtì_Àbá'.split('_'), - weekdaysMin : 'Àì_Aj_Ìs_Ọr_Ọb_Ẹt_Àb'.split('_'), - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[Ònì ni] LT', - nextDay : '[Ọ̀la ni] LT', - nextWeek : 'dddd [Ọsẹ̀ tón\'bọ] [ni] LT', - lastDay : '[Àna ni] LT', - lastWeek : 'dddd [Ọsẹ̀ tólọ́] [ni] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ní %s', - past : '%s kọjá', - s : 'ìsẹjú aayá die', - ss :'aayá %d', - m : 'ìsẹjú kan', - mm : 'ìsẹjú %d', - h : 'wákati kan', - hh : 'wákati %d', - d : 'ọjọ́ kan', - dd : 'ọjọ́ %d', - M : 'osù kan', - MM : 'osù %d', - y : 'ọdún kan', - yy : 'ọdún %d' - }, - dayOfMonthOrdinalParse : /ọjọ́\s\d{1,2}/, - ordinal : 'ọjọ́ %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('zh-cn', { - months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), - weekdaysShort : '周日_周一_周二_周三_周四_周五_周六'.split('_'), - weekdaysMin : '日_一_二_三_四_五_六'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY/MM/DD', - LL : 'YYYY年M月D日', - LLL : 'YYYY年M月D日Ah点mm分', - LLLL : 'YYYY年M月D日ddddAh点mm分', - l : 'YYYY/M/D', - ll : 'YYYY年M月D日', - lll : 'YYYY年M月D日 HH:mm', - llll : 'YYYY年M月D日dddd HH:mm' - }, - meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === '凌晨' || meridiem === '早上' || - meridiem === '上午') { - return hour; - } else if (meridiem === '下午' || meridiem === '晚上') { - return hour + 12; - } else { - // '中午' - return hour >= 11 ? hour : hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 600) { - return '凌晨'; - } else if (hm < 900) { - return '早上'; - } else if (hm < 1130) { - return '上午'; - } else if (hm < 1230) { - return '中午'; - } else if (hm < 1800) { - return '下午'; - } else { - return '晚上'; - } - }, - calendar : { - sameDay : '[今天]LT', - nextDay : '[明天]LT', - nextWeek : '[下]ddddLT', - lastDay : '[昨天]LT', - lastWeek : '[上]ddddLT', - sameElse : 'L' - }, - dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/, - ordinal : function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '日'; - case 'M': - return number + '月'; - case 'w': - case 'W': - return number + '周'; - default: - return number; - } - }, - relativeTime : { - future : '%s内', - past : '%s前', - s : '几秒', - ss : '%d 秒', - m : '1 分钟', - mm : '%d 分钟', - h : '1 小时', - hh : '%d 小时', - d : '1 天', - dd : '%d 天', - M : '1 个月', - MM : '%d 个月', - y : '1 年', - yy : '%d 年' - }, - week : { - // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效 - 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('zh-hk', { - months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), - weekdaysShort : '週日_週一_週二_週三_週四_週五_週六'.split('_'), - weekdaysMin : '日_一_二_三_四_五_六'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY/MM/DD', - LL : 'YYYY年M月D日', - LLL : 'YYYY年M月D日 HH:mm', - LLLL : 'YYYY年M月D日dddd HH:mm', - l : 'YYYY/M/D', - ll : 'YYYY年M月D日', - lll : 'YYYY年M月D日 HH:mm', - llll : 'YYYY年M月D日dddd HH:mm' - }, - meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') { - return hour; - } else if (meridiem === '中午') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === '下午' || meridiem === '晚上') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 600) { - return '凌晨'; - } else if (hm < 900) { - return '早上'; - } else if (hm < 1130) { - return '上午'; - } else if (hm < 1230) { - return '中午'; - } else if (hm < 1800) { - return '下午'; - } else { - return '晚上'; - } - }, - calendar : { - sameDay : '[今天]LT', - nextDay : '[明天]LT', - nextWeek : '[下]ddddLT', - lastDay : '[昨天]LT', - lastWeek : '[上]ddddLT', - sameElse : 'L' - }, - dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/, - ordinal : function (number, period) { - switch (period) { - case 'd' : - case 'D' : - case 'DDD' : - return number + '日'; - case 'M' : - return number + '月'; - case 'w' : - case 'W' : - return number + '週'; - default : - return number; - } - }, - relativeTime : { - future : '%s內', - past : '%s前', - s : '幾秒', - ss : '%d 秒', - m : '1 分鐘', - mm : '%d 分鐘', - h : '1 小時', - hh : '%d 小時', - d : '1 天', - dd : '%d 天', - M : '1 個月', - MM : '%d 個月', - y : '1 年', - yy : '%d 年' - } - }); - - //! moment.js locale configuration - - moment.defineLocale('zh-tw', { - months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), - weekdaysShort : '週日_週一_週二_週三_週四_週五_週六'.split('_'), - weekdaysMin : '日_一_二_三_四_五_六'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY/MM/DD', - LL : 'YYYY年M月D日', - LLL : 'YYYY年M月D日 HH:mm', - LLLL : 'YYYY年M月D日dddd HH:mm', - l : 'YYYY/M/D', - ll : 'YYYY年M月D日', - lll : 'YYYY年M月D日 HH:mm', - llll : 'YYYY年M月D日dddd HH:mm' - }, - meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') { - return hour; - } else if (meridiem === '中午') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === '下午' || meridiem === '晚上') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 600) { - return '凌晨'; - } else if (hm < 900) { - return '早上'; - } else if (hm < 1130) { - return '上午'; - } else if (hm < 1230) { - return '中午'; - } else if (hm < 1800) { - return '下午'; - } else { - return '晚上'; - } - }, - calendar : { - sameDay : '[今天] LT', - nextDay : '[明天] LT', - nextWeek : '[下]dddd LT', - lastDay : '[昨天] LT', - lastWeek : '[上]dddd LT', - sameElse : 'L' - }, - dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/, - ordinal : function (number, period) { - switch (period) { - case 'd' : - case 'D' : - case 'DDD' : - return number + '日'; - case 'M' : - return number + '月'; - case 'w' : - case 'W' : - return number + '週'; - default : - return number; - } - }, - relativeTime : { - future : '%s內', - past : '%s前', - s : '幾秒', - ss : '%d 秒', - m : '1 分鐘', - mm : '%d 分鐘', - h : '1 小時', - hh : '%d 小時', - d : '1 天', - dd : '%d 天', - M : '1 個月', - MM : '%d 個月', - y : '1 年', - yy : '%d 年' - } - }); - moment.locale('en'); return moment; diff --git a/min/locales.min.js b/min/locales.min.js index c5c3475987..4824d74d09 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= 20) ? 'ste' : 'de'); // Thanks to Joris Röling : https://github.com/jjupiter + 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, // Maandag is die eerste dag van die week. - doy : 4 // Die week wat die 4de Januarie bevat is die eerste week van die jaar. + 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('ar-dz', { - months : 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - monthsShort : 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'احد_اثنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'أح_إث_ثلا_أر_خم_جم_سب'.split('_'), - weekdaysParseExact : true, + hooks.defineLocale('en-ca', { + 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' + LT : 'h:mm A', + LTS : 'h:mm:ss A', + L : 'YYYY-MM-DD', + LL : 'MMMM D, YYYY', + LLL : 'MMMM D, YYYY h:mm A', + LLLL : 'dddd, MMMM D, YYYY h:mm A' }, calendar : { - sameDay: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' + 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 : 'في %s', - past : 'منذ %s', - s : 'ثوان', - ss : '%d ثانية', - m : 'دقيقة', - mm : '%d دقائق', - h : 'ساعة', - hh : '%d ساعات', - d : 'يوم', - dd : '%d أيام', - M : 'شهر', - MM : '%d أشهر', - y : 'سنة', - yy : '%d سنوات' + 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' }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. + 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; } }); //! moment.js locale configuration - hooks.defineLocale('ar-kw', { - months : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), - monthsShort : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), - weekdays : 'الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, + hooks.defineLocale('en-gb', { + 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' + LLLL : 'dddd, D MMMM YYYY HH:mm' }, calendar : { - sameDay: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' + 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 : 'في %s', - past : 'منذ %s', - s : 'ثوان', - ss : '%d ثانية', - m : 'دقيقة', - mm : '%d دقائق', - h : 'ساعة', - hh : '%d ساعات', - d : 'يوم', - dd : '%d أيام', - M : 'شهر', - MM : '%d أشهر', - y : 'سنة', - yy : '%d سنوات' + 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 : 0, // Sunday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. + 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 symbolMap = { - '1': '1', - '2': '2', - '3': '3', - '4': '4', - '5': '5', - '6': '6', - '7': '7', - '8': '8', - '9': '9', - '0': '0' - }, pluralForm = function (n) { - return n === 0 ? 0 : n === 1 ? 1 : n === 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5; - }, plurals = { - s : ['أقل من ثانية', 'ثانية واحدة', ['ثانيتان', 'ثانيتين'], '%d ثوان', '%d ثانية', '%d ثانية'], - m : ['أقل من دقيقة', 'دقيقة واحدة', ['دقيقتان', 'دقيقتين'], '%d دقائق', '%d دقيقة', '%d دقيقة'], - h : ['أقل من ساعة', 'ساعة واحدة', ['ساعتان', 'ساعتين'], '%d ساعات', '%d ساعة', '%d ساعة'], - d : ['أقل من يوم', 'يوم واحد', ['يومان', 'يومين'], '%d أيام', '%d يومًا', '%d يوم'], - M : ['أقل من شهر', 'شهر واحد', ['شهران', 'شهرين'], '%d أشهر', '%d شهرا', '%d شهر'], - y : ['أقل من عام', 'عام واحد', ['عامان', 'عامين'], '%d أعوام', '%d عامًا', '%d عام'] - }, pluralize = function (u) { - return function (number, withoutSuffix, string, isFuture) { - var f = pluralForm(number), - str = plurals[u][pluralForm(number)]; - if (f === 2) { - str = str[withoutSuffix ? 0 : 1]; - } - return str.replace(/%d/i, number); - }; - }, months$1 = [ - 'يناير', - 'فبراير', - 'مارس', - 'أبريل', - 'مايو', - 'يونيو', - 'يوليو', - 'أغسطس', - 'سبتمبر', - 'أكتوبر', - 'نوفمبر', - 'ديسمبر' - ]; - - hooks.defineLocale('ar-ly', { - months : months$1, - monthsShort : months$1, - weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, + hooks.defineLocale('en-ie', { + 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 : 'D/\u200FM/\u200FYYYY', + L : 'DD/MM/YYYY', LL : 'D MMMM YYYY', LLL : 'D MMMM YYYY HH:mm', LLLL : 'dddd D MMMM YYYY HH:mm' }, - meridiemParse: /ص|م/, - isPM : function (input) { - return 'م' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ص'; - } else { - return 'م'; - } - }, calendar : { - sameDay: '[اليوم عند الساعة] LT', - nextDay: '[غدًا عند الساعة] LT', - nextWeek: 'dddd [عند الساعة] LT', - lastDay: '[أمس عند الساعة] LT', - lastWeek: 'dddd [عند الساعة] LT', - sameElse: 'L' + 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 : 'بعد %s', - past : 'منذ %s', - s : pluralize('s'), - ss : pluralize('s'), - m : pluralize('m'), - mm : pluralize('m'), - h : pluralize('h'), - hh : pluralize('h'), - d : pluralize('d'), - dd : pluralize('d'), - M : pluralize('M'), - MM : pluralize('M'), - y : pluralize('y'), - yy : pluralize('y') - }, - preparse: function (string) { - return string.replace(/،/g, ','); + 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' }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }).replace(/,/g, '،'); + 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 : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. + 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('ar-ma', { - months : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), - monthsShort : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), - weekdays : 'الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, + hooks.defineLocale('en-il', { + 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' + LLLL : 'dddd, D MMMM YYYY HH:mm' }, calendar : { - sameDay: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' + 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 : 'في %s', - past : 'منذ %s', - s : 'ثوان', - ss : '%d ثانية', - m : 'دقيقة', - mm : '%d دقائق', - h : 'ساعة', - hh : '%d ساعات', - d : 'يوم', - dd : '%d أيام', - M : 'شهر', - MM : '%d أشهر', - y : 'سنة', - yy : '%d سنوات' + future : 'in %s', + past : '%s ago', + s : 'a few seconds', + m : 'a minute', + mm : '%d minutes', + h : 'an hour', + hh : '%d hours', + d : 'a day', + dd : '%d days', + M : 'a month', + MM : '%d months', + y : 'a year', + yy : '%d years' }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. + 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; } }); //! moment.js locale configuration - var symbolMap$1 = { - '1': '١', - '2': '٢', - '3': '٣', - '4': '٤', - '5': '٥', - '6': '٦', - '7': '٧', - '8': '٨', - '9': '٩', - '0': '٠' - }, numberMap = { - '١': '1', - '٢': '2', - '٣': '3', - '٤': '4', - '٥': '5', - '٦': '6', - '٧': '7', - '٨': '8', - '٩': '9', - '٠': '0' - }; - - hooks.defineLocale('ar-sa', { - months : 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - monthsShort : 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, + hooks.defineLocale('en-nz', { + 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', + LT : 'h:mm A', + LTS : 'h:mm:ss A', L : 'DD/MM/YYYY', LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - meridiemParse: /ص|م/, - isPM : function (input) { - return 'م' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ص'; - } else { - return 'م'; - } + LLL : 'D MMMM YYYY h:mm A', + LLLL : 'dddd, D MMMM YYYY h:mm A' }, calendar : { - sameDay: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' + 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 : 'في %s', - past : 'منذ %s', - s : 'ثوان', - ss : '%d ثانية', - m : 'دقيقة', - mm : '%d دقائق', - h : 'ساعة', - hh : '%d ساعات', - d : 'يوم', - dd : '%d أيام', - M : 'شهر', - MM : '%d أشهر', - y : 'سنة', - yy : '%d سنوات' - }, - preparse: function (string) { - return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { - return numberMap[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$1[match]; - }).replace(/,/g, '،'); - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('ar-tn', { - months: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - monthsShort: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - 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: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' - }, - relativeTime: { - future: 'في %s', - past: 'منذ %s', - s: 'ثوان', - ss : '%d ثانية', - m: 'دقيقة', - mm: '%d دقائق', - h: 'ساعة', - hh: '%d ساعات', - d: 'يوم', - dd: '%d أيام', - M: 'شهر', - MM: '%d أشهر', - y: 'سنة', - yy: '%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 - - var symbolMap$2 = { - '1': '١', - '2': '٢', - '3': '٣', - '4': '٤', - '5': '٥', - '6': '٦', - '7': '٧', - '8': '٨', - '9': '٩', - '0': '٠' - }, numberMap$1 = { - '١': '1', - '٢': '2', - '٣': '3', - '٤': '4', - '٥': '5', - '٦': '6', - '٧': '7', - '٨': '8', - '٩': '9', - '٠': '0' - }, pluralForm$1 = function (n) { - return n === 0 ? 0 : n === 1 ? 1 : n === 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5; - }, plurals$1 = { - s : ['أقل من ثانية', 'ثانية واحدة', ['ثانيتان', 'ثانيتين'], '%d ثوان', '%d ثانية', '%d ثانية'], - m : ['أقل من دقيقة', 'دقيقة واحدة', ['دقيقتان', 'دقيقتين'], '%d دقائق', '%d دقيقة', '%d دقيقة'], - h : ['أقل من ساعة', 'ساعة واحدة', ['ساعتان', 'ساعتين'], '%d ساعات', '%d ساعة', '%d ساعة'], - d : ['أقل من يوم', 'يوم واحد', ['يومان', 'يومين'], '%d أيام', '%d يومًا', '%d يوم'], - M : ['أقل من شهر', 'شهر واحد', ['شهران', 'شهرين'], '%d أشهر', '%d شهرا', '%d شهر'], - y : ['أقل من عام', 'عام واحد', ['عامان', 'عامين'], '%d أعوام', '%d عامًا', '%d عام'] - }, pluralize$1 = function (u) { - return function (number, withoutSuffix, string, isFuture) { - var f = pluralForm$1(number), - str = plurals$1[u][pluralForm$1(number)]; - if (f === 2) { - str = str[withoutSuffix ? 0 : 1]; - } - return str.replace(/%d/i, number); - }; - }, months$2 = [ - 'يناير', - 'فبراير', - 'مارس', - 'أبريل', - 'مايو', - 'يونيو', - 'يوليو', - 'أغسطس', - 'سبتمبر', - 'أكتوبر', - 'نوفمبر', - 'ديسمبر' - ]; - - hooks.defineLocale('ar', { - months : months$2, - monthsShort : months$2, - weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - 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: /ص|م/, - isPM : function (input) { - return 'م' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ص'; - } else { - return 'م'; - } - }, - calendar : { - sameDay: '[اليوم عند الساعة] LT', - nextDay: '[غدًا عند الساعة] LT', - nextWeek: 'dddd [عند الساعة] LT', - lastDay: '[أمس عند الساعة] LT', - lastWeek: 'dddd [عند الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'بعد %s', - past : 'منذ %s', - s : pluralize$1('s'), - ss : pluralize$1('s'), - m : pluralize$1('m'), - mm : pluralize$1('m'), - h : pluralize$1('h'), - hh : pluralize$1('h'), - d : pluralize$1('d'), - dd : pluralize$1('d'), - M : pluralize$1('M'), - MM : pluralize$1('M'), - y : pluralize$1('y'), - yy : pluralize$1('y') - }, - preparse: function (string) { - return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { - return numberMap$1[match]; - }).replace(/،/g, ','); + 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' }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$2[match]; - }).replace(/,/g, '،'); + 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 : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. + 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 suffixes = { - 1: '-inci', - 5: '-inci', - 8: '-inci', - 70: '-inci', - 80: '-inci', - 2: '-nci', - 7: '-nci', - 20: '-nci', - 50: '-nci', - 3: '-üncü', - 4: '-üncü', - 100: '-üncü', - 6: '-ncı', - 9: '-uncu', - 10: '-uncu', - 30: '-uncu', - 60: '-ıncı', - 90: '-ıncı' - }; - - hooks.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əsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə'.split('_'), - weekdaysShort : 'Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən'.split('_'), - weekdaysMin : 'Bz_BE_ÇA_Çə_CA_Cü_Şə'.split('_'), - weekdaysParseExact : true, + 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', + L : 'DD/MM/YYYY', LL : 'D MMMM YYYY', LLL : 'D MMMM YYYY HH:mm', LLLL : 'dddd, D MMMM YYYY HH:mm' }, calendar : { - sameDay : '[bugün saat] LT', - nextDay : '[sabah saat] LT', - nextWeek : '[gələn həftə] dddd [saat] LT', - lastDay : '[dünən] LT', - lastWeek : '[keçən həftə] dddd [saat] LT', + 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 : '%s sonra', - past : '%s əvvəl', - s : 'birneçə saniyə', - ss : '%d saniyə', - m : 'bir dəqiqə', - mm : '%d dəqiqə', - h : 'bir saat', - hh : '%d saat', - d : 'bir gün', - dd : '%d gün', - M : 'bir ay', - MM : '%d ay', - y : 'bir il', - yy : '%d il' - }, - meridiemParse: /gecə|səhər|gündüz|axşam/, - isPM : function (input) { - return /^(gündüz|axşam)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'gecə'; - } else if (hour < 12) { - return 'səhər'; - } else if (hour < 17) { - return 'gündüz'; - } else { - return 'axşam'; - } + 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}-(ıncı|inci|nci|üncü|ncı|uncu)/, + dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, ordinal : function (number) { - if (number === 0) { // special case for zero - return number + '-ıncı'; - } - var a = number % 10, - b = number % 100 - a, - c = number >= 100 ? 100 : null; - return number + (suffixes[a] || suffixes[b] || suffixes[c]); + 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 : 7 // The week that contains Jan 7th is the first week of the year. + doy : 4 // The week that contains Jan 4th is the first week of the year. } }); //! moment.js locale configuration - function plural(word, num) { - var forms = word.split('_'); - return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]); - } - function relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'ss': withoutSuffix ? 'секунда_секунды_секунд' : 'секунду_секунды_секунд', - 'mm': withoutSuffix ? 'хвіліна_хвіліны_хвілін' : 'хвіліну_хвіліны_хвілін', - 'hh': withoutSuffix ? 'гадзіна_гадзіны_гадзін' : 'гадзіну_гадзіны_гадзін', - 'dd': 'дзень_дні_дзён', - 'MM': 'месяц_месяцы_месяцаў', - 'yy': 'год_гады_гадоў' - }; - if (key === 'm') { - return withoutSuffix ? 'хвіліна' : 'хвіліну'; - } - else if (key === 'h') { - return withoutSuffix ? 'гадзіна' : 'гадзіну'; - } - else { - return number + ' ' + plural(format[key], +number); - } - } + 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('_'); - hooks.defineLocale('be', { - months : { - format: 'студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня'.split('_'), - standalone: 'студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань'.split('_') - }, - monthsShort : 'студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж'.split('_'), - weekdays : { - format: 'нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу'.split('_'), - standalone: 'нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота'.split('_'), - isFormat: /\[ ?[Ууў] ?(?:мінулую|наступную)? ?\] ?dddd/ + 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; + + hooks.defineLocale('es-do', { + months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'), + monthsShort : function (m, format) { + if (!m) { + return monthsShortDot; + } else if (/-MMM-/.test(format)) { + return monthsShort[m.month()]; + } else { + return monthsShortDot[m.month()]; + } }, - weekdaysShort : 'нд_пн_ат_ср_чц_пт_сб'.split('_'), - weekdaysMin : 'нд_пн_ат_ср_чц_пт_сб'.split('_'), + 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, + 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('_'), + weekdaysParseExact : true, 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' + LT : 'h:mm A', + LTS : 'h:mm:ss A', + L : 'DD/MM/YYYY', + 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: '[Сёння ў] LT', - nextDay: '[Заўтра ў] LT', - lastDay: '[Учора ў] LT', - nextWeek: function () { - return '[У] dddd [ў] LT'; + sameDay : function () { + return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; }, - lastWeek: function () { - switch (this.day()) { - case 0: - case 3: - case 5: - case 6: - return '[У мінулую] dddd [ў] LT'; - case 1: - case 2: - case 4: - return '[У мінулы] dddd [ў] LT'; - } + nextDay : function () { + return '[mañana a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; }, - sameElse: 'L' + nextWeek : function () { + return 'dddd [a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; + }, + lastDay : function () { + return '[ayer a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; + }, + lastWeek : function () { + return '[el] dddd [pasado a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; + }, + sameElse : 'L' }, relativeTime : { - future : 'праз %s', - past : '%s таму', - s : 'некалькі секунд', - m : relativeTimeWithPlural, - mm : relativeTimeWithPlural, - h : relativeTimeWithPlural, - hh : relativeTimeWithPlural, - d : 'дзень', - dd : relativeTimeWithPlural, - M : 'месяц', - MM : relativeTimeWithPlural, - y : 'год', - yy : relativeTimeWithPlural - }, - meridiemParse: /ночы|раніцы|дня|вечара/, - isPM : function (input) { - return /^(дня|вечара)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ночы'; - } else if (hour < 12) { - return 'раніцы'; - } else if (hour < 17) { - return 'дня'; - } else { - return 'вечара'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}-(і|ы|га)/, - ordinal: function (number, period) { - switch (period) { - case 'M': - case 'd': - case 'DDD': - case 'w': - case 'W': - return (number % 10 === 2 || number % 10 === 3) && (number % 100 !== 12 && number % 100 !== 13) ? number + '-і' : number + '-ы'; - case 'D': - return number + '-га'; - default: - return number; - } + future : 'en %s', + past : 'hace %s', + s : 'unos segundos', + ss : '%d segundos', + m : 'un minuto', + mm : '%d minutos', + h : 'una hora', + hh : '%d horas', + d : 'un día', + dd : '%d días', + M : 'un mes', + MM : '%d meses', + y : 'un año', + yy : '%d años' }, + dayOfMonthOrdinalParse : /\d{1,2}º/, + ordinal : '%dº', week : { dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. + doy : 4 // The week that contains Jan 4th is the first week of the year. } }); //! moment.js locale configuration - hooks.defineLocale('bg', { - months : 'януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември'.split('_'), - monthsShort : 'янр_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек'.split('_'), - weekdays : 'неделя_понеделник_вторник_сряда_четвъртък_петък_събота'.split('_'), - weekdaysShort : 'нед_пон_вто_сря_чет_пет_съб'.split('_'), - weekdaysMin : 'нд_пн_вт_ср_чт_пт_сб'.split('_'), + var monthsShortDot$1 = '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$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-us', { + months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'), + monthsShort : function (m, format) { + if (!m) { + return monthsShortDot$1; + } else if (/-MMM-/.test(format)) { + return monthsShort$1[m.month()]; + } else { + return monthsShortDot$1[m.month()]; + } + }, + 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$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('_'), + weekdaysParseExact : true, 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' + LT : 'h:mm A', + LTS : 'h:mm:ss A', + L : 'MM/DD/YYYY', + 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 : '[Днес в] LT', - nextDay : '[Утре в] LT', - nextWeek : 'dddd [в] LT', - lastDay : '[Вчера в] LT', + sameDay : function () { + return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; + }, + nextDay : function () { + return '[mañana a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; + }, + nextWeek : function () { + return 'dddd [a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; + }, + lastDay : function () { + return '[ayer a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; + }, lastWeek : function () { - switch (this.day()) { - case 0: - case 3: - case 6: - return '[В изминалата] dddd [в] LT'; - case 1: - case 2: - case 4: - case 5: - return '[В изминалия] dddd [в] LT'; - } + return '[el] dddd [pasado a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; }, sameElse : 'L' }, relativeTime : { - future : 'след %s', - past : 'преди %s', - s : 'няколко секунди', - ss : '%d секунди', - m : 'минута', - mm : '%d минути', - h : 'час', - hh : '%d часа', - d : 'ден', - dd : '%d дни', - M : 'месец', - MM : '%d месеца', - y : 'година', - yy : '%d години' - }, - dayOfMonthOrdinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/, - ordinal : function (number) { - var lastDigit = number % 10, - last2Digits = number % 100; - if (number === 0) { - return number + '-ев'; - } else if (last2Digits === 0) { - return number + '-ен'; - } else if (last2Digits > 10 && last2Digits < 20) { - return number + '-ти'; - } else if (lastDigit === 1) { - return number + '-ви'; - } else if (lastDigit === 2) { - return number + '-ри'; - } else if (lastDigit === 7 || lastDigit === 8) { - return number + '-ми'; - } else { - return number + '-ти'; - } + future : 'en %s', + past : 'hace %s', + s : 'unos segundos', + ss : '%d segundos', + m : 'un minuto', + mm : '%d minutos', + h : 'una hora', + hh : '%d horas', + d : 'un día', + dd : '%d días', + M : 'un mes', + MM : '%d meses', + y : 'un año', + yy : '%d años' }, + dayOfMonthOrdinalParse : /\d{1,2}º/, + ordinal : '%dº', week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. + dow : 0, // Sunday is the first day of the week. + doy : 6 // The week that contains Jan 6th is the first week of the year. } }); //! moment.js locale configuration - hooks.defineLocale('bm', { - months : 'Zanwuyekalo_Fewuruyekalo_Marisikalo_Awirilikalo_Mɛkalo_Zuwɛnkalo_Zuluyekalo_Utikalo_Sɛtanburukalo_ɔkutɔburukalo_Nowanburukalo_Desanburukalo'.split('_'), - monthsShort : 'Zan_Few_Mar_Awi_Mɛ_Zuw_Zul_Uti_Sɛt_ɔku_Now_Des'.split('_'), - weekdays : 'Kari_Ntɛnɛn_Tarata_Araba_Alamisa_Juma_Sibiri'.split('_'), - weekdaysShort : 'Kar_Ntɛ_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ɛrɛ] HH:mm', - LLLL : 'dddd MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm' - }, - calendar : { - sameDay : '[Bi lɛrɛ] LT', - nextDay : '[Sini lɛrɛ] LT', - nextWeek : 'dddd [don lɛrɛ] LT', - lastDay : '[Kunu lɛrɛ] LT', - lastWeek : 'dddd [tɛmɛnen lɛrɛ] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s kɔnɔ', - past : 'a bɛ %s bɔ', - s : 'sanga dama dama', - ss : 'sekondi %d', - m : 'miniti kelen', - mm : 'miniti %d', - h : 'lɛrɛ kelen', - hh : 'lɛrɛ %d', - d : 'tile kelen', - dd : 'tile %d', - M : 'kalo kelen', - MM : 'kalo %d', - y : 'san kelen', - yy : 'san %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 - - var symbolMap$3 = { - '1': '১', - '2': '২', - '3': '৩', - '4': '৪', - '5': '৫', - '6': '৬', - '7': '৭', - '8': '৮', - '9': '৯', - '0': '০' - }, - numberMap$2 = { - '১': '1', - '২': '2', - '৩': '3', - '৪': '4', - '৫': '5', - '৬': '6', - '৭': '7', - '৮': '8', - '৯': '9', - '০': '0' - }; - - hooks.defineLocale('bn', { - months : 'জানুয়ারী_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর'.split('_'), - monthsShort : 'জানু_ফেব_মার্চ_এপ্র_মে_জুন_জুল_আগ_সেপ্ট_অক্টো_নভে_ডিসে'.split('_'), - weekdays : 'রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার'.split('_'), - weekdaysShort : 'রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি'.split('_'), - weekdaysMin : 'রবি_সোম_মঙ্গ_বুধ_বৃহঃ_শুক্র_শনি'.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 : '[আজ] LT', - nextDay : '[আগামীকাল] LT', - nextWeek : 'dddd, LT', - lastDay : '[গতকাল] LT', - lastWeek : '[গত] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s পরে', - past : '%s আগে', - s : 'কয়েক সেকেন্ড', - ss : '%d সেকেন্ড', - m : 'এক মিনিট', - mm : '%d মিনিট', - h : 'এক ঘন্টা', - hh : '%d ঘন্টা', - d : 'এক দিন', - dd : '%d দিন', - M : 'এক মাস', - MM : '%d মাস', - y : 'এক বছর', - yy : '%d বছর' - }, - preparse: function (string) { - return string.replace(/[১২৩৪৫৬৭৮৯০]/g, function (match) { - return numberMap$2[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$3[match]; - }); - }, - meridiemParse: /রাত|সকাল|দুপুর|বিকাল|রাত/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ((meridiem === 'রাত' && hour >= 4) || - (meridiem === 'দুপুর' && hour < 5) || - meridiem === 'বিকাল') { - return hour + 12; - } else { - return hour; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'রাত'; - } else if (hour < 10) { - return 'সকাল'; - } else if (hour < 17) { - return 'দুপুর'; - } else if (hour < 20) { - return 'বিকাল'; - } else { - return 'রাত'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - //! moment.js locale configuration + var monthsShortDot$2 = '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 symbolMap$4 = { - '1': '༡', - '2': '༢', - '3': '༣', - '4': '༤', - '5': '༥', - '6': '༦', - '7': '༧', - '8': '༨', - '9': '༩', - '0': '༠' - }, - numberMap$3 = { - '༡': '1', - '༢': '2', - '༣': '3', - '༤': '4', - '༥': '5', - '༦': '6', - '༧': '7', - '༨': '8', - '༩': '9', - '༠': '0' - }; + 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('bo', { - months : 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split('_'), - monthsShort : 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split('_'), - weekdays : 'གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་'.split('_'), - weekdaysShort : 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split('_'), - weekdaysMin : 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.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 : '[དི་རིང] LT', - nextDay : '[སང་ཉིན] LT', - nextWeek : '[བདུན་ཕྲག་རྗེས་མ], LT', - lastDay : '[ཁ་སང] LT', - lastWeek : '[བདུན་ཕྲག་མཐའ་མ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ལ་', - past : '%s སྔན་ལ', - s : 'ལམ་སང', - ss : '%d སྐར་ཆ།', - m : 'སྐར་མ་གཅིག', - mm : '%d སྐར་མ', - h : 'ཆུ་ཚོད་གཅིག', - hh : '%d ཆུ་ཚོད', - d : 'ཉིན་གཅིག', - dd : '%d ཉིན་', - M : 'ཟླ་བ་གཅིག', - MM : '%d ཟླ་བ', - y : 'ལོ་གཅིག', - yy : '%d ལོ' - }, - preparse: function (string) { - return string.replace(/[༡༢༣༤༥༦༧༨༩༠]/g, function (match) { - return numberMap$3[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$4[match]; - }); - }, - meridiemParse: /མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ((meridiem === 'མཚན་མོ' && hour >= 4) || - (meridiem === 'ཉིན་གུང' && hour < 5) || - meridiem === 'དགོང་དག') { - return hour + 12; - } else { - return hour; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'མཚན་མོ'; - } else if (hour < 10) { - return 'ཞོགས་ཀས'; - } else if (hour < 17) { - return 'ཉིན་གུང'; - } else if (hour < 20) { - return 'དགོང་དག'; + hooks.defineLocale('es', { + months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'), + monthsShort : function (m, format) { + if (!m) { + return monthsShortDot$2; + } else if (/-MMM-/.test(format)) { + return monthsShort$2[m.month()]; } else { - return 'མཚན་མོ'; + return monthsShortDot$2[m.month()]; } }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - //! moment.js locale configuration - - function relativeTimeWithMutation(number, withoutSuffix, key) { - var format = { - 'mm': 'munutenn', - 'MM': 'miz', - 'dd': 'devezh' - }; - return number + ' ' + mutation(format[key], number); - } - function specialMutationForYears(number) { - switch (lastNumber(number)) { - case 1: - case 3: - case 4: - case 5: - case 9: - return number + ' bloaz'; - default: - return number + ' vloaz'; - } - } - function lastNumber(number) { - if (number > 9) { - return lastNumber(number % 10); - } - return number; - } - function mutation(text, number) { - if (number === 2) { - return softMutation(text); - } - return text; - } - function softMutation(text) { - var mutationTable = { - 'm': 'v', - 'b': 'v', - 'd': 'z' - }; - if (mutationTable[text.charAt(0)] === undefined) { - return text; - } - return mutationTable[text.charAt(0)] + text.substring(1); - } - - hooks.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 : true, - 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ù', - ss : '%d eilenn', - m : 'ur vunutenn', - mm : relativeTimeWithMutation, - h : 'un eur', - hh : '%d eur', - d : 'un devezh', - dd : relativeTimeWithMutation, - M : 'ur miz', - MM : relativeTimeWithMutation, - y : 'ur bloaz', - yy : specialMutationForYears - }, - dayOfMonthOrdinalParse: /\d{1,2}(añ|vet)/, - ordinal : function (number) { - var output = (number === 1) ? 'añ' : 'vet'; - 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 - - function translate(number, withoutSuffix, key) { - var result = number + ' '; - switch (key) { - case 'ss': - if (number === 1) { - result += 'sekunda'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'sekunde'; - } else { - result += 'sekundi'; - } - return result; - case 'm': - return withoutSuffix ? 'jedna minuta' : 'jedne minute'; - case 'mm': - if (number === 1) { - result += 'minuta'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'minute'; - } else { - result += 'minuta'; - } - return result; - case 'h': - return withoutSuffix ? 'jedan sat' : 'jednog sata'; - case 'hh': - if (number === 1) { - result += 'sat'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'sata'; - } else { - result += 'sati'; - } - return result; - case 'dd': - if (number === 1) { - result += 'dan'; - } else { - result += 'dana'; - } - return result; - case 'MM': - if (number === 1) { - result += 'mjesec'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'mjeseca'; - } else { - result += 'mjeseci'; - } - return result; - case 'yy': - if (number === 1) { - result += 'godina'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'godine'; - } else { - result += 'godina'; - } - return result; - } - } - - hooks.defineLocale('bs', { - months : 'januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar'.split('_'), - monthsShort : 'jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), - weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), - weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[danas u] LT', - nextDay : '[sutra u] LT', - nextWeek : function () { - switch (this.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'; - } - }, - lastDay : '[jučer u] LT', - lastWeek : function () { - switch (this.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'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'prije %s', - s : 'par sekundi', - ss : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : 'dan', - dd : translate, - M : 'mjesec', - MM : translate, - y : 'godinu', - yy : translate - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('ca', { - months : { - standalone: 'gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre'.split('_'), - format: 'de gener_de febrer_de març_d\'abril_de maig_de juny_de juliol_d\'agost_de setembre_d\'octubre_de novembre_de desembre'.split('_'), - isFormat: /D[oD]?(\s)+MMMM/ - }, - monthsShort : 'gen._febr._març_abr._maig_juny_jul._ag._set._oct._nov._des.'.split('_'), - monthsParseExact : true, - weekdays : 'diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte'.split('_'), - weekdaysShort : 'dg._dl._dt._dc._dj._dv._ds.'.split('_'), - weekdaysMin : 'dg_dl_dt_dc_dj_dv_ds'.split('_'), + 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('_'), weekdaysParseExact : true, longDateFormat : { LT : 'H:mm', LTS : 'H:mm:ss', L : 'DD/MM/YYYY', - LL : 'D MMMM [de] YYYY', - ll : 'D MMM YYYY', - LLL : 'D MMMM [de] YYYY [a les] H:mm', - lll : 'D MMM YYYY, H:mm', - LLLL : 'dddd D MMMM [de] YYYY [a les] H:mm', - llll : 'ddd D MMM YYYY, H:mm' + LL : 'D [de] MMMM [de] YYYY', + LLL : 'D [de] MMMM [de] YYYY H:mm', + LLLL : 'dddd, D [de] MMMM [de] YYYY H:mm' }, calendar : { sameDay : function () { - return '[avui a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; + return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; }, nextDay : function () { - return '[demà a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; + return '[mañana a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; }, nextWeek : function () { - return 'dddd [a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; + return 'dddd [a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; }, lastDay : function () { - return '[ahir a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; + return '[ayer a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; }, lastWeek : function () { - return '[el] dddd [passat a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; + return '[el] dddd [pasado a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; }, sameElse : 'L' }, relativeTime : { - future : 'd\'aquí %s', - past : 'fa %s', - s : 'uns segons', - ss : '%d segons', - m : 'un minut', - mm : '%d minuts', + future : 'en %s', + past : 'hace %s', + s : 'unos segundos', + ss : '%d segundos', + m : 'un minuto', + mm : '%d minutos', h : 'una hora', - hh : '%d hores', - d : 'un dia', - dd : '%d dies', + hh : '%d horas', + d : 'un día', + dd : '%d días', M : 'un mes', - MM : '%d mesos', - y : 'un any', - yy : '%d anys' - }, - dayOfMonthOrdinalParse: /\d{1,2}(r|n|t|è|a)/, - ordinal : function (number, period) { - var output = (number === 1) ? 'r' : - (number === 2) ? 'n' : - (number === 3) ? 'r' : - (number === 4) ? 't' : 'è'; - if (period === 'w' || period === 'W') { - output = 'a'; - } - return number + output; + MM : '%d meses', + y : 'un año', + yy : '%d años' }, + 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. - } + }, + invalidDate: 'Fecha invalida' }); //! moment.js locale configuration - 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); - } - function translate$1(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': // a few seconds / in a few seconds / a few seconds ago - return (withoutSuffix || isFuture) ? 'pár sekund' : 'pár sekundami'; - case 'ss': // 9 seconds / in 9 seconds / 9 seconds ago - if (withoutSuffix || isFuture) { - return result + (plural$1(number) ? 'sekundy' : 'sekund'); - } else { - return result + 'sekundami'; - } - break; - case 'm': // a minute / in a minute / a minute ago - return withoutSuffix ? 'minuta' : (isFuture ? 'minutu' : 'minutou'); - case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago - if (withoutSuffix || isFuture) { - return result + (plural$1(number) ? 'minuty' : 'minut'); - } else { - return result + 'minutami'; - } - break; - case 'h': // an hour / in an hour / an hour ago - return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou'); - case 'hh': // 9 hours / in 9 hours / 9 hours ago - if (withoutSuffix || isFuture) { - return result + (plural$1(number) ? 'hodiny' : 'hodin'); - } else { - return result + 'hodinami'; - } - break; - case 'd': // a day / in a day / a day ago - return (withoutSuffix || isFuture) ? 'den' : 'dnem'; - case 'dd': // 9 days / in 9 days / 9 days ago - if (withoutSuffix || isFuture) { - return result + (plural$1(number) ? 'dny' : 'dní'); - } else { - return result + 'dny'; - } - break; - case 'M': // a month / in a month / a month ago - return (withoutSuffix || isFuture) ? 'měsíc' : 'měsícem'; - case 'MM': // 9 months / in 9 months / 9 months ago - if (withoutSuffix || isFuture) { - return result + (plural$1(number) ? 'měsíce' : 'měsíců'); - } else { - return result + 'měsíci'; - } - break; - case 'y': // a year / in a year / a year ago - return (withoutSuffix || isFuture) ? 'rok' : 'rokem'; - case 'yy': // 9 years / in 9 years / 9 years ago - if (withoutSuffix || isFuture) { - return result + (plural$1(number) ? 'roky' : 'let'); - } else { - return result + 'lety'; - } - break; - } - } - - hooks.defineLocale('cs', { - months : months$3, - monthsShort : monthsShort, - 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('_'), + 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('_'), + 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('_'), + weekdaysParseExact : true, longDateFormat : { - LT: 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd D. MMMM YYYY H:mm', - l : 'D. M. YYYY' + LT : 'HH:mm', + LTS : 'HH:mm:ss', + L : 'DD/MM/YYYY', + LL : 'D [de] MMMM [de] YYYY', + LLL : 'D [de] MMMM [de] YYYY [às] HH:mm', + LLLL : 'dddd, D [de] MMMM [de] YYYY [às] HH:mm' }, calendar : { - sameDay: '[dnes v] LT', - nextDay: '[zítra v] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[v neděli v] LT'; - case 1: - case 2: - return '[v] dddd [v] LT'; - case 3: - return '[ve středu v] LT'; - case 4: - return '[ve čtvrtek v] LT'; - case 5: - return '[v pátek v] LT'; - case 6: - return '[v sobotu v] LT'; - } - }, - lastDay: '[včera v] LT', + sameDay: '[Hoje às] LT', + nextDay: '[Amanhã às] LT', + nextWeek: 'dddd [às] LT', + lastDay: '[Ontem às] LT', lastWeek: function () { - switch (this.day()) { - case 0: - return '[minulou neděli v] LT'; - case 1: - case 2: - return '[minulé] dddd [v] LT'; - case 3: - return '[minulou středu v] LT'; - case 4: - case 5: - return '[minulý] dddd [v] LT'; - case 6: - return '[minulou sobotu v] LT'; - } + return (this.day() === 0 || this.day() === 6) ? + '[Último] dddd [às] LT' : // Saturday + Sunday + '[Última] dddd [às] LT'; // Monday - Friday }, sameElse: 'L' }, relativeTime : { - future : 'za %s', - past : 'před %s', - s : translate$1, - ss : translate$1, - m : translate$1, - mm : translate$1, - h : translate$1, - hh : translate$1, - d : translate$1, - dd : translate$1, - M : translate$1, - MM : translate$1, - y : translate$1, - yy : translate$1 + future : 'em %s', + past : 'há %s', + s : 'poucos segundos', + ss : '%d segundos', + m : 'um minuto', + mm : '%d minutos', + h : 'uma hora', + hh : '%d horas', + d : 'um dia', + dd : '%d dias', + M : 'um mês', + MM : '%d meses', + y : 'um ano', + yy : '%d anos' }, - 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. - } + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal : '%dº' }); //! moment.js locale configuration - hooks.defineLocale('cv', { - months : 'кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав'.split('_'), - monthsShort : 'кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш'.split('_'), - weekdays : 'вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун'.split('_'), - weekdaysShort : 'выр_тун_ытл_юн_кӗҫ_эрн_шӑм'.split('_'), - weekdaysMin : 'вр_тн_ыт_юн_кҫ_эр_шм'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD-MM-YYYY', - LL : 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]', - LLL : 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm', - LLLL : 'dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm' - }, - calendar : { - sameDay: '[Паян] LT [сехетре]', - nextDay: '[Ыран] LT [сехетре]', - lastDay: '[Ӗнер] LT [сехетре]', - nextWeek: '[Ҫитес] dddd LT [сехетре]', - lastWeek: '[Иртнӗ] dddd LT [сехетре]', - sameElse: 'L' - }, - relativeTime : { - future : function (output) { - var affix = /сехет$/i.exec(output) ? 'рен' : /ҫул$/i.exec(output) ? 'тан' : 'ран'; - return output + affix; - }, - past : '%s каялла', - s : 'пӗр-ик ҫеккунт', - ss : '%d ҫеккунт', - m : 'пӗр минут', - mm : '%d минут', - h : 'пӗр сехет', - hh : '%d сехет', - d : 'пӗр кун', - dd : '%d кун', - M : 'пӗр уйӑх', - MM : '%d уйӑх', - y : 'пӗр ҫул', - yy : '%d ҫул' - }, - dayOfMonthOrdinalParse: /\d{1,2}-мӗш/, - ordinal : '%d-мӗш', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('cy', { - months: 'Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr'.split('_'), - monthsShort: 'Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag'.split('_'), - weekdays: 'Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn'.split('_'), - weekdaysShort: 'Sul_Llun_Maw_Mer_Iau_Gwe_Sad'.split('_'), - weekdaysMin: 'Su_Ll_Ma_Me_Ia_Gw_Sa'.split('_'), - weekdaysParseExact : true, - // time formats are the same as en-gb - 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: '[Heddiw am] LT', - nextDay: '[Yfory am] LT', - nextWeek: 'dddd [am] LT', - lastDay: '[Ddoe am] LT', - lastWeek: 'dddd [diwethaf am] LT', - sameElse: 'L' - }, - relativeTime: { - future: 'mewn %s', - past: '%s yn ôl', - s: 'ychydig eiliadau', - ss: '%d eiliad', - m: 'munud', - mm: '%d munud', - h: 'awr', - hh: '%d awr', - d: 'diwrnod', - dd: '%d diwrnod', - M: 'mis', - MM: '%d mis', - y: 'blwyddyn', - yy: '%d flynedd' - }, - dayOfMonthOrdinalParse: /\d{1,2}(fed|ain|af|il|ydd|ed|eg)/, - // traditional ordinal numbers above 31 are not commonly used in colloquial Welsh - ordinal: function (number) { - var b = number, - output = '', - lookup = [ - '', 'af', 'il', 'ydd', 'ydd', 'ed', 'ed', 'ed', 'fed', 'fed', 'fed', // 1af to 10fed - 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'fed' // 11eg to 20fed - ]; - if (b > 20) { - if (b === 40 || b === 50 || b === 60 || b === 80 || b === 100) { - output = 'fed'; // not 30ain, 70ain or 90ain - } else { - output = 'ain'; - } - } else if (b > 0) { - output = lookup[b]; - } - 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('da', { - months : 'januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december'.split('_'), - monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), - weekdays : 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'), - weekdaysShort : 'søn_man_tir_ons_tor_fre_lør'.split('_'), - weekdaysMin : 'sø_ma_ti_on_to_fr_lø'.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.] D. MMMM YYYY [kl.] HH:mm' - }, - calendar : { - sameDay : '[i dag kl.] LT', - nextDay : '[i morgen kl.] LT', - nextWeek : 'på dddd [kl.] LT', - lastDay : '[i går kl.] LT', - lastWeek : '[i] dddd[s kl.] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'om %s', - past : '%s siden', - s : 'få sekunder', - ss : '%d sekunder', - m : 'et minut', - mm : '%d minutter', - h : 'en time', - hh : '%d timer', - d : 'en dag', - dd : '%d dage', - M : 'en måned', - MM : '%d måneder', - y : 'et år', - yy : '%d år' - }, - 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 - - function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eine Minute', 'einer Minute'], - 'h': ['eine Stunde', 'einer Stunde'], - 'd': ['ein Tag', 'einem Tag'], - 'dd': [number + ' Tage', number + ' Tagen'], - 'M': ['ein Monat', 'einem Monat'], - 'MM': [number + ' Monate', number + ' Monaten'], - 'y': ['ein Jahr', 'einem Jahr'], - 'yy': [number + ' Jahre', number + ' Jahren'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } - - hooks.defineLocale('de-at', { - months : 'Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort : 'Jän._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'), - weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), - weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - 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: '[heute um] LT [Uhr]', - sameElse: 'L', - nextDay: '[morgen um] LT [Uhr]', - nextWeek: 'dddd [um] LT [Uhr]', - lastDay: '[gestern um] LT [Uhr]', - lastWeek: '[letzten] dddd [um] LT [Uhr]' - }, - relativeTime : { - future : 'in %s', - past : 'vor %s', - s : 'ein paar Sekunden', - ss : '%d Sekunden', - m : processRelativeTime, - mm : '%d Minuten', - h : processRelativeTime, - hh : '%d Stunden', - d : processRelativeTime, - dd : processRelativeTime, - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - 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 - - function processRelativeTime$1(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eine Minute', 'einer Minute'], - 'h': ['eine Stunde', 'einer Stunde'], - 'd': ['ein Tag', 'einem Tag'], - 'dd': [number + ' Tage', number + ' Tagen'], - 'M': ['ein Monat', 'einem Monat'], - 'MM': [number + ' Monate', number + ' Monaten'], - 'y': ['ein Jahr', 'einem Jahr'], - 'yy': [number + ' Jahre', number + ' Jahren'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } - - hooks.defineLocale('de-ch', { - months : 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort : 'Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'), - weekdaysShort : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - 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: '[heute um] LT [Uhr]', - sameElse: 'L', - nextDay: '[morgen um] LT [Uhr]', - nextWeek: 'dddd [um] LT [Uhr]', - lastDay: '[gestern um] LT [Uhr]', - lastWeek: '[letzten] dddd [um] LT [Uhr]' - }, - relativeTime : { - future : 'in %s', - past : 'vor %s', - s : 'ein paar Sekunden', - ss : '%d Sekunden', - m : processRelativeTime$1, - mm : '%d Minuten', - h : processRelativeTime$1, - hh : '%d Stunden', - d : processRelativeTime$1, - dd : processRelativeTime$1, - M : processRelativeTime$1, - MM : processRelativeTime$1, - y : processRelativeTime$1, - yy : processRelativeTime$1 - }, - 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 - - function processRelativeTime$2(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eine Minute', 'einer Minute'], - 'h': ['eine Stunde', 'einer Stunde'], - 'd': ['ein Tag', 'einem Tag'], - 'dd': [number + ' Tage', number + ' Tagen'], - 'M': ['ein Monat', 'einem Monat'], - 'MM': [number + ' Monate', number + ' Monaten'], - 'y': ['ein Jahr', 'einem Jahr'], - 'yy': [number + ' Jahre', number + ' Jahren'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } - - hooks.defineLocale('de', { - months : 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort : 'Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'), - weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), - weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - 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: '[heute um] LT [Uhr]', - sameElse: 'L', - nextDay: '[morgen um] LT [Uhr]', - nextWeek: 'dddd [um] LT [Uhr]', - lastDay: '[gestern um] LT [Uhr]', - lastWeek: '[letzten] dddd [um] LT [Uhr]' - }, - relativeTime : { - future : 'in %s', - past : 'vor %s', - s : 'ein paar Sekunden', - ss : '%d Sekunden', - m : processRelativeTime$2, - mm : '%d Minuten', - h : processRelativeTime$2, - hh : '%d Stunden', - d : processRelativeTime$2, - dd : processRelativeTime$2, - M : processRelativeTime$2, - MM : processRelativeTime$2, - y : processRelativeTime$2, - yy : processRelativeTime$2 - }, - 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 - - var months$4 = [ - 'ޖެނުއަރީ', - 'ފެބްރުއަރީ', - 'މާރިޗު', - 'އޭޕްރީލު', - 'މޭ', - 'ޖޫން', - 'ޖުލައި', - 'އޯގަސްޓު', - 'ސެޕްޓެމްބަރު', - 'އޮކްޓޯބަރު', - 'ނޮވެމްބަރު', - 'ޑިސެމްބަރު' - ], weekdays = [ - 'އާދިއްތަ', - 'ހޯމަ', - 'އަންގާރަ', - 'ބުދަ', - 'ބުރާސްފަތި', - 'ހުކުރު', - 'ހޮނިހިރު' - ]; - - hooks.defineLocale('dv', { - months : months$4, - monthsShort : months$4, - weekdays : weekdays, - weekdaysShort : weekdays, - weekdaysMin : 'އާދި_ހޯމަ_އަން_ބުދަ_ބުރާ_ހުކު_ހޮނި'.split('_'), - longDateFormat : { - - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'D/M/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - meridiemParse: /މކ|މފ/, - isPM : function (input) { - return 'މފ' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'މކ'; - } else { - return 'މފ'; - } - }, - calendar : { - sameDay : '[މިއަދު] LT', - nextDay : '[މާދަމާ] LT', - nextWeek : 'dddd LT', - lastDay : '[އިއްޔެ] LT', - lastWeek : '[ފާއިތުވި] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ތެރޭގައި %s', - past : 'ކުރިން %s', - s : 'ސިކުންތުކޮޅެއް', - ss : 'd% ސިކުންތު', - m : 'މިނިޓެއް', - mm : 'މިނިޓު %d', - h : 'ގަޑިއިރެއް', - hh : 'ގަޑިއިރު %d', - d : 'ދުވަހެއް', - dd : 'ދުވަސް %d', - M : 'މަހެއް', - MM : 'މަސް %d', - y : 'އަހަރެއް', - yy : 'އަހަރު %d' - }, - preparse: function (string) { - return string.replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/,/g, '،'); - }, - week : { - dow : 7, // Sunday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('el', { - monthsNominativeEl : 'Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος'.split('_'), - monthsGenitiveEl : 'Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου'.split('_'), - months : function (momentToFormat, format) { - if (!momentToFormat) { - return this._monthsNominativeEl; - } else if (typeof format === 'string' && /D/.test(format.substring(0, format.indexOf('MMMM')))) { // if there is a day number before 'MMMM' - return this._monthsGenitiveEl[momentToFormat.month()]; - } else { - return this._monthsNominativeEl[momentToFormat.month()]; - } - }, - monthsShort : 'Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ'.split('_'), - weekdays : 'Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο'.split('_'), - weekdaysShort : 'Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ'.split('_'), - weekdaysMin : 'Κυ_Δε_Τρ_Τε_Πε_Πα_Σα'.split('_'), - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'μμ' : 'ΜΜ'; - } else { - return isLower ? 'πμ' : 'ΠΜ'; - } - }, - isPM : function (input) { - return ((input + '').toLowerCase()[0] === 'μ'); - }, - meridiemParse : /[ΠΜ]\.?Μ?\.?/i, - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendarEl : { - sameDay : '[Σήμερα {}] LT', - nextDay : '[Αύριο {}] LT', - nextWeek : 'dddd [{}] LT', - lastDay : '[Χθες {}] LT', - lastWeek : function () { - switch (this.day()) { - case 6: - return '[το προηγούμενο] dddd [{}] LT'; - default: - return '[την προηγούμενη] dddd [{}] LT'; - } - }, - sameElse : 'L' - }, - calendar : function (key, mom) { - var output = this._calendarEl[key], - hours = mom && mom.hours(); - if (isFunction(output)) { - output = output.apply(mom); - } - return output.replace('{}', (hours % 12 === 1 ? 'στη' : 'στις')); - }, - relativeTime : { - future : 'σε %s', - past : '%s πριν', - s : 'λίγα δευτερόλεπτα', - ss : '%d δευτερόλεπτα', - m : 'ένα λεπτό', - mm : '%d λεπτά', - h : 'μία ώρα', - hh : '%d ώρες', - d : 'μία μέρα', - dd : '%d μέρες', - M : 'ένας μήνας', - MM : '%d μήνες', - y : 'ένας χρόνος', - yy : '%d χρόνια' - }, - dayOfMonthOrdinalParse: /\d{1,2}η/, - ordinal: '%dη', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4st is the first week of the year. - } - }); - - //! 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('_'), - 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 : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - 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-ca', { - 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 : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'YYYY-MM-DD', - LL : 'MMMM D, YYYY', - LLL : 'MMMM D, YYYY h:mm A', - LLLL : 'dddd, MMMM D, YYYY h:mm A' - }, - 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; - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('en-gb', { - 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-ie', { - 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-il', { - 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', - 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; - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('en-nz', { - 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 : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - 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('eo', { - months : 'januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro'.split('_'), - monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aŭg_sep_okt_nov_dec'.split('_'), - weekdays : 'dimanĉo_lundo_mardo_merkredo_ĵaŭdo_vendredo_sabato'.split('_'), - weekdaysShort : 'dim_lun_mard_merk_ĵaŭ_ven_sab'.split('_'), - weekdaysMin : 'di_lu_ma_me_ĵa_ve_sa'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'D[-a de] MMMM, YYYY', - LLL : 'D[-a de] MMMM, YYYY HH:mm', - LLLL : 'dddd, [la] D[-a de] MMMM, YYYY HH:mm' - }, - meridiemParse: /[ap]\.t\.m/i, - isPM: function (input) { - return input.charAt(0).toLowerCase() === 'p'; - }, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'p.t.m.' : 'P.T.M.'; - } else { - return isLower ? 'a.t.m.' : 'A.T.M.'; - } - }, - calendar : { - sameDay : '[Hodiaŭ je] LT', - nextDay : '[Morgaŭ je] LT', - nextWeek : 'dddd [je] LT', - lastDay : '[Hieraŭ je] LT', - lastWeek : '[pasinta] dddd [je] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'post %s', - past : 'antaŭ %s', - s : 'sekundoj', - ss : '%d sekundoj', - m : 'minuto', - mm : '%d minutoj', - h : 'horo', - hh : '%d horoj', - d : 'tago',//ne 'diurno', ĉar estas uzita por proksimumo - dd : '%d tagoj', - M : 'monato', - MM : '%d monatoj', - y : 'jaro', - yy : '%d jaroj' - }, - dayOfMonthOrdinalParse: /\d{1,2}a/, - ordinal : '%da', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - 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$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('_'), - monthsShort : function (m, format) { - if (!m) { - return monthsShortDot; - } else if (/-MMM-/.test(format)) { - return monthsShort$1[m.month()]; - } else { - return monthsShortDot[m.month()]; - } - }, - 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$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('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - 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 () { - return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - nextDay : function () { - return '[mañana a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - nextWeek : function () { - return 'dddd [a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - lastDay : function () { - return '[ayer a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - lastWeek : function () { - return '[el] dddd [pasado a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'en %s', - past : 'hace %s', - s : 'unos segundos', - ss : '%d segundos', - m : 'un minuto', - mm : '%d minutos', - h : 'una hora', - hh : '%d horas', - d : 'un día', - dd : '%d días', - M : 'un mes', - MM : '%d meses', - y : 'un año', - yy : '%d años' - }, - 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 - - 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) { - if (!m) { - return monthsShortDot$1; - } else if (/-MMM-/.test(format)) { - return monthsShort$2[m.month()]; - } else { - return monthsShortDot$1[m.month()]; - } - }, - 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('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'MM/DD/YYYY', - 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 () { - return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - nextDay : function () { - return '[mañana a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - nextWeek : function () { - return 'dddd [a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - lastDay : function () { - return '[ayer a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - lastWeek : function () { - return '[el] dddd [pasado a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'en %s', - past : 'hace %s', - s : 'unos segundos', - ss : '%d segundos', - m : 'un minuto', - mm : '%d minutos', - h : 'una hora', - hh : '%d horas', - d : 'un día', - dd : '%d días', - M : 'un mes', - MM : '%d meses', - y : 'un año', - yy : '%d años' - }, - dayOfMonthOrdinalParse : /\d{1,2}º/, - ordinal : '%dº', - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - //! moment.js locale configuration - - 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$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('_'), - monthsShort : function (m, format) { - if (!m) { - return monthsShortDot$2; - } else if (/-MMM-/.test(format)) { - return monthsShort$3[m.month()]; - } else { - return monthsShortDot$2[m.month()]; - } - }, - 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$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('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [de] MMMM [de] YYYY', - LLL : 'D [de] MMMM [de] YYYY H:mm', - LLLL : 'dddd, D [de] MMMM [de] YYYY H:mm' - }, - calendar : { - sameDay : function () { - return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - nextDay : function () { - return '[mañana a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - nextWeek : function () { - return 'dddd [a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - lastDay : function () { - return '[ayer a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - lastWeek : function () { - return '[el] dddd [pasado a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'en %s', - past : 'hace %s', - s : 'unos segundos', - ss : '%d segundos', - m : 'un minuto', - mm : '%d minutos', - h : 'una hora', - hh : '%d horas', - d : 'un día', - dd : '%d días', - M : 'un mes', - MM : '%d meses', - y : 'un año', - yy : '%d años' - }, - 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 - - function processRelativeTime$3(number, withoutSuffix, key, isFuture) { - var format = { - 's' : ['mõne sekundi', 'mõni sekund', 'paar sekundit'], - 'ss': [number + 'sekundi', number + 'sekundit'], - 'm' : ['ühe minuti', 'üks minut'], - 'mm': [number + ' minuti', number + ' minutit'], - 'h' : ['ühe tunni', 'tund aega', 'üks tund'], - 'hh': [number + ' tunni', number + ' tundi'], - 'd' : ['ühe päeva', 'üks päev'], - 'M' : ['kuu aja', 'kuu aega', 'üks kuu'], - 'MM': [number + ' kuu', number + ' kuud'], - 'y' : ['ühe aasta', 'aasta', 'üks aasta'], - 'yy': [number + ' aasta', number + ' aastat'] - }; - if (withoutSuffix) { - return format[key][2] ? format[key][2] : format[key][1]; - } - return isFuture ? format[key][0] : format[key][1]; - } - - hooks.defineLocale('et', { - months : 'jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember'.split('_'), - monthsShort : 'jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets'.split('_'), - weekdays : 'pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev'.split('_'), - weekdaysShort : 'P_E_T_K_N_R_L'.split('_'), - weekdaysMin : 'P_E_T_K_N_R_L'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[Täna,] LT', - nextDay : '[Homme,] LT', - nextWeek : '[Järgmine] dddd LT', - lastDay : '[Eile,] LT', - lastWeek : '[Eelmine] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s pärast', - past : '%s tagasi', - s : processRelativeTime$3, - ss : processRelativeTime$3, - m : processRelativeTime$3, - mm : processRelativeTime$3, - h : processRelativeTime$3, - hh : processRelativeTime$3, - d : processRelativeTime$3, - dd : '%d päeva', - M : processRelativeTime$3, - MM : processRelativeTime$3, - y : processRelativeTime$3, - yy : processRelativeTime$3 - }, - 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('eu', { - months : 'urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua'.split('_'), - monthsShort : 'urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.'.split('_'), - monthsParseExact : true, - weekdays : 'igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata'.split('_'), - weekdaysShort : 'ig._al._ar._az._og._ol._lr.'.split('_'), - weekdaysMin : 'ig_al_ar_az_og_ol_lr'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'YYYY[ko] MMMM[ren] D[a]', - LLL : 'YYYY[ko] MMMM[ren] D[a] HH:mm', - LLLL : 'dddd, YYYY[ko] MMMM[ren] D[a] HH:mm', - l : 'YYYY-M-D', - ll : 'YYYY[ko] MMM D[a]', - lll : 'YYYY[ko] MMM D[a] HH:mm', - llll : 'ddd, YYYY[ko] MMM D[a] HH:mm' - }, - calendar : { - sameDay : '[gaur] LT[etan]', - nextDay : '[bihar] LT[etan]', - nextWeek : 'dddd LT[etan]', - lastDay : '[atzo] LT[etan]', - lastWeek : '[aurreko] dddd LT[etan]', - sameElse : 'L' - }, - relativeTime : { - future : '%s barru', - past : 'duela %s', - s : 'segundo batzuk', - ss : '%d segundo', - m : 'minutu bat', - mm : '%d minutu', - h : 'ordu bat', - hh : '%d ordu', - d : 'egun bat', - dd : '%d egun', - M : 'hilabete bat', - MM : '%d hilabete', - y : 'urte bat', - yy : '%d urte' - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - var symbolMap$5 = { - '1': '۱', - '2': '۲', - '3': '۳', - '4': '۴', - '5': '۵', - '6': '۶', - '7': '۷', - '8': '۸', - '9': '۹', - '0': '۰' - }, numberMap$4 = { - '۱': '1', - '۲': '2', - '۳': '3', - '۴': '4', - '۵': '5', - '۶': '6', - '۷': '7', - '۸': '8', - '۹': '9', - '۰': '0' - }; - - hooks.defineLocale('fa', { - months : 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), - monthsShort : 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), - weekdays : 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'), - weekdaysShort : 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'), - weekdaysMin : 'ی_د_س_چ_پ_ج_ش'.split('_'), - weekdaysParseExact : true, - 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: /قبل از ظهر|بعد از ظهر/, - isPM: function (input) { - return /بعد از ظهر/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'قبل از ظهر'; - } else { - return 'بعد از ظهر'; - } - }, - calendar : { - sameDay : '[امروز ساعت] LT', - nextDay : '[فردا ساعت] LT', - nextWeek : 'dddd [ساعت] LT', - lastDay : '[دیروز ساعت] LT', - lastWeek : 'dddd [پیش] [ساعت] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'در %s', - past : '%s پیش', - s : 'چند ثانیه', - ss : 'ثانیه d%', - m : 'یک دقیقه', - mm : '%d دقیقه', - h : 'یک ساعت', - hh : '%d ساعت', - d : 'یک روز', - dd : '%d روز', - M : 'یک ماه', - MM : '%d ماه', - y : 'یک سال', - yy : '%d سال' - }, - preparse: function (string) { - return string.replace(/[۰-۹]/g, function (match) { - return numberMap$4[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$5[match]; - }).replace(/,/g, '،'); - }, - dayOfMonthOrdinalParse: /\d{1,2}م/, - ordinal : '%dم', - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } - }); - - //! moment.js locale configuration - - var numbersPast = 'nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän'.split(' '), - numbersFuture = [ - 'nolla', 'yhden', 'kahden', 'kolmen', 'neljän', 'viiden', 'kuuden', - numbersPast[7], numbersPast[8], numbersPast[9] - ]; - function translate$2(number, withoutSuffix, key, isFuture) { - var result = ''; - switch (key) { - case 's': - return isFuture ? 'muutaman sekunnin' : 'muutama sekunti'; - case 'ss': - return isFuture ? 'sekunnin' : 'sekuntia'; - case 'm': - return isFuture ? 'minuutin' : 'minuutti'; - case 'mm': - result = isFuture ? 'minuutin' : 'minuuttia'; - break; - case 'h': - return isFuture ? 'tunnin' : 'tunti'; - case 'hh': - result = isFuture ? 'tunnin' : 'tuntia'; - break; - case 'd': - return isFuture ? 'päivän' : 'päivä'; - case 'dd': - result = isFuture ? 'päivän' : 'päivää'; - break; - case 'M': - return isFuture ? 'kuukauden' : 'kuukausi'; - case 'MM': - result = isFuture ? 'kuukauden' : 'kuukautta'; - break; - case 'y': - return isFuture ? 'vuoden' : 'vuosi'; - case 'yy': - result = isFuture ? 'vuoden' : 'vuotta'; - break; - } - result = verbalNumber(number, isFuture) + ' ' + result; - return result; - } - function verbalNumber(number, isFuture) { - return number < 10 ? (isFuture ? numbersFuture[number] : numbersPast[number]) : number; - } - - hooks.defineLocale('fi', { - months : 'tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu'.split('_'), - monthsShort : 'tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu'.split('_'), - weekdays : 'sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai'.split('_'), - weekdaysShort : 'su_ma_ti_ke_to_pe_la'.split('_'), - weekdaysMin : 'su_ma_ti_ke_to_pe_la'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD.MM.YYYY', - LL : 'Do MMMM[ta] YYYY', - LLL : 'Do MMMM[ta] YYYY, [klo] HH.mm', - LLLL : 'dddd, Do MMMM[ta] YYYY, [klo] HH.mm', - l : 'D.M.YYYY', - ll : 'Do MMM YYYY', - lll : 'Do MMM YYYY, [klo] HH.mm', - llll : 'ddd, Do MMM YYYY, [klo] HH.mm' - }, - calendar : { - sameDay : '[tänään] [klo] LT', - nextDay : '[huomenna] [klo] LT', - nextWeek : 'dddd [klo] LT', - lastDay : '[eilen] [klo] LT', - lastWeek : '[viime] dddd[na] [klo] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s päästä', - past : '%s sitten', - s : translate$2, - ss : translate$2, - m : translate$2, - mm : translate$2, - h : translate$2, - hh : translate$2, - d : translate$2, - dd : translate$2, - M : translate$2, - MM : translate$2, - y : translate$2, - yy : translate$2 - }, - 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('fo', { - months : 'januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember'.split('_'), - monthsShort : 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'), - weekdays : 'sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur'.split('_'), - weekdaysShort : 'sun_mán_týs_mik_hós_frí_ley'.split('_'), - weekdaysMin : 'su_má_tý_mi_hó_fr_le'.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 : '[Í dag kl.] LT', - nextDay : '[Í morgin kl.] LT', - nextWeek : 'dddd [kl.] LT', - lastDay : '[Í gjár kl.] LT', - lastWeek : '[síðstu] dddd [kl] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'um %s', - past : '%s síðani', - s : 'fá sekund', - ss : '%d sekundir', - m : 'ein minuttur', - mm : '%d minuttir', - h : 'ein tími', - hh : '%d tímar', - d : 'ein dagur', - dd : '%d dagar', - M : 'ein mánaður', - MM : '%d mánaðir', - y : 'eitt ár', - yy : '%d ár' - }, - 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('fr-ca', { - months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), - monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), - monthsParseExact : true, - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'di_lu_ma_me_je_ve_sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Aujourd’hui à] LT', - nextDay : '[Demain à] LT', - nextWeek : 'dddd [à] LT', - lastDay : '[Hier à] LT', - lastWeek : 'dddd [dernier à] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dans %s', - past : 'il y a %s', - s : 'quelques secondes', - ss : '%d secondes', - m : 'une minute', - mm : '%d minutes', - h : 'une heure', - hh : '%d heures', - d : 'un jour', - dd : '%d jours', - M : 'un mois', - MM : '%d mois', - y : 'un an', - yy : '%d ans' - }, - dayOfMonthOrdinalParse: /\d{1,2}(er|e)/, - ordinal : function (number, period) { - switch (period) { - // Words with masculine grammatical gender: mois, trimestre, jour - default: - case 'M': - case 'Q': - case 'D': - case 'DDD': - case 'd': - return number + (number === 1 ? 'er' : 'e'); - - // Words with feminine grammatical gender: semaine - case 'w': - case 'W': - return number + (number === 1 ? 're' : 'e'); - } - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('fr-ch', { - months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), - monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), - monthsParseExact : true, - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'di_lu_ma_me_je_ve_sa'.split('_'), - weekdaysParseExact : true, - 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 : '[Aujourd’hui à] LT', - nextDay : '[Demain à] LT', - nextWeek : 'dddd [à] LT', - lastDay : '[Hier à] LT', - lastWeek : 'dddd [dernier à] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dans %s', - past : 'il y a %s', - s : 'quelques secondes', - ss : '%d secondes', - m : 'une minute', - mm : '%d minutes', - h : 'une heure', - hh : '%d heures', - d : 'un jour', - dd : '%d jours', - M : 'un mois', - MM : '%d mois', - y : 'un an', - yy : '%d ans' - }, - dayOfMonthOrdinalParse: /\d{1,2}(er|e)/, - ordinal : function (number, period) { - switch (period) { - // Words with masculine grammatical gender: mois, trimestre, jour - default: - case 'M': - case 'Q': - case 'D': - case 'DDD': - case 'd': - return number + (number === 1 ? 'er' : 'e'); - - // Words with feminine grammatical gender: semaine - case 'w': - case 'W': - return number + (number === 1 ? 're' : 'e'); - } - }, - 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('fr', { - months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), - monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), - monthsParseExact : true, - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'di_lu_ma_me_je_ve_sa'.split('_'), - weekdaysParseExact : true, - 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 : '[Aujourd’hui à] LT', - nextDay : '[Demain à] LT', - nextWeek : 'dddd [à] LT', - lastDay : '[Hier à] LT', - lastWeek : 'dddd [dernier à] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dans %s', - past : 'il y a %s', - s : 'quelques secondes', - ss : '%d secondes', - m : 'une minute', - mm : '%d minutes', - h : 'une heure', - hh : '%d heures', - d : 'un jour', - dd : '%d jours', - M : 'un mois', - MM : '%d mois', - y : 'un an', - yy : '%d ans' - }, - dayOfMonthOrdinalParse: /\d{1,2}(er|)/, - ordinal : function (number, period) { - switch (period) { - // TODO: Return 'e' when day of month > 1. Move this case inside - // block for masculine words below. - // See https://github.com/moment/moment/issues/3375 - case 'D': - return number + (number === 1 ? 'er' : ''); - - // Words with masculine grammatical gender: mois, trimestre, jour - default: - case 'M': - case 'Q': - case 'DDD': - case 'd': - return number + (number === 1 ? 'er' : 'e'); - - // Words with feminine grammatical gender: semaine - case 'w': - case 'W': - return number + (number === 1 ? 're' : 'e'); - } - }, - 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 monthsShortWithDots = 'jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.'.split('_'), - monthsShortWithoutDots = 'jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'); - - hooks.defineLocale('fy', { - months : 'jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber'.split('_'), - monthsShort : function (m, format) { - if (!m) { - return monthsShortWithDots; - } else if (/-MMM-/.test(format)) { - return monthsShortWithoutDots[m.month()]; - } else { - return monthsShortWithDots[m.month()]; - } - }, - monthsParseExact : true, - weekdays : 'snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon'.split('_'), - weekdaysShort : 'si._mo._ti._wo._to._fr._so.'.split('_'), - weekdaysMin : 'Si_Mo_Ti_Wo_To_Fr_So'.split('_'), - weekdaysParseExact : true, - 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: '[hjoed om] LT', - nextDay: '[moarn om] LT', - nextWeek: 'dddd [om] LT', - lastDay: '[juster om] LT', - lastWeek: '[ôfrûne] dddd [om] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'oer %s', - past : '%s lyn', - s : 'in pear sekonden', - ss : '%d sekonden', - m : 'ien minút', - mm : '%d minuten', - h : 'ien oere', - hh : '%d oeren', - d : 'ien dei', - dd : '%d dagen', - M : 'ien moanne', - MM : '%d moannen', - y : 'ien jier', - yy : '%d jierren' - }, - dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/, - ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); - }, - 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 = [ - '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$5 = ['Faoi', 'Gear', 'Màrt', 'Gibl', 'Cèit', 'Ògmh', 'Iuch', 'Lùn', 'Sult', 'Dàmh', 'Samh', 'Dùbh']; - - var weekdays$2 = ['Didòmhnaich', 'Diluain', 'Dimàirt', 'Diciadain', 'Diardaoin', 'Dihaoine', 'Disathairne']; - - var weekdaysShort$1 = ['Did', 'Dil', 'Dim', 'Dic', 'Dia', 'Dih', 'Dis']; - - var weekdaysMin$1 = ['Dò', 'Lu', 'Mà', 'Ci', 'Ar', 'Ha', 'Sa']; - - hooks.defineLocale('gd', { - months : months$6, - monthsShort : monthsShort$5, - monthsParseExact : true, - weekdays : weekdays$2, - weekdaysShort : weekdaysShort$1, - weekdaysMin : weekdaysMin$1, - 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 : '[An-diugh aig] LT', - nextDay : '[A-màireach aig] LT', - nextWeek : 'dddd [aig] LT', - lastDay : '[An-dè aig] LT', - lastWeek : 'dddd [seo chaidh] [aig] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ann an %s', - past : 'bho chionn %s', - s : 'beagan diogan', - ss : '%d diogan', - m : 'mionaid', - mm : '%d mionaidean', - h : 'uair', - hh : '%d uairean', - d : 'latha', - dd : '%d latha', - M : 'mìos', - MM : '%d mìosan', - y : 'bliadhna', - yy : '%d bliadhna' - }, - 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 - - hooks.defineLocale('gl', { - months : 'xaneiro_febreiro_marzo_abril_maio_xuño_xullo_agosto_setembro_outubro_novembro_decembro'.split('_'), - monthsShort : 'xan._feb._mar._abr._mai._xuñ._xul._ago._set._out._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'domingo_luns_martes_mércores_xoves_venres_sábado'.split('_'), - weekdaysShort : 'dom._lun._mar._mér._xov._ven._sáb.'.split('_'), - weekdaysMin : 'do_lu_ma_mé_xo_ve_sá'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [de] MMMM [de] YYYY', - LLL : 'D [de] MMMM [de] YYYY H:mm', - LLLL : 'dddd, D [de] MMMM [de] YYYY H:mm' - }, - calendar : { - sameDay : function () { - return '[hoxe ' + ((this.hours() !== 1) ? 'ás' : 'á') + '] LT'; - }, - nextDay : function () { - return '[mañá ' + ((this.hours() !== 1) ? 'ás' : 'á') + '] LT'; - }, - nextWeek : function () { - return 'dddd [' + ((this.hours() !== 1) ? 'ás' : 'a') + '] LT'; - }, - lastDay : function () { - return '[onte ' + ((this.hours() !== 1) ? 'á' : 'a') + '] LT'; - }, - lastWeek : function () { - return '[o] dddd [pasado ' + ((this.hours() !== 1) ? 'ás' : 'a') + '] LT'; - }, - sameElse : 'L' - }, - relativeTime : { - future : function (str) { - if (str.indexOf('un') === 0) { - return 'n' + str; - } - return 'en ' + str; - }, - past : 'hai %s', - s : 'uns segundos', - ss : '%d segundos', - m : 'un minuto', - mm : '%d minutos', - h : 'unha hora', - hh : '%d horas', - d : 'un día', - dd : '%d días', - M : 'un mes', - MM : '%d meses', - y : 'un ano', - yy : '%d anos' - }, - 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 - - function processRelativeTime$4(number, withoutSuffix, key, isFuture) { - var format = { - 's': ['thodde secondanim', 'thodde second'], - 'ss': [number + ' secondanim', number + ' second'], - 'm': ['eka mintan', 'ek minute'], - 'mm': [number + ' mintanim', number + ' mintam'], - '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'], - 'MM': [number + ' mhoineanim', number + ' mhoine'], - 'y': ['eka vorsan', 'ek voros'], - 'yy': [number + ' vorsanim', number + ' vorsam'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } - - hooks.defineLocale('gom-latn', { - months : 'Janer_Febrer_Mars_Abril_Mai_Jun_Julai_Agost_Setembr_Otubr_Novembr_Dezembr'.split('_'), - monthsShort : 'Jan._Feb._Mars_Abr._Mai_Jun_Jul._Ago._Set._Otu._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays : 'Aitar_Somar_Mongllar_Budvar_Brestar_Sukrar_Son\'var'.split('_'), - weekdaysShort : 'Ait._Som._Mon._Bud._Bre._Suk._Son.'.split('_'), - weekdaysMin : 'Ai_Sm_Mo_Bu_Br_Su_Sn'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'A h:mm [vazta]', - LTS : 'A h:mm:ss [vazta]', - L : 'DD-MM-YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY A h:mm [vazta]', - LLLL : 'dddd, MMMM[achea] Do, YYYY, A h:mm [vazta]', - llll: 'ddd, D MMM YYYY, A h:mm [vazta]' - }, - calendar : { - sameDay: '[Aiz] LT', - nextDay: '[Faleam] LT', - nextWeek: '[Ieta to] dddd[,] LT', - lastDay: '[Kal] LT', - lastWeek: '[Fatlo] dddd[,] LT', - sameElse: 'L' - }, - relativeTime : { - future : '%s', - past : '%s adim', - s : processRelativeTime$4, - ss : processRelativeTime$4, - m : processRelativeTime$4, - mm : processRelativeTime$4, - h : processRelativeTime$4, - hh : processRelativeTime$4, - d : processRelativeTime$4, - dd : processRelativeTime$4, - M : processRelativeTime$4, - MM : processRelativeTime$4, - y : processRelativeTime$4, - yy : processRelativeTime$4 - }, - dayOfMonthOrdinalParse : /\d{1,2}(er)/, - ordinal : function (number, period) { - switch (period) { - // the ordinal 'er' only applies to day of the month - case 'D': - return number + 'er'; - default: - case 'M': - case 'Q': - case 'DDD': - case 'd': - case 'w': - case 'W': - return number; - } - }, - 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. - }, - meridiemParse: /rati|sokalli|donparam|sanje/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'rati') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'sokalli') { - return hour; - } else if (meridiem === 'donparam') { - return hour > 12 ? hour : hour + 12; - } else if (meridiem === 'sanje') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'rati'; - } else if (hour < 12) { - return 'sokalli'; - } else if (hour < 16) { - return 'donparam'; - } else if (hour < 20) { - return 'sanje'; - } else { - return 'rati'; - } - } - }); - - //! moment.js locale configuration - - var symbolMap$6 = { - '1': '૧', - '2': '૨', - '3': '૩', - '4': '૪', - '5': '૫', - '6': '૬', - '7': '૭', - '8': '૮', - '9': '૯', - '0': '૦' - }, - numberMap$5 = { - '૧': '1', - '૨': '2', - '૩': '3', - '૪': '4', - '૫': '5', - '૬': '6', - '૭': '7', - '૮': '8', - '૯': '9', - '૦': '0' - }; - - hooks.defineLocale('gu', { - months: 'જાન્યુઆરી_ફેબ્રુઆરી_માર્ચ_એપ્રિલ_મે_જૂન_જુલાઈ_ઑગસ્ટ_સપ્ટેમ્બર_ઑક્ટ્બર_નવેમ્બર_ડિસેમ્બર'.split('_'), - monthsShort: 'જાન્યુ._ફેબ્રુ._માર્ચ_એપ્રિ._મે_જૂન_જુલા._ઑગ._સપ્ટે._ઑક્ટ્._નવે._ડિસે.'.split('_'), - monthsParseExact: true, - weekdays: 'રવિવાર_સોમવાર_મંગળવાર_બુધ્વાર_ગુરુવાર_શુક્રવાર_શનિવાર'.split('_'), - weekdaysShort: 'રવિ_સોમ_મંગળ_બુધ્_ગુરુ_શુક્ર_શનિ'.split('_'), - weekdaysMin: 'ર_સો_મં_બુ_ગુ_શુ_શ'.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: '[આજ] LT', - nextDay: '[કાલે] LT', - nextWeek: 'dddd, LT', - lastDay: '[ગઇકાલે] LT', - lastWeek: '[પાછલા] dddd, LT', - sameElse: 'L' - }, - relativeTime: { - future: '%s મા', - past: '%s પેહલા', - s: 'અમુક પળો', - ss: '%d સેકંડ', - m: 'એક મિનિટ', - mm: '%d મિનિટ', - h: 'એક કલાક', - hh: '%d કલાક', - d: 'એક દિવસ', - dd: '%d દિવસ', - M: 'એક મહિનો', - MM: '%d મહિનો', - y: 'એક વર્ષ', - yy: '%d વર્ષ' - }, - preparse: function (string) { - return string.replace(/[૧૨૩૪૫૬૭૮૯૦]/g, function (match) { - return numberMap$5[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$6[match]; - }); - }, - // Gujarati notation for meridiems are quite fuzzy in practice. While there exists - // a rigid notion of a 'Pahar' it is not used as rigidly in modern Gujarati. - meridiemParse: /રાત|બપોર|સવાર|સાંજ/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'રાત') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'સવાર') { - return hour; - } else if (meridiem === 'બપોર') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'સાંજ') { - return hour + 12; - } - }, - meridiem: function (hour, minute, isLower) { - if (hour < 4) { - return 'રાત'; - } else if (hour < 10) { - return 'સવાર'; - } else if (hour < 17) { - return 'બપોર'; - } else if (hour < 20) { - return 'સાંજ'; - } else { - return 'રાત'; - } - }, - week: { - dow: 0, // Sunday is the first day of the week. - doy: 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('he', { - months : 'ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר'.split('_'), - monthsShort : 'ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳'.split('_'), - weekdays : 'ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת'.split('_'), - weekdaysShort : 'א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳'.split('_'), - weekdaysMin : 'א_ב_ג_ד_ה_ו_ש'.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', - l : 'D/M/YYYY', - ll : 'D MMM YYYY', - lll : 'D MMM YYYY HH:mm', - llll : 'ddd, D MMM YYYY HH:mm' - }, - calendar : { - sameDay : '[היום ב־]LT', - nextDay : '[מחר ב־]LT', - nextWeek : 'dddd [בשעה] LT', - lastDay : '[אתמול ב־]LT', - lastWeek : '[ביום] dddd [האחרון בשעה] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'בעוד %s', - past : 'לפני %s', - s : 'מספר שניות', - ss : '%d שניות', - m : 'דקה', - mm : '%d דקות', - h : 'שעה', - hh : function (number) { - if (number === 2) { - return 'שעתיים'; - } - return number + ' שעות'; - }, - d : 'יום', - dd : function (number) { - if (number === 2) { - return 'יומיים'; - } - return number + ' ימים'; - }, - M : 'חודש', - MM : function (number) { - if (number === 2) { - return 'חודשיים'; - } - return number + ' חודשים'; - }, - y : 'שנה', - yy : function (number) { - if (number === 2) { - return 'שנתיים'; - } else if (number % 10 === 0 && number !== 10) { - return number + ' שנה'; - } - return number + ' שנים'; - } - }, - meridiemParse: /אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i, - isPM : function (input) { - return /^(אחה"צ|אחרי הצהריים|בערב)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 5) { - return 'לפנות בוקר'; - } else if (hour < 10) { - return 'בבוקר'; - } else if (hour < 12) { - return isLower ? 'לפנה"צ' : 'לפני הצהריים'; - } else if (hour < 18) { - return isLower ? 'אחה"צ' : 'אחרי הצהריים'; - } else { - return 'בערב'; - } - } - }); - - //! moment.js locale configuration - - var symbolMap$7 = { - '1': '१', - '2': '२', - '3': '३', - '4': '४', - '5': '५', - '6': '६', - '7': '७', - '8': '८', - '9': '९', - '0': '०' - }, - numberMap$6 = { - '१': '1', - '२': '2', - '३': '3', - '४': '4', - '५': '5', - '६': '6', - '७': '7', - '८': '8', - '९': '9', - '०': '0' - }; - - hooks.defineLocale('hi', { - months : 'जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर'.split('_'), - monthsShort : 'जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.'.split('_'), - monthsParseExact: true, - weekdays : 'रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'), - weekdaysShort : 'रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि'.split('_'), - weekdaysMin : 'र_सो_मं_बु_गु_शु_श'.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 : '[आज] LT', - nextDay : '[कल] LT', - nextWeek : 'dddd, LT', - lastDay : '[कल] LT', - lastWeek : '[पिछले] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s में', - past : '%s पहले', - s : 'कुछ ही क्षण', - ss : '%d सेकंड', - m : 'एक मिनट', - mm : '%d मिनट', - h : 'एक घंटा', - hh : '%d घंटे', - d : 'एक दिन', - dd : '%d दिन', - M : 'एक महीने', - MM : '%d महीने', - y : 'एक वर्ष', - yy : '%d वर्ष' - }, - preparse: function (string) { - return string.replace(/[१२३४५६७८९०]/g, function (match) { - return numberMap$6[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$7[match]; - }); - }, - // Hindi notation for meridiems are quite fuzzy in practice. While there exists - // a rigid notion of a 'Pahar' it is not used as rigidly in modern Hindi. - meridiemParse: /रात|सुबह|दोपहर|शाम/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'रात') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'सुबह') { - return hour; - } else if (meridiem === 'दोपहर') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'शाम') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'रात'; - } else if (hour < 10) { - return 'सुबह'; - } else if (hour < 17) { - return 'दोपहर'; - } else if (hour < 20) { - return 'शाम'; - } else { - return 'रात'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - //! moment.js locale configuration - - function translate$3(number, withoutSuffix, key) { - var result = number + ' '; - switch (key) { - case 'ss': - if (number === 1) { - result += 'sekunda'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'sekunde'; - } else { - result += 'sekundi'; - } - return result; - case 'm': - return withoutSuffix ? 'jedna minuta' : 'jedne minute'; - case 'mm': - if (number === 1) { - result += 'minuta'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'minute'; - } else { - result += 'minuta'; - } - return result; - case 'h': - return withoutSuffix ? 'jedan sat' : 'jednog sata'; - case 'hh': - if (number === 1) { - result += 'sat'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'sata'; - } else { - result += 'sati'; - } - return result; - case 'dd': - if (number === 1) { - result += 'dan'; - } else { - result += 'dana'; - } - return result; - case 'MM': - if (number === 1) { - result += 'mjesec'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'mjeseca'; - } else { - result += 'mjeseci'; - } - return result; - case 'yy': - if (number === 1) { - result += 'godina'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'godine'; - } else { - result += 'godina'; - } - return result; - } - } - - hooks.defineLocale('hr', { - months : { - format: 'siječnja_veljače_ožujka_travnja_svibnja_lipnja_srpnja_kolovoza_rujna_listopada_studenoga_prosinca'.split('_'), - standalone: 'siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac'.split('_') - }, - monthsShort : 'sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.'.split('_'), - monthsParseExact: true, - weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), - weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), - weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[danas u] LT', - nextDay : '[sutra u] LT', - nextWeek : function () { - switch (this.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'; - } - }, - lastDay : '[jučer u] LT', - lastWeek : function () { - switch (this.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'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'prije %s', - s : 'par sekundi', - ss : translate$3, - m : translate$3, - mm : translate$3, - h : translate$3, - hh : translate$3, - d : 'dan', - dd : translate$3, - M : 'mjesec', - MM : translate$3, - y : 'godinu', - yy : translate$3 - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - var weekEndings = 'vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton'.split(' '); - function translate$4(number, withoutSuffix, key, isFuture) { - var num = number; - switch (key) { - case 's': - return (isFuture || withoutSuffix) ? 'néhány másodperc' : 'néhány másodperce'; - case 'ss': - return num + (isFuture || withoutSuffix) ? ' másodperc' : ' másodperce'; - case 'm': - return 'egy' + (isFuture || withoutSuffix ? ' perc' : ' perce'); - case 'mm': - return num + (isFuture || withoutSuffix ? ' perc' : ' perce'); - case 'h': - return 'egy' + (isFuture || withoutSuffix ? ' óra' : ' órája'); - case 'hh': - return num + (isFuture || withoutSuffix ? ' óra' : ' órája'); - case 'd': - return 'egy' + (isFuture || withoutSuffix ? ' nap' : ' napja'); - case 'dd': - return num + (isFuture || withoutSuffix ? ' nap' : ' napja'); - case 'M': - return 'egy' + (isFuture || withoutSuffix ? ' hónap' : ' hónapja'); - case 'MM': - return num + (isFuture || withoutSuffix ? ' hónap' : ' hónapja'); - case 'y': - return 'egy' + (isFuture || withoutSuffix ? ' év' : ' éve'); - case 'yy': - return num + (isFuture || withoutSuffix ? ' év' : ' éve'); - } - return ''; - } - function week(isFuture) { - return (isFuture ? '' : '[múlt] ') + '[' + weekEndings[this.day()] + '] LT[-kor]'; - } - - hooks.defineLocale('hu', { - months : 'január_február_március_április_május_június_július_augusztus_szeptember_október_november_december'.split('_'), - monthsShort : 'jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec'.split('_'), - weekdays : 'vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat'.split('_'), - weekdaysShort : 'vas_hét_kedd_sze_csüt_pén_szo'.split('_'), - weekdaysMin : 'v_h_k_sze_cs_p_szo'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'YYYY.MM.DD.', - LL : 'YYYY. MMMM D.', - LLL : 'YYYY. MMMM D. H:mm', - LLLL : 'YYYY. MMMM D., dddd H:mm' - }, - meridiemParse: /de|du/i, - isPM: function (input) { - return input.charAt(1).toLowerCase() === 'u'; - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 12) { - return isLower === true ? 'de' : 'DE'; - } else { - return isLower === true ? 'du' : 'DU'; - } - }, - calendar : { - sameDay : '[ma] LT[-kor]', - nextDay : '[holnap] LT[-kor]', - nextWeek : function () { - return week.call(this, true); - }, - lastDay : '[tegnap] LT[-kor]', - lastWeek : function () { - return week.call(this, false); - }, - sameElse : 'L' - }, - relativeTime : { - future : '%s múlva', - past : '%s', - s : translate$4, - ss : translate$4, - m : translate$4, - mm : translate$4, - h : translate$4, - hh : translate$4, - d : translate$4, - dd : translate$4, - M : translate$4, - MM : translate$4, - y : translate$4, - yy : translate$4 - }, - 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('hy-am', { - months : { - format: 'հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի'.split('_'), - standalone: 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split('_') - }, - monthsShort : 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_'), - weekdays : 'կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ'.split('_'), - weekdaysShort : 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'), - weekdaysMin : 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.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: '[այսօր] LT', - nextDay: '[վաղը] LT', - lastDay: '[երեկ] LT', - nextWeek: function () { - return 'dddd [օրը ժամը] LT'; - }, - lastWeek: function () { - return '[անցած] dddd [օրը ժամը] LT'; - }, - sameElse: 'L' - }, - relativeTime : { - future : '%s հետո', - past : '%s առաջ', - s : 'մի քանի վայրկյան', - ss : '%d վայրկյան', - m : 'րոպե', - mm : '%d րոպե', - h : 'ժամ', - hh : '%d ժամ', - d : 'օր', - dd : '%d օր', - M : 'ամիս', - MM : '%d ամիս', - y : 'տարի', - yy : '%d տարի' - }, - meridiemParse: /գիշերվա|առավոտվա|ցերեկվա|երեկոյան/, - isPM: function (input) { - return /^(ցերեկվա|երեկոյան)$/.test(input); - }, - meridiem : function (hour) { - if (hour < 4) { - return 'գիշերվա'; - } else if (hour < 12) { - return 'առավոտվա'; - } else if (hour < 17) { - return 'ցերեկվա'; - } else { - return 'երեկոյան'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}|\d{1,2}-(ին|րդ)/, - ordinal: function (number, period) { - switch (period) { - case 'DDD': - case 'w': - case 'W': - case 'DDDo': - if (number === 1) { - return number + '-ին'; - } - return number + '-րդ'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('id', { - months : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Agt_Sep_Okt_Nov_Des'.split('_'), - weekdays : 'Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu'.split('_'), - weekdaysShort : 'Min_Sen_Sel_Rab_Kam_Jum_Sab'.split('_'), - weekdaysMin : 'Mg_Sn_Sl_Rb_Km_Jm_Sb'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /pagi|siang|sore|malam/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'pagi') { - return hour; - } else if (meridiem === 'siang') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'sore' || meridiem === 'malam') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'pagi'; - } else if (hours < 15) { - return 'siang'; - } else if (hours < 19) { - return 'sore'; - } else { - return 'malam'; - } - }, - calendar : { - sameDay : '[Hari ini pukul] LT', - nextDay : '[Besok pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kemarin pukul] LT', - lastWeek : 'dddd [lalu pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dalam %s', - past : '%s yang lalu', - s : 'beberapa detik', - ss : '%d detik', - m : 'semenit', - mm : '%d menit', - h : 'sejam', - hh : '%d jam', - d : 'sehari', - dd : '%d hari', - M : 'sebulan', - MM : '%d bulan', - y : 'setahun', - yy : '%d tahun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - function plural$2(n) { - if (n % 100 === 11) { - return true; - } else if (n % 10 === 1) { - return false; - } - return true; - } - function translate$5(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': - return withoutSuffix || isFuture ? 'nokkrar sekúndur' : 'nokkrum sekúndum'; - case 'ss': - if (plural$2(number)) { - return result + (withoutSuffix || isFuture ? 'sekúndur' : 'sekúndum'); - } - return result + 'sekúnda'; - case 'm': - return withoutSuffix ? 'mínúta' : 'mínútu'; - case 'mm': - if (plural$2(number)) { - return result + (withoutSuffix || isFuture ? 'mínútur' : 'mínútum'); - } else if (withoutSuffix) { - return result + 'mínúta'; - } - return result + 'mínútu'; - case 'hh': - if (plural$2(number)) { - return result + (withoutSuffix || isFuture ? 'klukkustundir' : 'klukkustundum'); - } - return result + 'klukkustund'; - case 'd': - if (withoutSuffix) { - return 'dagur'; - } - return isFuture ? 'dag' : 'degi'; - case 'dd': - if (plural$2(number)) { - if (withoutSuffix) { - return result + 'dagar'; - } - return result + (isFuture ? 'daga' : 'dögum'); - } else if (withoutSuffix) { - return result + 'dagur'; - } - return result + (isFuture ? 'dag' : 'degi'); - case 'M': - if (withoutSuffix) { - return 'mánuður'; - } - return isFuture ? 'mánuð' : 'mánuði'; - case 'MM': - if (plural$2(number)) { - if (withoutSuffix) { - return result + 'mánuðir'; - } - return result + (isFuture ? 'mánuði' : 'mánuðum'); - } else if (withoutSuffix) { - return result + 'mánuður'; - } - return result + (isFuture ? 'mánuð' : 'mánuði'); - case 'y': - return withoutSuffix || isFuture ? 'ár' : 'ári'; - case 'yy': - if (plural$2(number)) { - return result + (withoutSuffix || isFuture ? 'ár' : 'árum'); - } - return result + (withoutSuffix || isFuture ? 'ár' : 'ári'); - } - } - - hooks.defineLocale('is', { - months : 'janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember'.split('_'), - monthsShort : 'jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des'.split('_'), - weekdays : 'sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur'.split('_'), - weekdaysShort : 'sun_mán_þri_mið_fim_fös_lau'.split('_'), - weekdaysMin : 'Su_Má_Þr_Mi_Fi_Fö_La'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY [kl.] H:mm', - LLLL : 'dddd, D. MMMM YYYY [kl.] H:mm' - }, - calendar : { - sameDay : '[í dag kl.] LT', - nextDay : '[á morgun kl.] LT', - nextWeek : 'dddd [kl.] LT', - lastDay : '[í gær kl.] LT', - lastWeek : '[síðasta] dddd [kl.] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'eftir %s', - past : 'fyrir %s síðan', - s : translate$5, - ss : translate$5, - m : translate$5, - mm : translate$5, - h : 'klukkustund', - hh : translate$5, - d : translate$5, - dd : translate$5, - M : translate$5, - MM : translate$5, - y : translate$5, - yy : translate$5 - }, - 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-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('_'), - 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('ja', { - months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日'.split('_'), - weekdaysShort : '日_月_火_水_木_金_土'.split('_'), - weekdaysMin : '日_月_火_水_木_金_土'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY/MM/DD', - LL : 'YYYY年M月D日', - LLL : 'YYYY年M月D日 HH:mm', - LLLL : 'YYYY年M月D日 dddd HH:mm', - l : 'YYYY/MM/DD', - ll : 'YYYY年M月D日', - lll : 'YYYY年M月D日 HH:mm', - llll : 'YYYY年M月D日(ddd) HH:mm' - }, - meridiemParse: /午前|午後/i, - isPM : function (input) { - return input === '午後'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return '午前'; - } else { - return '午後'; - } - }, - calendar : { - sameDay : '[今日] LT', - nextDay : '[明日] LT', - nextWeek : function (now) { - if (now.week() < this.week()) { - return '[来週]dddd LT'; - } else { - return 'dddd LT'; - } - }, - lastDay : '[昨日] LT', - lastWeek : function (now) { - if (this.week() < now.week()) { - return '[先週]dddd LT'; - } else { - return 'dddd LT'; - } - }, - sameElse : 'L' - }, - dayOfMonthOrdinalParse : /\d{1,2}日/, - ordinal : function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '日'; - default: - return number; - } - }, - relativeTime : { - future : '%s後', - past : '%s前', - s : '数秒', - ss : '%d秒', - m : '1分', - mm : '%d分', - h : '1時間', - hh : '%d時間', - d : '1日', - dd : '%d日', - M : '1ヶ月', - MM : '%dヶ月', - y : '1年', - yy : '%d年' - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('jv', { - months : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des'.split('_'), - weekdays : 'Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu'.split('_'), - weekdaysShort : 'Min_Sen_Sel_Reb_Kem_Jem_Sep'.split('_'), - weekdaysMin : 'Mg_Sn_Sl_Rb_Km_Jm_Sp'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /enjing|siyang|sonten|ndalu/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'enjing') { - return hour; - } else if (meridiem === 'siyang') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'sonten' || meridiem === 'ndalu') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'enjing'; - } else if (hours < 15) { - return 'siyang'; - } else if (hours < 19) { - return 'sonten'; - } else { - return 'ndalu'; - } - }, - calendar : { - sameDay : '[Dinten puniko pukul] LT', - nextDay : '[Mbenjang pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kala wingi pukul] LT', - lastWeek : 'dddd [kepengker pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'wonten ing %s', - past : '%s ingkang kepengker', - s : 'sawetawis detik', - ss : '%d detik', - m : 'setunggal menit', - mm : '%d menit', - h : 'setunggal jam', - hh : '%d jam', - d : 'sedinten', - dd : '%d dinten', - M : 'sewulan', - MM : '%d wulan', - y : 'setaun', - yy : '%d taun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('ka', { - months : { - standalone: 'იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი'.split('_'), - format: 'იანვარს_თებერვალს_მარტს_აპრილის_მაისს_ივნისს_ივლისს_აგვისტს_სექტემბერს_ოქტომბერს_ნოემბერს_დეკემბერს'.split('_') - }, - monthsShort : 'იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ'.split('_'), - weekdays : { - standalone: 'კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი'.split('_'), - format: 'კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს'.split('_'), - isFormat: /(წინა|შემდეგ)/ - }, - weekdaysShort : 'კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ'.split('_'), - weekdaysMin : 'კვ_ორ_სა_ოთ_ხუ_პა_შა'.split('_'), - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[დღეს] LT[-ზე]', - nextDay : '[ხვალ] LT[-ზე]', - lastDay : '[გუშინ] LT[-ზე]', - nextWeek : '[შემდეგ] dddd LT[-ზე]', - lastWeek : '[წინა] dddd LT-ზე', - sameElse : 'L' - }, - relativeTime : { - future : function (s) { - return (/(წამი|წუთი|საათი|წელი)/).test(s) ? - s.replace(/ი$/, 'ში') : - s + 'ში'; - }, - past : function (s) { - if ((/(წამი|წუთი|საათი|დღე|თვე)/).test(s)) { - return s.replace(/(ი|ე)$/, 'ის წინ'); - } - if ((/წელი/).test(s)) { - return s.replace(/წელი$/, 'წლის წინ'); - } - }, - s : 'რამდენიმე წამი', - ss : '%d წამი', - m : 'წუთი', - mm : '%d წუთი', - h : 'საათი', - hh : '%d საათი', - d : 'დღე', - dd : '%d დღე', - M : 'თვე', - MM : '%d თვე', - y : 'წელი', - yy : '%d წელი' - }, - dayOfMonthOrdinalParse: /0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/, - ordinal : function (number) { - if (number === 0) { - return number; - } - if (number === 1) { - return number + '-ლი'; - } - if ((number < 20) || (number <= 100 && (number % 20 === 0)) || (number % 100 === 0)) { - return 'მე-' + number; - } - return number + '-ე'; - }, - week : { - dow : 1, - doy : 7 - } - }); - - //! moment.js locale configuration - - var suffixes$1 = { - 0: '-ші', - 1: '-ші', - 2: '-ші', - 3: '-ші', - 4: '-ші', - 5: '-ші', - 6: '-шы', - 7: '-ші', - 8: '-ші', - 9: '-шы', - 10: '-шы', - 20: '-шы', - 30: '-шы', - 40: '-шы', - 50: '-ші', - 60: '-шы', - 70: '-ші', - 80: '-ші', - 90: '-шы', - 100: '-ші' - }; - - hooks.defineLocale('kk', { - months : 'қаңтар_ақпан_наурыз_сәуір_мамыр_маусым_шілде_тамыз_қыркүйек_қазан_қараша_желтоқсан'.split('_'), - monthsShort : 'қаң_ақп_нау_сәу_мам_мау_шіл_там_қыр_қаз_қар_жел'.split('_'), - weekdays : 'жексенбі_дүйсенбі_сейсенбі_сәрсенбі_бейсенбі_жұма_сенбі'.split('_'), - weekdaysShort : 'жек_дүй_сей_сәр_бей_жұм_сен'.split('_'), - weekdaysMin : 'жк_дй_сй_ср_бй_жм_сн'.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 : '[Бүгін сағат] LT', - nextDay : '[Ертең сағат] LT', - nextWeek : 'dddd [сағат] LT', - lastDay : '[Кеше сағат] LT', - lastWeek : '[Өткен аптаның] dddd [сағат] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ішінде', - past : '%s бұрын', - s : 'бірнеше секунд', - ss : '%d секунд', - m : 'бір минут', - mm : '%d минут', - h : 'бір сағат', - hh : '%d сағат', - d : 'бір күн', - dd : '%d күн', - M : 'бір ай', - MM : '%d ай', - y : 'бір жыл', - yy : '%d жыл' - }, - dayOfMonthOrdinalParse: /\d{1,2}-(ші|шы)/, - ordinal : function (number) { - var a = number % 10, - b = number >= 100 ? 100 : null; - return number + (suffixes$1[number] || suffixes$1[a] || suffixes$1[b]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - var symbolMap$8 = { - '1': '១', - '2': '២', - '3': '៣', - '4': '៤', - '5': '៥', - '6': '៦', - '7': '៧', - '8': '៨', - '9': '៩', - '0': '០' - }, numberMap$7 = { - '១': '1', - '២': '2', - '៣': '3', - '៤': '4', - '៥': '5', - '៦': '6', - '៧': '7', - '៨': '8', - '៩': '9', - '០': '0' - }; - - hooks.defineLocale('km', { - months: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split( - '_' - ), - monthsShort: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split( - '_' - ), - weekdays: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'), - weekdaysShort: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'), - weekdaysMin: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'), - weekdaysParseExact: true, - 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: /ព្រឹក|ល្ងាច/, - isPM: function (input) { - return input === 'ល្ងាច'; - }, - meridiem: function (hour, minute, isLower) { - if (hour < 12) { - return 'ព្រឹក'; - } else { - return 'ល្ងាច'; - } - }, - calendar: { - sameDay: '[ថ្ងៃនេះ ម៉ោង] LT', - nextDay: '[ស្អែក ម៉ោង] LT', - nextWeek: 'dddd [ម៉ោង] LT', - lastDay: '[ម្សិលមិញ ម៉ោង] LT', - lastWeek: 'dddd [សប្តាហ៍មុន] [ម៉ោង] LT', - sameElse: 'L' - }, - relativeTime: { - future: '%sទៀត', - past: '%sមុន', - s: 'ប៉ុន្មានវិនាទី', - ss: '%d វិនាទី', - m: 'មួយនាទី', - mm: '%d នាទី', - h: 'មួយម៉ោង', - hh: '%d ម៉ោង', - d: 'មួយថ្ងៃ', - dd: '%d ថ្ងៃ', - M: 'មួយខែ', - MM: '%d ខែ', - y: 'មួយឆ្នាំ', - yy: '%d ឆ្នាំ' - }, - dayOfMonthOrdinalParse : /ទី\d{1,2}/, - ordinal : 'ទី%d', - preparse: function (string) { - return string.replace(/[១២៣៤៥៦៧៨៩០]/g, function (match) { - return numberMap$7[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$8[match]; - }); - }, - 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 symbolMap$9 = { - '1': '೧', - '2': '೨', - '3': '೩', - '4': '೪', - '5': '೫', - '6': '೬', - '7': '೭', - '8': '೮', - '9': '೯', - '0': '೦' - }, - numberMap$8 = { - '೧': '1', - '೨': '2', - '೩': '3', - '೪': '4', - '೫': '5', - '೬': '6', - '೭': '7', - '೮': '8', - '೯': '9', - '೦': '0' - }; - - hooks.defineLocale('kn', { - months : 'ಜನವರಿ_ಫೆಬ್ರವರಿ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂಬರ್_ಅಕ್ಟೋಬರ್_ನವೆಂಬರ್_ಡಿಸೆಂಬರ್'.split('_'), - monthsShort : 'ಜನ_ಫೆಬ್ರ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂ_ಅಕ್ಟೋ_ನವೆಂ_ಡಿಸೆಂ'.split('_'), - monthsParseExact: true, - weekdays : 'ಭಾನುವಾರ_ಸೋಮವಾರ_ಮಂಗಳವಾರ_ಬುಧವಾರ_ಗುರುವಾರ_ಶುಕ್ರವಾರ_ಶನಿವಾರ'.split('_'), - weekdaysShort : 'ಭಾನು_ಸೋಮ_ಮಂಗಳ_ಬುಧ_ಗುರು_ಶುಕ್ರ_ಶನಿ'.split('_'), - weekdaysMin : 'ಭಾ_ಸೋ_ಮಂ_ಬು_ಗು_ಶು_ಶ'.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 : '[ಇಂದು] LT', - nextDay : '[ನಾಳೆ] LT', - nextWeek : 'dddd, LT', - lastDay : '[ನಿನ್ನೆ] LT', - lastWeek : '[ಕೊನೆಯ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ನಂತರ', - past : '%s ಹಿಂದೆ', - s : 'ಕೆಲವು ಕ್ಷಣಗಳು', - ss : '%d ಸೆಕೆಂಡುಗಳು', - m : 'ಒಂದು ನಿಮಿಷ', - mm : '%d ನಿಮಿಷ', - h : 'ಒಂದು ಗಂಟೆ', - hh : '%d ಗಂಟೆ', - d : 'ಒಂದು ದಿನ', - dd : '%d ದಿನ', - M : 'ಒಂದು ತಿಂಗಳು', - MM : '%d ತಿಂಗಳು', - y : 'ಒಂದು ವರ್ಷ', - yy : '%d ವರ್ಷ' - }, - preparse: function (string) { - return string.replace(/[೧೨೩೪೫೬೭೮೯೦]/g, function (match) { - return numberMap$8[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$9[match]; - }); - }, - meridiemParse: /ರಾತ್ರಿ|ಬೆಳಿಗ್ಗೆ|ಮಧ್ಯಾಹ್ನ|ಸಂಜೆ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'ರಾತ್ರಿ') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'ಬೆಳಿಗ್ಗೆ') { - return hour; - } else if (meridiem === 'ಮಧ್ಯಾಹ್ನ') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'ಸಂಜೆ') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ರಾತ್ರಿ'; - } else if (hour < 10) { - return 'ಬೆಳಿಗ್ಗೆ'; - } else if (hour < 17) { - return 'ಮಧ್ಯಾಹ್ನ'; - } else if (hour < 20) { - return 'ಸಂಜೆ'; - } else { - return 'ರಾತ್ರಿ'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}(ನೇ)/, - ordinal : function (number) { - return number + 'ನೇ'; - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('ko', { - months : '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'), - monthsShort : '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'), - weekdays : '일요일_월요일_화요일_수요일_목요일_금요일_토요일'.split('_'), - weekdaysShort : '일_월_화_수_목_금_토'.split('_'), - weekdaysMin : '일_월_화_수_목_금_토'.split('_'), - longDateFormat : { - LT : 'A h:mm', - LTS : 'A h:mm:ss', - L : 'YYYY.MM.DD.', - LL : 'YYYY년 MMMM D일', - LLL : 'YYYY년 MMMM D일 A h:mm', - LLLL : 'YYYY년 MMMM D일 dddd A h:mm', - l : 'YYYY.MM.DD.', - ll : 'YYYY년 MMMM D일', - lll : 'YYYY년 MMMM D일 A h:mm', - llll : 'YYYY년 MMMM D일 dddd A h:mm' - }, - calendar : { - sameDay : '오늘 LT', - nextDay : '내일 LT', - nextWeek : 'dddd LT', - lastDay : '어제 LT', - lastWeek : '지난주 dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s 후', - past : '%s 전', - s : '몇 초', - ss : '%d초', - m : '1분', - mm : '%d분', - h : '한 시간', - hh : '%d시간', - d : '하루', - dd : '%d일', - M : '한 달', - MM : '%d달', - y : '일 년', - yy : '%d년' - }, - dayOfMonthOrdinalParse : /\d{1,2}(일|월|주)/, - ordinal : function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '일'; - case 'M': - return number + '월'; - case 'w': - case 'W': - return number + '주'; - default: - return number; - } - }, - meridiemParse : /오전|오후/, - isPM : function (token) { - return token === '오후'; - }, - meridiem : function (hour, minute, isUpper) { - return hour < 12 ? '오전' : '오후'; - } - }); - - //! moment.js locale configuration - - var symbolMap$a = { - '1': '١', - '2': '٢', - '3': '٣', - '4': '٤', - '5': '٥', - '6': '٦', - '7': '٧', - '8': '٨', - '9': '٩', - '0': '٠' - }, numberMap$9 = { - '١': '1', - '٢': '2', - '٣': '3', - '٤': '4', - '٥': '5', - '٦': '6', - '٧': '7', - '٨': '8', - '٩': '9', - '٠': '0' - }, - months$7 = [ - 'کانونی دووەم', - 'شوبات', - 'ئازار', - 'نیسان', - 'ئایار', - 'حوزەیران', - 'تەمموز', - 'ئاب', - 'ئەیلوول', - 'تشرینی یەكەم', - 'تشرینی دووەم', - 'كانونی یەکەم' - ]; - - - hooks.defineLocale('ku', { - months : months$7, - monthsShort : months$7, - weekdays : 'یه‌كشه‌ممه‌_دووشه‌ممه‌_سێشه‌ممه‌_چوارشه‌ممه‌_پێنجشه‌ممه‌_هه‌ینی_شه‌ممه‌'.split('_'), - weekdaysShort : 'یه‌كشه‌م_دووشه‌م_سێشه‌م_چوارشه‌م_پێنجشه‌م_هه‌ینی_شه‌ممه‌'.split('_'), - weekdaysMin : 'ی_د_س_چ_پ_ه_ش'.split('_'), - weekdaysParseExact : true, - 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: /ئێواره‌|به‌یانی/, - isPM: function (input) { - return /ئێواره‌/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'به‌یانی'; - } else { - return 'ئێواره‌'; - } - }, - calendar : { - sameDay : '[ئه‌مرۆ كاتژمێر] LT', - nextDay : '[به‌یانی كاتژمێر] LT', - nextWeek : 'dddd [كاتژمێر] LT', - lastDay : '[دوێنێ كاتژمێر] LT', - lastWeek : 'dddd [كاتژمێر] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'له‌ %s', - past : '%s', - s : 'چه‌ند چركه‌یه‌ك', - ss : 'چركه‌ %d', - m : 'یه‌ك خوله‌ك', - mm : '%d خوله‌ك', - h : 'یه‌ك كاتژمێر', - hh : '%d كاتژمێر', - d : 'یه‌ك ڕۆژ', - dd : '%d ڕۆژ', - M : 'یه‌ك مانگ', - MM : '%d مانگ', - y : 'یه‌ك ساڵ', - yy : '%d ساڵ' - }, - preparse: function (string) { - return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { - return numberMap$9[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$a[match]; - }).replace(/,/g, '،'); - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } - }); - - //! moment.js locale configuration - - var suffixes$2 = { - 0: '-чү', - 1: '-чи', - 2: '-чи', - 3: '-чү', - 4: '-чү', - 5: '-чи', - 6: '-чы', - 7: '-чи', - 8: '-чи', - 9: '-чу', - 10: '-чу', - 20: '-чы', - 30: '-чу', - 40: '-чы', - 50: '-чү', - 60: '-чы', - 70: '-чи', - 80: '-чи', - 90: '-чу', - 100: '-чү' - }; - - hooks.defineLocale('ky', { - months : 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_'), - monthsShort : 'янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек'.split('_'), - weekdays : 'Жекшемби_Дүйшөмбү_Шейшемби_Шаршемби_Бейшемби_Жума_Ишемби'.split('_'), - weekdaysShort : 'Жек_Дүй_Шей_Шар_Бей_Жум_Ише'.split('_'), - weekdaysMin : 'Жк_Дй_Шй_Шр_Бй_Жм_Иш'.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 : '[Бүгүн саат] LT', - nextDay : '[Эртең саат] LT', - nextWeek : 'dddd [саат] LT', - lastDay : '[Кечээ саат] LT', - lastWeek : '[Өткөн аптанын] dddd [күнү] [саат] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ичинде', - past : '%s мурун', - s : 'бирнече секунд', - ss : '%d секунд', - m : 'бир мүнөт', - mm : '%d мүнөт', - h : 'бир саат', - hh : '%d саат', - d : 'бир күн', - dd : '%d күн', - M : 'бир ай', - MM : '%d ай', - y : 'бир жыл', - yy : '%d жыл' - }, - dayOfMonthOrdinalParse: /\d{1,2}-(чи|чы|чү|чу)/, - ordinal : function (number) { - var a = number % 10, - b = number >= 100 ? 100 : null; - return number + (suffixes$2[number] || suffixes$2[a] || suffixes$2[b]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - function processRelativeTime$5(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eng Minutt', 'enger Minutt'], - 'h': ['eng Stonn', 'enger Stonn'], - 'd': ['een Dag', 'engem Dag'], - 'M': ['ee Mount', 'engem Mount'], - 'y': ['ee Joer', 'engem Joer'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } - function processFutureTime(string) { - var number = string.substr(0, string.indexOf(' ')); - if (eifelerRegelAppliesToNumber(number)) { - return 'a ' + string; - } - return 'an ' + string; - } - function processPastTime(string) { - var number = string.substr(0, string.indexOf(' ')); - if (eifelerRegelAppliesToNumber(number)) { - return 'viru ' + string; - } - return 'virun ' + string; - } - /** - * Returns true if the word before the given number loses the '-n' ending. - * e.g. 'an 10 Deeg' but 'a 5 Deeg' - * - * @param number {integer} - * @returns {boolean} - */ - function eifelerRegelAppliesToNumber(number) { - number = parseInt(number, 10); - if (isNaN(number)) { - return false; - } - if (number < 0) { - // Negative Number --> always true - return true; - } else if (number < 10) { - // Only 1 digit - if (4 <= number && number <= 7) { - return true; - } - return false; - } else if (number < 100) { - // 2 digits - var lastDigit = number % 10, firstDigit = number / 10; - if (lastDigit === 0) { - return eifelerRegelAppliesToNumber(firstDigit); - } - return eifelerRegelAppliesToNumber(lastDigit); - } else if (number < 10000) { - // 3 or 4 digits --> recursively check first digit - while (number >= 10) { - number = number / 10; - } - return eifelerRegelAppliesToNumber(number); - } else { - // Anything larger than 4 digits: recursively check first n-3 digits - number = number / 1000; - return eifelerRegelAppliesToNumber(number); - } - } - - hooks.defineLocale('lb', { - months: 'Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort: 'Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays: 'Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg'.split('_'), - weekdaysShort: 'So._Mé._Dë._Më._Do._Fr._Sa.'.split('_'), - weekdaysMin: 'So_Mé_Dë_Më_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm [Auer]', - LTS: 'H:mm:ss [Auer]', - L: 'DD.MM.YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm [Auer]', - LLLL: 'dddd, D. MMMM YYYY H:mm [Auer]' - }, - calendar: { - sameDay: '[Haut um] LT', - sameElse: 'L', - nextDay: '[Muer um] LT', - nextWeek: 'dddd [um] LT', - lastDay: '[Gëschter um] LT', - lastWeek: function () { - // Different date string for 'Dënschdeg' (Tuesday) and 'Donneschdeg' (Thursday) due to phonological rule - switch (this.day()) { - case 2: - case 4: - return '[Leschten] dddd [um] LT'; - default: - return '[Leschte] dddd [um] LT'; - } - } - }, - relativeTime : { - future : processFutureTime, - past : processPastTime, - s : 'e puer Sekonnen', - ss : '%d Sekonnen', - m : processRelativeTime$5, - mm : '%d Minutten', - h : processRelativeTime$5, - hh : '%d Stonnen', - d : processRelativeTime$5, - dd : '%d Deeg', - M : processRelativeTime$5, - MM : '%d Méint', - y : processRelativeTime$5, - yy : '%d Joer' - }, - 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('lo', { - months : 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split('_'), - monthsShort : 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split('_'), - weekdays : 'ອາທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'), - weekdaysShort : 'ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'), - weekdaysMin : 'ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ'.split('_'), - weekdaysParseExact : true, - 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: /ຕອນເຊົ້າ|ຕອນແລງ/, - isPM: function (input) { - return input === 'ຕອນແລງ'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ຕອນເຊົ້າ'; - } else { - return 'ຕອນແລງ'; - } - }, - calendar : { - sameDay : '[ມື້ນີ້ເວລາ] LT', - nextDay : '[ມື້ອື່ນເວລາ] LT', - nextWeek : '[ວັນ]dddd[ໜ້າເວລາ] LT', - lastDay : '[ມື້ວານນີ້ເວລາ] LT', - lastWeek : '[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ອີກ %s', - past : '%sຜ່ານມາ', - s : 'ບໍ່ເທົ່າໃດວິນາທີ', - ss : '%d ວິນາທີ' , - m : '1 ນາທີ', - mm : '%d ນາທີ', - h : '1 ຊົ່ວໂມງ', - hh : '%d ຊົ່ວໂມງ', - d : '1 ມື້', - dd : '%d ມື້', - M : '1 ເດືອນ', - MM : '%d ເດືອນ', - y : '1 ປີ', - yy : '%d ປີ' - }, - dayOfMonthOrdinalParse: /(ທີ່)\d{1,2}/, - ordinal : function (number) { - return 'ທີ່' + number; - } - }); - - //! moment.js locale configuration - - var units = { - 'ss' : 'sekundė_sekundžių_sekundes', - 'm' : 'minutė_minutės_minutę', - 'mm': 'minutės_minučių_minutes', - 'h' : 'valanda_valandos_valandą', - 'hh': 'valandos_valandų_valandas', - 'd' : 'diena_dienos_dieną', - 'dd': 'dienos_dienų_dienas', - 'M' : 'mėnuo_mėnesio_mėnesį', - 'MM': 'mėnesiai_mėnesių_mėnesius', - 'y' : 'metai_metų_metus', - 'yy': 'metai_metų_metus' - }; - function translateSeconds(number, withoutSuffix, key, isFuture) { - if (withoutSuffix) { - return 'kelios sekundės'; - } else { - return isFuture ? 'kelių sekundžių' : 'kelias sekundes'; - } - } - function translateSingular(number, withoutSuffix, key, isFuture) { - return withoutSuffix ? forms(key)[0] : (isFuture ? forms(key)[1] : forms(key)[2]); - } - function special(number) { - return number % 10 === 0 || (number > 10 && number < 20); - } - function forms(key) { - return units[key].split('_'); - } - function translate$6(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - if (number === 1) { - return result + translateSingular(number, withoutSuffix, key[0], isFuture); - } else if (withoutSuffix) { - return result + (special(number) ? forms(key)[1] : forms(key)[0]); - } else { - if (isFuture) { - return result + forms(key)[1]; - } else { - return result + (special(number) ? forms(key)[1] : forms(key)[2]); - } - } - } - hooks.defineLocale('lt', { - months : { - format: 'sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio'.split('_'), - standalone: 'sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis'.split('_'), - isFormat: /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|MMMM?(\[[^\[\]]*\]|\s)+D[oD]?/ - }, - monthsShort : 'sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd'.split('_'), - weekdays : { - format: 'sekmadienį_pirmadienį_antradienį_trečiadienį_ketvirtadienį_penktadienį_šeštadienį'.split('_'), - standalone: 'sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis'.split('_'), - isFormat: /dddd HH:mm/ - }, - weekdaysShort : 'Sek_Pir_Ant_Tre_Ket_Pen_Šeš'.split('_'), - weekdaysMin : 'S_P_A_T_K_Pn_Š'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'YYYY [m.] MMMM D [d.]', - LLL : 'YYYY [m.] MMMM D [d.], HH:mm [val.]', - LLLL : 'YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]', - l : 'YYYY-MM-DD', - ll : 'YYYY [m.] MMMM D [d.]', - lll : 'YYYY [m.] MMMM D [d.], HH:mm [val.]', - llll : 'YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]' - }, - calendar : { - sameDay : '[Šiandien] LT', - nextDay : '[Rytoj] LT', - nextWeek : 'dddd LT', - lastDay : '[Vakar] LT', - lastWeek : '[Praėjusį] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : 'po %s', - past : 'prieš %s', - s : translateSeconds, - ss : translate$6, - m : translateSingular, - mm : translate$6, - h : translateSingular, - hh : translate$6, - d : translateSingular, - dd : translate$6, - M : translateSingular, - MM : translate$6, - y : translateSingular, - yy : translate$6 - }, - dayOfMonthOrdinalParse: /\d{1,2}-oji/, - ordinal : function (number) { - return number + '-oji'; - }, - 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 units$1 = { - 'ss': 'sekundes_sekundēm_sekunde_sekundes'.split('_'), - 'm': 'minūtes_minūtēm_minūte_minūtes'.split('_'), - 'mm': 'minūtes_minūtēm_minūte_minūtes'.split('_'), - 'h': 'stundas_stundām_stunda_stundas'.split('_'), - 'hh': 'stundas_stundām_stunda_stundas'.split('_'), - 'd': 'dienas_dienām_diena_dienas'.split('_'), - 'dd': 'dienas_dienām_diena_dienas'.split('_'), - 'M': 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'), - 'MM': 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'), - 'y': 'gada_gadiem_gads_gadi'.split('_'), - 'yy': 'gada_gadiem_gads_gadi'.split('_') - }; - /** - * @param withoutSuffix boolean true = a length of time; false = before/after a period of time. - */ - function format$1(forms, number, withoutSuffix) { - if (withoutSuffix) { - // E.g. "21 minūte", "3 minūtes". - return number % 10 === 1 && number % 100 !== 11 ? forms[2] : forms[3]; - } else { - // E.g. "21 minūtes" as in "pēc 21 minūtes". - // E.g. "3 minūtēm" as in "pēc 3 minūtēm". - return number % 10 === 1 && number % 100 !== 11 ? forms[0] : forms[1]; - } - } - function relativeTimeWithPlural$1(number, withoutSuffix, key) { - return number + ' ' + format$1(units$1[key], number, withoutSuffix); - } - function relativeTimeWithSingular(number, withoutSuffix, key) { - return format$1(units$1[key], number, withoutSuffix); - } - function relativeSeconds(number, withoutSuffix) { - return withoutSuffix ? 'dažas sekundes' : 'dažām sekundēm'; - } - - hooks.defineLocale('lv', { - months : 'janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris'.split('_'), - monthsShort : 'jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec'.split('_'), - weekdays : 'svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena'.split('_'), - weekdaysShort : 'Sv_P_O_T_C_Pk_S'.split('_'), - weekdaysMin : 'Sv_P_O_T_C_Pk_S'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY.', - LL : 'YYYY. [gada] D. MMMM', - LLL : 'YYYY. [gada] D. MMMM, HH:mm', - LLLL : 'YYYY. [gada] D. MMMM, dddd, HH:mm' - }, - calendar : { - sameDay : '[Šodien pulksten] LT', - nextDay : '[Rīt pulksten] LT', - nextWeek : 'dddd [pulksten] LT', - lastDay : '[Vakar pulksten] LT', - lastWeek : '[Pagājušā] dddd [pulksten] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'pēc %s', - past : 'pirms %s', - s : relativeSeconds, - ss : relativeTimeWithPlural$1, - m : relativeTimeWithSingular, - mm : relativeTimeWithPlural$1, - h : relativeTimeWithSingular, - hh : relativeTimeWithPlural$1, - d : relativeTimeWithSingular, - dd : relativeTimeWithPlural$1, - M : relativeTimeWithSingular, - MM : relativeTimeWithPlural$1, - y : relativeTimeWithSingular, - yy : relativeTimeWithPlural$1 - }, - 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 - - var translator = { - words: { //Different grammatical cases - ss: ['sekund', 'sekunda', 'sekundi'], - m: ['jedan minut', 'jednog minuta'], - mm: ['minut', 'minuta', 'minuta'], - h: ['jedan sat', 'jednog sata'], - hh: ['sat', 'sata', 'sati'], - dd: ['dan', 'dana', 'dana'], - MM: ['mjesec', 'mjeseca', 'mjeseci'], - yy: ['godina', 'godine', 'godina'] - }, - correctGrammaticalCase: function (number, wordKey) { - return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]); - }, - translate: function (number, withoutSuffix, key) { - var wordKey = translator.words[key]; - if (key.length === 1) { - return withoutSuffix ? wordKey[0] : wordKey[1]; - } else { - return number + ' ' + translator.correctGrammaticalCase(number, wordKey); - } - } - }; - - hooks.defineLocale('me', { - months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split('_'), - monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'), - monthsParseExact : true, - weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), - weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), - weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm', - LTS : 'H:mm:ss', - L: 'DD.MM.YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm', - LLLL: 'dddd, D. MMMM YYYY H:mm' - }, - calendar: { - sameDay: '[danas u] LT', - nextDay: '[sjutra u] LT', - - nextWeek: function () { - switch (this.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'; - } - }, - lastDay : '[juče u] LT', - lastWeek : function () { - var lastWeekDays = [ - '[prošle] [nedjelje] [u] LT', - '[prošlog] [ponedjeljka] [u] LT', - '[prošlog] [utorka] [u] LT', - '[prošle] [srijede] [u] LT', - '[prošlog] [četvrtka] [u] LT', - '[prošlog] [petka] [u] LT', - '[prošle] [subote] [u] LT' - ]; - return lastWeekDays[this.day()]; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'prije %s', - s : 'nekoliko sekundi', - ss : translator.translate, - m : translator.translate, - mm : translator.translate, - h : translator.translate, - hh : translator.translate, - d : 'dan', - dd : translator.translate, - M : 'mjesec', - MM : translator.translate, - y : 'godinu', - yy : translator.translate - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('mi', { - months: 'Kohi-tāte_Hui-tanguru_Poutū-te-rangi_Paenga-whāwhā_Haratua_Pipiri_Hōngoingoi_Here-turi-kōkā_Mahuru_Whiringa-ā-nuku_Whiringa-ā-rangi_Hakihea'.split('_'), - monthsShort: 'Kohi_Hui_Pou_Pae_Hara_Pipi_Hōngoi_Here_Mahu_Whi-nu_Whi-ra_Haki'.split('_'), - monthsRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i, - monthsStrictRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i, - monthsShortRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i, - monthsShortStrictRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,2}/i, - weekdays: 'Rātapu_Mane_Tūrei_Wenerei_Tāite_Paraire_Hātarei'.split('_'), - weekdaysShort: 'Ta_Ma_Tū_We_Tāi_Pa_Hā'.split('_'), - weekdaysMin: 'Ta_Ma_Tū_We_Tāi_Pa_Hā'.split('_'), - longDateFormat: { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L: 'DD/MM/YYYY', - LL: 'D MMMM YYYY', - LLL: 'D MMMM YYYY [i] HH:mm', - LLLL: 'dddd, D MMMM YYYY [i] HH:mm' - }, - calendar: { - sameDay: '[i teie mahana, i] LT', - nextDay: '[apopo i] LT', - nextWeek: 'dddd [i] LT', - lastDay: '[inanahi i] LT', - lastWeek: 'dddd [whakamutunga i] LT', - sameElse: 'L' - }, - relativeTime: { - future: 'i roto i %s', - past: '%s i mua', - s: 'te hēkona ruarua', - ss: '%d hēkona', - m: 'he meneti', - mm: '%d meneti', - h: 'te haora', - hh: '%d haora', - d: 'he ra', - dd: '%d ra', - M: 'he marama', - MM: '%d marama', - y: 'he tau', - yy: '%d tau' - }, - 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('mk', { - months : 'јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември'.split('_'), - monthsShort : 'јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек'.split('_'), - weekdays : 'недела_понеделник_вторник_среда_четврток_петок_сабота'.split('_'), - weekdaysShort : 'нед_пон_вто_сре_чет_пет_саб'.split('_'), - weekdaysMin : 'нe_пo_вт_ср_че_пе_сa'.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 : '[Денес во] LT', - nextDay : '[Утре во] LT', - nextWeek : '[Во] dddd [во] LT', - lastDay : '[Вчера во] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - case 3: - case 6: - return '[Изминатата] dddd [во] LT'; - case 1: - case 2: - case 4: - case 5: - return '[Изминатиот] dddd [во] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'после %s', - past : 'пред %s', - s : 'неколку секунди', - ss : '%d секунди', - m : 'минута', - mm : '%d минути', - h : 'час', - hh : '%d часа', - d : 'ден', - dd : '%d дена', - M : 'месец', - MM : '%d месеци', - y : 'година', - yy : '%d години' - }, - dayOfMonthOrdinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/, - ordinal : function (number) { - var lastDigit = number % 10, - last2Digits = number % 100; - if (number === 0) { - return number + '-ев'; - } else if (last2Digits === 0) { - return number + '-ен'; - } else if (last2Digits > 10 && last2Digits < 20) { - return number + '-ти'; - } else if (lastDigit === 1) { - return number + '-ви'; - } else if (lastDigit === 2) { - return number + '-ри'; - } else if (lastDigit === 7 || lastDigit === 8) { - return number + '-ми'; - } else { - return number + '-ти'; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('ml', { - months : 'ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ'.split('_'), - monthsShort : 'ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.'.split('_'), - monthsParseExact : true, - weekdays : 'ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച'.split('_'), - weekdaysShort : 'ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി'.split('_'), - weekdaysMin : 'ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ'.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 : '[ഇന്ന്] LT', - nextDay : '[നാളെ] LT', - nextWeek : 'dddd, LT', - lastDay : '[ഇന്നലെ] LT', - lastWeek : '[കഴിഞ്ഞ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s കഴിഞ്ഞ്', - past : '%s മുൻപ്', - s : 'അൽപ നിമിഷങ്ങൾ', - ss : '%d സെക്കൻഡ്', - m : 'ഒരു മിനിറ്റ്', - mm : '%d മിനിറ്റ്', - h : 'ഒരു മണിക്കൂർ', - hh : '%d മണിക്കൂർ', - d : 'ഒരു ദിവസം', - dd : '%d ദിവസം', - M : 'ഒരു മാസം', - MM : '%d മാസം', - y : 'ഒരു വർഷം', - yy : '%d വർഷം' - }, - meridiemParse: /രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ((meridiem === 'രാത്രി' && hour >= 4) || - meridiem === 'ഉച്ച കഴിഞ്ഞ്' || - meridiem === 'വൈകുന്നേരം') { - return hour + 12; - } else { - return hour; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'രാത്രി'; - } else if (hour < 12) { - return 'രാവിലെ'; - } else if (hour < 17) { - return 'ഉച്ച കഴിഞ്ഞ്'; - } else if (hour < 20) { - return 'വൈകുന്നേരം'; - } else { - return 'രാത്രി'; - } - } - }); - - //! moment.js locale configuration - - function translate$7(number, withoutSuffix, key, isFuture) { - switch (key) { - case 's': - return withoutSuffix ? 'хэдхэн секунд' : 'хэдхэн секундын'; - case 'ss': - return number + (withoutSuffix ? ' секунд' : ' секундын'); - case 'm': - case 'mm': - return number + (withoutSuffix ? ' минут' : ' минутын'); - case 'h': - case 'hh': - return number + (withoutSuffix ? ' цаг' : ' цагийн'); - case 'd': - case 'dd': - return number + (withoutSuffix ? ' өдөр' : ' өдрийн'); - case 'M': - case 'MM': - return number + (withoutSuffix ? ' сар' : ' сарын'); - case 'y': - case 'yy': - return number + (withoutSuffix ? ' жил' : ' жилийн'); - default: - return number; - } - } - - hooks.defineLocale('mn', { - months : 'Нэгдүгээр сар_Хоёрдугаар сар_Гуравдугаар сар_Дөрөвдүгээр сар_Тавдугаар сар_Зургадугаар сар_Долдугаар сар_Наймдугаар сар_Есдүгээр сар_Аравдугаар сар_Арван нэгдүгээр сар_Арван хоёрдугаар сар'.split('_'), - monthsShort : '1 сар_2 сар_3 сар_4 сар_5 сар_6 сар_7 сар_8 сар_9 сар_10 сар_11 сар_12 сар'.split('_'), - monthsParseExact : true, - weekdays : 'Ням_Даваа_Мягмар_Лхагва_Пүрэв_Баасан_Бямба'.split('_'), - weekdaysShort : 'Ням_Дав_Мяг_Лха_Пүр_Баа_Бям'.split('_'), - weekdaysMin : 'Ня_Да_Мя_Лх_Пү_Ба_Бя'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'YYYY оны MMMMын D', - LLL : 'YYYY оны MMMMын D HH:mm', - LLLL : 'dddd, YYYY оны MMMMын D HH:mm' - }, - meridiemParse: /ҮӨ|ҮХ/i, - isPM : function (input) { - return input === 'ҮХ'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ҮӨ'; - } else { - return 'ҮХ'; - } - }, - calendar : { - sameDay : '[Өнөөдөр] LT', - nextDay : '[Маргааш] LT', - nextWeek : '[Ирэх] dddd LT', - lastDay : '[Өчигдөр] LT', - lastWeek : '[Өнгөрсөн] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s дараа', - past : '%s өмнө', - s : translate$7, - ss : translate$7, - m : translate$7, - mm : translate$7, - h : translate$7, - hh : translate$7, - d : translate$7, - dd : translate$7, - M : translate$7, - MM : translate$7, - y : translate$7, - yy : translate$7 - }, - dayOfMonthOrdinalParse: /\d{1,2} өдөр/, - ordinal : function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + ' өдөр'; - default: - return number; - } - } - }); - - //! moment.js locale configuration - - var symbolMap$b = { - '1': '१', - '2': '२', - '3': '३', - '4': '४', - '5': '५', - '6': '६', - '7': '७', - '8': '८', - '9': '९', - '0': '०' - }, - numberMap$a = { - '१': '1', - '२': '2', - '३': '3', - '४': '4', - '५': '5', - '६': '6', - '७': '7', - '८': '8', - '९': '9', - '०': '0' - }; - - function relativeTimeMr(number, withoutSuffix, string, isFuture) - { - var output = ''; - if (withoutSuffix) { - switch (string) { - case 's': output = 'काही सेकंद'; break; - case 'ss': output = '%d सेकंद'; break; - case 'm': output = 'एक मिनिट'; break; - case 'mm': output = '%d मिनिटे'; break; - case 'h': output = 'एक तास'; break; - case 'hh': output = '%d तास'; break; - case 'd': output = 'एक दिवस'; break; - case 'dd': output = '%d दिवस'; break; - case 'M': output = 'एक महिना'; break; - case 'MM': output = '%d महिने'; break; - case 'y': output = 'एक वर्ष'; break; - case 'yy': output = '%d वर्षे'; break; - } - } - else { - switch (string) { - case 's': output = 'काही सेकंदां'; break; - case 'ss': output = '%d सेकंदां'; break; - case 'm': output = 'एका मिनिटा'; break; - case 'mm': output = '%d मिनिटां'; break; - case 'h': output = 'एका तासा'; break; - case 'hh': output = '%d तासां'; break; - case 'd': output = 'एका दिवसा'; break; - case 'dd': output = '%d दिवसां'; break; - case 'M': output = 'एका महिन्या'; break; - case 'MM': output = '%d महिन्यां'; break; - case 'y': output = 'एका वर्षा'; break; - case 'yy': output = '%d वर्षां'; break; - } - } - return output.replace(/%d/i, number); - } - - hooks.defineLocale('mr', { - months : 'जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर'.split('_'), - monthsShort: 'जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.'.split('_'), - monthsParseExact : true, - weekdays : 'रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'), - weekdaysShort : 'रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि'.split('_'), - weekdaysMin : 'र_सो_मं_बु_गु_शु_श'.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 : '[आज] LT', - nextDay : '[उद्या] LT', - nextWeek : 'dddd, LT', - lastDay : '[काल] LT', - lastWeek: '[मागील] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future: '%sमध्ये', - past: '%sपूर्वी', - s: relativeTimeMr, - ss: relativeTimeMr, - m: relativeTimeMr, - mm: relativeTimeMr, - h: relativeTimeMr, - hh: relativeTimeMr, - d: relativeTimeMr, - dd: relativeTimeMr, - M: relativeTimeMr, - MM: relativeTimeMr, - y: relativeTimeMr, - yy: relativeTimeMr - }, - preparse: function (string) { - return string.replace(/[१२३४५६७८९०]/g, function (match) { - return numberMap$a[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$b[match]; - }); - }, - meridiemParse: /रात्री|सकाळी|दुपारी|सायंकाळी/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'रात्री') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'सकाळी') { - return hour; - } else if (meridiem === 'दुपारी') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'सायंकाळी') { - return hour + 12; - } - }, - meridiem: function (hour, minute, isLower) { - if (hour < 4) { - return 'रात्री'; - } else if (hour < 10) { - return 'सकाळी'; - } else if (hour < 17) { - return 'दुपारी'; - } else if (hour < 20) { - return 'सायंकाळी'; - } else { - return 'रात्री'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('ms-my', { - months : 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split('_'), - monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'), - weekdays : 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'), - weekdaysShort : 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'), - weekdaysMin : 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /pagi|tengahari|petang|malam/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'pagi') { - return hour; - } else if (meridiem === 'tengahari') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'petang' || meridiem === 'malam') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'pagi'; - } else if (hours < 15) { - return 'tengahari'; - } else if (hours < 19) { - return 'petang'; - } else { - return 'malam'; - } - }, - calendar : { - sameDay : '[Hari ini pukul] LT', - nextDay : '[Esok pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kelmarin pukul] LT', - lastWeek : 'dddd [lepas pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dalam %s', - past : '%s yang lepas', - s : 'beberapa saat', - ss : '%d saat', - m : 'seminit', - mm : '%d minit', - h : 'sejam', - hh : '%d jam', - d : 'sehari', - dd : '%d hari', - M : 'sebulan', - MM : '%d bulan', - y : 'setahun', - yy : '%d tahun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('ms', { - months : 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split('_'), - monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'), - weekdays : 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'), - weekdaysShort : 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'), - weekdaysMin : 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /pagi|tengahari|petang|malam/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'pagi') { - return hour; - } else if (meridiem === 'tengahari') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'petang' || meridiem === 'malam') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'pagi'; - } else if (hours < 15) { - return 'tengahari'; - } else if (hours < 19) { - return 'petang'; - } else { - return 'malam'; - } - }, - calendar : { - sameDay : '[Hari ini pukul] LT', - nextDay : '[Esok pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kelmarin pukul] LT', - lastWeek : 'dddd [lepas pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dalam %s', - past : '%s yang lepas', - s : 'beberapa saat', - ss : '%d saat', - m : 'seminit', - mm : '%d minit', - h : 'sejam', - hh : '%d jam', - d : 'sehari', - dd : '%d hari', - M : 'sebulan', - MM : '%d bulan', - y : 'setahun', - yy : '%d tahun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('mt', { - months : 'Jannar_Frar_Marzu_April_Mejju_Ġunju_Lulju_Awwissu_Settembru_Ottubru_Novembru_Diċembru'.split('_'), - monthsShort : 'Jan_Fra_Mar_Apr_Mej_Ġun_Lul_Aww_Set_Ott_Nov_Diċ'.split('_'), - weekdays : 'Il-Ħadd_It-Tnejn_It-Tlieta_L-Erbgħa_Il-Ħamis_Il-Ġimgħa_Is-Sibt'.split('_'), - weekdaysShort : 'Ħad_Tne_Tli_Erb_Ħam_Ġim_Sib'.split('_'), - weekdaysMin : 'Ħa_Tn_Tl_Er_Ħa_Ġi_Si'.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 : '[Illum fil-]LT', - nextDay : '[Għada fil-]LT', - nextWeek : 'dddd [fil-]LT', - lastDay : '[Il-bieraħ fil-]LT', - lastWeek : 'dddd [li għadda] [fil-]LT', - sameElse : 'L' - }, - relativeTime : { - future : 'f’ %s', - past : '%s ilu', - s : 'ftit sekondi', - ss : '%d sekondi', - m : 'minuta', - mm : '%d minuti', - h : 'siegħa', - hh : '%d siegħat', - d : 'ġurnata', - dd : '%d ġranet', - M : 'xahar', - MM : '%d xhur', - y : 'sena', - yy : '%d sni' - }, - 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 - - var symbolMap$c = { - '1': '၁', - '2': '၂', - '3': '၃', - '4': '၄', - '5': '၅', - '6': '၆', - '7': '၇', - '8': '၈', - '9': '၉', - '0': '၀' - }, numberMap$b = { - '၁': '1', - '၂': '2', - '၃': '3', - '၄': '4', - '၅': '5', - '၆': '6', - '၇': '7', - '၈': '8', - '၉': '9', - '၀': '0' - }; - - hooks.defineLocale('my', { - months: 'ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ'.split('_'), - monthsShort: 'ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ'.split('_'), - weekdays: 'တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ'.split('_'), - weekdaysShort: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'), - weekdaysMin: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.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: '[ယနေ.] LT [မှာ]', - nextDay: '[မနက်ဖြန်] LT [မှာ]', - nextWeek: 'dddd LT [မှာ]', - lastDay: '[မနေ.က] LT [မှာ]', - lastWeek: '[ပြီးခဲ့သော] dddd LT [မှာ]', - sameElse: 'L' - }, - relativeTime: { - future: 'လာမည့် %s မှာ', - past: 'လွန်ခဲ့သော %s က', - s: 'စက္ကန်.အနည်းငယ်', - ss : '%d စက္ကန့်', - m: 'တစ်မိနစ်', - mm: '%d မိနစ်', - h: 'တစ်နာရီ', - hh: '%d နာရီ', - d: 'တစ်ရက်', - dd: '%d ရက်', - M: 'တစ်လ', - MM: '%d လ', - y: 'တစ်နှစ်', - yy: '%d နှစ်' - }, - preparse: function (string) { - return string.replace(/[၁၂၃၄၅၆၇၈၉၀]/g, function (match) { - return numberMap$b[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$c[match]; - }); - }, - 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('nb', { - months : 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split('_'), - monthsShort : 'jan._feb._mars_april_mai_juni_juli_aug._sep._okt._nov._des.'.split('_'), - monthsParseExact : true, - weekdays : 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'), - weekdaysShort : 'sø._ma._ti._on._to._fr._lø.'.split('_'), - weekdaysMin : 'sø_ma_ti_on_to_fr_lø'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY [kl.] HH:mm', - LLLL : 'dddd D. MMMM YYYY [kl.] HH:mm' - }, - calendar : { - sameDay: '[i dag kl.] LT', - nextDay: '[i morgen kl.] LT', - nextWeek: 'dddd [kl.] LT', - lastDay: '[i går kl.] LT', - lastWeek: '[forrige] dddd [kl.] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'om %s', - past : '%s siden', - s : 'noen sekunder', - ss : '%d sekunder', - m : 'ett minutt', - mm : '%d minutter', - h : 'en time', - hh : '%d timer', - d : 'en dag', - dd : '%d dager', - M : 'en måned', - MM : '%d måneder', - y : 'ett år', - yy : '%d år' - }, - 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 - - var symbolMap$d = { - '1': '१', - '2': '२', - '3': '३', - '4': '४', - '5': '५', - '6': '६', - '7': '७', - '8': '८', - '9': '९', - '0': '०' - }, - numberMap$c = { - '१': '1', - '२': '2', - '३': '3', - '४': '4', - '५': '5', - '६': '6', - '७': '7', - '८': '8', - '९': '9', - '०': '0' - }; - - hooks.defineLocale('ne', { - months : 'जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर'.split('_'), - monthsShort : 'जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.'.split('_'), - monthsParseExact : true, - weekdays : 'आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार'.split('_'), - weekdaysShort : 'आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.'.split('_'), - weekdaysMin : 'आ._सो._मं._बु._बि._शु._श.'.split('_'), - weekdaysParseExact : true, - 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 बजे' - }, - preparse: function (string) { - return string.replace(/[१२३४५६७८९०]/g, function (match) { - return numberMap$c[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$d[match]; - }); - }, - meridiemParse: /राति|बिहान|दिउँसो|साँझ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'राति') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'बिहान') { - return hour; - } else if (meridiem === 'दिउँसो') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'साँझ') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 3) { - return 'राति'; - } else if (hour < 12) { - return 'बिहान'; - } else if (hour < 16) { - return 'दिउँसो'; - } else if (hour < 20) { - return 'साँझ'; - } else { - return 'राति'; - } - }, - calendar : { - sameDay : '[आज] LT', - nextDay : '[भोलि] LT', - nextWeek : '[आउँदो] dddd[,] LT', - lastDay : '[हिजो] LT', - lastWeek : '[गएको] dddd[,] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%sमा', - past : '%s अगाडि', - s : 'केही क्षण', - ss : '%d सेकेण्ड', - m : 'एक मिनेट', - mm : '%d मिनेट', - h : 'एक घण्टा', - hh : '%d घण्टा', - d : 'एक दिन', - dd : '%d दिन', - M : 'एक महिना', - MM : '%d महिना', - y : 'एक बर्ष', - yy : '%d बर्ष' - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - //! moment.js locale configuration - - 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$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('_'), - monthsShort : function (m, format) { - if (!m) { - return monthsShortWithDots$1; - } else if (/-MMM-/.test(format)) { - return monthsShortWithoutDots$1[m.month()]; - } else { - return monthsShortWithDots$1[m.month()]; - } - }, - - 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$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('_'), - weekdaysMin : 'zo_ma_di_wo_do_vr_za'.split('_'), - weekdaysParseExact : true, - 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: '[vandaag om] LT', - nextDay: '[morgen om] LT', - nextWeek: 'dddd [om] LT', - lastDay: '[gisteren om] LT', - lastWeek: '[afgelopen] dddd [om] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'over %s', - past : '%s geleden', - s : 'een paar seconden', - ss : '%d seconden', - m : 'één minuut', - mm : '%d minuten', - h : 'één uur', - hh : '%d uur', - d : 'één dag', - dd : '%d dagen', - M : 'één maand', - MM : '%d maanden', - y : 'één jaar', - yy : '%d jaar' - }, - dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/, - ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); - }, - 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 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$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('_'), - monthsShort : function (m, format) { - if (!m) { - return monthsShortWithDots$2; - } else if (/-MMM-/.test(format)) { - return monthsShortWithoutDots$2[m.month()]; - } else { - return monthsShortWithDots$2[m.month()]; - } - }, - - 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$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('_'), - weekdaysMin : 'zo_ma_di_wo_do_vr_za'.split('_'), - weekdaysParseExact : true, - 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: '[vandaag om] LT', - nextDay: '[morgen om] LT', - nextWeek: 'dddd [om] LT', - lastDay: '[gisteren om] LT', - lastWeek: '[afgelopen] dddd [om] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'over %s', - past : '%s geleden', - s : 'een paar seconden', - ss : '%d seconden', - m : 'één minuut', - mm : '%d minuten', - h : 'één uur', - hh : '%d uur', - d : 'één dag', - dd : '%d dagen', - M : 'één maand', - MM : '%d maanden', - y : 'één jaar', - yy : '%d jaar' - }, - dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/, - ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); - }, - 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('nn', { - months : 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split('_'), - monthsShort : 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'), - weekdays : 'sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag'.split('_'), - weekdaysShort : 'sun_mån_tys_ons_tor_fre_lau'.split('_'), - weekdaysMin : 'su_må_ty_on_to_fr_lø'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY [kl.] H:mm', - LLLL : 'dddd D. MMMM YYYY [kl.] HH:mm' - }, - calendar : { - sameDay: '[I dag klokka] LT', - nextDay: '[I morgon klokka] LT', - nextWeek: 'dddd [klokka] LT', - lastDay: '[I går klokka] LT', - lastWeek: '[Føregåande] dddd [klokka] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'om %s', - past : '%s sidan', - s : 'nokre sekund', - ss : '%d sekund', - m : 'eit minutt', - mm : '%d minutt', - h : 'ein time', - hh : '%d timar', - d : 'ein dag', - dd : '%d dagar', - M : 'ein månad', - MM : '%d månader', - y : 'eit år', - yy : '%d år' - }, - 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 - - var symbolMap$e = { - '1': '੧', - '2': '੨', - '3': '੩', - '4': '੪', - '5': '੫', - '6': '੬', - '7': '੭', - '8': '੮', - '9': '੯', - '0': '੦' - }, - numberMap$d = { - '੧': '1', - '੨': '2', - '੩': '3', - '੪': '4', - '੫': '5', - '੬': '6', - '੭': '7', - '੮': '8', - '੯': '9', - '੦': '0' - }; - - hooks.defineLocale('pa-in', { - // There are months name as per Nanakshahi Calendar but they are not used as rigidly in modern Punjabi. - months : 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split('_'), - monthsShort : 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split('_'), - weekdays : 'ਐਤਵਾਰ_ਸੋਮਵਾਰ_ਮੰਗਲਵਾਰ_ਬੁਧਵਾਰ_ਵੀਰਵਾਰ_ਸ਼ੁੱਕਰਵਾਰ_ਸ਼ਨੀਚਰਵਾਰ'.split('_'), - weekdaysShort : 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'), - weekdaysMin : 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.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 : '[ਅਜ] LT', - nextDay : '[ਕਲ] LT', - nextWeek : '[ਅਗਲਾ] dddd, LT', - lastDay : '[ਕਲ] LT', - lastWeek : '[ਪਿਛਲੇ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ਵਿੱਚ', - past : '%s ਪਿਛਲੇ', - s : 'ਕੁਝ ਸਕਿੰਟ', - ss : '%d ਸਕਿੰਟ', - m : 'ਇਕ ਮਿੰਟ', - mm : '%d ਮਿੰਟ', - h : 'ਇੱਕ ਘੰਟਾ', - hh : '%d ਘੰਟੇ', - d : 'ਇੱਕ ਦਿਨ', - dd : '%d ਦਿਨ', - M : 'ਇੱਕ ਮਹੀਨਾ', - MM : '%d ਮਹੀਨੇ', - y : 'ਇੱਕ ਸਾਲ', - yy : '%d ਸਾਲ' - }, - preparse: function (string) { - return string.replace(/[੧੨੩੪੫੬੭੮੯੦]/g, function (match) { - return numberMap$d[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$e[match]; - }); - }, - // Punjabi notation for meridiems are quite fuzzy in practice. While there exists - // a rigid notion of a 'Pahar' it is not used as rigidly in modern Punjabi. - meridiemParse: /ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'ਰਾਤ') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'ਸਵੇਰ') { - return hour; - } else if (meridiem === 'ਦੁਪਹਿਰ') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'ਸ਼ਾਮ') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ਰਾਤ'; - } else if (hour < 10) { - return 'ਸਵੇਰ'; - } else if (hour < 17) { - return 'ਦੁਪਹਿਰ'; - } else if (hour < 20) { - return 'ਸ਼ਾਮ'; - } else { - return 'ਰਾਤ'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - //! moment.js locale configuration - - var monthsNominative = 'styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień'.split('_'), - monthsSubjective = 'stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia'.split('_'); - function plural$3(n) { - return (n % 10 < 5) && (n % 10 > 1) && ((~~(n / 10) % 10) !== 1); - } - function translate$8(number, withoutSuffix, key) { - var result = number + ' '; - switch (key) { - case 'ss': - return result + (plural$3(number) ? 'sekundy' : 'sekund'); - case 'm': - return withoutSuffix ? 'minuta' : 'minutę'; - case 'mm': - return result + (plural$3(number) ? 'minuty' : 'minut'); - case 'h': - return withoutSuffix ? 'godzina' : 'godzinę'; - case 'hh': - return result + (plural$3(number) ? 'godziny' : 'godzin'); - case 'MM': - return result + (plural$3(number) ? 'miesiące' : 'miesięcy'); - case 'yy': - return result + (plural$3(number) ? 'lata' : 'lat'); - } - } - - hooks.defineLocale('pl', { - months : function (momentToFormat, format) { - if (!momentToFormat) { - return monthsNominative; - } else if (format === '') { - // Hack: if format empty we know this is used to generate - // RegExp by moment. Give then back both valid forms of months - // in RegExp ready format. - return '(' + monthsSubjective[momentToFormat.month()] + '|' + monthsNominative[momentToFormat.month()] + ')'; - } else if (/D MMMM/.test(format)) { - return monthsSubjective[momentToFormat.month()]; - } else { - return monthsNominative[momentToFormat.month()]; - } - }, - monthsShort : 'sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru'.split('_'), - weekdays : 'niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota'.split('_'), - weekdaysShort : 'ndz_pon_wt_śr_czw_pt_sob'.split('_'), - weekdaysMin : 'Nd_Pn_Wt_Śr_Cz_Pt_So'.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: '[Dziś o] LT', - nextDay: '[Jutro o] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[W niedzielę o] LT'; - - case 2: - return '[We wtorek o] LT'; - - case 3: - return '[W środę o] LT'; - - case 6: - return '[W sobotę o] LT'; - - default: - return '[W] dddd [o] LT'; - } - }, - lastDay: '[Wczoraj o] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[W zeszłą niedzielę o] LT'; - case 3: - return '[W zeszłą środę o] LT'; - case 6: - return '[W zeszłą sobotę o] LT'; - default: - return '[W zeszły] dddd [o] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'za %s', - past : '%s temu', - s : 'kilka sekund', - ss : translate$8, - m : translate$8, - mm : translate$8, - h : translate$8, - hh : translate$8, - d : '1 dzień', - dd : '%d dni', - M : 'miesiąc', - MM : translate$8, - y : 'rok', - yy : translate$8 - }, - 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('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('_'), - 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('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [de] MMMM [de] YYYY', - LLL : 'D [de] MMMM [de] YYYY [às] HH:mm', - LLLL : 'dddd, D [de] MMMM [de] YYYY [às] HH:mm' - }, - calendar : { - sameDay: '[Hoje às] LT', - nextDay: '[Amanhã às] LT', - nextWeek: 'dddd [às] LT', - lastDay: '[Ontem às] LT', - lastWeek: function () { - return (this.day() === 0 || this.day() === 6) ? - '[Último] dddd [às] LT' : // Saturday + Sunday - '[Última] dddd [às] LT'; // Monday - Friday - }, - sameElse: 'L' - }, - relativeTime : { - future : 'em %s', - past : 'há %s', - s : 'poucos segundos', - ss : '%d segundos', - m : 'um minuto', - mm : '%d minutos', - h : 'uma hora', - hh : '%d horas', - d : 'um dia', - dd : '%d dias', - M : 'um mês', - MM : '%d meses', - y : 'um ano', - yy : '%d anos' - }, - dayOfMonthOrdinalParse: /\d{1,2}º/, - ordinal : '%dº' - }); - - //! 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('_'), - 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('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [de] MMMM [de] YYYY', - LLL : 'D [de] MMMM [de] YYYY HH:mm', - LLLL : 'dddd, D [de] MMMM [de] YYYY HH:mm' - }, - calendar : { - sameDay: '[Hoje às] LT', - nextDay: '[Amanhã às] LT', - nextWeek: 'dddd [às] LT', - lastDay: '[Ontem às] LT', - lastWeek: function () { - return (this.day() === 0 || this.day() === 6) ? - '[Último] dddd [às] LT' : // Saturday + Sunday - '[Última] dddd [às] LT'; // Monday - Friday - }, - sameElse: 'L' - }, - relativeTime : { - future : 'em %s', - past : 'há %s', - s : 'segundos', - ss : '%d segundos', - m : 'um minuto', - mm : '%d minutos', - h : 'uma hora', - hh : '%d horas', - d : 'um dia', - dd : '%d dias', - M : 'um mês', - MM : '%d meses', - y : 'um ano', - yy : '%d anos' - }, - 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 - - function relativeTimeWithPlural$2(number, withoutSuffix, key) { - var format = { - 'ss': 'secunde', - 'mm': 'minute', - 'hh': 'ore', - 'dd': 'zile', - 'MM': 'luni', - 'yy': 'ani' - }, - separator = ' '; - if (number % 100 >= 20 || (number >= 100 && number % 100 === 0)) { - separator = ' de '; - } - return number + separator + format[key]; - } - - hooks.defineLocale('ro', { - months : 'ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie'.split('_'), - monthsShort : 'ian._febr._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'duminică_luni_marți_miercuri_joi_vineri_sâmbătă'.split('_'), - weekdaysShort : 'Dum_Lun_Mar_Mie_Joi_Vin_Sâm'.split('_'), - weekdaysMin : 'Du_Lu_Ma_Mi_Jo_Vi_Sâ'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY H:mm', - LLLL : 'dddd, D MMMM YYYY H:mm' - }, - calendar : { - sameDay: '[azi la] LT', - nextDay: '[mâine la] LT', - nextWeek: 'dddd [la] LT', - lastDay: '[ieri la] LT', - lastWeek: '[fosta] dddd [la] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'peste %s', - past : '%s în urmă', - s : 'câteva secunde', - ss : relativeTimeWithPlural$2, - m : 'un minut', - mm : relativeTimeWithPlural$2, - h : 'o oră', - hh : relativeTimeWithPlural$2, - d : 'o zi', - dd : relativeTimeWithPlural$2, - M : 'o lună', - MM : relativeTimeWithPlural$2, - y : 'un an', - yy : relativeTimeWithPlural$2 - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - function plural$4(word, num) { - var forms = word.split('_'); - return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]); - } - function relativeTimeWithPlural$3(number, withoutSuffix, key) { - var format = { - 'ss': withoutSuffix ? 'секунда_секунды_секунд' : 'секунду_секунды_секунд', - 'mm': withoutSuffix ? 'минута_минуты_минут' : 'минуту_минуты_минут', - 'hh': 'час_часа_часов', - 'dd': 'день_дня_дней', - 'MM': 'месяц_месяца_месяцев', - 'yy': 'год_года_лет' - }; - if (key === 'm') { - return withoutSuffix ? 'минута' : 'минуту'; - } - else { - return number + ' ' + plural$4(format[key], +number); - } - } - 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 - // CLDR data: http://www.unicode.org/cldr/charts/28/summary/ru.html#1753 - hooks.defineLocale('ru', { - months : { - format: 'января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря'.split('_'), - standalone: 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_') - }, - monthsShort : { - // по CLDR именно "июл." и "июн.", но какой смысл менять букву на точку ? - format: 'янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.'.split('_'), - standalone: 'янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.'.split('_') - }, - weekdays : { - standalone: 'воскресенье_понедельник_вторник_среда_четверг_пятница_суббота'.split('_'), - format: 'воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу'.split('_'), - isFormat: /\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?\] ?dddd/ - }, - weekdaysShort : 'вс_пн_вт_ср_чт_пт_сб'.split('_'), - weekdaysMin : 'вс_пн_вт_ср_чт_пт_сб'.split('_'), - monthsParse : monthsParse$6, - longMonthsParse : monthsParse$6, - shortMonthsParse : monthsParse$6, - - // полные названия с падежами, по три буквы, для некоторых, по 4 буквы, сокращения с точкой и без точки - monthsRegex: /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i, - - // копия предыдущего - monthsShortRegex: /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i, - - // полные названия с падежами - monthsStrictRegex: /^(январ[яь]|феврал[яь]|марта?|апрел[яь]|ма[яй]|июн[яь]|июл[яь]|августа?|сентябр[яь]|октябр[яь]|ноябр[яь]|декабр[яь])/i, - - // Выражение, которое соотвествует только сокращённым формам - monthsShortStrictRegex: /^(янв\.|февр?\.|мар[т.]|апр\.|ма[яй]|июн[ья.]|июл[ья.]|авг\.|сент?\.|окт\.|нояб?\.|дек\.)/i, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY г.', - LLL : 'D MMMM YYYY г., H:mm', - LLLL : 'dddd, D MMMM YYYY г., H:mm' - }, - calendar : { - sameDay: '[Сегодня, в] LT', - nextDay: '[Завтра, в] LT', - lastDay: '[Вчера, в] LT', - nextWeek: function (now) { - if (now.week() !== this.week()) { - switch (this.day()) { - case 0: - return '[В следующее] dddd, [в] LT'; - case 1: - case 2: - case 4: - return '[В следующий] dddd, [в] LT'; - case 3: - case 5: - case 6: - return '[В следующую] dddd, [в] LT'; - } - } else { - if (this.day() === 2) { - return '[Во] dddd, [в] LT'; - } else { - return '[В] dddd, [в] LT'; - } - } - }, - lastWeek: function (now) { - if (now.week() !== this.week()) { - switch (this.day()) { - case 0: - return '[В прошлое] dddd, [в] LT'; - case 1: - case 2: - case 4: - return '[В прошлый] dddd, [в] LT'; - case 3: - case 5: - case 6: - return '[В прошлую] dddd, [в] LT'; - } - } else { - if (this.day() === 2) { - return '[Во] dddd, [в] LT'; - } else { - return '[В] dddd, [в] LT'; - } - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'через %s', - past : '%s назад', - s : 'несколько секунд', - ss : relativeTimeWithPlural$3, - m : relativeTimeWithPlural$3, - mm : relativeTimeWithPlural$3, - h : 'час', - hh : relativeTimeWithPlural$3, - d : 'день', - dd : relativeTimeWithPlural$3, - M : 'месяц', - MM : relativeTimeWithPlural$3, - y : 'год', - yy : relativeTimeWithPlural$3 - }, - meridiemParse: /ночи|утра|дня|вечера/i, - isPM : function (input) { - return /^(дня|вечера)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ночи'; - } else if (hour < 12) { - return 'утра'; - } else if (hour < 17) { - return 'дня'; - } else { - return 'вечера'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}-(й|го|я)/, - ordinal: function (number, period) { - switch (period) { - case 'M': - case 'd': - case 'DDD': - return number + '-й'; - case 'D': - return number + '-го'; - case 'w': - case 'W': - return number + '-я'; - default: - return number; - } - }, - 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$8 = [ - 'جنوري', - 'فيبروري', - 'مارچ', - 'اپريل', - 'مئي', - 'جون', - 'جولاءِ', - 'آگسٽ', - 'سيپٽمبر', - 'آڪٽوبر', - 'نومبر', - 'ڊسمبر' - ]; - var days$1 = [ - 'آچر', - 'سومر', - 'اڱارو', - 'اربع', - 'خميس', - 'جمع', - 'ڇنڇر' - ]; - - hooks.defineLocale('sd', { - months : months$8, - monthsShort : months$8, - weekdays : days$1, - weekdaysShort : days$1, - weekdaysMin : days$1, - 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: /صبح|شام/, - isPM : function (input) { - return 'شام' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'صبح'; - } - return 'شام'; - }, - calendar : { - sameDay : '[اڄ] LT', - nextDay : '[سڀاڻي] LT', - nextWeek : 'dddd [اڳين هفتي تي] LT', - lastDay : '[ڪالهه] LT', - lastWeek : '[گزريل هفتي] dddd [تي] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s پوء', - past : '%s اڳ', - s : 'چند سيڪنڊ', - ss : '%d سيڪنڊ', - m : 'هڪ منٽ', - mm : '%d منٽ', - h : 'هڪ ڪلاڪ', - hh : '%d ڪلاڪ', - d : 'هڪ ڏينهن', - dd : '%d ڏينهن', - M : 'هڪ مهينو', - MM : '%d مهينا', - y : 'هڪ سال', - yy : '%d سال' - }, - preparse: function (string) { - return string.replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/,/g, '،'); - }, - 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('se', { - months : 'ođđajagemánnu_guovvamánnu_njukčamánnu_cuoŋománnu_miessemánnu_geassemánnu_suoidnemánnu_borgemánnu_čakčamánnu_golggotmánnu_skábmamánnu_juovlamánnu'.split('_'), - monthsShort : 'ođđj_guov_njuk_cuo_mies_geas_suoi_borg_čakč_golg_skáb_juov'.split('_'), - weekdays : 'sotnabeaivi_vuossárga_maŋŋebárga_gaskavahkku_duorastat_bearjadat_lávvardat'.split('_'), - weekdaysShort : 'sotn_vuos_maŋ_gask_duor_bear_láv'.split('_'), - weekdaysMin : 's_v_m_g_d_b_L'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'MMMM D. [b.] YYYY', - LLL : 'MMMM D. [b.] YYYY [ti.] HH:mm', - LLLL : 'dddd, MMMM D. [b.] YYYY [ti.] HH:mm' - }, - calendar : { - sameDay: '[otne ti] LT', - nextDay: '[ihttin ti] LT', - nextWeek: 'dddd [ti] LT', - lastDay: '[ikte ti] LT', - lastWeek: '[ovddit] dddd [ti] LT', - sameElse: 'L' - }, - relativeTime : { - future : '%s geažes', - past : 'maŋit %s', - s : 'moadde sekunddat', - ss: '%d sekunddat', - m : 'okta minuhta', - mm : '%d minuhtat', - h : 'okta diimmu', - hh : '%d diimmut', - d : 'okta beaivi', - dd : '%d beaivvit', - M : 'okta mánnu', - MM : '%d mánut', - y : 'okta jahki', - yy : '%d jagit' - }, - 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 - - /*jshint -W100*/ - hooks.defineLocale('si', { - months : 'ජනවාරි_පෙබරවාරි_මාර්තු_අප්‍රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්'.split('_'), - monthsShort : 'ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ'.split('_'), - weekdays : 'ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්‍රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා'.split('_'), - weekdaysShort : 'ඉරි_සඳු_අඟ_බදා_බ්‍රහ_සිකු_සෙන'.split('_'), - weekdaysMin : 'ඉ_ස_අ_බ_බ්‍ර_සි_සෙ'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'a h:mm', - LTS : 'a h:mm:ss', - L : 'YYYY/MM/DD', - LL : 'YYYY MMMM D', - LLL : 'YYYY MMMM D, a h:mm', - LLLL : 'YYYY MMMM D [වැනි] dddd, a h:mm:ss' - }, - calendar : { - sameDay : '[අද] LT[ට]', - nextDay : '[හෙට] LT[ට]', - nextWeek : 'dddd LT[ට]', - lastDay : '[ඊයේ] LT[ට]', - lastWeek : '[පසුගිය] dddd LT[ට]', - sameElse : 'L' - }, - relativeTime : { - future : '%sකින්', - past : '%sකට පෙර', - s : 'තත්පර කිහිපය', - ss : 'තත්පර %d', - m : 'මිනිත්තුව', - mm : 'මිනිත්තු %d', - h : 'පැය', - hh : 'පැය %d', - d : 'දිනය', - dd : 'දින %d', - M : 'මාසය', - MM : 'මාස %d', - y : 'වසර', - yy : 'වසර %d' - }, - dayOfMonthOrdinalParse: /\d{1,2} වැනි/, - ordinal : function (number) { - return number + ' වැනි'; - }, - meridiemParse : /පෙර වරු|පස් වරු|පෙ.ව|ප.ව./, - isPM : function (input) { - return input === 'ප.ව.' || input === 'පස් වරු'; - }, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'ප.ව.' : 'පස් වරු'; - } else { - return isLower ? 'පෙ.ව.' : 'පෙර වරු'; - } - } - }); - - //! moment.js locale configuration - - 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); - } - function translate$9(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': // a few seconds / in a few seconds / a few seconds ago - return (withoutSuffix || isFuture) ? 'pár sekúnd' : 'pár sekundami'; - case 'ss': // 9 seconds / in 9 seconds / 9 seconds ago - if (withoutSuffix || isFuture) { - return result + (plural$5(number) ? 'sekundy' : 'sekúnd'); - } else { - return result + 'sekundami'; - } - break; - case 'm': // a minute / in a minute / a minute ago - return withoutSuffix ? 'minúta' : (isFuture ? 'minútu' : 'minútou'); - case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago - if (withoutSuffix || isFuture) { - return result + (plural$5(number) ? 'minúty' : 'minút'); - } else { - return result + 'minútami'; - } - break; - case 'h': // an hour / in an hour / an hour ago - return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou'); - case 'hh': // 9 hours / in 9 hours / 9 hours ago - if (withoutSuffix || isFuture) { - return result + (plural$5(number) ? 'hodiny' : 'hodín'); - } else { - return result + 'hodinami'; - } - break; - case 'd': // a day / in a day / a day ago - return (withoutSuffix || isFuture) ? 'deň' : 'dňom'; - case 'dd': // 9 days / in 9 days / 9 days ago - if (withoutSuffix || isFuture) { - return result + (plural$5(number) ? 'dni' : 'dní'); - } else { - return result + 'dňami'; - } - break; - case 'M': // a month / in a month / a month ago - return (withoutSuffix || isFuture) ? 'mesiac' : 'mesiacom'; - case 'MM': // 9 months / in 9 months / 9 months ago - if (withoutSuffix || isFuture) { - return result + (plural$5(number) ? 'mesiace' : 'mesiacov'); - } else { - return result + 'mesiacmi'; - } - break; - case 'y': // a year / in a year / a year ago - return (withoutSuffix || isFuture) ? 'rok' : 'rokom'; - case 'yy': // 9 years / in 9 years / 9 years ago - if (withoutSuffix || isFuture) { - return result + (plural$5(number) ? 'roky' : 'rokov'); - } else { - return result + 'rokmi'; - } - break; - } - } - - hooks.defineLocale('sk', { - 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('_'), - longDateFormat : { - LT: 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd D. MMMM YYYY H:mm' - }, - calendar : { - sameDay: '[dnes o] LT', - nextDay: '[zajtra o] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[v nedeľu o] LT'; - case 1: - case 2: - return '[v] dddd [o] LT'; - case 3: - return '[v stredu o] LT'; - case 4: - return '[vo štvrtok o] LT'; - case 5: - return '[v piatok o] LT'; - case 6: - return '[v sobotu o] LT'; - } - }, - lastDay: '[včera o] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[minulú nedeľu o] LT'; - case 1: - case 2: - return '[minulý] dddd [o] LT'; - case 3: - return '[minulú stredu o] LT'; - case 4: - case 5: - return '[minulý] dddd [o] LT'; - case 6: - return '[minulú sobotu o] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'za %s', - past : 'pred %s', - s : translate$9, - ss : translate$9, - m : translate$9, - mm : translate$9, - h : translate$9, - hh : translate$9, - d : translate$9, - dd : translate$9, - M : translate$9, - MM : translate$9, - y : translate$9, - yy : translate$9 - }, - 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 - - function processRelativeTime$6(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': - return withoutSuffix || isFuture ? 'nekaj sekund' : 'nekaj sekundami'; - case 'ss': - if (number === 1) { - result += withoutSuffix ? 'sekundo' : 'sekundi'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'sekundi' : 'sekundah'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'sekunde' : 'sekundah'; - } else { - result += 'sekund'; - } - return result; - case 'm': - return withoutSuffix ? 'ena minuta' : 'eno minuto'; - case 'mm': - if (number === 1) { - result += withoutSuffix ? 'minuta' : 'minuto'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'minuti' : 'minutama'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'minute' : 'minutami'; - } else { - result += withoutSuffix || isFuture ? 'minut' : 'minutami'; - } - return result; - case 'h': - return withoutSuffix ? 'ena ura' : 'eno uro'; - case 'hh': - if (number === 1) { - result += withoutSuffix ? 'ura' : 'uro'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'uri' : 'urama'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'ure' : 'urami'; - } else { - result += withoutSuffix || isFuture ? 'ur' : 'urami'; - } - return result; - case 'd': - return withoutSuffix || isFuture ? 'en dan' : 'enim dnem'; - case 'dd': - if (number === 1) { - result += withoutSuffix || isFuture ? 'dan' : 'dnem'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'dni' : 'dnevoma'; - } else { - result += withoutSuffix || isFuture ? 'dni' : 'dnevi'; - } - return result; - case 'M': - return withoutSuffix || isFuture ? 'en mesec' : 'enim mesecem'; - case 'MM': - if (number === 1) { - result += withoutSuffix || isFuture ? 'mesec' : 'mesecem'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'meseca' : 'mesecema'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'mesece' : 'meseci'; - } else { - result += withoutSuffix || isFuture ? 'mesecev' : 'meseci'; - } - return result; - case 'y': - return withoutSuffix || isFuture ? 'eno leto' : 'enim letom'; - case 'yy': - if (number === 1) { - result += withoutSuffix || isFuture ? 'leto' : 'letom'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'leti' : 'letoma'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'leta' : 'leti'; - } else { - result += withoutSuffix || isFuture ? 'let' : 'leti'; - } - return result; - } - } - - hooks.defineLocale('sl', { - months : 'januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december'.split('_'), - monthsShort : 'jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota'.split('_'), - weekdaysShort : 'ned._pon._tor._sre._čet._pet._sob.'.split('_'), - weekdaysMin : 'ne_po_to_sr_če_pe_so'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[danes ob] LT', - nextDay : '[jutri ob] LT', - - nextWeek : function () { - switch (this.day()) { - case 0: - return '[v] [nedeljo] [ob] LT'; - case 3: - return '[v] [sredo] [ob] LT'; - case 6: - return '[v] [soboto] [ob] LT'; - case 1: - case 2: - case 4: - case 5: - return '[v] dddd [ob] LT'; - } - }, - lastDay : '[včeraj ob] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - return '[prejšnjo] [nedeljo] [ob] LT'; - case 3: - return '[prejšnjo] [sredo] [ob] LT'; - case 6: - return '[prejšnjo] [soboto] [ob] LT'; - case 1: - case 2: - case 4: - case 5: - return '[prejšnji] dddd [ob] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'čez %s', - past : 'pred %s', - s : processRelativeTime$6, - ss : processRelativeTime$6, - m : processRelativeTime$6, - mm : processRelativeTime$6, - h : processRelativeTime$6, - hh : processRelativeTime$6, - d : processRelativeTime$6, - dd : processRelativeTime$6, - M : processRelativeTime$6, - MM : processRelativeTime$6, - y : processRelativeTime$6, - yy : processRelativeTime$6 - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('sq', { - months : 'Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor'.split('_'), - monthsShort : 'Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj'.split('_'), - weekdays : 'E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë'.split('_'), - weekdaysShort : 'Die_Hën_Mar_Mër_Enj_Pre_Sht'.split('_'), - weekdaysMin : 'D_H_Ma_Më_E_P_Sh'.split('_'), - weekdaysParseExact : true, - meridiemParse: /PD|MD/, - isPM: function (input) { - return input.charAt(0) === 'M'; - }, - meridiem : function (hours, minutes, isLower) { - return hours < 12 ? 'PD' : 'MD'; - }, - 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 : '[Sot në] LT', - nextDay : '[Nesër në] LT', - nextWeek : 'dddd [në] LT', - lastDay : '[Dje në] LT', - lastWeek : 'dddd [e kaluar në] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'në %s', - past : '%s më parë', - s : 'disa sekonda', - ss : '%d sekonda', - m : 'një minutë', - mm : '%d minuta', - h : 'një orë', - hh : '%d orë', - d : 'një ditë', - dd : '%d ditë', - M : 'një muaj', - MM : '%d muaj', - y : 'një vit', - yy : '%d vite' - }, - 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 - - var translator$1 = { - words: { //Different grammatical cases - ss: ['секунда', 'секунде', 'секунди'], - m: ['један минут', 'једне минуте'], - mm: ['минут', 'минуте', 'минута'], - h: ['један сат', 'једног сата'], - hh: ['сат', 'сата', 'сати'], - dd: ['дан', 'дана', 'дана'], - MM: ['месец', 'месеца', 'месеци'], - yy: ['година', 'године', 'година'] - }, - correctGrammaticalCase: function (number, wordKey) { - return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]); - }, - translate: function (number, withoutSuffix, key) { - var wordKey = translator$1.words[key]; - if (key.length === 1) { - return withoutSuffix ? wordKey[0] : wordKey[1]; - } else { - return number + ' ' + translator$1.correctGrammaticalCase(number, wordKey); - } - } - }; - - hooks.defineLocale('sr-cyrl', { - months: 'јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар'.split('_'), - monthsShort: 'јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.'.split('_'), - monthsParseExact: true, - weekdays: 'недеља_понедељак_уторак_среда_четвртак_петак_субота'.split('_'), - weekdaysShort: 'нед._пон._уто._сре._чет._пет._суб.'.split('_'), - weekdaysMin: 'не_по_ут_ср_че_пе_су'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm', - LTS : 'H:mm:ss', - L: 'DD.MM.YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm', - LLLL: 'dddd, D. MMMM YYYY H:mm' - }, - calendar: { - sameDay: '[данас у] LT', - nextDay: '[сутра у] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[у] [недељу] [у] LT'; - case 3: - return '[у] [среду] [у] LT'; - case 6: - return '[у] [суботу] [у] LT'; - case 1: - case 2: - case 4: - case 5: - return '[у] dddd [у] LT'; - } - }, - lastDay : '[јуче у] LT', - lastWeek : function () { - var lastWeekDays = [ - '[прошле] [недеље] [у] LT', - '[прошлог] [понедељка] [у] LT', - '[прошлог] [уторка] [у] LT', - '[прошле] [среде] [у] LT', - '[прошлог] [четвртка] [у] LT', - '[прошлог] [петка] [у] LT', - '[прошле] [суботе] [у] LT' - ]; - return lastWeekDays[this.day()]; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'за %s', - past : 'пре %s', - s : 'неколико секунди', - ss : translator$1.translate, - m : translator$1.translate, - mm : translator$1.translate, - h : translator$1.translate, - hh : translator$1.translate, - d : 'дан', - dd : translator$1.translate, - M : 'месец', - MM : translator$1.translate, - y : 'годину', - yy : translator$1.translate - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - var translator$2 = { - words: { //Different grammatical cases - ss: ['sekunda', 'sekunde', 'sekundi'], - m: ['jedan minut', 'jedne minute'], - mm: ['minut', 'minute', 'minuta'], - h: ['jedan sat', 'jednog sata'], - hh: ['sat', 'sata', 'sati'], - dd: ['dan', 'dana', 'dana'], - MM: ['mesec', 'meseca', 'meseci'], - yy: ['godina', 'godine', 'godina'] - }, - correctGrammaticalCase: function (number, wordKey) { - return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]); - }, - translate: function (number, withoutSuffix, key) { - var wordKey = translator$2.words[key]; - if (key.length === 1) { - return withoutSuffix ? wordKey[0] : wordKey[1]; - } else { - return number + ' ' + translator$2.correctGrammaticalCase(number, wordKey); - } - } - }; - - hooks.defineLocale('sr', { - months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split('_'), - monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays: 'nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota'.split('_'), - weekdaysShort: 'ned._pon._uto._sre._čet._pet._sub.'.split('_'), - weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm', - LTS : 'H:mm:ss', - L: 'DD.MM.YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm', - LLLL: 'dddd, D. MMMM YYYY H:mm' - }, - calendar: { - sameDay: '[danas u] LT', - nextDay: '[sutra u] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[u] [nedelju] [u] LT'; - case 3: - return '[u] [sredu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - }, - lastDay : '[juče u] LT', - lastWeek : function () { - var lastWeekDays = [ - '[prošle] [nedelje] [u] LT', - '[prošlog] [ponedeljka] [u] LT', - '[prošlog] [utorka] [u] LT', - '[prošle] [srede] [u] LT', - '[prošlog] [četvrtka] [u] LT', - '[prošlog] [petka] [u] LT', - '[prošle] [subote] [u] LT' - ]; - return lastWeekDays[this.day()]; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'pre %s', - s : 'nekoliko sekundi', - ss : translator$2.translate, - m : translator$2.translate, - mm : translator$2.translate, - h : translator$2.translate, - hh : translator$2.translate, - d : 'dan', - dd : translator$2.translate, - M : 'mesec', - MM : translator$2.translate, - y : 'godinu', - yy : translator$2.translate - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('ss', { - months : "Bhimbidvwane_Indlovana_Indlov'lenkhulu_Mabasa_Inkhwekhweti_Inhlaba_Kholwane_Ingci_Inyoni_Imphala_Lweti_Ingongoni".split('_'), - monthsShort : 'Bhi_Ina_Inu_Mab_Ink_Inh_Kho_Igc_Iny_Imp_Lwe_Igo'.split('_'), - weekdays : 'Lisontfo_Umsombuluko_Lesibili_Lesitsatfu_Lesine_Lesihlanu_Umgcibelo'.split('_'), - weekdaysShort : 'Lis_Umb_Lsb_Les_Lsi_Lsh_Umg'.split('_'), - weekdaysMin : 'Li_Us_Lb_Lt_Ls_Lh_Ug'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[Namuhla nga] LT', - nextDay : '[Kusasa nga] LT', - nextWeek : 'dddd [nga] LT', - lastDay : '[Itolo nga] LT', - lastWeek : 'dddd [leliphelile] [nga] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'nga %s', - past : 'wenteka nga %s', - s : 'emizuzwana lomcane', - ss : '%d mzuzwana', - m : 'umzuzu', - mm : '%d emizuzu', - h : 'lihora', - hh : '%d emahora', - d : 'lilanga', - dd : '%d emalanga', - M : 'inyanga', - MM : '%d tinyanga', - y : 'umnyaka', - yy : '%d iminyaka' - }, - meridiemParse: /ekuseni|emini|entsambama|ebusuku/, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'ekuseni'; - } else if (hours < 15) { - return 'emini'; - } else if (hours < 19) { - return 'entsambama'; - } else { - return 'ebusuku'; - } - }, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'ekuseni') { - return hour; - } else if (meridiem === 'emini') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'entsambama' || meridiem === 'ebusuku') { - if (hour === 0) { - return 0; - } - return hour + 12; - } - }, - 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('sv', { - months : 'januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december'.split('_'), - monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), - weekdays : 'söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag'.split('_'), - weekdaysShort : 'sön_mån_tis_ons_tor_fre_lör'.split('_'), - weekdaysMin : 'sö_må_ti_on_to_fr_lö'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [kl.] HH:mm', - LLLL : 'dddd D MMMM YYYY [kl.] HH:mm', - lll : 'D MMM YYYY HH:mm', - llll : 'ddd D MMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Idag] LT', - nextDay: '[Imorgon] LT', - lastDay: '[Igår] LT', - nextWeek: '[På] dddd LT', - lastWeek: '[I] dddd[s] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'om %s', - past : 'för %s sedan', - s : 'några sekunder', - ss : '%d sekunder', - m : 'en minut', - mm : '%d minuter', - h : 'en timme', - hh : '%d timmar', - d : 'en dag', - dd : '%d dagar', - M : 'en månad', - MM : '%d månader', - y : 'ett år', - yy : '%d år' - }, - dayOfMonthOrdinalParse: /\d{1,2}(e|a)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'e' : - (b === 1) ? 'a' : - (b === 2) ? 'a' : - (b === 3) ? 'e' : 'e'; - 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('sw', { - months : 'Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba'.split('_'), - monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des'.split('_'), - weekdays : 'Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi'.split('_'), - weekdaysShort : 'Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos'.split('_'), - weekdaysMin : 'J2_J3_J4_J5_Al_Ij_J1'.split('_'), - weekdaysParseExact : true, - 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 : '[leo saa] LT', - nextDay : '[kesho saa] LT', - nextWeek : '[wiki ijayo] dddd [saat] LT', - lastDay : '[jana] LT', - lastWeek : '[wiki iliyopita] dddd [saat] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s baadaye', - past : 'tokea %s', - s : 'hivi punde', - ss : 'sekunde %d', - m : 'dakika moja', - mm : 'dakika %d', - h : 'saa limoja', - hh : 'masaa %d', - d : 'siku moja', - dd : 'masiku %d', - M : 'mwezi mmoja', - MM : 'miezi %d', - y : 'mwaka mmoja', - yy : 'miaka %d' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - var symbolMap$f = { - '1': '௧', - '2': '௨', - '3': '௩', - '4': '௪', - '5': '௫', - '6': '௬', - '7': '௭', - '8': '௮', - '9': '௯', - '0': '௦' - }, numberMap$e = { - '௧': '1', - '௨': '2', - '௩': '3', - '௪': '4', - '௫': '5', - '௬': '6', - '௭': '7', - '௮': '8', - '௯': '9', - '௦': '0' - }; - - hooks.defineLocale('ta', { - months : 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'), - monthsShort : 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'), - weekdays : 'ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை'.split('_'), - weekdaysShort : 'ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி'.split('_'), - weekdaysMin : 'ஞா_தி_செ_பு_வி_வெ_ச'.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 : '[இன்று] LT', - nextDay : '[நாளை] LT', - nextWeek : 'dddd, LT', - lastDay : '[நேற்று] LT', - lastWeek : '[கடந்த வாரம்] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s இல்', - past : '%s முன்', - s : 'ஒரு சில விநாடிகள்', - ss : '%d விநாடிகள்', - m : 'ஒரு நிமிடம்', - mm : '%d நிமிடங்கள்', - h : 'ஒரு மணி நேரம்', - hh : '%d மணி நேரம்', - d : 'ஒரு நாள்', - dd : '%d நாட்கள்', - M : 'ஒரு மாதம்', - MM : '%d மாதங்கள்', - y : 'ஒரு வருடம்', - yy : '%d ஆண்டுகள்' - }, - dayOfMonthOrdinalParse: /\d{1,2}வது/, - ordinal : function (number) { - return number + 'வது'; - }, - preparse: function (string) { - return string.replace(/[௧௨௩௪௫௬௭௮௯௦]/g, function (match) { - return numberMap$e[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap$f[match]; - }); - }, - // refer http://ta.wikipedia.org/s/1er1 - meridiemParse: /யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/, - meridiem : function (hour, minute, isLower) { - if (hour < 2) { - return ' யாமம்'; - } else if (hour < 6) { - return ' வைகறை'; // வைகறை - } else if (hour < 10) { - return ' காலை'; // காலை - } else if (hour < 14) { - return ' நண்பகல்'; // நண்பகல் - } else if (hour < 18) { - return ' எற்பாடு'; // எற்பாடு - } else if (hour < 22) { - return ' மாலை'; // மாலை - } else { - return ' யாமம்'; - } - }, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'யாமம்') { - return hour < 2 ? hour : hour + 12; - } else if (meridiem === 'வைகறை' || meridiem === 'காலை') { - return hour; - } else if (meridiem === 'நண்பகல்') { - return hour >= 10 ? hour : hour + 12; - } else { - return hour + 12; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('te', { - months : 'జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జులై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్'.split('_'), - monthsShort : 'జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జులై_ఆగ._సెప్._అక్టో._నవ._డిసె.'.split('_'), - monthsParseExact : true, - weekdays : 'ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం'.split('_'), - weekdaysShort : 'ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని'.split('_'), - weekdaysMin : 'ఆ_సో_మం_బు_గు_శు_శ'.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 : '[నేడు] LT', - nextDay : '[రేపు] LT', - nextWeek : 'dddd, LT', - lastDay : '[నిన్న] LT', - lastWeek : '[గత] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s లో', - past : '%s క్రితం', - s : 'కొన్ని క్షణాలు', - ss : '%d సెకన్లు', - m : 'ఒక నిమిషం', - mm : '%d నిమిషాలు', - h : 'ఒక గంట', - hh : '%d గంటలు', - d : 'ఒక రోజు', - dd : '%d రోజులు', - M : 'ఒక నెల', - MM : '%d నెలలు', - y : 'ఒక సంవత్సరం', - yy : '%d సంవత్సరాలు' - }, - dayOfMonthOrdinalParse : /\d{1,2}వ/, - ordinal : '%dవ', - meridiemParse: /రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'రాత్రి') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'ఉదయం') { - return hour; - } else if (meridiem === 'మధ్యాహ్నం') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'సాయంత్రం') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'రాత్రి'; - } else if (hour < 10) { - return 'ఉదయం'; - } else if (hour < 17) { - return 'మధ్యాహ్నం'; - } else if (hour < 20) { - return 'సాయంత్రం'; - } else { - return 'రాత్రి'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('tet', { - months : 'Janeiru_Fevereiru_Marsu_Abril_Maiu_Juñu_Jullu_Agustu_Setembru_Outubru_Novembru_Dezembru'.split('_'), - monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'), - weekdays : 'Domingu_Segunda_Tersa_Kuarta_Kinta_Sesta_Sabadu'.split('_'), - weekdaysShort : 'Dom_Seg_Ters_Kua_Kint_Sest_Sab'.split('_'), - weekdaysMin : 'Do_Seg_Te_Ku_Ki_Ses_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: '[Ohin iha] LT', - nextDay: '[Aban iha] LT', - nextWeek: 'dddd [iha] LT', - lastDay: '[Horiseik iha] LT', - lastWeek: 'dddd [semana kotuk] [iha] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'iha %s', - past : '%s liuba', - s : 'minutu balun', - ss : 'minutu %d', - m : 'minutu ida', - mm : 'minutu %d', - h : 'oras ida', - hh : 'oras %d', - d : 'loron ida', - dd : 'loron %d', - M : 'fulan ida', - MM : 'fulan %d', - y : 'tinan ida', - yy : 'tinan %d' - }, - 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 - - var suffixes$3 = { - 0: '-ум', - 1: '-ум', - 2: '-юм', - 3: '-юм', - 4: '-ум', - 5: '-ум', - 6: '-ум', - 7: '-ум', - 8: '-ум', - 9: '-ум', - 10: '-ум', - 12: '-ум', - 13: '-ум', - 20: '-ум', - 30: '-юм', - 40: '-ум', - 50: '-ум', - 60: '-ум', - 70: '-ум', - 80: '-ум', - 90: '-ум', - 100: '-ум' - }; - - hooks.defineLocale('tg', { - months : 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split('_'), - monthsShort : 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'), - weekdays : 'якшанбе_душанбе_сешанбе_чоршанбе_панҷшанбе_ҷумъа_шанбе'.split('_'), - weekdaysShort : 'яшб_дшб_сшб_чшб_пшб_ҷум_шнб'.split('_'), - weekdaysMin : 'яш_дш_сш_чш_пш_ҷм_шб'.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 : '[Имрӯз соати] LT', - nextDay : '[Пагоҳ соати] LT', - lastDay : '[Дирӯз соати] LT', - nextWeek : 'dddd[и] [ҳафтаи оянда соати] LT', - lastWeek : 'dddd[и] [ҳафтаи гузашта соати] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'баъди %s', - past : '%s пеш', - s : 'якчанд сония', - m : 'як дақиқа', - mm : '%d дақиқа', - h : 'як соат', - hh : '%d соат', - d : 'як рӯз', - dd : '%d рӯз', - M : 'як моҳ', - MM : '%d моҳ', - y : 'як сол', - yy : '%d сол' - }, - meridiemParse: /шаб|субҳ|рӯз|бегоҳ/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'шаб') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'субҳ') { - return hour; - } else if (meridiem === 'рӯз') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'бегоҳ') { - return hour + 12; - } - }, - meridiem: function (hour, minute, isLower) { - if (hour < 4) { - return 'шаб'; - } else if (hour < 11) { - return 'субҳ'; - } else if (hour < 16) { - return 'рӯз'; - } else if (hour < 19) { - return 'бегоҳ'; - } else { - return 'шаб'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}-(ум|юм)/, - ordinal: function (number) { - var a = number % 10, - b = number >= 100 ? 100 : null; - return number + (suffixes$3[number] || suffixes$3[a] || suffixes$3[b]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1th is the first week of the year. - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('th', { - months : 'มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม'.split('_'), - monthsShort : 'ม.ค._ก.พ._มี.ค._เม.ย._พ.ค._มิ.ย._ก.ค._ส.ค._ก.ย._ต.ค._พ.ย._ธ.ค.'.split('_'), - monthsParseExact: true, - weekdays : 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์'.split('_'), - weekdaysShort : 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์'.split('_'), // yes, three characters difference - weekdaysMin : 'อา._จ._อ._พ._พฤ._ศ._ส.'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY เวลา H:mm', - LLLL : 'วันddddที่ D MMMM YYYY เวลา H:mm' - }, - meridiemParse: /ก่อนเที่ยง|หลังเที่ยง/, - isPM: function (input) { - return input === 'หลังเที่ยง'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ก่อนเที่ยง'; - } else { - return 'หลังเที่ยง'; - } - }, - calendar : { - sameDay : '[วันนี้ เวลา] LT', - nextDay : '[พรุ่งนี้ เวลา] LT', - nextWeek : 'dddd[หน้า เวลา] LT', - lastDay : '[เมื่อวานนี้ เวลา] LT', - lastWeek : '[วัน]dddd[ที่แล้ว เวลา] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'อีก %s', - past : '%sที่แล้ว', - s : 'ไม่กี่วินาที', - ss : '%d วินาที', - m : '1 นาที', - mm : '%d นาที', - h : '1 ชั่วโมง', - hh : '%d ชั่วโมง', - d : '1 วัน', - dd : '%d วัน', - M : '1 เดือน', - MM : '%d เดือน', - y : '1 ปี', - yy : '%d ปี' - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('tl-ph', { - months : 'Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre'.split('_'), - monthsShort : 'Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis'.split('_'), - weekdays : 'Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado'.split('_'), - weekdaysShort : 'Lin_Lun_Mar_Miy_Huw_Biy_Sab'.split('_'), - weekdaysMin : 'Li_Lu_Ma_Mi_Hu_Bi_Sab'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'MM/D/YYYY', - LL : 'MMMM D, YYYY', - LLL : 'MMMM D, YYYY HH:mm', - LLLL : 'dddd, MMMM DD, YYYY HH:mm' - }, - calendar : { - sameDay: 'LT [ngayong araw]', - nextDay: '[Bukas ng] LT', - nextWeek: 'LT [sa susunod na] dddd', - lastDay: 'LT [kahapon]', - lastWeek: 'LT [noong nakaraang] dddd', - sameElse: 'L' - }, - relativeTime : { - future : 'sa loob ng %s', - past : '%s ang nakalipas', - s : 'ilang segundo', - ss : '%d segundo', - m : 'isang minuto', - mm : '%d minuto', - h : 'isang oras', - hh : '%d oras', - d : 'isang araw', - dd : '%d araw', - M : 'isang buwan', - MM : '%d buwan', - y : 'isang taon', - yy : '%d taon' - }, - dayOfMonthOrdinalParse: /\d{1,2}/, - ordinal : function (number) { - return number; - }, - 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 numbersNouns = 'pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut'.split('_'); - - function translateFuture(output) { - var time = output; - time = (output.indexOf('jaj') !== -1) ? - time.slice(0, -3) + 'leS' : - (output.indexOf('jar') !== -1) ? - time.slice(0, -3) + 'waQ' : - (output.indexOf('DIS') !== -1) ? - time.slice(0, -3) + 'nem' : - time + ' pIq'; - return time; - } - - function translatePast(output) { - var time = output; - time = (output.indexOf('jaj') !== -1) ? - time.slice(0, -3) + 'Hu’' : - (output.indexOf('jar') !== -1) ? - time.slice(0, -3) + 'wen' : - (output.indexOf('DIS') !== -1) ? - time.slice(0, -3) + 'ben' : - time + ' ret'; - return time; - } - - function translate$a(number, withoutSuffix, string, isFuture) { - var numberNoun = numberAsNoun(number); - switch (string) { - case 'ss': - return numberNoun + ' lup'; - case 'mm': - return numberNoun + ' tup'; - case 'hh': - return numberNoun + ' rep'; - case 'dd': - return numberNoun + ' jaj'; - case 'MM': - return numberNoun + ' jar'; - case 'yy': - return numberNoun + ' DIS'; - } - } - - function numberAsNoun(number) { - var hundred = Math.floor((number % 1000) / 100), - ten = Math.floor((number % 100) / 10), - one = number % 10, - word = ''; - if (hundred > 0) { - word += numbersNouns[hundred] + 'vatlh'; - } - if (ten > 0) { - word += ((word !== '') ? ' ' : '') + numbersNouns[ten] + 'maH'; - } - if (one > 0) { - word += ((word !== '') ? ' ' : '') + numbersNouns[one]; - } - return (word === '') ? 'pagh' : word; - } - - hooks.defineLocale('tlh', { - months : 'tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’'.split('_'), - monthsShort : 'jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’'.split('_'), - monthsParseExact : true, - weekdays : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), - weekdaysShort : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), - weekdaysMin : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.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: '[DaHjaj] LT', - nextDay: '[wa’leS] LT', - nextWeek: 'LLL', - lastDay: '[wa’Hu’] LT', - lastWeek: 'LLL', - sameElse: 'L' - }, - relativeTime : { - future : translateFuture, - past : translatePast, - s : 'puS lup', - ss : translate$a, - m : 'wa’ tup', - mm : translate$a, - h : 'wa’ rep', - hh : translate$a, - d : 'wa’ jaj', - dd : translate$a, - M : 'wa’ jar', - MM : translate$a, - y : 'wa’ DIS', - yy : translate$a - }, - 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. - } - }); - - var suffixes$4 = { - 1: '\'inci', - 5: '\'inci', - 8: '\'inci', - 70: '\'inci', - 80: '\'inci', - 2: '\'nci', - 7: '\'nci', - 20: '\'nci', - 50: '\'nci', - 3: '\'üncü', - 4: '\'üncü', - 100: '\'üncü', - 6: '\'ncı', - 9: '\'uncu', - 10: '\'uncu', - 30: '\'uncu', - 60: '\'ıncı', - 90: '\'ıncı' - }; - - hooks.defineLocale('tr', { - months : 'Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık'.split('_'), - monthsShort : 'Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara'.split('_'), - weekdays : 'Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi'.split('_'), - weekdaysShort : 'Paz_Pts_Sal_Çar_Per_Cum_Cts'.split('_'), - weekdaysMin : 'Pz_Pt_Sa_Ça_Pe_Cu_Ct'.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 : '[bugün saat] LT', - nextDay : '[yarın saat] LT', - nextWeek : '[gelecek] dddd [saat] LT', - lastDay : '[dün] LT', - lastWeek : '[geçen] dddd [saat] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s sonra', - past : '%s önce', - s : 'birkaç saniye', - ss : '%d saniye', - m : 'bir dakika', - mm : '%d dakika', - h : 'bir saat', - hh : '%d saat', - d : 'bir gün', - dd : '%d gün', - M : 'bir ay', - MM : '%d ay', - y : 'bir yıl', - yy : '%d yıl' - }, - ordinal: function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'Do': - case 'DD': - return number; - default: - if (number === 0) { // special case for zero - return number + '\'ıncı'; - } - var a = number % 10, - b = number % 100 - a, - c = number >= 100 ? 100 : null; - return number + (suffixes$4[a] || suffixes$4[b] || suffixes$4[c]); - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - // After the year there should be a slash and the amount of years since December 26, 1979 in Roman numerals. - // This is currently too difficult (maybe even impossible) to add. - hooks.defineLocale('tzl', { - months : 'Januar_Fevraglh_Març_Avrïu_Mai_Gün_Julia_Guscht_Setemvar_Listopäts_Noemvar_Zecemvar'.split('_'), - monthsShort : 'Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec'.split('_'), - weekdays : 'Súladi_Lúneçi_Maitzi_Márcuri_Xhúadi_Viénerçi_Sáturi'.split('_'), - weekdaysShort : 'Súl_Lún_Mai_Már_Xhú_Vié_Sát'.split('_'), - weekdaysMin : 'Sú_Lú_Ma_Má_Xh_Vi_Sá'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM [dallas] YYYY', - LLL : 'D. MMMM [dallas] YYYY HH.mm', - LLLL : 'dddd, [li] D. MMMM [dallas] YYYY HH.mm' - }, - meridiemParse: /d\'o|d\'a/i, - isPM : function (input) { - return 'd\'o' === input.toLowerCase(); - }, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'd\'o' : 'D\'O'; - } else { - return isLower ? 'd\'a' : 'D\'A'; - } - }, - calendar : { - sameDay : '[oxhi à] LT', - nextDay : '[demà à] LT', - nextWeek : 'dddd [à] LT', - lastDay : '[ieiri à] LT', - lastWeek : '[sür el] dddd [lasteu à] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'osprei %s', - past : 'ja%s', - s : processRelativeTime$7, - ss : processRelativeTime$7, - m : processRelativeTime$7, - mm : processRelativeTime$7, - h : processRelativeTime$7, - hh : processRelativeTime$7, - d : processRelativeTime$7, - dd : processRelativeTime$7, - M : processRelativeTime$7, - MM : processRelativeTime$7, - y : processRelativeTime$7, - yy : processRelativeTime$7 - }, - 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. - } - }); - - function processRelativeTime$7(number, withoutSuffix, key, isFuture) { - var format = { - 's': ['viensas secunds', '\'iensas secunds'], - 'ss': [number + ' secunds', '' + number + ' secunds'], - 'm': ['\'n míut', '\'iens míut'], - 'mm': [number + ' míuts', '' + number + ' míuts'], - 'h': ['\'n þora', '\'iensa þora'], - 'hh': [number + ' þoras', '' + number + ' þoras'], - 'd': ['\'n ziua', '\'iensa ziua'], - 'dd': [number + ' ziuas', '' + number + ' ziuas'], - 'M': ['\'n mes', '\'iens mes'], - 'MM': [number + ' mesen', '' + number + ' mesen'], - 'y': ['\'n ar', '\'iens ar'], - 'yy': [number + ' ars', '' + number + ' ars'] - }; - return isFuture ? format[key][0] : (withoutSuffix ? format[key][0] : format[key][1]); - } - - //! moment.js locale configuration - - hooks.defineLocale('tzm-latn', { - months : 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split('_'), - monthsShort : 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split('_'), - weekdays : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), - weekdaysShort : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), - weekdaysMin : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.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: '[asdkh g] LT', - nextDay: '[aska g] LT', - nextWeek: 'dddd [g] LT', - lastDay: '[assant g] LT', - lastWeek: 'dddd [g] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'dadkh s yan %s', - past : 'yan %s', - s : 'imik', - ss : '%d imik', - m : 'minuḍ', - mm : '%d minuḍ', - h : 'saɛa', - hh : '%d tassaɛin', - d : 'ass', - dd : '%d ossan', - M : 'ayowr', - MM : '%d iyyirn', - y : 'asgas', - yy : '%d isgasn' - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('tzm', { - months : 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split('_'), - monthsShort : 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split('_'), - weekdays : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), - weekdaysShort : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), - weekdaysMin : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.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: '[ⴰⵙⴷⵅ ⴴ] LT', - nextDay: '[ⴰⵙⴽⴰ ⴴ] LT', - nextWeek: 'dddd [ⴴ] LT', - lastDay: '[ⴰⵚⴰⵏⵜ ⴴ] LT', - lastWeek: 'dddd [ⴴ] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s', - past : 'ⵢⴰⵏ %s', - s : 'ⵉⵎⵉⴽ', - ss : '%d ⵉⵎⵉⴽ', - m : 'ⵎⵉⵏⵓⴺ', - mm : '%d ⵎⵉⵏⵓⴺ', - h : 'ⵙⴰⵄⴰ', - hh : '%d ⵜⴰⵙⵙⴰⵄⵉⵏ', - d : 'ⴰⵙⵙ', - dd : '%d oⵙⵙⴰⵏ', - M : 'ⴰⵢoⵓⵔ', - MM : '%d ⵉⵢⵢⵉⵔⵏ', - y : 'ⴰⵙⴳⴰⵙ', - yy : '%d ⵉⵙⴳⴰⵙⵏ' - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } - }); - - //! moment.js language configuration - - hooks.defineLocale('ug-cn', { - months: 'يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر'.split( - '_' - ), - monthsShort: 'يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر'.split( - '_' - ), - weekdays: 'يەكشەنبە_دۈشەنبە_سەيشەنبە_چارشەنبە_پەيشەنبە_جۈمە_شەنبە'.split( - '_' - ), - weekdaysShort: 'يە_دۈ_سە_چا_پە_جۈ_شە'.split('_'), - weekdaysMin: 'يە_دۈ_سە_چا_پە_جۈ_شە'.split('_'), - longDateFormat: { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L: 'YYYY-MM-DD', - LL: 'YYYY-يىلىM-ئاينىڭD-كۈنى', - LLL: 'YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm', - LLLL: 'dddd، YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm' - }, - meridiemParse: /يېرىم كېچە|سەھەر|چۈشتىن بۇرۇن|چۈش|چۈشتىن كېيىن|كەچ/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ( - meridiem === 'يېرىم كېچە' || - meridiem === 'سەھەر' || - meridiem === 'چۈشتىن بۇرۇن' - ) { - return hour; - } else if (meridiem === 'چۈشتىن كېيىن' || meridiem === 'كەچ') { - return hour + 12; - } else { - return hour >= 11 ? hour : hour + 12; - } - }, - meridiem: function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 600) { - return 'يېرىم كېچە'; - } else if (hm < 900) { - return 'سەھەر'; - } else if (hm < 1130) { - return 'چۈشتىن بۇرۇن'; - } else if (hm < 1230) { - return 'چۈش'; - } else if (hm < 1800) { - return 'چۈشتىن كېيىن'; - } else { - return 'كەچ'; - } - }, - calendar: { - sameDay: '[بۈگۈن سائەت] LT', - nextDay: '[ئەتە سائەت] LT', - nextWeek: '[كېلەركى] dddd [سائەت] LT', - lastDay: '[تۆنۈگۈن] LT', - lastWeek: '[ئالدىنقى] dddd [سائەت] LT', - sameElse: 'L' - }, - relativeTime: { - future: '%s كېيىن', - past: '%s بۇرۇن', - s: 'نەچچە سېكونت', - ss: '%d سېكونت', - m: 'بىر مىنۇت', - mm: '%d مىنۇت', - h: 'بىر سائەت', - hh: '%d سائەت', - d: 'بىر كۈن', - dd: '%d كۈن', - M: 'بىر ئاي', - MM: '%d ئاي', - y: 'بىر يىل', - yy: '%d يىل' - }, - - dayOfMonthOrdinalParse: /\d{1,2}(-كۈنى|-ئاي|-ھەپتە)/, - ordinal: function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '-كۈنى'; - case 'w': - case 'W': - return number + '-ھەپتە'; - default: - return number; - } - }, - preparse: function (string) { - return string.replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/,/g, '،'); - }, - week: { - // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效 - dow: 1, // Monday is the first day of the week. - doy: 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - - function plural$6(word, num) { - var forms = word.split('_'); - return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]); - } - function relativeTimeWithPlural$4(number, withoutSuffix, key) { - var format = { - 'ss': withoutSuffix ? 'секунда_секунди_секунд' : 'секунду_секунди_секунд', - 'mm': withoutSuffix ? 'хвилина_хвилини_хвилин' : 'хвилину_хвилини_хвилин', - 'hh': withoutSuffix ? 'година_години_годин' : 'годину_години_годин', - 'dd': 'день_дні_днів', - 'MM': 'місяць_місяці_місяців', - 'yy': 'рік_роки_років' - }; - if (key === 'm') { - return withoutSuffix ? 'хвилина' : 'хвилину'; - } - else if (key === 'h') { - return withoutSuffix ? 'година' : 'годину'; - } - else { - return number + ' ' + plural$6(format[key], +number); - } - } - function weekdaysCaseReplace(m, format) { - var weekdays = { - 'nominative': 'неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота'.split('_'), - 'accusative': 'неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу'.split('_'), - 'genitive': 'неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи'.split('_') - }; - - if (m === true) { - return weekdays['nominative'].slice(1, 7).concat(weekdays['nominative'].slice(0, 1)); - } - if (!m) { - return weekdays['nominative']; - } - - var nounCase = (/(\[[ВвУу]\]) ?dddd/).test(format) ? - 'accusative' : - ((/\[?(?:минулої|наступної)? ?\] ?dddd/).test(format) ? - 'genitive' : - 'nominative'); - return weekdays[nounCase][m.day()]; - } - function processHoursFunction(str) { - return function () { - return str + 'о' + (this.hours() === 11 ? 'б' : '') + '] LT'; - }; - } - - hooks.defineLocale('uk', { - months : { - 'format': 'січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня'.split('_'), - 'standalone': 'січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень'.split('_') - }, - monthsShort : 'січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд'.split('_'), - weekdays : weekdaysCaseReplace, - weekdaysShort : 'нд_пн_вт_ср_чт_пт_сб'.split('_'), - weekdaysMin : 'нд_пн_вт_ср_чт_пт_сб'.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: processHoursFunction('[Сьогодні '), - nextDay: processHoursFunction('[Завтра '), - lastDay: processHoursFunction('[Вчора '), - nextWeek: processHoursFunction('[У] dddd ['), - lastWeek: function () { - switch (this.day()) { - case 0: - case 3: - case 5: - case 6: - return processHoursFunction('[Минулої] dddd [').call(this); - case 1: - case 2: - case 4: - return processHoursFunction('[Минулого] dddd [').call(this); - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'за %s', - past : '%s тому', - s : 'декілька секунд', - ss : relativeTimeWithPlural$4, - m : relativeTimeWithPlural$4, - mm : relativeTimeWithPlural$4, - h : 'годину', - hh : relativeTimeWithPlural$4, - d : 'день', - dd : relativeTimeWithPlural$4, - M : 'місяць', - MM : relativeTimeWithPlural$4, - y : 'рік', - yy : relativeTimeWithPlural$4 - }, - // M. E.: those two are virtually unused but a user might want to implement them for his/her website for some reason - meridiemParse: /ночі|ранку|дня|вечора/, - isPM: function (input) { - return /^(дня|вечора)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ночі'; - } else if (hour < 12) { - return 'ранку'; - } else if (hour < 17) { - return 'дня'; - } else { - return 'вечора'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}-(й|го)/, - ordinal: function (number, period) { - switch (period) { - case 'M': - case 'd': - case 'DDD': - case 'w': - case 'W': - return number + '-й'; - case 'D': - return number + '-го'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - var months$a = [ - 'جنوری', - 'فروری', - 'مارچ', - 'اپریل', - 'مئی', - 'جون', - 'جولائی', - 'اگست', - 'ستمبر', - 'اکتوبر', - 'نومبر', - 'دسمبر' - ]; - var days$2 = [ - 'اتوار', - 'پیر', - 'منگل', - 'بدھ', - 'جمعرات', - 'جمعہ', - 'ہفتہ' - ]; - - hooks.defineLocale('ur', { - months : months$a, - monthsShort : months$a, - weekdays : days$2, - weekdaysShort : days$2, - weekdaysMin : days$2, - 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: /صبح|شام/, - isPM : function (input) { - return 'شام' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'صبح'; - } - return 'شام'; - }, - calendar : { - sameDay : '[آج بوقت] LT', - nextDay : '[کل بوقت] LT', - nextWeek : 'dddd [بوقت] LT', - lastDay : '[گذشتہ روز بوقت] LT', - lastWeek : '[گذشتہ] dddd [بوقت] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s بعد', - past : '%s قبل', - s : 'چند سیکنڈ', - ss : '%d سیکنڈ', - m : 'ایک منٹ', - mm : '%d منٹ', - h : 'ایک گھنٹہ', - hh : '%d گھنٹے', - d : 'ایک دن', - dd : '%d دن', - M : 'ایک ماہ', - MM : '%d ماہ', - y : 'ایک سال', - yy : '%d سال' - }, - preparse: function (string) { - return string.replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/,/g, '،'); - }, - 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('uz-latn', { - months : 'Yanvar_Fevral_Mart_Aprel_May_Iyun_Iyul_Avgust_Sentabr_Oktabr_Noyabr_Dekabr'.split('_'), - monthsShort : 'Yan_Fev_Mar_Apr_May_Iyun_Iyul_Avg_Sen_Okt_Noy_Dek'.split('_'), - weekdays : 'Yakshanba_Dushanba_Seshanba_Chorshanba_Payshanba_Juma_Shanba'.split('_'), - weekdaysShort : 'Yak_Dush_Sesh_Chor_Pay_Jum_Shan'.split('_'), - weekdaysMin : 'Ya_Du_Se_Cho_Pa_Ju_Sha'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'D MMMM YYYY, dddd HH:mm' - }, - calendar : { - sameDay : '[Bugun soat] LT [da]', - nextDay : '[Ertaga] LT [da]', - nextWeek : 'dddd [kuni soat] LT [da]', - lastDay : '[Kecha soat] LT [da]', - lastWeek : '[O\'tgan] dddd [kuni soat] LT [da]', - sameElse : 'L' - }, - relativeTime : { - future : 'Yaqin %s ichida', - past : 'Bir necha %s oldin', - s : 'soniya', - ss : '%d soniya', - m : 'bir daqiqa', - mm : '%d daqiqa', - h : 'bir soat', - hh : '%d soat', - d : 'bir kun', - dd : '%d kun', - M : 'bir oy', - MM : '%d oy', - y : 'bir yil', - yy : '%d yil' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('uz', { - months : 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split('_'), - monthsShort : 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'), - weekdays : 'Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба'.split('_'), - weekdaysShort : 'Якш_Душ_Сеш_Чор_Пай_Жум_Шан'.split('_'), - weekdaysMin : 'Як_Ду_Се_Чо_Па_Жу_Ша'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'D MMMM YYYY, dddd HH:mm' - }, - calendar : { - sameDay : '[Бугун соат] LT [да]', - nextDay : '[Эртага] LT [да]', - nextWeek : 'dddd [куни соат] LT [да]', - lastDay : '[Кеча соат] LT [да]', - lastWeek : '[Утган] dddd [куни соат] LT [да]', - sameElse : 'L' - }, - relativeTime : { - future : 'Якин %s ичида', - past : 'Бир неча %s олдин', - s : 'фурсат', - ss : '%d фурсат', - m : 'бир дакика', - mm : '%d дакика', - h : 'бир соат', - hh : '%d соат', - d : 'бир кун', - dd : '%d кун', - M : 'бир ой', - MM : '%d ой', - y : 'бир йил', - yy : '%d йил' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('vi', { - months : 'tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12'.split('_'), - monthsShort : 'Th01_Th02_Th03_Th04_Th05_Th06_Th07_Th08_Th09_Th10_Th11_Th12'.split('_'), - monthsParseExact : true, - weekdays : 'chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy'.split('_'), - weekdaysShort : 'CN_T2_T3_T4_T5_T6_T7'.split('_'), - weekdaysMin : 'CN_T2_T3_T4_T5_T6_T7'.split('_'), + 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('_'), + 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('_'), weekdaysParseExact : true, - meridiemParse: /sa|ch/i, - isPM : function (input) { - return /^ch$/i.test(input); - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 12) { - return isLower ? 'sa' : 'SA'; - } else { - return isLower ? 'ch' : 'CH'; - } - }, longDateFormat : { LT : 'HH:mm', LTS : 'HH:mm:ss', L : 'DD/MM/YYYY', - LL : 'D MMMM [năm] YYYY', - LLL : 'D MMMM [năm] YYYY HH:mm', - LLLL : 'dddd, D MMMM [năm] YYYY HH:mm', - l : 'DD/M/YYYY', - ll : 'D MMM YYYY', - lll : 'D MMM YYYY HH:mm', - llll : 'ddd, D MMM YYYY HH:mm' + LL : 'D [de] MMMM [de] YYYY', + LLL : 'D [de] MMMM [de] YYYY HH:mm', + LLLL : 'dddd, D [de] MMMM [de] YYYY HH:mm' }, calendar : { - sameDay: '[Hôm nay lúc] LT', - nextDay: '[Ngày mai lúc] LT', - nextWeek: 'dddd [tuần tới lúc] LT', - lastDay: '[Hôm qua lúc] LT', - lastWeek: 'dddd [tuần rồi lúc] LT', + sameDay: '[Hoje às] LT', + nextDay: '[Amanhã às] LT', + nextWeek: 'dddd [às] LT', + lastDay: '[Ontem às] LT', + lastWeek: function () { + return (this.day() === 0 || this.day() === 6) ? + '[Último] dddd [às] LT' : // Saturday + Sunday + '[Última] dddd [às] LT'; // Monday - Friday + }, sameElse: 'L' }, relativeTime : { - future : '%s tới', - past : '%s trước', - s : 'vài giây', - ss : '%d giây' , - m : 'một phút', - mm : '%d phút', - h : 'một giờ', - hh : '%d giờ', - d : 'một ngày', - dd : '%d ngày', - M : 'một tháng', - MM : '%d tháng', - y : 'một năm', - yy : '%d năm' - }, - dayOfMonthOrdinalParse: /\d{1,2}/, - ordinal : function (number) { - return number; - }, - 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('x-pseudo', { - months : 'J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér'.split('_'), - monthsShort : 'J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc'.split('_'), - monthsParseExact : true, - weekdays : 'S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý'.split('_'), - weekdaysShort : 'S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát'.split('_'), - weekdaysMin : 'S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[T~ódá~ý át] LT', - nextDay : '[T~ómó~rró~w át] LT', - nextWeek : 'dddd [át] LT', - lastDay : '[Ý~ést~érdá~ý át] LT', - lastWeek : '[L~ást] dddd [át] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'í~ñ %s', - past : '%s á~gó', - s : 'á ~féw ~sécó~ñds', - ss : '%d s~écóñ~ds', - m : 'á ~míñ~úté', - mm : '%d m~íñú~tés', - h : 'á~ñ hó~úr', - hh : '%d h~óúrs', - d : 'á ~dáý', - dd : '%d d~áýs', - M : 'á ~móñ~th', - MM : '%d m~óñt~hs', - y : 'á ~ýéár', - yy : '%d ý~éárs' - }, - dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, - 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('yo', { - months : 'Sẹ́rẹ́_Èrèlè_Ẹrẹ̀nà_Ìgbé_Èbibi_Òkùdu_Agẹmo_Ògún_Owewe_Ọ̀wàrà_Bélú_Ọ̀pẹ̀̀'.split('_'), - monthsShort : 'Sẹ́r_Èrl_Ẹrn_Ìgb_Èbi_Òkù_Agẹ_Ògú_Owe_Ọ̀wà_Bél_Ọ̀pẹ̀̀'.split('_'), - weekdays : 'Àìkú_Ajé_Ìsẹ́gun_Ọjọ́rú_Ọjọ́bọ_Ẹtì_Àbámẹ́ta'.split('_'), - weekdaysShort : 'Àìk_Ajé_Ìsẹ́_Ọjr_Ọjb_Ẹtì_Àbá'.split('_'), - weekdaysMin : 'Àì_Aj_Ìs_Ọr_Ọb_Ẹt_Àb'.split('_'), - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[Ònì ni] LT', - nextDay : '[Ọ̀la ni] LT', - nextWeek : 'dddd [Ọsẹ̀ tón\'bọ] [ni] LT', - lastDay : '[Àna ni] LT', - lastWeek : 'dddd [Ọsẹ̀ tólọ́] [ni] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ní %s', - past : '%s kọjá', - s : 'ìsẹjú aayá die', - ss :'aayá %d', - m : 'ìsẹjú kan', - mm : 'ìsẹjú %d', - h : 'wákati kan', - hh : 'wákati %d', - d : 'ọjọ́ kan', - dd : 'ọjọ́ %d', - M : 'osù kan', - MM : 'osù %d', - y : 'ọdún kan', - yy : 'ọdún %d' - }, - dayOfMonthOrdinalParse : /ọjọ́\s\d{1,2}/, - ordinal : 'ọjọ́ %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('zh-cn', { - months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), - weekdaysShort : '周日_周一_周二_周三_周四_周五_周六'.split('_'), - weekdaysMin : '日_一_二_三_四_五_六'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY/MM/DD', - LL : 'YYYY年M月D日', - LLL : 'YYYY年M月D日Ah点mm分', - LLLL : 'YYYY年M月D日ddddAh点mm分', - l : 'YYYY/M/D', - ll : 'YYYY年M月D日', - lll : 'YYYY年M月D日 HH:mm', - llll : 'YYYY年M月D日dddd HH:mm' - }, - meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === '凌晨' || meridiem === '早上' || - meridiem === '上午') { - return hour; - } else if (meridiem === '下午' || meridiem === '晚上') { - return hour + 12; - } else { - // '中午' - return hour >= 11 ? hour : hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 600) { - return '凌晨'; - } else if (hm < 900) { - return '早上'; - } else if (hm < 1130) { - return '上午'; - } else if (hm < 1230) { - return '中午'; - } else if (hm < 1800) { - return '下午'; - } else { - return '晚上'; - } - }, - calendar : { - sameDay : '[今天]LT', - nextDay : '[明天]LT', - nextWeek : '[下]ddddLT', - lastDay : '[昨天]LT', - lastWeek : '[上]ddddLT', - sameElse : 'L' - }, - dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/, - ordinal : function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '日'; - case 'M': - return number + '月'; - case 'w': - case 'W': - return number + '周'; - default: - return number; - } - }, - relativeTime : { - future : '%s内', - past : '%s前', - s : '几秒', - ss : '%d 秒', - m : '1 分钟', - mm : '%d 分钟', - h : '1 小时', - hh : '%d 小时', - d : '1 天', - dd : '%d 天', - M : '1 个月', - MM : '%d 个月', - y : '1 年', - yy : '%d 年' + future : 'em %s', + past : 'há %s', + s : 'segundos', + ss : '%d segundos', + m : 'um minuto', + mm : '%d minutos', + h : 'uma hora', + hh : '%d horas', + d : 'um dia', + dd : '%d dias', + M : 'um mês', + MM : '%d meses', + y : 'um ano', + yy : '%d anos' }, + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal : '%dº', week : { - // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效 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('zh-hk', { - months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), - weekdaysShort : '週日_週一_週二_週三_週四_週五_週六'.split('_'), - weekdaysMin : '日_一_二_三_四_五_六'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY/MM/DD', - LL : 'YYYY年M月D日', - LLL : 'YYYY年M月D日 HH:mm', - LLLL : 'YYYY年M月D日dddd HH:mm', - l : 'YYYY/M/D', - ll : 'YYYY年M月D日', - lll : 'YYYY年M月D日 HH:mm', - llll : 'YYYY年M月D日dddd HH:mm' - }, - meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') { - return hour; - } else if (meridiem === '中午') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === '下午' || meridiem === '晚上') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 600) { - return '凌晨'; - } else if (hm < 900) { - return '早上'; - } else if (hm < 1130) { - return '上午'; - } else if (hm < 1230) { - return '中午'; - } else if (hm < 1800) { - return '下午'; - } else { - return '晚上'; - } - }, - calendar : { - sameDay : '[今天]LT', - nextDay : '[明天]LT', - nextWeek : '[下]ddddLT', - lastDay : '[昨天]LT', - lastWeek : '[上]ddddLT', - sameElse : 'L' - }, - dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/, - ordinal : function (number, period) { - switch (period) { - case 'd' : - case 'D' : - case 'DDD' : - return number + '日'; - case 'M' : - return number + '月'; - case 'w' : - case 'W' : - return number + '週'; - default : - return number; - } - }, - relativeTime : { - future : '%s內', - past : '%s前', - s : '幾秒', - ss : '%d 秒', - m : '1 分鐘', - mm : '%d 分鐘', - h : '1 小時', - hh : '%d 小時', - d : '1 天', - dd : '%d 天', - M : '1 個月', - MM : '%d 個月', - y : '1 年', - yy : '%d 年' - } - }); - - //! moment.js locale configuration - - hooks.defineLocale('zh-tw', { - months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), - weekdaysShort : '週日_週一_週二_週三_週四_週五_週六'.split('_'), - weekdaysMin : '日_一_二_三_四_五_六'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY/MM/DD', - LL : 'YYYY年M月D日', - LLL : 'YYYY年M月D日 HH:mm', - LLLL : 'YYYY年M月D日dddd HH:mm', - l : 'YYYY/M/D', - ll : 'YYYY年M月D日', - lll : 'YYYY年M月D日 HH:mm', - llll : 'YYYY年M月D日dddd HH:mm' - }, - meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') { - return hour; - } else if (meridiem === '中午') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === '下午' || meridiem === '晚上') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 600) { - return '凌晨'; - } else if (hm < 900) { - return '早上'; - } else if (hm < 1130) { - return '上午'; - } else if (hm < 1230) { - return '中午'; - } else if (hm < 1800) { - return '下午'; - } else { - return '晚上'; - } - }, - calendar : { - sameDay : '[今天] LT', - nextDay : '[明天] LT', - nextWeek : '[下]dddd LT', - lastDay : '[昨天] LT', - lastWeek : '[上]dddd LT', - sameElse : 'L' - }, - dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/, - ordinal : function (number, period) { - switch (period) { - case 'd' : - case 'D' : - case 'DDD' : - return number + '日'; - case 'M' : - return number + '月'; - case 'w' : - case 'W' : - return number + '週'; - default : - return number; - } - }, - relativeTime : { - future : '%s內', - past : '%s前', - s : '幾秒', - ss : '%d 秒', - m : '1 分鐘', - mm : '%d 分鐘', - h : '1 小時', - hh : '%d 小時', - d : '1 天', - dd : '%d 天', - M : '1 個月', - MM : '%d 個月', - y : '1 年', - yy : '%d 年' - } - }); - hooks.locale('en'); return hooks; diff --git a/min/moment-with-locales.min.js b/min/moment-with-locales.min.js index d81e02ca33..51ffe35640 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 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;sSe(e)?(r=e+1,o-Se(e)):(r=e,o),{year:r,dayOfYear:i}}function Ge(e,t,n){var s,a,r=Ue(e.year(),t,n),i=Math.floor((e.dayOfYear()-r-1)/7)+1;return i<1?s=i+Ve(a=e.year()-1,t,n):i>Ve(e.year(),t,n)?(s=i-Ve(e.year(),t,n),a=e.year()+1):(a=e.year(),s=i),{week:s,year:a}}function Ve(e,t,n){var s=Ue(e,t,n),a=Ue(e+1,t,n);return(Se(e)-s+a)/7}G("w",["ww",2],"wo","week"),G("W",["WW",2],"Wo","isoWeek"),H("week","w"),H("isoWeek","W"),j("week",5),j("isoWeek",5),de("w",q),de("ww",q,z),de("W",q),de("WW",q,z),ce(["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))}G("d",0,"do","day"),G("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),G("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),G("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),G("e",0,0,"weekday"),G("E",0,0,"isoWeekday"),H("day","d"),H("weekday","e"),H("isoWeekday","E"),j("day",11),j("weekday",11),j("isoWeekday",11),de("d",q),de("e",q),de("E",q),de("dd",function(e,t){return t.weekdaysMinRegex(e)}),de("ddd",function(e,t){return t.weekdaysShortRegex(e)}),de("dddd",function(e,t){return t.weekdaysRegex(e)}),ce(["dd","ddd","dddd"],function(e,t,n,s){var a=n._locale.weekdaysParse(e,s,n._strict);null!=a?t.d=a:m(n).invalidWeekday=e}),ce(["d","e","E"],function(e,t,n,s){t[s]=D(e)});var Ie="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 Qe=ie;var $e=ie;var qe=ie;function Be(){function e(e,t){return t.length-e.length}var t,n,s,a,r,i=[],o=[],d=[],u=[];for(t=0;t<7;t++)n=l([2e3,1]).day(t),s=this.weekdaysMin(n,""),a=this.weekdaysShort(n,""),r=this.weekdays(n,""),i.push(s),o.push(a),d.push(r),u.push(s),u.push(a),u.push(r);for(i.sort(e),o.sort(e),d.sort(e),u.sort(e),t=0;t<7;t++)o[t]=he(o[t]),d[t]=he(d[t]),u[t]=he(u[t]);this._weekdaysRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+d.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+i.join("|")+")","i")}function Xe(){return this.hours()%12||12}function Ke(e,t){G(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function et(e,t){return t._meridiemParse}G("H",["HH",2],0,"hour"),G("h",["hh",2],0,Xe),G("k",["kk",2],0,function(){return this.hours()||24}),G("hmm",0,0,function(){return""+Xe.apply(this)+R(this.minutes(),2)}),G("hmmss",0,0,function(){return""+Xe.apply(this)+R(this.minutes(),2)+R(this.seconds(),2)}),G("Hmm",0,0,function(){return""+this.hours()+R(this.minutes(),2)}),G("Hmmss",0,0,function(){return""+this.hours()+R(this.minutes(),2)+R(this.seconds(),2)}),Ke("a",!0),Ke("A",!1),H("hour","h"),j("hour",13),de("a",et),de("A",et),de("H",q),de("h",q),de("k",q),de("HH",q,z),de("hh",q,z),de("kk",q,z),de("hmm",B),de("hmmss",X),de("Hmm",B),de("Hmmss",X),_e(["H","HH"],Me),_e(["k","kk"],function(e,t,n){var s=D(e);t[Me]=24===s?0:s}),_e(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),_e(["h","hh"],function(e,t,n){t[Me]=D(e),m(n).bigHour=!0}),_e("hmm",function(e,t,n){var s=e.length-2;t[Me]=D(e.substr(0,s)),t[ge]=D(e.substr(s)),m(n).bigHour=!0}),_e("hmmss",function(e,t,n){var s=e.length-4,a=e.length-2;t[Me]=D(e.substr(0,s)),t[ge]=D(e.substr(s,2)),t[Ye]=D(e.substr(a)),m(n).bigHour=!0}),_e("Hmm",function(e,t,n){var s=e.length-2;t[Me]=D(e.substr(0,s)),t[ge]=D(e.substr(s))}),_e("Hmmss",function(e,t,n){var s=e.length-4,a=e.length-2;t[Me]=D(e.substr(0,s)),t[ge]=D(e.substr(s,2)),t[Ye]=D(e.substr(a))});var tt,nt=Le("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:He,monthsShort:Pe,week:{dow:0,doy:6},weekdays:Ie,weekdaysMin:Ze,weekdaysShort:ze,meridiemParse:/[ap]\.?m?\.?/i},at={},rt={};function it(e){return e?e.toLowerCase().replace("_","-"):e}function ot(e){var t=null;if(!at[e]&&"undefined"!=typeof module&&module&&module.exports)try{t=tt._abbr,require("./locale/"+e),dt(t)}catch(e){}return at[e]}function dt(e,t){var n;return e&&((n=r(t)?ht(e):ut(e,t))?tt=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),tt._abbr}function ut(e,t){if(null===t)return delete at[e],null;var n,s=st;if(t.abbr=e,null!=at[e])L("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=at[e]._config;else if(null!=t.parentLocale)if(null!=at[t.parentLocale])s=at[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 at[e]=new x(O(s,t)),rt[e]&&rt[e].forEach(function(e){ut(e.name,e.config)}),dt(e),at[e]}function ht(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return tt;if(!i(e)){if(t=ot(e))return t;e=[e]}return function(e){for(var t,n,s,a,r=0;r=t&&S(a,n,!0)>=t-1)break;t--}r++}return tt}(e)}function lt(e){var t,n=e._a;return n&&-2===m(e).overflow&&(t=n[fe]<0||11xe(n[me],n[fe])?ye:n[Me]<0||24Ve(n,r,i)?m(e)._overflowWeeks=!0:null!=d?m(e)._overflowWeekday=!0:(o=Ee(n,s,a,r,i),e._a[me]=o.year,e._dayOfYear=o.dayOfYear)}(e),null!=e._dayOfYear&&(r=_t(e._a[me],s[me]),(e._dayOfYear>Se(r)||0===e._dayOfYear)&&(m(e)._overflowDayOfYear=!0),n=Ne(r,0,e._dayOfYear),e._a[fe]=n.getUTCMonth(),e._a[ye]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=i[t]=s[t];for(;t<7;t++)e._a[t]=i[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[Me]&&0===e._a[ge]&&0===e._a[Ye]&&0===e._a[pe]&&(e._nextDay=!0,e._a[Me]=0),e._d=(e._useUTC?Ne:function(e,t,n,s,a,r,i){var o;return e<100&&0<=e?(o=new Date(e+400,t,n,s,a,r,i),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,n,s,a,r,i),o}).apply(null,i),a=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Me]=24),e._w&&void 0!==e._w.d&&e._w.d!==a&&(m(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)?)?$/,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)?)?$/,yt=/Z|[+-]\d\d(?::?\d\d)?/,Mt=[["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/]],Yt=/^\/?Date\((\-?\d+)/i;function pt(e){var t,n,s,a,r,i,o=e._i,d=mt.exec(o)||ft.exec(o);if(d){for(m(e).iso=!0,t=0,n=Mt.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.",dn),mn.months=n("months accessor is deprecated. Use month instead",Ae),mn.years=n("years accessor is deprecated. Use year instead",Te),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(!r(this._isDSTShifted))return this._isDSTShifted;var e={};if(g(e,this),(e=Tt(e))._a){var t=e._isUTC?l(e._a):bt(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>>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)]=k(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:m(n).invalidWeekday=e}),fe(["d","e","E"],function(e,t,n,s){t[s]=k(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=d([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=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),m(n).bigHour=!0}),ce("hmm",function(e,t,n){var s=e.length-2;t[ge]=k(e.substr(0,s)),t[ve]=k(e.substr(s)),m(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[ve]=k(e.substr(s,2)),t[pe]=k(e.substr(i)),m(n).bigHour=!0}),ce("Hmm",function(e,t,n){var s=e.length-2;t[ge]=k(e.substr(0,s)),t[ve]=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[ve]=k(e.substr(s,2)),t[pe]=k(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=r(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(!a(e)){if(t=ot(e))return t;e=[e]}return function(e){for(var t,n,s,i,r=0;r=t&&S(i,n,!0)>=t-1)break;t--}r++}return tt}(e)}function dt(e){var t,n=e._a;return n&&-2===m(e).overflow&&(t=n[_e]<0||11Pe(n[me],n[_e])?ye:n[ge]<0||24Ae(n,r,a)?m(e)._overflowWeeks=!0:null!=u?m(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)&&(m(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&&(m(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(m(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(!r(this._isDSTShifted))return this._isDSTShifted;var e={};if(v(e,this),(e=Ot(e))._a){var t=e._isUTC?d(e._a):bt(e._a);this._isDSTShifted=this.isValid()&&0 ' + a[i][1]); - } - }); + 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'); - 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'); + assert.equal(moment([2011, 0, 31]).format('DDDo'), '31st', '31st'); }); test('format month', function (assert) { - var expected = 'جانفي جانفي_فيفري فيفري_مارس مارس_أفريل أفريل_ماي ماي_جوان جوان_جويلية جويلية_أوت أوت_سبتمبر سبتمبر_أكتوبر أكتوبر_نوفمبر نوفمبر_ديسمبر ديسمبر'.split('_'), i; + 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 expected = 'الأحد احد أح_الإثنين اثنين إث_الثلاثاء ثلاثاء ثلا_الأربعاء اربعاء أر_الخميس خميس خم_الجمعة جمعة جم_السبت سبت سب'.split('_'), i; + 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]); } @@ -881,82 +387,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), '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: 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), '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), 'في ثوان', 'prefix'); - assert.equal(moment(0).from(30000), 'منذ ثوان', 'suffix'); + 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(), 'منذ ثوان', '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(), 'في ثوان', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'في 5 أيام', 'in 5 days'); + 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(), 'اليوم على الساعة 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 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 [على الساعة] 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 [على الساعة] 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 [على الساعة] LT'), 'Today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('dddd [at] 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('[Last] dddd [at] 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('[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('dddd [على الساعة] LT'), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days end of day'); } }); @@ -975,58206 +482,39 @@ }); test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2016, 1, 4]).format('w ww wo'), '5 05 5', 'Feb 4 2016 should be week 5'); - assert.equal(moment([2016, 0, 6]).format('w ww wo'), '1 01 1', 'Jan 6 2016 should be week 1'); - assert.equal(moment([2016, 0, 7]).format('w ww wo'), '1 01 1', 'Jan 7 2016 should be week 1'); - assert.equal(moment([2016, 0, 13]).format('w ww wo'), '2 02 2', 'Jan 13 2016 should be week 2'); - assert.equal(moment([2016, 0, 14]).format('w ww wo'), '2 02 2', 'Jan 14 2016 should be week 2'); + 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'); }); -}))); - - -;(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('ar-kw'); - - test('parse', function (assert) { - 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); - 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', 'الأحد, فبراير 14 2010, 3:25:50 pm'], - ['ddd, hA', 'احد, 3PM'], - ['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', '9 9 09'], - ['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'], - ['LT', '15:25'], - ['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; - 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 = 'يناير يناير_فبراير فبراير_مارس مارس_أبريل أبريل_ماي ماي_يونيو يونيو_يوليوز يوليوز_غشت غشت_شتنبر شتنبر_أكتوبر أكتوبر_نونبر نونبر_دجنبر دجنبر'.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; - 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), 'ثوان', '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), '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: 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), 'في ثوان', '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'); - }); - - 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'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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([2011, 11, 31]).format('w ww wo'), '1 01 1', 'Dec 31 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '2 02 2', 'Jan 1 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '3 03 3', 'Jan 8 2012 should be week 3'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '3 03 3', 'Jan 14 2012 should be week 3'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '4 04 4', 'Jan 15 2012 should be week 4'); - }); - -}))); - - -;(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('ar-ly'); - - var months = [ - 'يناير', - 'فبراير', - 'مارس', - 'أبريل', - 'مايو', - 'يونيو', - 'يوليو', - 'أغسطس', - 'سبتمبر', - 'أكتوبر', - 'نوفمبر', - 'ديسمبر' - ]; - - test('parse', function (assert) { - var tests = months, 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()); - } - for (i = 0; i < 12; i++) { - equalTest(tests[i], 'MMM', i); - equalTest(tests[i], 'MMM', i); - equalTest(tests[i], 'MMMM', i); - equalTest(tests[i], 'MMMM', i); - equalTest(tests[i].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'الأحد، فبراير 14 2010، 3:25:50 م'], - ['ddd, hA', 'أحد، 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'], - ['LT', '15:25'], - ['LTS', '15:25:50'], - ['L', '14/\u200f2/\u200f2010'], - ['LL', '14 فبراير 2010'], - ['LLL', '14 فبراير 2010 15:25'], - ['LLLL', 'الأحد 14 فبراير 2010 15:25'], - ['l', '14/\u200f2/\u200f2010'], - ['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; - 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 = months, i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM'), expected[i], expected[i]); - assert.equal(moment([2011, i, 1]).format('MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - 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]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), '44 ثانية', '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 دقيقة', '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({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), 'بعد 30 ثانية', 'prefix'); - assert.equal(moment(0).from(30000), 'منذ 30 ثانية', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'منذ ثانية واحدة', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'بعد 30 ثانية', 'in a few 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(), 'اليوم عند الساعة 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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 wednesday custom', function (assert) { - assert.equal(moment('2003 1 6', 'gggg w d').format('YYYY-MM-DD'), '2002-12-28', 'Week 1 of 2003 should be Dec 28 2002'); - assert.equal(moment('2003 1 0', 'gggg w e').format('YYYY-MM-DD'), '2002-12-28', 'Week 1 of 2003 should be Dec 28 2002'); - assert.equal(moment('2003 1 6', 'gggg w d').format('gggg w d'), '2003 1 6', 'Saturday of week 1 of 2003 parsed should be formatted as 2003 1 6'); - assert.equal(moment('2003 1 0', 'gggg w e').format('gggg w e'), '2003 1 0', '1st day of week 1 of 2003 parsed should be formatted as 2003 1 0'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 31]).format('w ww wo'), '1 01 1', 'Dec 31 2011 should be week 1'); - assert.equal(moment([2012, 0, 6]).format('w ww wo'), '1 01 1', 'Jan 6 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '2 02 2', 'Jan 7 2012 should be week 2'); - assert.equal(moment([2012, 0, 13]).format('w ww wo'), '2 02 2', 'Jan 13 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '3 03 3', 'Jan 14 2012 should be week 3'); - }); - - test('no leading zeros in long date formats', function (assert) { - var i, j, longDateStr, shortDateStr; - for (i = 1; i <= 9; ++i) { - for (j = 1; j <= 9; ++j) { - longDateStr = moment([2014, i, j]).format('L'); - shortDateStr = moment([2014, i, j]).format('l'); - assert.equal(longDateStr, shortDateStr, 'should not have leading zeros in month or day'); - } - } - }); - - // locale-specific - test('ar-ly strict mode parsing works', function (assert) { - var m, formattedDate; - m = moment().locale('ar-ly'); - formattedDate = m.format('l'); - assert.equal(moment.utc(formattedDate, 'l', 'ar-ly', false).isValid(), true, 'Non-strict parsing works'); - assert.equal(moment.utc(formattedDate, 'l', 'ar-ly', true).isValid(), true,'Strict parsing must work'); - }); - -}))); - - -;(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('ar-ma'); - - test('parse', function (assert) { - 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); - 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', 'الأحد, فبراير 14 2010, 3:25:50 pm'], - ['ddd, hA', 'احد, 3PM'], - ['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', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45 day of the year'], - ['LT', '15:25'], - ['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; - 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 = 'يناير يناير_فبراير فبراير_مارس مارس_أبريل أبريل_ماي ماي_يونيو يونيو_يوليوز يوليوز_غشت غشت_شتنبر شتنبر_أكتوبر أكتوبر_نونبر نونبر_دجنبر دجنبر'.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; - 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), 'ثوان', '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), '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: 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), 'في ثوان', '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'); - }); - - 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'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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([2011, 11, 31]).format('w ww wo'), '1 01 1', 'Dec 31 2011 should be week 1'); - assert.equal(moment([2012, 0, 6]).format('w ww wo'), '1 01 1', 'Jan 6 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '2 02 2', 'Jan 7 2012 should be week 2'); - assert.equal(moment([2012, 0, 13]).format('w ww wo'), '2 02 2', 'Jan 13 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '3 03 3', 'Jan 14 2012 should be week 3'); - }); - -}))); - - -;(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('ar-sa'); - - test('parse', function (assert) { - var tests = 'يناير:يناير_فبراير:فبراير_مارس:مارس_أبريل:أبريل_مايو:مايو_يونيو:يونيو_يوليو:يوليو_أغسطس:أغسطس_سبتمبر:سبتمبر_أكتوبر:أكتوبر_نوفمبر:نوفمبر_ديسمبر:ديسمبر'.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()); - } - 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', 'الأحد، فبراير ١٤ ٢٠١٠، ٣:٢٥:٥٠ م'], - ['ddd, hA', 'أحد، ٣م'], - ['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', 'م م'], - ['[the] DDDo [day of the year]', 'the ٤٥ day of the year'], - ['LT', '١٥:٢٥'], - ['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'); - 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'); - 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'); - 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'); - }); - - test('format month', function (assert) { - 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; - 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), 'ثوان', '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'); - }); - - test('now from now', function (assert) { - 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(), 'في ٥ أيام', '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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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 wednesday custom', function (assert) { - assert.equal(moment('2003 1 6', 'gggg w d').format('YYYY-MM-DD'), '٢٠٠٣-٠١-٠٤', '2003 1 6 : gggg w d'); - assert.equal(moment('2003 1 0', 'gggg w e').format('YYYY-MM-DD'), '٢٠٠٢-١٢-٢٩', '2003 1 0 : gggg w e'); - assert.equal(moment('2003 1 6', 'gggg w d').format('gggg w d'), '٢٠٠٣ ١ ٦', '2003 1 6 : gggg w d'); - assert.equal(moment('2003 1 0', 'gggg w e').format('gggg w e'), '٢٠٠٣ ١ ٠', '2003 1 0 : gggg w e'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 31]).format('w ww wo'), '٥٣ ٥٣ ٥٣', '2011 11 31'); - assert.equal(moment([2012, 0, 6]).format('w ww wo'), '١ ٠١ ١', '2012 0 6'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '١ ٠١ ١', '2012 0 7'); - assert.equal(moment([2012, 0, 13]).format('w ww wo'), '٢ ٠٢ ٢', '2012 0 13'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '٢ ٠٢ ٢', '2012 0 14'); - }); - -}))); - - -;(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('ar-tn'); - - test('parse', function (assert) { - 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); - 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', 'الأحد, فيفري 14 2010, 3:25:50 pm'], - ['ddd, hA', 'أحد, 3PM'], - ['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', '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'], - ['LT', '15:25'], - ['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; - 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 = 'جانفي جانفي_فيفري فيفري_مارس مارس_أفريل أفريل_ماي ماي_جوان جوان_جويلية جويلية_أوت أوت_سبتمبر سبتمبر_أكتوبر أكتوبر_نوفمبر نوفمبر_ديسمبر ديسمبر'.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; - 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), 'ثوان', '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), '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: 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), 'في ثوان', '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'); - }); - - 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'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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 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; - } - 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('ar'); - - var months = [ - 'يناير', - 'فبراير', - 'مارس', - 'أبريل', - 'مايو', - 'يونيو', - 'يوليو', - 'أغسطس', - 'سبتمبر', - 'أكتوبر', - 'نوفمبر', - 'ديسمبر' - ]; - - test('parse', function (assert) { - var tests = months, 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()); - } - for (i = 0; i < 12; i++) { - equalTest(tests[i], 'MMM', i); - equalTest(tests[i], 'MMM', i); - equalTest(tests[i], 'MMMM', i); - equalTest(tests[i], 'MMMM', i); - equalTest(tests[i].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'الأحد، فبراير ١٤ ٢٠١٠، ٣:٢٥:٥٠ م'], - ['ddd, hA', 'أحد، ٣م'], - ['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', 'م م'], - ['[the] DDDo [day of the year]', 'the ٤٥ day of the year'], - ['LT', '١٥:٢٥'], - ['LTS', '١٥:٢٥:٥٠'], - ['L', '١٤/\u200f٢/\u200f٢٠١٠'], - ['LL', '١٤ فبراير ٢٠١٠'], - ['LLL', '١٤ فبراير ٢٠١٠ ١٥:٢٥'], - ['LLLL', 'الأحد ١٤ فبراير ٢٠١٠ ١٥:٢٥'], - ['l', '١٤/\u200f٢/\u200f٢٠١٠'], - ['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'); - 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'); - 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'); - 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'); - }); - - test('format month', function (assert) { - var expected = months, i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM'), expected[i], expected[i]); - assert.equal(moment([2011, i, 1]).format('MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - 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]); - } - }); - - 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'); - }); - - test('suffix', function (assert) { - 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'); - }); - - 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'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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 wednesday custom', function (assert) { - assert.equal(moment('2003 1 6', 'gggg w d').format('YYYY-MM-DD'), '٢٠٠٢-١٢-٢٨', 'Week 1 of 2003 should be Dec 28 2002'); - assert.equal(moment('2003 1 0', 'gggg w e').format('YYYY-MM-DD'), '٢٠٠٢-١٢-٢٨', 'Week 1 of 2003 should be Dec 28 2002'); - assert.equal(moment('2003 1 6', 'gggg w d').format('gggg w d'), '٢٠٠٣ ١ ٦', 'Saturday of week 1 of 2003 parsed should be formatted as 2003 1 6'); - assert.equal(moment('2003 1 0', 'gggg w e').format('gggg w e'), '٢٠٠٣ ١ ٠', '1st day of week 1 of 2003 parsed should be formatted as 2003 1 0'); - }); - - 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'); - }); - - test('no leading zeros in long date formats', function (assert) { - var i, j, longDateStr, shortDateStr; - for (i = 1; i <= 9; ++i) { - for (j = 1; j <= 9; ++j) { - longDateStr = moment([2014, i, j]).format('L'); - shortDateStr = moment([2014, i, j]).format('l'); - assert.equal(longDateStr, shortDateStr, 'should not have leading zeros in month or day'); - } - } - }); - - // locale-specific - test('ar strict mode parsing works', function (assert) { - var m, formattedDate; - m = moment().locale('ar'); - formattedDate = m.format('l'); - assert.equal(moment.utc(formattedDate, 'l', 'ar', false).isValid(), true, 'Non-strict parsing works'); - assert.equal(moment.utc(formattedDate, 'l', 'ar', true).isValid(), true,'Strict parsing must work'); - }); - -}))); - - -;(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('az'); - - test('parse', function (assert) { - var tests = 'yanvar yan_fevral fev_mart mar_Aprel apr_may may_iyun iyn_iyul iyl_Avqust avq_sentyabr sen_oktyabr okt_noyabr noy_dekabr dek'.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, D MMMM YYYY, HH:mm:ss', 'Bazar, 14 fevral 2010, 15:25:50'], - ['ddd, A h', 'Baz, gündüz 3'], - ['M Mo MM MMMM MMM', '2 2-nci 02 fevral fev'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14-üncü 14'], - ['d do dddd ddd dd', '0 0-ıncı Bazar Baz Bz'], - ['DDD DDDo DDDD', '45 45-inci 045'], - ['w wo ww', '7 7-nci 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'gündüz gündüz'], - ['[ilin] DDDo [günü]', 'ilin 45-inci günü'], - ['LT', '15:25'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 fevral 2010'], - ['LLL', '14 fevral 2010 15:25'], - ['LLLL', 'Bazar, 14 fevral 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14 fev 2010'], - ['lll', '14 fev 2010 15:25'], - ['llll', 'Baz, 14 fev 2010 15:25'] - ], - DDDo = [ - [359, '360-ıncı'], - [199, '200-üncü'], - [149, '150-nci'] - ], - dt = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - DDDoDt, - i; - - for (i = 0; i < a.length; i++) { - assert.equal(dt.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - for (i = 0; i < DDDo.length; i++) { - DDDoDt = moment([2010]); - assert.equal(DDDoDt.add(DDDo[i][0], 'days').format('DDDo'), DDDo[i][1], DDDo[i][0] + ' ---> ' + DDDo[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1-inci', '1st'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2-nci', '2nd'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3-üncü', '3rd'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4-üncü', '4th'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5-inci', '5th'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6-ncı', '6th'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7-nci', '7th'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8-inci', '8th'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9-uncu', '9th'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10-uncu', '10th'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11-inci', '11th'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12-nci', '12th'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13-üncü', '13th'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14-üncü', '14th'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15-inci', '15th'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16-ncı', '16th'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17-nci', '17th'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18-inci', '18th'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19-uncu', '19th'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20-nci', '20th'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21-inci', '21th'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22-nci', '22th'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23-üncü', '23th'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24-üncü', '24th'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25-inci', '25th'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26-ncı', '26th'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27-nci', '27th'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28-inci', '28th'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29-uncu', '29th'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30-uncu', '30th'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31-inci', '31st'); - }); - - test('format month', function (assert) { - var expected = 'yanvar yan_fevral fev_mart mar_aprel apr_may may_iyun iyn_iyul iyl_avqust avq_sentyabr sen_oktyabr okt_noyabr noy_dekabr dek'.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 = 'Bazar Baz Bz_Bazar ertəsi BzE BE_Çərşənbə axşamı ÇAx ÇA_Çərşənbə Çər Çə_Cümə axşamı CAx CA_Cümə Cüm Cü_Şənbə Şən Şə'.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), 'birneçə saniyə', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'bir dəqiqə', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'bir dəqiqə', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 dəqiqə', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 dəqiqə', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'bir saat', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'bir saat', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 saat', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 saat', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 saat', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'bir gün', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'bir gün', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 gün', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'bir gün', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 gün', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 gün', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'bir ay', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'bir ay', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 ay', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 ay', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 ay', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'bir ay', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 ay', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'bir il', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 il', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'bir il', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 il', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'birneçə saniyə sonra', 'prefix'); - assert.equal(moment(0).from(30000), 'birneçə saniyə əvvəl', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'birneçə saniyə əvvəl', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'birneçə saniyə sonra', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5 gün sonra', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'bugün saat 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'bugün saat 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'bugün saat 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'sabah saat 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'bugün saat 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'dünən 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('[gələn həftə] dddd [saat] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[gələn həftə] dddd [saat] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[gələn həftə] dddd [saat] 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('[keçən həftə] dddd [saat] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[keçən həftə] dddd [saat] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[keçən həftə] dddd [saat] 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([2011, 11, 26]).format('w ww wo'), '1 01 1-inci', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1-inci', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2-nci', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2-nci', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3-üncü', 'Jan 9 2012 should be week 3'); - }); - -}))); - - -;(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('be'); - - test('parse', function (assert) { - 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); - 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, 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-ы нядзеля нд нд'], - ['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-ы дзень года'], - ['LT', '15:25'], - ['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; - 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 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; - 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 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 week', function (assert) { - 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]); - } - }); - - 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: 31}), true), '31 хвіліна', '31 minutes = 31 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), 'праз некалькі секунд', 'prefix'); - assert.equal(moment(0).from(30000), 'некалькі секунд таму', 'suffix'); - }); - - 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({m: 31}).fromNow(), 'праз 31 хвіліну', 'in 31 minutes = in 31 minutes'); - assert.equal(moment().subtract({m: 31}).fromNow(), '31 хвіліну таму', '31 minutes ago = 31 minutes ago'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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(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: - case 5: - case 6: - return '[У мінулую] dddd [ў] LT'; - case 1: - case 2: - case 4: - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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(makeFormat(m)), '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([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'); - }); - - test('calendar should format', function (assert) { - assert.equal(moment('2018-04-13').calendar(moment('2018-04-16')), 'У мінулую пятніцу ў 00:00', 'calendar should handle day of week'); - }); - -}))); - - -;(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('bg'); - - test('parse', function (assert) { - 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); - 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', 'неделя, февруари 14-ти 2010, 15:25:50'], - ['ddd, hA', 'нед, 3PM'], - ['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', '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'], - ['LT', '15:25'], - ['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; - 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 = 'януари янр_февруари фев_март мар_април апр_май май_юни юни_юли юли_август авг_септември сеп_октомври окт_ноември ное_декември дек'.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; - 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), 'няколко секунди', '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), '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: 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), 'след няколко секунди', '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'); - }); - - 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'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - function makeFormat(d) { - switch (d.day()) { - case 0: - case 3: - case 6: - return '[В изминалата] dddd [в] LT'; - case 1: - case 2: - case 4: - case 5: - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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(makeFormat(m)), '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([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'); - }); - -}))); - - -;(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('bm'); - - test('parse', function (assert) { - var i, - tests = 'Zanwuyekalo Zan_Fewuruyekalo Few_Marisikalo Mar_Awirilikalo Awi_Mɛkalo Mɛ_Zuwɛnkalo Zuw_Zuluyekalo Zul_Utikalo Uti_Sɛtanburukalo Sɛt_ɔkutɔburukalo ɔku_Nowanburukalo Now_Desanburukalo Des'.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); - 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', 'Kari, Fewuruyekalo 14 2010, 3:25:50 pm'], - ['ddd, hA', 'Kar, 3PM'], - ['M Mo MM MMMM MMM', '2 2 02 Fewuruyekalo Few'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 Kari Kar Ka'], - ['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'], - ['[le] Do [jour du mois]', 'le 14 jour du mois'], - ['[le] DDDo [jour de l’année]', 'le 45 jour de l’année'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', 'Fewuruyekalo tile 14 san 2010'], - ['LLL', 'Fewuruyekalo tile 14 san 2010 lɛrɛ 15:25'], - ['LLLL', 'Kari Fewuruyekalo tile 14 san 2010 lɛrɛ 15:25'], - ['l', '14/2/2010'], - ['ll', 'Few tile 14 san 2010'], - ['lll', 'Few tile 14 san 2010 lɛrɛ 15:25'], - ['llll', 'Kar Few tile 14 san 2010 lɛrɛ 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 month', function (assert) { - var i, - expected = 'Zanwuyekalo Zan_Fewuruyekalo Few_Marisikalo Mar_Awirilikalo Awi_Mɛkalo Mɛ_Zuwɛnkalo Zuw_Zuluyekalo Zul_Utikalo Uti_Sɛtanburukalo Sɛt_ɔkutɔburukalo ɔku_Nowanburukalo Now_Desanburukalo Des'.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 i, - expected = 'Kari Kar Ka_Ntɛnɛn Ntɛ Nt_Tarata Tar Ta_Araba Ara Ar_Alamisa Ala Al_Juma Jum Ju_Sibiri Sib Si'.split('_'); - - 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), 'sanga dama dama', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'miniti kelen', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'miniti kelen', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), 'miniti 2', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), 'miniti 44', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'lɛrɛ kelen', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'lɛrɛ kelen', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), 'lɛrɛ 2', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), 'lɛrɛ 5', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), 'lɛrɛ 21', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'tile kelen', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'tile kelen', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), 'tile 2', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'tile kelen', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), 'tile 5', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), 'tile 25', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'kalo kelen', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'kalo kelen', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'kalo kelen', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), 'kalo 2', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), 'kalo 2', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), 'kalo 3', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'kalo kelen', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), 'kalo 5', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'san kelen', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), 'san 2', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'san kelen', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), 'san 5', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'sanga dama dama kɔnɔ', 'prefix'); - assert.equal(moment(0).from(30000), 'a bɛ sanga dama dama bɔ', 'suffix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'sanga dama dama kɔnɔ', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'tile 5 kɔnɔ', 'in 5 days'); - }); - - test('same day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Bi lɛrɛ 12:00', 'Today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Bi lɛrɛ 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Bi lɛrɛ 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Sini lɛrɛ 12:00', 'Tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Bi lɛrɛ 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kunu lɛrɛ 12:00', 'Yesterday at the same time'); - }); - - 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 [don lɛrɛ] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [don lɛrɛ] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [don lɛrɛ] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - 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('dddd [tɛmɛnen lɛrɛ] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [tɛmɛnen lɛrɛ] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [tɛmɛnen lɛrɛ] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - 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'); - - 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 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; - } - 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('bn'); - - test('parse', function (assert) { - 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); - 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, 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', 'দুপুর দুপুর'], - ['LT', 'দুপুর ৩:২৫ সময়'], - ['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'), '১', '১'); - 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; - 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; - 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), 'কয়েক সেকেন্ড', '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: 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'); - }); - - test('now from now', function (assert) { - 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(), '৫ দিন পরে', '৫ দিন পরে'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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('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'); - }); - -}))); - - -;(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('bo'); - - test('parse', function (assert) { - 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); - 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, 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', 'ཉིན་གུང ཉིན་གུང'], - ['LT', 'ཉིན་གུང ༣:༢༥'], - ['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'), '༡', '༡'); - 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; - 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; - 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), 'ལམ་སང', '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'); - }); - - test('now from now', function (assert) { - 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(), '༥ ཉིན་ ལ་', '༥ ཉིན་ ལ་'); - }); - - 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'); - }); - - 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('[བདུན་ཕྲག་རྗེས་མ][,] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[བདུན་ཕྲག་རྗེས་མ][,] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[བདུན་ཕྲག་རྗེས་མ][,] 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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('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'); - }); - -}))); - - -;(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('br'); - - test('parse', function (assert) { - var tests = 'Genver Gen_C\'hwevrer C\'hwe_Meurzh Meu_Ebrel Ebr_Mae Mae_Mezheven Eve_Gouere Gou_Eost Eos_Gwengolo Gwe_Here Her_Du Du_Kerzu Ker'.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) { - moment.locale('br'); - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Sul, C\'hwevrer 14vet 2010, 3:25:50 pm'], - ['ddd, h A', 'Sul, 3 PM'], - ['M Mo MM MMMM MMM', '2 2vet 02 C\'hwevrer C\'hwe'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14vet 14'], - ['d do dddd ddd dd', '0 0vet Sul Sul Su'], - ['DDD DDDo DDDD', '45 45vet 045'], - ['w wo ww', '6 6vet 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['DDDo [devezh] [ar] [vloaz]', '45vet devezh ar vloaz'], - ['L', '14/02/2010'], - ['LL', '14 a viz C\'hwevrer 2010'], - ['LLL', '14 a viz C\'hwevrer 2010 3e25 PM'], - ['LLLL', 'Sul, 14 a viz C\'hwevrer 2010 3e25 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) { - moment.locale('br'); - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1añ', '1añ'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2vet', '2vet'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3vet', '3vet'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4vet', '4vet'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5vet', '5vet'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6vet', '6vet'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7vet', '7vet'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8vet', '8vet'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9vet', '9vet'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10vet', '10vet'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11vet', '11vet'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12vet', '12vet'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13vet', '13vet'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14vet', '14vet'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15vet', '15vet'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16vet', '16vet'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17vet', '17vet'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18vet', '18vet'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19vet', '19vet'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20vet', '20vet'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21vet', '21vet'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22vet', '22vet'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23vet', '23vet'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24vet', '24vet'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25vet', '25vet'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26vet', '26vet'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27vet', '27vet'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28vet', '28vet'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29vet', '29vet'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30vet', '30vet'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31vet', '31vet'); - }); - - test('format month', function (assert) { - moment.locale('br'); - var expected = 'Genver Gen_C\'hwevrer C\'hwe_Meurzh Meu_Ebrel Ebr_Mae Mae_Mezheven Eve_Gouere Gou_Eost Eos_Gwengolo Gwe_Here Her_Du Du_Kerzu Ker'.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) { - moment.locale('br'); - var expected = 'Sul Sul Su_Lun Lun Lu_Meurzh Meu Me_Merc\'her Mer Mer_Yaou Yao Ya_Gwener Gwe Gw_Sadorn Sad 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]); - } - }); - - test('from', function (assert) { - moment.locale('br'); - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'un nebeud segondennoù', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ur vunutenn', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ur vunutenn', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 vunutenn', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 munutenn', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'un eur', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'un eur', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 eur', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 eur', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 eur', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'un devezh', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'un devezh', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 zevezh', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'un devezh', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 devezh', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 devezh', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ur miz', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ur miz', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ur miz', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 viz', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 viz', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 miz', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ur miz', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 miz', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ur bloaz', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 vloaz', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ur bloaz', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 bloaz', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - moment.locale('br'); - assert.equal(moment(30000).from(0), 'a-benn un nebeud segondennoù', 'prefix'); - assert.equal(moment(0).from(30000), 'un nebeud segondennoù \'zo', 'suffix'); - }); - - test('now from now', function (assert) { - moment.locale('br'); - assert.equal(moment().fromNow(), 'un nebeud segondennoù \'zo', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - moment.locale('br'); - assert.equal(moment().add({s: 30}).fromNow(), 'a-benn un nebeud segondennoù', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'a-benn 5 devezh', 'in 5 days'); - }); - - test('calendar day', function (assert) { - moment.locale('br'); - - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Hiziv da 12e00 PM', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Hiziv da 12e25 PM', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Hiziv da 1e00 PM', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Warc\'hoazh da 12e00 PM', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hiziv da 11e00 AM', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Dec\'h da 12e00 PM', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - moment.locale('br'); - - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [da] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [da] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [da] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - moment.locale('br'); - - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [paset da] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [paset da] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [paset da] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - moment.locale('br'); - 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('special mutations for years', function (assert) { - moment.locale('br'); - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ur bloaz', 'mutation 1 year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 2}), true), '2 vloaz', 'mutation 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 3}), true), '3 bloaz', 'mutation 3 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 4}), true), '4 bloaz', 'mutation 4 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 bloaz', 'mutation 5 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 9}), true), '9 bloaz', 'mutation 9 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 10}), true), '10 vloaz', 'mutation 10 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 21}), true), '21 bloaz', 'mutation 21 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 22}), true), '22 vloaz', 'mutation 22 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 133}), true), '133 bloaz', 'mutation 133 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 148}), true), '148 vloaz', 'mutation 148 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 261}), true), '261 bloaz', 'mutation 261 years'); - }); - -}))); - - -;(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('bs'); - - test('parse', function (assert) { - var tests = 'januar jan._februar feb._mart mar._april apr._maj maj._juni jun._juli jul._august aug._septembar sep._oktobar okt._novembar nov._decembar dec.'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1) + ' inp ' + mmm); - } - 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, Do MMMM YYYY, h:mm:ss a', 'nedjelja, 14. februar 2010, 3:25:50 pm'], - ['ddd, hA', 'ned., 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. 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. februar 2010'], - ['LLL', '14. februar 2010 15:25'], - ['LLLL', 'nedjelja, 14. februar 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14. feb. 2010'], - ['lll', '14. feb. 2010 15:25'], - ['llll', 'ned., 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'), '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 = 'januar jan._februar feb._mart mar._april apr._maj maj._juni jun._juli jul._august aug._septembar sep._oktobar okt._novembar nov._decembar 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; - 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), '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), 'za par sekundi', 'prefix'); - assert.equal(moment(0).from(30000), 'prije par sekundi', 'prefix'); - }); - - test('now from now', function (assert) { - 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(), '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(), '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(makeFormat(m)), '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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - 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(makeFormat(m)), '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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), '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([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'); - }); - -}))); - - -;(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('ca'); - - test('parse', function (assert) { - var tests = 'gener gen._febrer febr._març març_abril abr._maig maig_juny juny_juliol jul._agost ag._setembre set._octubre oct._novembre nov._desembre 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, Do MMMM YYYY, h:mm:ss a', 'diumenge, 14è de febrer 2010, 3:25:50 pm'], - ['ddd, hA', 'dg., 3PM'], - ['M Mo MM MMMM MMM', '2 2n 02 febrer febr.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14è 14'], - ['d do dddd ddd dd', '0 0è diumenge dg. dg'], - ['DDD DDDo DDDD', '45 45è 045'], - ['w wo ww', '6 6a 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 febrer de 2010'], - ['LLL', '14 de febrer de 2010 a les 15:25'], - ['LLLL', 'diumenge 14 de febrer de 2010 a les 15:25'], - ['l', '14/2/2010'], - ['ll', '14 febr. 2010'], - ['lll', '14 febr. 2010, 15:25'], - ['llll', 'dg. 14 febr. 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'), '1r', '1r'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2n', '2n'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3r', '3r'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4t', '4t'); - 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 = 'gener gen._febrer febr._març març_abril abr._maig maig_juny juny_juliol jul._agost ag._setembre set._octubre oct._novembre nov._desembre 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 = 'diumenge dg. dg_dilluns dl. dl_dimarts dt. dt_dimecres dc. dc_dijous dj. dj_divendres dv. dv_dissabte ds. ds'.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 segons', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'un minut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'un minut', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuts', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuts', '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 hores', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 hores', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 hores', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'un dia', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'un dia', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dies', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'un dia', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dies', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dies', '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 mesos', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mesos', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mesos', '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 mesos', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'un any', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 anys', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'un any', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 anys', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'd\'aquí uns segons', 'prefix'); - assert.equal(moment(0).from(30000), 'fa uns segons', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'fa uns segons', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'd\'aquí uns segons', 'd\'aquí uns segons'); - assert.equal(moment().add({d: 5}).fromNow(), 'd\'aquí 5 dies', 'd\'aquí 5 dies'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'avui a les 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'avui a les 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'avui a les 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'demà a les 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).add({d: 1, h : -1}).calendar(), 'demà a les 11:00', 'tomorrow minus 1 hour'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'avui a les 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'ahir a les 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 [a ' + ((m.hours() !== 1) ? 'les' : 'la') + '] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [a ' + ((m.hours() !== 1) ? 'les' : 'la') + '] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [a ' + ((m.hours() !== 1) ? 'les' : 'la') + '] 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('[el] dddd [passat a ' + ((m.hours() !== 1) ? 'les' : 'la') + '] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[el] dddd [passat a ' + ((m.hours() !== 1) ? 'les' : 'la') + '] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[el] dddd [passat a ' + ((m.hours() !== 1) ? 'les' : 'la') + '] 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 52a', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1a', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1a', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2a', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2a', 'Jan 15 2012 should be week 2'); - }); - - test('day and month', function (assert) { - assert.equal(moment([2012, 1, 15]).format('D MMMM'), '15 de febrer'); - assert.equal(moment([2012, 9, 15]).format('D MMMM'), '15 d\'octubre'); - assert.equal(moment([2012, 9, 15]).format('MMMM, D'), 'octubre, 15'); - }); - -}))); - - -;(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('cs'); - - test('parse', function (assert) { - var tests = 'leden led ledna_únor úno února_březen bře března_duben dub dubna_květen kvě května_červen čvn června_červenec čvc července_srpen srp srpna_září zář září_říjen říj října_listopad lis listopadu_prosinec pro prosince'.split('_'), i; - function equalTest(input, mmm, monthIndex) { - assert.equal(moment(input, mmm).month(), monthIndex, input + ' ' + mmm + ' should be month ' + (monthIndex + 1)); - } - function equalTestStrict(input, mmm, monthIndex) { - assert.equal(moment(input, mmm, true).month(), monthIndex, input + ' ' + mmm + ' should be strict month ' + (monthIndex + 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][2], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][2], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][2].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][2].toLocaleUpperCase(), 'MMMM', i); - - equalTestStrict(tests[i][1], 'MMM', i); - equalTestStrict(tests[i][0], 'MMMM', i); - equalTestStrict(tests[i][2], 'MMMM', i); - equalTestStrict(tests[i][1].toLocaleLowerCase(), 'MMM', i); - equalTestStrict(tests[i][1].toLocaleUpperCase(), 'MMM', i); - equalTestStrict(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTestStrict(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTestStrict(tests[i][2].toLocaleLowerCase(), 'MMMM', i); - equalTestStrict(tests[i][2].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss', 'neděle, únor 14. 2010, 3:25:50'], - ['ddd, h', 'ne, 3'], - ['M Mo MM MMMM MMM', '2 2. 02 únor úno'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. neděle ne ne'], - ['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'], - ['DDDo [den v roce]', '45. den v roce'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14. únor 2010'], - ['LLL', '14. únor 2010 15:25'], - ['LLLL', 'neděle 14. únor 2010 15:25'], - ['l', '14. 2. 2010'], - ['ll', '14. úno 2010'], - ['lll', '14. úno 2010 15:25'], - ['llll', 'ne 14. úno 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 = 'leden led_únor úno_březen bře_duben dub_květen kvě_červen čvn_červenec čvc_srpen srp_září zář_říjen říj_listopad lis_prosinec 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 = 'neděle ne ne_pondělí po po_úterý út út_středa st st_čtvrtek čt čt_pátek pá pá_sobota 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), 'pár sekund', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minuta', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minuta', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuty', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minut', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'hodina', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'hodina', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 hodiny', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 hodin', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 hodin', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'den', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'den', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dny', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'den', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dní', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dní', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'měsíc', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'měsíc', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'měsíc', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 měsíce', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 měsíce', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 měsíce', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'měsíc', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 měsíců', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'rok', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 roky', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'rok', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 let', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'za pár sekund', 'prefix'); - assert.equal(moment(0).from(30000), 'před pár sekundami', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'před pár sekundami', 'now from now should display as in the past'); - }); - - test('fromNow (future)', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'za pár sekund', 'in a few seconds'); - assert.equal(moment().add({m: 1}).fromNow(), 'za minutu', 'in a minute'); - assert.equal(moment().add({m: 3}).fromNow(), 'za 3 minuty', 'in 3 minutes'); - assert.equal(moment().add({m: 10}).fromNow(), 'za 10 minut', 'in 10 minutes'); - assert.equal(moment().add({h: 1}).fromNow(), 'za hodinu', 'in an hour'); - assert.equal(moment().add({h: 3}).fromNow(), 'za 3 hodiny', 'in 3 hours'); - assert.equal(moment().add({h: 10}).fromNow(), 'za 10 hodin', 'in 10 hours'); - assert.equal(moment().add({d: 1}).fromNow(), 'za den', 'in a day'); - assert.equal(moment().add({d: 3}).fromNow(), 'za 3 dny', 'in 3 days'); - assert.equal(moment().add({d: 10}).fromNow(), 'za 10 dní', 'in 10 days'); - assert.equal(moment().add({M: 1}).fromNow(), 'za měsíc', 'in a month'); - assert.equal(moment().add({M: 3}).fromNow(), 'za 3 měsíce', 'in 3 months'); - assert.equal(moment().add({M: 10}).fromNow(), 'za 10 měsíců', 'in 10 months'); - assert.equal(moment().add({y: 1}).fromNow(), 'za rok', 'in a year'); - assert.equal(moment().add({y: 3}).fromNow(), 'za 3 roky', 'in 3 years'); - assert.equal(moment().add({y: 10}).fromNow(), 'za 10 let', 'in 10 years'); - }); - - test('fromNow (past)', function (assert) { - assert.equal(moment().subtract({s: 30}).fromNow(), 'před pár sekundami', 'a few seconds ago'); - assert.equal(moment().subtract({m: 1}).fromNow(), 'před minutou', 'a minute ago'); - assert.equal(moment().subtract({m: 3}).fromNow(), 'před 3 minutami', '3 minutes ago'); - assert.equal(moment().subtract({m: 10}).fromNow(), 'před 10 minutami', '10 minutes ago'); - assert.equal(moment().subtract({h: 1}).fromNow(), 'před hodinou', 'an hour ago'); - assert.equal(moment().subtract({h: 3}).fromNow(), 'před 3 hodinami', '3 hours ago'); - assert.equal(moment().subtract({h: 10}).fromNow(), 'před 10 hodinami', '10 hours ago'); - assert.equal(moment().subtract({d: 1}).fromNow(), 'před dnem', 'a day ago'); - assert.equal(moment().subtract({d: 3}).fromNow(), 'před 3 dny', '3 days ago'); - assert.equal(moment().subtract({d: 10}).fromNow(), 'před 10 dny', '10 days ago'); - assert.equal(moment().subtract({M: 1}).fromNow(), 'před měsícem', 'a month ago'); - assert.equal(moment().subtract({M: 3}).fromNow(), 'před 3 měsíci', '3 months ago'); - assert.equal(moment().subtract({M: 10}).fromNow(), 'před 10 měsíci', '10 months ago'); - assert.equal(moment().subtract({y: 1}).fromNow(), 'před rokem', 'a year ago'); - assert.equal(moment().subtract({y: 3}).fromNow(), 'před 3 lety', '3 years ago'); - assert.equal(moment().subtract({y: 10}).fromNow(), 'před 10 lety', '10 years ago'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'dnes v 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'dnes v 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'dnes v 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'zítra v 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'dnes v 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'včera v 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m, nextDay; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - nextDay = ''; - switch (m.day()) { - case 0: - nextDay = 'v neděli'; - break; - case 1: - nextDay = 'v pondělí'; - break; - case 2: - nextDay = 'v úterý'; - break; - case 3: - nextDay = 've středu'; - break; - case 4: - nextDay = 've čtvrtek'; - break; - case 5: - nextDay = 'v pátek'; - break; - case 6: - nextDay = 'v sobotu'; - break; - } - assert.equal(m.calendar(), m.format('[' + nextDay + '] [v] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[' + nextDay + '] [v] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[' + nextDay + '] [v] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m, lastDay; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - lastDay = ''; - switch (m.day()) { - case 0: - lastDay = 'minulou neděli'; - break; - case 1: - lastDay = 'minulé pondělí'; - break; - case 2: - lastDay = 'minulé úterý'; - break; - case 3: - lastDay = 'minulou středu'; - break; - case 4: - lastDay = 'minulý čtvrtek'; - break; - case 5: - lastDay = 'minulý pátek'; - break; - case 6: - lastDay = 'minulou sobotu'; - break; - } - assert.equal(m.calendar(), m.format('[' + lastDay + '] [v] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[' + lastDay + '] [v] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[' + lastDay + '] [v] 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('humanize duration', function (assert) { - assert.equal(moment.duration(1, 'minutes').humanize(), 'minuta', 'a minute (future)'); - assert.equal(moment.duration(1, 'minutes').humanize(true), 'za minutu', 'in a minute'); - assert.equal(moment.duration(-1, 'minutes').humanize(), 'minuta', 'a minute (past)'); - assert.equal(moment.duration(-1, 'minutes').humanize(true), 'před minutou', 'a minute ago'); - }); - - 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; - } - 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('cv'); - - test('parse', function (assert) { - 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); - 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', 'вырсарникун, нарӑс 14-мӗш 2010, 3:25:50 pm'], - ['ddd, hA', 'выр, 3PM'], - ['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', '7 7-мӗш 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['Ҫулӑн DDDo кунӗ', 'Ҫулӑн 45-мӗш кунӗ'], - ['LTS', '15:25:50'], - ['L', '14-02-2010'], - ['LL', '2010 ҫулхи нарӑс уйӑхӗн 14-мӗшӗ'], - ['LLL', '2010 ҫулхи нарӑс уйӑхӗн 14-мӗшӗ, 15:25'], - ['LLLL', 'вырсарникун, 2010 ҫулхи нарӑс уйӑхӗн 14-мӗшӗ, 15:25'], - ['l', '14-2-2010'], - ['ll', '2010 ҫулхи нар уйӑхӗн 14-мӗшӗ'], - ['lll', '2010 ҫулхи нар уйӑхӗн 14-мӗшӗ, 15:25'], - ['llll', 'выр, 2010 ҫулхи нар уйӑхӗн 14-мӗшӗ, 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 = 'кӑрлач кӑр_нарӑс нар_пуш пуш_ака ака_май май_ҫӗртме ҫӗр_утӑ утӑ_ҫурла ҫур_авӑн авн_юпа юпа_чӳк чӳк_раштав раш'.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; - 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), 'пӗр-ик ҫеккунт', '44 sekunder = 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), '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: 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), 'пӗр-ик ҫеккунтран', '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'); - }); - - 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({h: 2}).fromNow(), '2 сехетрен', 'in 2 hours, the right suffix!'); - assert.equal(moment().add({y: 3}).fromNow(), '3 ҫултан', 'in 3 years, the right suffix!'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - }); - - // Monday is the first day of the week. - // The week that contains Jan 1st is the first week of the year. - - 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'); - }); - -}))); - - -;(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('cy'); - - test('parse', function (assert) { - var tests = 'Ionawr Ion_Chwefror Chwe_Mawrth Maw_Ebrill Ebr_Mai Mai_Mehefin Meh_Gorffennaf Gor_Awst Aws_Medi Med_Hydref Hyd_Tachwedd Tach_Rhagfyr Rhag'.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', 'Dydd Sul, Chwefror 14eg 2010, 3:25:50 pm'], - ['ddd, hA', 'Sul, 3PM'], - ['M Mo MM MMMM MMM', '2 2il 02 Chwefror Chwe'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14eg 14'], - ['d do dddd ddd dd', '0 0 Dydd Sul Sul Su'], - ['DDD DDDo DDDD', '45 45ain 045'], - ['w wo ww', '6 6ed 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 45ain day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 Chwefror 2010'], - ['LLL', '14 Chwefror 2010 15:25'], - ['LLLL', 'Dydd Sul, 14 Chwefror 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Chwe 2010'], - ['lll', '14 Chwe 2010 15:25'], - ['llll', 'Sul, 14 Chwe 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'), '1af', '1af'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2il', '2il'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3ydd', '3ydd'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4ydd', '4ydd'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5ed', '5ed'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6ed', '6ed'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7ed', '7ed'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8fed', '8fed'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9fed', '9fed'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10fed', '10fed'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11eg', '11eg'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12fed', '12fed'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13eg', '13eg'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14eg', '14eg'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15fed', '15fed'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16eg', '16eg'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17eg', '17eg'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18fed', '18fed'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19eg', '19eg'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20fed', '20fed'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21ain', '21ain'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22ain', '22ain'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23ain', '23ain'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24ain', '24ain'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25ain', '25ain'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26ain', '26ain'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27ain', '27ain'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28ain', '28ain'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29ain', '29ain'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30ain', '30ain'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31ain', '31ain'); - }); - - test('format month', function (assert) { - var expected = 'Ionawr Ion_Chwefror Chwe_Mawrth Maw_Ebrill Ebr_Mai Mai_Mehefin Meh_Gorffennaf Gor_Awst Aws_Medi Med_Hydref Hyd_Tachwedd Tach_Rhagfyr Rhag'.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 = 'Dydd Sul Sul Su_Dydd Llun Llun Ll_Dydd Mawrth Maw Ma_Dydd Mercher Mer Me_Dydd Iau Iau Ia_Dydd Gwener Gwe Gw_Dydd Sadwrn Sad 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]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ychydig eiliadau', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'munud', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'munud', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 munud', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 munud', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'awr', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'awr', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 awr', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 awr', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 awr', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'diwrnod', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'diwrnod', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 diwrnod', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'diwrnod', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 diwrnod', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 diwrnod', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mis', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mis', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mis', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mis', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mis', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mis', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mis', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mis', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'blwyddyn', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 flynedd', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'blwyddyn', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 flynedd', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'mewn ychydig eiliadau', 'prefix'); - assert.equal(moment(0).from(30000), 'ychydig eiliadau yn ôl', 'suffix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'mewn ychydig eiliadau', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'mewn 5 diwrnod', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Heddiw am 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Heddiw am 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Heddiw am 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Yfory am 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Heddiw am 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ddoe am 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 [am] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [am] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [am] 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 [diwethaf am] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [diwethaf am] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [diwethaf am] 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 52ain', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1af', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1af', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2il', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2il', '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('da'); - - test('parse', function (assert) { - var tests = 'januar jan_februar feb_marts mar_april apr_maj maj_juni jun_juli jul_august aug_september sep_oktober 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)); - } - 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 [den] Do MMMM YYYY, h:mm:ss a', 'søndag den 14. februar 2010, 3:25:50 pm'], - ['ddd hA', 'søn 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. søndag søn sø'], - ['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'], - ['[den] DDDo [dag på året]', 'den 45. dag på året'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14. februar 2010'], - ['LLL', '14. februar 2010 15:25'], - ['LLLL', 'søndag d. 14. februar 2010 kl. 15:25'], - ['l', '14.2.2010'], - ['ll', '14. feb 2010'], - ['lll', '14. feb 2010 15:25'], - ['llll', 'søn d. 14. feb 2010 kl. 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 = 'januar jan_februar feb_marts mar_april apr_maj maj_juni jun_juli jul_august aug_september sep_oktober 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 = 'søndag søn sø_mandag man ma_tirsdag tir ti_onsdag ons on_torsdag tor to_fredag fre fr_lørdag lør 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]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'få sekunder', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'et minut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'et minut', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutter', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutter', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'en time', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'en time', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 timer', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 timer', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 timer', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'en dag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'en dag', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dage', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'en dag', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dage', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dage', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'en måned', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'en måned', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'en måned', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 måneder', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 måneder', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 måneder', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'en måned', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 måneder', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'et å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), 'et å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), 'om få sekunder', 'prefix'); - assert.equal(moment(0).from(30000), 'få sekunder siden', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'få sekunder siden', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'om få sekunder', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'om 5 dage', 'in 5 days'); - }); - - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'i dag kl. 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'i dag kl. 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'i dag kl. 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'i morgen kl. 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'i dag kl. 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'i 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('på dddd [kl.] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('på dddd [kl.] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('på 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('[i] dddd[s kl.] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[i] dddd[s kl.] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[i] dddd[s kl.] 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 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; - } - 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('de-at'); - - test('parse', function (assert) { - var tests = 'Jänner Jän._Februar Feb._März März_April Apr._Mai Mai_Juni Juni_Juli Juli_August Aug._September Sep._Oktober Okt._November Nov._Dezember Dez.'.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, Do MMMM YYYY, h:mm:ss a', 'Sonntag, 14. Februar 2010, 3:25:50 pm'], - ['ddd, hA', 'So., 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. Sonntag So. So'], - ['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. Februar 2010'], - ['LLL', '14. Februar 2010 15:25'], - ['LLLL', 'Sonntag, 14. Februar 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14. Feb. 2010'], - ['lll', '14. Feb. 2010 15:25'], - ['llll', 'So., 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'), '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 = 'Jänner Jän._Februar Feb._März März_April Apr._Mai Mai_Juni Juni_Juli Juli_August Aug._September Sep._Oktober Okt._November Nov._Dezember Dez.'.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 = 'Sonntag So. So_Montag Mo. Mo_Dienstag Di. Di_Mittwoch Mi. Mi_Donnerstag Do. Do_Freitag Fr. Fr_Samstag Sa. 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]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ein paar Sekunden', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'eine Minute', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'eine Minute', '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), 'eine Stunde', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'eine Stunde', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 Stunden', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 Stunden', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 Stunden', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ein Tag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ein Tag', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 Tage', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ein Tag', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 Tage', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 Tage', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ein Monat', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ein Monat', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 Monate', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 Monate', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 Monate', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ein Monat', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 Monate', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ein Jahr', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 Jahre', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ein Jahr', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 Jahre', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'in ein paar Sekunden', 'prefix'); - assert.equal(moment(0).from(30000), 'vor ein paar Sekunden', 'suffix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'in ein paar Sekunden', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'in 5 Tagen', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'heute um 12:00 Uhr', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'heute um 12:25 Uhr', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'heute um 13:00 Uhr', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'morgen um 12:00 Uhr', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'heute um 11:00 Uhr', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'gestern um 12:00 Uhr', '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 [um] LT [Uhr]'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [um] LT [Uhr]'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [um] LT [Uhr]'), '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('[letzten] dddd [um] LT [Uhr]'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[letzten] dddd [um] LT [Uhr]'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[letzten] dddd [um] LT [Uhr]'), '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 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; - } - 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('de-ch'); - - test('parse', function (assert) { - var tests = 'Januar Jan._Februar Feb._März März_April Apr._Mai Mai_Juni Juni_Juli Juli_August Aug._September Sep._Oktober Okt._November Nov._Dezember Dez.'.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, Do MMMM YYYY, h:mm:ss a', 'Sonntag, 14. Februar 2010, 3:25:50 pm'], - ['ddd, hA', 'So, 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. Sonntag So So'], - ['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'], - ['LT', '15:25'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14. Februar 2010'], - ['LLL', '14. Februar 2010 15:25'], - ['LLLL', 'Sonntag, 14. Februar 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14. Feb. 2010'], - ['lll', '14. Feb. 2010 15:25'], - ['llll', 'So, 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'), '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 = 'Januar Jan._Februar Feb._März März_April Apr._Mai Mai_Juni Juni_Juli Juli_August Aug._September Sep._Oktober Okt._November Nov._Dezember Dez.'.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 = 'Sonntag So So_Montag Mo Mo_Dienstag Di Di_Mittwoch Mi Mi_Donnerstag Do Do_Freitag Fr Fr_Samstag Sa 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]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ein paar Sekunden', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'eine Minute', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'eine Minute', '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), 'eine Stunde', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'eine Stunde', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 Stunden', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 Stunden', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 Stunden', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ein Tag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ein Tag', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 Tage', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ein Tag', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 Tage', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 Tage', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ein Monat', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ein Monat', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ein Monat', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 Monate', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 Monate', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 Monate', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ein Monat', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 Monate', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ein Jahr', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 Jahre', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ein Jahr', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 Jahre', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'in ein paar Sekunden', 'prefix'); - assert.equal(moment(0).from(30000), 'vor ein paar Sekunden', 'suffix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'in ein paar Sekunden', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'in 5 Tagen', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'heute um 12:00 Uhr', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'heute um 12:25 Uhr', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'heute um 13:00 Uhr', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'morgen um 12:00 Uhr', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'heute um 11:00 Uhr', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'gestern um 12:00 Uhr', '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 [um] LT [Uhr]'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [um] LT [Uhr]'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [um] LT [Uhr]'), '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('[letzten] dddd [um] LT [Uhr]'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[letzten] dddd [um] LT [Uhr]'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[letzten] dddd [um] LT [Uhr]'), '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 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; - } - 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('de'); - - test('parse', function (assert) { - var tests = 'Januar Jan._Februar Feb._März März_April Apr._Mai Mai_Juni Juni_Juli Juli_August Aug._September Sep._Oktober Okt._November Nov._Dezember Dez.'.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, Do MMMM YYYY, h:mm:ss a', 'Sonntag, 14. Februar 2010, 3:25:50 pm'], - ['ddd, hA', 'So., 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. Sonntag So. So'], - ['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. Februar 2010'], - ['LLL', '14. Februar 2010 15:25'], - ['LLLL', 'Sonntag, 14. Februar 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14. Feb. 2010'], - ['lll', '14. Feb. 2010 15:25'], - ['llll', 'So., 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'), '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 = 'Januar Jan._Februar Feb._März März_April Apr._Mai Mai_Juni Juni_Juli Juli_August Aug._September Sep._Oktober Okt._November Nov._Dezember Dez.'.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 = 'Sonntag So. So_Montag Mo. Mo_Dienstag Di. Di_Mittwoch Mi. Mi_Donnerstag Do. Do_Freitag Fr. Fr_Samstag Sa. 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]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ein paar Sekunden', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'eine Minute', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'eine Minute', '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), 'eine Stunde', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'eine Stunde', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 Stunden', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 Stunden', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 Stunden', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ein Tag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ein Tag', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 Tage', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ein Tag', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 Tage', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 Tage', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ein Monat', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ein Monat', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ein Monat', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 Monate', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 Monate', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 Monate', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ein Monat', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 Monate', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ein Jahr', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 Jahre', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ein Jahr', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 Jahre', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'in ein paar Sekunden', 'prefix'); - assert.equal(moment(0).from(30000), 'vor ein paar Sekunden', 'suffix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'in ein paar Sekunden', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'in 5 Tagen', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'heute um 12:00 Uhr', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'heute um 12:25 Uhr', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'heute um 13:00 Uhr', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'morgen um 12:00 Uhr', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'heute um 11:00 Uhr', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'gestern um 12:00 Uhr', '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 [um] LT [Uhr]'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [um] LT [Uhr]'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [um] LT [Uhr]'), '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('[letzten] dddd [um] LT [Uhr]'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[letzten] dddd [um] LT [Uhr]'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[letzten] dddd [um] LT [Uhr]'), '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 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; - } - 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('dv'); - - test('parse', function (assert) { - var i, - tests = [ - 'ޖެނުއަރީ', - 'ފެބްރުއަރީ', - 'މާރިޗު', - 'އޭޕްރީލު', - 'މޭ', - 'ޖޫން', - 'ޖުލައި', - 'އޯގަސްޓު', - 'ސެޕްޓެމްބަރު', - 'އޮކްޓޯބަރު', - 'ނޮވެމްބަރު', - 'ޑިސެމްބަރު' - ]; - - function equalTest(input, mmm, i) { - 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); - equalTest(tests[i].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'އާދިއްތަ، ފެބްރުއަރީ 14 2010، 3:25:50 މފ'], - ['ddd, hA', 'އާދިއްތަ، 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', 'މފ މފ'], - ['LTS', '15:25:50'], - ['L', '14/2/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; - - 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 month', function (assert) { - var i, - expected = [ - 'ޖެނުއަރީ', - 'ފެބްރުއަރީ', - 'މާރިޗު', - 'އޭޕްރީލު', - 'މޭ', - 'ޖޫން', - 'ޖުލައި', - 'އޯގަސްޓު', - 'ސެޕްޓެމްބަރު', - 'އޮކްޓޯބަރު', - 'ނޮވެމްބަރު', - 'ޑިސެމްބަރު' - ]; - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM'), expected[i]); - } - }); - - test('format week', function (assert) { - var i, - expected = [ - 'އާދިއްތަ', - 'ހޯމަ', - 'އަންގާރަ', - 'ބުދަ', - 'ބުރާސްފަތި', - 'ހުކުރު', - 'ހޮނިހިރު' - ]; - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd'), expected[i]); - } - }); - - - 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), 'ގަޑިއިރު 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: 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), 'ތެރޭގައި ސިކުންތުކޮޅެއް', 'prefix'); - assert.equal(moment(0).from(30000), 'ކުރިން ސިކުންތުކޮޅެއް', 'suffix'); - }); - - 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'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'), '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'), '2 02 2', 'Jan 8 2012 should be week 2'); - 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'), '3 03 3', 'Jan 15 2012 should be week 3'); - }); - -}))); - - -;(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('el'); - - test('parse', function (assert) { - var i, - tests = 'Ιανουάριος Ιαν_Φεβρουάριος Φεβ_Μάρτιος Μαρ_Απρίλιος Απρ_Μάιος Μαϊ_Ιούνιος Ιουν_Ιούλιος Ιουλ_Αύγουστος Αυγ_Σεπτέμβριος Σεπ_Οκτώβριος Οκτ_Νοέμβριος Νοε_Δεκέμβριος Δεκ'.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); - 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('parse meridiem', function (assert) { - var i, - b = moment(), - meridiemTests = [ - // h a patterns, expected hours, isValid - ['10 πμ', 10, true], - ['10 μμ', 22, true], - ['10 π.μ.', 10, true], - ['10 μ.μ.', 22, true], - ['10 π', 10, true], - ['10 μ', 22, true], - ['10 ΠΜ', 10, true], - ['10 ΜΜ', 22, true], - ['10 Π.Μ.', 10, true], - ['10 Μ.Μ.', 22, true], - ['10 Π', 10, true], - ['10 Μ', 22, true], - ['10 am', 10, false], - ['10 pm', 10, false] - ], - parsed; - - // test that a formatted moment including meridiem string can be parsed back to the same moment - assert.ok(b.isSame(moment(b.format('h:mm:ss a'), 'h:mm:ss a', 'el', true), 'seconds'), b.format('h:mm:ss a') + ' should be equal to ' + moment(b.format('h:mm:ss a'), 'h:mm:ss a', 'el', true).format('h:mm:ss a')); - - // test that a formatted moment having a meridiem string can be parsed with strict flag - assert.ok(moment(b.format('h:mm:ss a'), 'h:mm:ss a', 'el', true).isValid(), b.format('h:mm:ss a') + ' should be parsed as valid'); - - for (i = 0; i < meridiemTests.length; i++) { - parsed = moment(meridiemTests[i][0], 'h a', 'el', true); - assert.equal(parsed.isValid(), meridiemTests[i][2], 'validity for ' + meridiemTests[i][0]); - if (parsed.isValid()) { - assert.equal(parsed.hours(), meridiemTests[i][1], 'hours for ' + meridiemTests[i][0]); - } - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Κυριακή, Φεβρουάριος 14η 2010, 3:25:50 μμ'], - ['dddd, D MMMM YYYY, h:mm:ss a', 'Κυριακή, 14 Φεβρουαρίου 2010, 3:25:50 μμ'], - ['ddd, hA', 'Κυρ, 3ΜΜ'], - ['dddd, MMMM YYYY', 'Κυριακή, Φεβρουάριος 2010'], - ['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', '6 6η 06'], - ['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', '3:25:50 ΜΜ'], - ['L', '14/02/2010'], - ['LL', '14 Φεβρουαρίου 2010'], - ['LLL', '14 Φεβρουαρίου 2010 3:25 ΜΜ'], - ['LLLL', 'Κυριακή, 14 Φεβρουαρίου 2010 3:25 ΜΜ'], - ['l', '14/2/2010'], - ['ll', '14 Φεβ 2010'], - ['lll', '14 Φεβ 2010 3:25 ΜΜ'], - ['llll', 'Κυρ, 14 Φεβ 2010 3: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 i, - expected = 'Ιανουάριος Ιαν_Φεβρουάριος Φεβ_Μάρτιος Μαρ_Απρίλιος Απρ_Μάιος Μαϊ_Ιούνιος Ιουν_Ιούλιος Ιουλ_Αύγουστος Αυγ_Σεπτέμβριος Σεπ_Οκτώβριος Οκτ_Νοέμβριος Νοε_Δεκέμβριος Δεκ'.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 i, - expected = 'Κυριακή Κυρ Κυ_Δευτέρα Δευ Δε_Τρίτη Τρι Τρ_Τετάρτη Τετ Τε_Πέμπτη Πεμ Πε_Παρασκευή Παρ Πα_Σάββατο Σαβ Σα'.split('_'); - - 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), 'λίγα δευτερόλεπτα', '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), '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: 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), 'σε λίγα δευτερόλεπτα', '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'); - }); - - 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'); - }); - - 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(), 'Σήμερα στη 1: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 [' + (m.hours() % 12 === 1 ? 'στη' : 'στις') + '] 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [στις] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m, dayString; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - dayString = m.day() === 6 ? '[το προηγούμενο Σάββατο]' : '[την προηγούμενη] dddd'; - assert.equal(m.calendar(), m.format(dayString + ' [' + (m.hours() % 12 === 1 ? 'στη' : 'στις') + '] LT'), 'Today - ' + i + ' days current time'); - m.hours(1).minutes(30).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(dayString + ' [στη] LT'), 'Today - ' + i + ' days one o clock'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(dayString + ' [στις] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(dayString + ' [στις] 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 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, 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'), '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('localeData months calls', function (assert) { - var jan = moment('2012-01-01'); - assert.equal(moment.localeData().months(jan), 'Ιανουάριος', 'should return the nominative month name'); - assert.equal(moment.localeData().months(jan, 'D MMMM'), 'Ιανουαρίου', 'should return the genitive month name'); - }); - -}))); - - -;(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('en-SG'); - - 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; - 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', '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 14th 14'], - ['d do dddd ddd dd', '0 0th Sunday Sun Su'], - ['DDD DDDo DDDD', '45 45th 045'], - ['w wo ww', '6 6th 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 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'] - ], - 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'), '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'), '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'), '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'), '31st', '31st'); - }); - - 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; - 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; - 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), '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), '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(), 'a few seconds ago', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - 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(), '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) { - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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 [at] 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('[Last] dddd [at] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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('[Last] dddd [at] 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 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'); - }); - -}))); - - -;(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('en-au'); - - 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; - 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', '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 14th 14'], - ['d do dddd ddd dd', '0 0th Sunday Sun Su'], - ['DDD DDDo DDDD', '45 45th 045'], - ['w wo ww', '6 6th 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 45th day of the year'], - ['LTS', '3:25:50 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]); - } - }); - - test('format ordinal', function (assert) { - 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'), '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'), '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'), '31st', '31st'); - }); - - 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; - 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; - 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), '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), '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(), 'a few seconds ago', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - 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(), '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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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 [at] 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('[Last] dddd [at] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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('[Last] dddd [at] 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 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'); - }); - -}))); - - -;(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('en-ca'); - - 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('_'); - - 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', '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 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', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45th day of the year'], - ['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]); - } - }); - - test('format ordinal', function (assert) { - 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'), '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'), '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'), '31st', '31st'); - }); - - 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('_'); - - 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('_'); - - 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), '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), '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(), 'a few seconds ago', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - 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(), '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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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 [at] 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('[Last] dddd [at] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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('[Last] dddd [at] 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 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'); - }); - -}))); - - -;(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('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; - 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', '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 14th 14'], - ['d do dddd ddd dd', '0 0th Sunday Sun Su'], - ['DDD DDDo DDDD', '45 45th 045'], - ['w wo ww', '6 6th 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 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'] - ], - 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'), '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'), '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'), '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'), '31st', '31st'); - }); - - 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; - 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; - 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), '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), '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(), 'a few seconds ago', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - 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(), '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) { - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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 [at] 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('[Last] dddd [at] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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('[Last] dddd [at] 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 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'); - }); - -}))); - - -;(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('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; - 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', '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 14th 14'], - ['d do dddd ddd dd', '0 0th Sunday Sun Su'], - ['DDD DDDo DDDD', '45 45th 045'], - ['w wo ww', '6 6th 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 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'] - ], - 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'), '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'), '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'), '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'), '31st', '31st'); - }); - - 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; - 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; - 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), '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), '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(), 'a few seconds ago', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - 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(), '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) { - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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 [at] 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('[Last] dddd [at] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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('[Last] dddd [at] 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 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'); - }); - -}))); - - -;(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('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; - 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', '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 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', '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'] - ], - 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'), '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'), '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'), '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'), '31st', '31st'); - }); - - 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; - 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; - 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), '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), '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(), 'a few seconds ago', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - 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(), '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) { - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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 [at] 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('[Last] dddd [at] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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('[Last] dddd [at] 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'), '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'); - }); - -}))); - - -;(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('en-nz'); - - 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; - 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', '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 14th 14'], - ['d do dddd ddd dd', '0 0th Sunday Sun Su'], - ['DDD DDDo DDDD', '45 45th 045'], - ['w wo ww', '6 6th 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 45th day of the year'], - ['LTS', '3:25:50 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]); - } - }); - - test('format ordinal', function (assert) { - 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'), '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'), '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'), '31st', '31st'); - }); - - 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; - 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; - 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), '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), '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(), 'a few seconds ago', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - 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(), '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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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 [at] 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('[Last] dddd [at] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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('[Last] dddd [at] 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 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'); - }); - -}))); - - -;(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('en'); - - 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('_'); - - 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', '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 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', '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'), '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'), '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'), '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'), '31st', '31st'); - }); - - 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('_'); - - 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('_'); - - 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), '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), '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(), 'a few seconds ago', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - 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(), '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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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 [at] 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('[Last] dddd [at] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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('[Last] dddd [at] 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 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); - } - }); - -}))); - - -;(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('eo'); - - 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; - 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', '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 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', '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; - 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, 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'), '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'), '31a', '31a'); - }); - - 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; - 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; - 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), '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), 'post sekundoj', 'post prefix'); - assert.equal(moment(0).from(30000), 'antaŭ sekundoj', 'antaŭ prefix'); - }); - - test('now from now', function (assert) { - 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(), '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(), '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) { - var i, m; - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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 [je] 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('[pasinta] dddd [je] 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'); - 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'); - } - }); - - 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([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'); - }); - -}))); - - -;(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('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; - 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, 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', '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'] - ], - 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 = '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 = '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]); - } - }); - - 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'); - }); - - test('suffix', function (assert) { - 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(), 'hace unos segundos', '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'); - }); - - 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'); - }); - - 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 [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('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('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('[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('[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('[el] dddd [pasado a la' + ((m.hours() !== 1) ? 's' : '') + '] 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 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'); - }); - -}))); - - -;(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('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; - 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, 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', '8 8º 08'], - ['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'], - ['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 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 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; - 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 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 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]); - } - }); - - 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'); - }); - - test('suffix', function (assert) { - 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(), 'hace unos segundos', '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'); - }); - - 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'); - }); - - 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 [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('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('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('[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('[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('[el] dddd [pasado a la' + ((m.hours() !== 1) ? 's' : '') + '] 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'), '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, 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'; // "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'); - }); - -}))); - - -;(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('es'); - - 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; - 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, 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; - 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 = '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 = '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]); - } - }); - - 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'); - }); - - test('suffix', function (assert) { - 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(), 'hace unos segundos', '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'); - }); - - 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'); - }); - - 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 [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('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('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('[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('[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('[el] dddd [pasado a la' + ((m.hours() !== 1) ? 's' : '') + '] 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 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'); - }); - -}))); - - -;(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('et'); - - 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; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' peaks olema kuu ' + (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, 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; - 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 = '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 = '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]); - } - }); - - 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'); - }); - - 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'); - }); - - test('now from now', function (assert) { - 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(), '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(), '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('[Järgmine] dddd 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'); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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('[Eelmine] dddd 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 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 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([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; - } - 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('eu'); - - 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; - 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', '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; - 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 = '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 = '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]); - } - }); - - 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'); - }); - - test('suffix', function (assert) { - 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(), 'duela segundo batzuk', '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'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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[etan]'), '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('[aurreko] dddd LT[etan]'), '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'); - 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'); - } - }); - - 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([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'); - }); - -}))); - - -;(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('fa'); - - test('parse', function (assert) { - var tests = 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.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()); - } - for (i = 0; i < 12; 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', 'یک\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; - 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'); - 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'); - 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'); - 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'); - }); - - test('format month', function (assert) { - 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 = 'یک\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]); - } - }); - - 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'); - }); - - test('suffix', function (assert) { - 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'); - }); - - 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'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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([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'); - }); - -}))); - - -;(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('fi'); - - 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; - 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', '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'] - ], - 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.', '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.', '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.', '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.', '31st'); - }); - - 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; - 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; - 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), '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), '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(), 'muutama sekunti sitten', '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'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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 [klo] 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('[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('[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('[viime] dddd[na] [klo] 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'), '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'), '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'), '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; - } - 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('fo'); - - 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; - 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 [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([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 = '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 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]); - } - }); - - 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 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), '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(), 'um fá sekund', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'um 5 dagar', '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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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 [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('[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('[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('[síðstu] dddd [kl] 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'), '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'), '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'), '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; - } - 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('fr-ca'); - - 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('_'); - - 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', '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'] - ], - 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, 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 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 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]); - } - }); - - 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'); - }); - - 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(), 'dans quelques secondes', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'dans 5 jours', 'in 5 days'); - }); - - test('same 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'); - }); - - 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 [à] 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [à] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - 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('dddd [dernier à] 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [dernier à] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - 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'); - - 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'), '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'); - }); - -}))); - - -;(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('fr-ch'); - - 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('_'); - - 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', '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', '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 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'], - ['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([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, 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 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 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]); - } - }); - - 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'); - }); - - 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(), 'dans quelques secondes', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'dans 5 jours', 'in 5 days'); - }); - - test('same 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'); - }); - - 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 [à] 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [à] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - 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('dddd [dernier à] 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [dernier à] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - 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'); - - 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 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'); - }); - -}))); - - -;(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('fr'); - - 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('_'); - - 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', '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([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'), '2', '2'); - - 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 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 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]); - } - }); - - 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'); - }); - - 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(), 'dans quelques secondes', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'dans 5 jours', 'in 5 days'); - }); - - test('same 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'); - }); - - 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 [à] 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [à] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - 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('dddd [dernier à] 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [dernier à] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - 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'); - - 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 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'); - }); - -}))); - - -;(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('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*/ - - 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('gd'); - - var months = [ - 'Am Faoilleach,Faoi', - 'An Gearran,Gear', - 'Am Màrt,Màrt', - 'An Giblean,Gibl', - 'An Cèitean,Cèit', - 'An t-Ògmhios,Ògmh', - 'An t-Iuchar,Iuch', - 'An Lùnastal,Lùn', - 'An t-Sultain,Sult', - 'An Dàmhair,Dàmh', - 'An t-Samhain,Samh', - 'An Dùbhlachd,Dùbh' - ]; - - 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', 'Didòmhnaich, An Gearran 14mh 2010, 3:25:50 pm'], - ['ddd, hA', 'Did, 3PM'], - ['M Mo MM MMMM MMM', '2 2na 02 An Gearran Gear'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14mh 14'], - ['d do dddd ddd dd', '0 0mh Didòmhnaich Did Dò'], - ['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 An Gearran 2010'], - ['LLL', '14 An Gearran 2010 15:25'], - ['LLLL', 'Didòmhnaich, 14 An Gearran 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Gear 2010'], - ['lll', '14 Gear 2010 15:25'], - ['llll', 'Did, 14 Gear 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 = ['Didòmhnaich Did Dò', 'Diluain Dil Lu', 'Dimàirt Dim Mà', 'Diciadain Dic Ci', 'Diardaoin Dia Ar', 'Dihaoine Dih Ha', 'Disathairne Dis 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), 'beagan diogan', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'mionaid', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'mionaid', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 mionaidean', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 mionaidean', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'uair', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'uair', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 uairean', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 uairean', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 uairean', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'latha', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'latha', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 latha', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'latha', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 latha', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 latha', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mìos', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mìos', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mìos', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mìosan', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mìosan', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mìosan', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mìos', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mìosan', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'bliadhna', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 bliadhna', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'bliadhna', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 bliadhna', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'ann an beagan diogan', 'prefix'); - assert.equal(moment(0).from(30000), 'bho chionn beagan diogan', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'bho chionn beagan diogan', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'ann an beagan diogan', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'ann an 5 latha', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'An-diugh aig 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'An-diugh aig 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'An-diugh aig 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'A-màireach aig 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'An-diugh aig 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'An-dè 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 [aig] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [aig] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [aig] 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 chaidh] [aig] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [seo chaidh] [aig] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [seo chaidh] [aig] 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', 'Faoi 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1d', 'Faoi 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1d', 'Faoi 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2na', 'Faoi 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2na', 'Faoi 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('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; - } - 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('gom-latn'); - - 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('_'); - - 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', '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'] - ], - 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 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 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]); - } - }); - - 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 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), 'thodde second', 'prefix'); - assert.equal(moment(0).from(30000), 'thodde second adim', 'suffix'); - }); - - test('now from now', function (assert) { - 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(), '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(), '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) { - 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'); - 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'); - 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'); - } - }); - - 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('[Fatlo] 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Fatlo] dddd[,] 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 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'); - }); - -}))); - - -;(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('gu'); - - test('parse', function (assert) { - 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); - 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, 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'), '૧', '૧'); - 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; - 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; - 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), 'અમુક પળો', '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'); - }); - - test('now from now', function (assert) { - 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(), '૫ દિવસ મા', '૫ દિવસ મા'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(2).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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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('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'); - }); - -}))); - - -;(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('he'); - - test('parse', function (assert) { - 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); - 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', 'ראשון, פברואר 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; - 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 month', function (assert) { - 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; - 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), 'מספר שניות', '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'); - }); - - test('now from now', function (assert) { - 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'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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 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'); - }); - -}))); - - -;(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('hi'); - - test('parse', function (assert) { - 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); - 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, 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'), '१', '१'); - 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; - 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; - 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), 'कुछ ही क्षण', '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'); - }); - - test('now from now', function (assert) { - 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(), '५ दिन में', '५ दिन में'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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('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'); - }); - -}))); - - -;(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('hr'); - - 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; - 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, 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; - 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 = '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 = '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]); - } - }); - - 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'); - }); - - test('suffix', function (assert) { - 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(), 'prije par sekundi', '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'); - }); - - 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'); - }); - - 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(makeFormat(m)), '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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - 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(makeFormat(m)), '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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), '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([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'); - }); - -}))); - - -;(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('hu'); - - 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; - 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', '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. vasárnap vas v'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '6 6. 06'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['[az év] DDDo [napja]', 'az év 45. napja'], - ['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'] - ], - 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('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.'); - 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 = '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 = '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'), 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'); - }); - - 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'); - }); - - 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'); - }); - - 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'); - }); - - 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('_'); - 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'); - 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'); - 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'); - } - }); - - 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('_'); - - 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'); - 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'); - 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'); - } - }); - - test('calendar all else', function (assert) { - 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'); - - 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'); - }); - - 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'); - }); - -}))); - - -;(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('hy-am'); - - test('parse', function (assert) { - 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); - 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('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 փետրվար փտր'], - ['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'], - ['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'] - ], - 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 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; - 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; - 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), 'մի քանի վայրկյան', '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), 'մի քանի վայրկյան հետո', 'prefix'); - assert.equal(moment(0).from(30000), 'մի քանի վայրկյան առաջ', 'suffix'); - }); - - test('fromNow', function (assert) { - 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(), 'այսօր 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; - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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(makeFormat(m)), '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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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(makeFormat(m)), '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([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'); - }); - -}))); - - -;(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('id'); - - 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; - 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', '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 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', '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; - 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 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; - 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; - 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), '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), '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(), '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(), '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; - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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('dddd [pukul] 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'); - 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'); - 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'); - } - }); - - 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([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'); - }); - -}))); - - -;(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('is'); - - 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; - 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, 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. 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'], - ['[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; - 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 = '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 = '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]); - } - }); - - 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'); - }); - - 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'); - }); - - 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'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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 [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('[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('[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('[síðasta] dddd [kl.] 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 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; - } - 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('it-ch'); - - test('parse', function (assert) { - 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)); - } - 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', '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º 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'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['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 15:25'], - ['llll', 'dom 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'), '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 = '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 = '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]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - 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), '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(), '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(), '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 [alle] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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 [alle] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m, weekday, datestring; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - // 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(datestring), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(datestring), '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 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; - } - 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('it'); - - test('parse', function (assert) { - 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)); - } - 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', '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º 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'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['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 15:25'], - ['llll', 'dom 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'), '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 = '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 = '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]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - 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), '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(), '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(), '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 [alle] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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 [alle] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m, weekday, datestring; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - // 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(datestring), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(datestring), '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 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; - } - 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('ja'); - - test('parse', function (assert) { - var tests = '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; - 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, a h:mm:ss', '日曜日, 二月 14日 2010, 午後 3:25:50'], - ['ddd, Ah', '日, 午後3'], - ['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日 日曜日 日 日'], - ['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', '2010/02/14'], - ['LL', '2010年2月14日'], - ['LLL', '2010年2月14日 15:25'], - ['LLLL', '2010年2月14日 日曜日 15:25'], - ['l', '2010/02/14'], - ['ll', '2010年2月14日'], - ['lll', '2010年2月14日 15:25'], - ['llll', '2010年2月14日(日) 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 month', function (assert) { - 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]); - } - }); - - test('format week', function (assert) { - 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]); - } - }); - - 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), '1分', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '1分', '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), '1時間', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '1時間', '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), '1日', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '1日', '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日', '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), '1ヶ月', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '1ヶ月', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '1ヶ月', '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ヶ月', '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), '1年', '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年', '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'); - }); - - test('now from now', function (assert) { - 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'); - }); - - 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'); - }); - - test('calendar next week', function (assert) { - var i, m; - var dow = moment().day(); - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - if (dow + i < 7) { - 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd LT'), 'Today + ' + i + ' days end of day'); - } else { - 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[来週]dddd LT'), 'Today + ' + i + ' days end of day'); - } - } - }); - - test('calendar last week', function (assert) { - var i, m; - var dow = moment().day(); - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - if (dow < i) { - 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[先週]dddd LT'), 'Today - ' + i + ' days end of day'); - } else { - 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd 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 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('parse with japanese parentheses', function (assert) { - assert.ok(moment('2016年5月18日(水)', 'YYYY年M月D日(dd)', true).isValid(), 'parse with japanese parentheses'); - }); - -}))); - - -;(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('jv'); - - test('parse', function (assert) { - var tests = 'Januari Jan_Februari Feb_Maret Mar_April Apr_Mei Mei_Juni Jun_Juli Jul_Agustus Ags_September Sep_Oktober Okt_Nopember Nop_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); - 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', 'Minggu, Februari 14 2010, 3:25:50 sonten'], - ['ddd, hA', 'Min, 3sonten'], - ['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 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', 'sonten sonten'], - ['[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; - 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 month', function (assert) { - var expected = 'Januari Jan_Februari Feb_Maret Mar_April Apr_Mei Mei_Juni Jun_Juli Jul_Agustus Ags_September Sep_Oktober Okt_Nopember Nop_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_Senen Sen Sn_Seloso Sel Sl_Rebu Reb Rb_Kemis Kem Km_Jemuwah Jem Jm_Septu Sep Sp'.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), 'sawetawis detik', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'setunggal menit', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'setunggal menit', '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), 'setunggal jam', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'setunggal jam', '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), 'sedinten', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'sedinten', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dinten', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'sedinten', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dinten', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dinten', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'sewulan', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'sewulan', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'sewulan', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 wulan', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 wulan', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 wulan', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'sewulan', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 wulan', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'setaun', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 taun', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'setaun', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 taun', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'wonten ing sawetawis detik', 'prefix'); - assert.equal(moment(0).from(30000), 'sawetawis detik ingkang kepengker', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'sawetawis detik ingkang kepengker', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'wonten ing sawetawis detik', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'wonten ing 5 dinten', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Dinten puniko pukul 12.00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Dinten puniko pukul 12.25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Dinten puniko pukul 13.00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Mbenjang pukul 12.00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Dinten puniko pukul 11.00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kala wingi pukul 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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('dddd [pukul] 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 [kepengker pukul] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [kepengker pukul] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [kepengker pukul] 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'); - }); - - // Monday is the first day of the week. - // The week that contains Jan 1st is the first week of the year. - - 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'); - }); - -}))); - - -;(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('ka'); - - test('parse', function (assert) { - var i, - tests = 'იანვარი იან_თებერვალი თებ_მარტი მარ_აპრილი აპრ_მაისი მაი_ივნისი ივნ_ივლისი ივლ_აგვისტო აგვ_სექტემბერი სექ_ოქტომბერი ოქტ_ნოემბერი ნოე_დეკემბერი დეკ'.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); - 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); - // the last two are broken until https://github.com/nodejs/node/issues/22518 is fixed - // 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', 'კვირა, თებერვალი მე-14 2010, 3:25:50 pm'], - ['ddd, hA', 'კვი, 3PM'], - ['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', '7 მე-7 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['წლის DDDo დღე', 'წლის 45-ე დღე'], - ['LTS', '3:25:50 PM'], - ['L', '14/02/2010'], - ['LL', '14 თებერვალს 2010'], - ['LLL', '14 თებერვალს 2010 3:25 PM'], - ['LLLL', 'კვირა, 14 თებერვალს 2010 3:25 PM'], - ['l', '14/2/2010'], - ['ll', '14 თებ 2010'], - ['lll', '14 თებ 2010 3:25 PM'], - ['llll', 'კვი, 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'), '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 40', 'YYYY DDD').format('DDDo'), 'მე-40', 'მე-40'); - assert.equal(moment('2011 50', 'YYYY DDD').format('DDDo'), '50-ე', '50-ე'); - assert.equal(moment('2011 60', 'YYYY DDD').format('DDDo'), 'მე-60', 'მე-60'); - assert.equal(moment('2011 100', 'YYYY DDD').format('DDDo'), 'მე-100', 'მე-100'); - assert.equal(moment('2011 101', 'YYYY DDD').format('DDDo'), '101-ე', '101-ე'); - }); - - test('format month', function (assert) { - var i, - expected = 'იანვარი იან_თებერვალი თებ_მარტი მარ_აპრილი აპრ_მაისი მაი_ივნისი ივნ_ივლისი ივლ_აგვისტო აგვ_სექტემბერი სექ_ოქტომბერი ოქტ_ნოემბერი ნოე_დეკემბერი დეკ'.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 i, - expected = 'კვირა კვი კვ_ორშაბათი ორშ ორ_სამშაბათი სამ სა_ოთხშაბათი ოთხ ოთ_ხუთშაბათი ხუთ ხუ_პარასკევი პარ პა_შაბათი შაბ შა'.split('_'); - - 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), 'რამდენიმე წამი', '44 წამი = რამდენიმე წამი'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'წუთი', '45 წამი = წუთი'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'წუთი', '89 წამი = წუთი'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 წუთი', '90 წამი = 2 წუთი'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 წუთი', '44 წამი = 44 წუთი'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'საათი', '45 წამი = საათი'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'საათი', '89 წამი = საათი'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 საათი', '90 წამი = 2 საათი'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 საათი', '5 საათი = 5 საათი'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 საათი', '21 საათი = 21 საათი'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'დღე', '22 საათი = დღე'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'დღე', '35 საათი = დღე'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 დღე', '36 საათი = 2 დღე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'დღე', '1 დღე = დღე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 დღე', '5 დღე = 5 დღე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 დღე', '25 დღე = 25 დღე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'თვე', '26 დღე = თვე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'თვე', '30 დღე = თვე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'თვე', '45 დღე = თვე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 თვე', '46 დღე = 2 თვე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 თვე', '75 დღე = 2 თვე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 თვე', '76 დღე = 3 თვე'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'თვე', '1 თვე = თვე'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 თვე', '5 თვე = 5 თვე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'წელი', '345 დღე = წელი'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 წელი', '548 დღე = 2 წელი'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'წელი', '1 წელი = წელი'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 წელი', '5 წელი = 5 წელი'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'რამდენიმე წამში', 'ში სუფიქსი'); - assert.equal(moment(0).from(30000), 'რამდენიმე წამის წინ', 'წინ სუფიქსი'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'რამდენიმე წამის წინ', 'უნდა აჩვენოს როგორც წარსული'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'რამდენიმე წამში', 'რამდენიმე წამში'); - assert.equal(moment().add({d: 5}).fromNow(), '5 დღეში', '5 დღეში'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'დღეს 12:00 PM-ზე', 'დღეს ამავე დროს'); - assert.equal(moment(a).add({m: 25}).calendar(), 'დღეს 12:25 PM-ზე', 'ახლანდელ დროს დამატებული 25 წუთი'); - assert.equal(moment(a).add({h: 1}).calendar(), 'დღეს 1:00 PM-ზე', 'ახლანდელ დროს დამატებული 1 საათი'); - assert.equal(moment(a).add({d: 1}).calendar(), 'ხვალ 12:00 PM-ზე', 'ხვალ ამავე დროს'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'დღეს 11:00 AM-ზე', 'ახლანდელ დროს გამოკლებული 1 საათი'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'გუშინ 12:00 PM-ზე', 'გუშინ ამავე დროს'); - }); - - 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[-ზე]'), 'დღეს + ' + i + ' დღე ახლანდელ დროს'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[შემდეგ] dddd LT[-ზე]'), 'დღეს + ' + i + ' დღე დღის დასაწყისში'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[შემდეგ] dddd LT[-ზე]'), 'დღეს + ' + i + ' დღე დღის დასასრულს'); - } - }); - - 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[-ზე]'), 'დღეს - ' + i + ' დღე ახლანდელ დროს'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[წინა] dddd LT[-ზე]'), 'დღეს - ' + i + ' დღე დღის დასაწყისში'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[წინა] dddd LT[-ზე]'), 'დღეს - ' + i + ' დღე დღის დასასრულს'); - } - }); - - 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 კვირის წინ'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), '1 კვირაში'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 კვირის წინ'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), '2 კვირაში'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1-ლი', 'დეკ 26 2011 უნდა იყოს კვირა 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1-ლი', 'იან 1 2012 უნდა იყოს კვირა 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 მე-2', 'იან 2 2012 უნდა იყოს კვირა 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 მე-2', 'იან 8 2012 უნდა იყოს კვირა 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 მე-3', 'იან 9 2012 უნდა იყოს კვირა 3'); - }); - -}))); - - -;(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('kk'); - - test('parse', function (assert) { - 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); - 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, Do MMMM YYYY, HH:mm:ss', 'жексенбі, 14-ші ақпан 2010, 15:25:50'], - ['ddd, hA', 'жек, 3PM'], - ['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', '7 7-ші 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[жылдың] 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'] - ], - 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-ші', '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-ші', '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-ші', '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-ші', '31st'); - }); - - test('format month', function (assert) { - 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; - 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), 'бірнеше секунд', '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), '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: 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), 'бірнеше секунд ішінде', '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'); - }); - - 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'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'), '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, 15]).format('w ww wo'), '3 03 3-ші', 'Jan 15 2012 should be week 3'); - }); - -}))); - - -;(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('km'); - - test('parse', function (assert) { - 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); - 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', - 'អាទិត្យ, កុម្ភៈ ទី១៤ ២០១០, ៣:២៥:៥០ ល្ងាច' - ], - ['ddd, hA', 'អា, ៣ល្ងាច'], - ['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', 'ល្ងាច ល្ងាច'], - ['[the] DDDo [day of the year]', 'the ទី៤៥ day of the year'], - ['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'), 'ទី១', '1st'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), 'ទី២', '2nd'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), 'ទី៣', '3rd'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), 'ទី៤', '4th'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), 'ទី៥', '5th'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), 'ទី៦', '6th'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), 'ទី៧', '7th'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), 'ទី៨', '8th'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), 'ទី៩', '9th'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), 'ទី១០', '10th'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), 'ទី១១', '11st'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), 'ទី១២', '12nd'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), 'ទី១៣', '13rd'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), 'ទី១៤', '14th'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), 'ទី១៥', '15th'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), 'ទី១៦', '16th'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), 'ទី១៧', '17th'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), 'ទី១៨', '18th'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), 'ទី១៩', '19th'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), 'ទី២០', '20th'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), 'ទី២១', '21st'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), 'ទី២២', '22nd'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), 'ទី២៣', '23rd'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), 'ទី២៤', '24th'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), 'ទី២៥', '25th'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), 'ទី២៦', '26th'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), 'ទី២៧', '27th'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), 'ទី២៨', '28th'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), 'ទី២៩', '29th'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), 'ទី៣០', '30th'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), 'ទី៣១', '31st'); - }); - - test('format month', function (assert) { - 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; - 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), - 'ប៉ុន្មានវិនាទី', - '44 seconds = ប៉ុន្មានវិនាទី' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({s: 45}), true), - 'មួយនាទី', - '45 seconds = មួយនាទី' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({s: 89}), true), - 'មួយនាទី', - '89 seconds = មួយនាទី' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({s: 90}), true), - '២ នាទី', - '90 seconds = 2 នាទី' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({m: 44}), true), - '៤៤ នាទី', - '44 minutes = 44 នាទី' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({m: 45}), true), - 'មួយម៉ោង', - '45 minutes = មួយម៉ោង' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({m: 89}), true), - 'មួយម៉ោង', - '89 minutes = មួយម៉ោង' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({m: 90}), true), - '២ ម៉ោង', - '90 minutes = 2 ម៉ោង' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({h: 5}), true), - '៥ ម៉ោង', - '5 hours = 5 ម៉ោង' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({h: 21}), true), - '២១ ម៉ោង', - '21 hours = 21 ម៉ោង' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({h: 22}), true), - 'មួយថ្ងៃ', - '22 hours = មួយថ្ងៃ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({h: 35}), true), - 'មួយថ្ងៃ', - '35 hours = មួយថ្ងៃ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({h: 36}), true), - '២ ថ្ងៃ', - '36 hours = 2 ថ្ងៃ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({d: 1}), true), - 'មួយថ្ងៃ', - '1 day = មួយថ្ងៃ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({d: 5}), true), - '៥ ថ្ងៃ', - '5 days = 5 ថ្ងៃ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({d: 25}), true), - '២៥ ថ្ងៃ', - '25 days = 25 ថ្ងៃ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({d: 26}), true), - 'មួយខែ', - '26 days = មួយខែ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({d: 30}), true), - 'មួយខែ', - '30 days = មួយខែ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({d: 43}), true), - 'មួយខែ', - '43 days = មួយខែ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({d: 46}), true), - '២ ខែ', - '46 days = 2 ខែ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({d: 74}), true), - '២ ខែ', - '75 days = 2 ខែ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({d: 76}), true), - '៣ ខែ', - '76 days = 3 ខែ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({M: 1}), true), - 'មួយខែ', - '1 month = មួយខែ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({M: 5}), true), - '៥ ខែ', - '5 months = 5 ខែ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({d: 345}), true), - 'មួយឆ្នាំ', - '345 days = មួយឆ្នាំ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({d: 548}), true), - '២ ឆ្នាំ', - '548 days = 2 ឆ្នាំ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({y: 1}), true), - 'មួយឆ្នាំ', - '1 year = មួយឆ្នាំ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({y: 5}), true), - '៥ ឆ្នាំ', - '5 years = 5 ឆ្នាំ' - ); - }); - - test('suffix', function (assert) { - 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' - ); - }); - - 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' - ); - }); - - 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' - ); - }); - - 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' - ); - m - .hours(0) - .minutes(0) - .seconds(0) - .milliseconds(0); - 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' - ); - } - }); - - 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' - ); - m - .hours(0) - .minutes(0) - .seconds(0) - .milliseconds(0); - 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' - ); - } - }); - - 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'), - '៥២ ៥២ ទី៥២', - 'Jan 1 2012 should be week 52' - ); - assert.equal( - moment([2012, 0, 2]).format('w ww wo'), - '១ ០១ ទី១', - 'Jan 2 2012 should be week 1' - ); - assert.equal( - moment([2012, 0, 8]).format('w ww wo'), - '១ ០១ ទី១', - 'Jan 8 2012 should be week 1' - ); - assert.equal( - moment([2012, 0, 9]).format('w ww wo'), - '២ ០២ ទី២', - 'Jan 9 2012 should be week 2' - ); - assert.equal( - moment([2012, 0, 15]).format('w ww wo'), - '២ ០២ ទី២', - '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('kn'); - - test('parse', function (assert) { - 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); - 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, 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'), '೧ನೇ', '೧ನೇ'); - 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; - 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; - 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), 'ಕೆಲವು ಕ್ಷಣಗಳು', '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'); - }); - - test('now from now', function (assert) { - 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(), '೫ ದಿನ ನಂತರ', '೫ ದಿನ ನಂತರ'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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('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'); - }); - -}))); - - -;(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('ko'); - - test('parse', function (assert) { - var tests = '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; - 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('parse meridiem', function (assert) { - var elements = [{ - expression : '1981년 9월 8일 오후 2시 30분', - inputFormat : 'YYYY[년] M[월] D[일] A h[시] m[분]', - outputFormat : 'A', - expected : '오후' - }, { - expression : '1981년 9월 8일 오전 2시 30분', - inputFormat : 'YYYY[년] M[월] D[일] A h[시] m[분]', - outputFormat : 'A h시', - expected : '오전 2시' - }, { - expression : '14시 30분', - inputFormat : 'H[시] m[분]', - outputFormat : 'A', - expected : '오후' - }, { - expression : '오후 4시', - inputFormat : 'A h[시]', - outputFormat : 'H', - expected : '16' - }], i, l, it, actual; - - for (i = 0, l = elements.length; i < l; ++i) { - it = elements[i]; - actual = moment(it.expression, it.inputFormat).format(it.outputFormat); - - assert.equal( - actual, - it.expected, - '\'' + it.outputFormat + '\' of \'' + it.expression + '\' must be \'' + it.expected + '\' but was \'' + actual + '\'.' - ); - } - }); - - test('format', function (assert) { - var a = [ - ['YYYY년 MMMM Do dddd a h:mm:ss', '2010년 2월 14일 일요일 오후 3:25:50'], - ['ddd A h', '일 오후 3'], - ['M Mo MM MMMM MMM', '2 2월 02 2월 2월'], - ['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', '오후 오후'], - ['일년 중 DDDo째 되는 날', '일년 중 45일째 되는 날'], - ['LTS', '오후 3:25:50'], - ['L', '2010.02.14.'], - ['LL', '2010년 2월 14일'], - ['LLL', '2010년 2월 14일 오후 3:25'], - ['LLLL', '2010년 2월 14일 일요일 오후 3:25'], - ['l', '2010.02.14.'], - ['ll', '2010년 2월 14일'], - ['lll', '2010년 2월 14일 오후 3:25'], - ['llll', '2010년 2월 14일 일요일 오후 3: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 = '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; - 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; - 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), '몇 초', '44초 = 몇 초'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), '1분', '45초 = 1분'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '1분', '89초 = 1분'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2분', '90초 = 2분'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44분', '44분 = 44분'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), '한 시간', '45분 = 한 시간'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '한 시간', '89분 = 한 시간'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2시간', '90분 = 2시간'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5시간', '5시간 = 5시간'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21시간', '21시간 = 21시간'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), '하루', '22시간 = 하루'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '하루', '35시간 = 하루'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2일', '36시간 = 2일'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), '하루', '하루 = 하루'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5일', '5일 = 5일'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25일', '25일 = 25일'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), '한 달', '26일 = 한 달'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '한 달', '30일 = 한 달'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '한 달', '45일 = 한 달'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2달', '46일 = 2달'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2달', '75일 = 2달'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3달', '76일 = 3달'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), '한 달', '1달 = 한 달'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5달', '5달 = 5달'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), '일 년', '345일 = 일 년'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2년', '548일 = 2년'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), '일 년', '일 년 = 일 년'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5년', '5년 = 5년'); - }); - - test('suffix', function (assert) { - 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'); - }); - - 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'); - }); - - 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(), '오늘 오후 1: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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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 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'); - }); - -}))); - - -;(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('ku'); - - var months = [ - 'کانونی دووەم', - 'شوبات', - 'ئازار', - 'نیسان', - 'ئایار', - 'حوزەیران', - 'تەمموز', - 'ئاب', - 'ئەیلوول', - 'تشرینی یەكەم', - 'تشرینی دووەم', - 'كانونی یەکەم' - ]; - - test('parse', function (assert) { - var tests = months, 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()); - } - for (i = 0; i < 12; i++) { - equalTest(tests[i], 'MMM', i); - equalTest(tests[i], 'MMM', i); - equalTest(tests[i], 'MMMM', i); - equalTest(tests[i], 'MMMM', i); - equalTest(tests[i].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'یه‌كشه‌ممه‌، شوبات ١٤ ٢٠١٠، ٣:٢٥:٥٠ ئێواره‌'], - ['ddd, hA', 'یه‌كشه‌م، ٣ئێواره‌'], - ['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', 'ئێواره‌ ئێواره‌'], - ['[the] DDDo [day of the year]', 'the ٤٥ day of the year'], - ['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'); - 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'); - 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'); - 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'); - }); - //ok - test('format month', function (assert) { - var expected = months, i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM'), expected[i], expected[i]); - assert.equal(moment([2011, i, 1]).format('MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - 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]); - } - }); - - 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'); - }); - - test('suffix', function (assert) { - 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'); - }); - - 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'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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([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'); - }); - - - // locale-specific - test('ku strict mode parsing works', function (assert) { - var m, formattedDate; - m = moment().locale('ku'); - formattedDate = m.format('l'); - assert.equal(moment.utc(formattedDate, 'l', 'ku', false).isValid(), true, 'Non-strict parsing works'); - assert.equal(moment.utc(formattedDate, 'l', 'ku', true).isValid(), true,'Strict parsing must work'); - }); - -}))); - - -;(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('ky'); - - test('parse', function (assert) { - 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); - 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, Do MMMM YYYY, HH:mm:ss', 'Жекшемби, 14-чү февраль 2010, 15:25:50'], - ['ddd, hA', 'Жек, 3PM'], - ['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', '7 7-чи 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[жылдын] 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'] - ], - 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-чи', '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-чи', '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-чи', '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-чи', '31st'); - }); - - test('format month', function (assert) { - 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; - 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), 'бирнече секунд', '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), '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: 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), 'бирнече секунд ичинде', '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'); - }); - - 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'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'), '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, 15]).format('w ww wo'), '3 03 3-чү', 'Jan 15 2012 should be week 3'); - }); - -}))); - - -;(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('lb'); - - test('parse', function (assert) { - var tests = 'Januar Jan._Februar Febr._Mäerz Mrz._Abrëll Abr._Mee Mee_Juni Jun._Juli Jul._August Aug._September Sept._Oktober Okt._November Nov._Dezember Dez.'.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, Do MMMM YYYY, HH:mm:ss', 'Sonndeg, 14. Februar 2010, 15:25:50'], - ['ddd, HH:mm', 'So., 15:25'], - ['M Mo MM MMMM MMM', '2 2. 02 Februar Febr.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. Sonndeg So. So'], - ['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 Auer'], - ['L', '14.02.2010'], - ['LL', '14. Februar 2010'], - ['LLL', '14. Februar 2010 15:25 Auer'], - ['LLLL', 'Sonndeg, 14. Februar 2010 15:25 Auer'], - ['l', '14.2.2010'], - ['ll', '14. Febr. 2010'], - ['lll', '14. Febr. 2010 15:25 Auer'], - ['llll', 'So., 14. Febr. 2010 15:25 Auer'] - ], - 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 month', function (assert) { - var expected = 'Januar Jan._Februar Febr._Mäerz Mrz._Abrëll Abr._Mee Mee_Juni Jun._Juli Jul._August Aug._September Sept._Oktober Okt._November Nov._Dezember Dez.'.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 = 'Sonndeg So. So_Méindeg Mé. Mé_Dënschdeg Dë. Dë_Mëttwoch Më. Më_Donneschdeg Do. Do_Freideg Fr. Fr_Samschdeg Sa. 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]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'e puer Sekonnen', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'eng Minutt', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'eng Minutt', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 Minutten', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 Minutten', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'eng Stonn', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'eng Stonn', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 Stonnen', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 Stonnen', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 Stonnen', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'een Dag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'een Dag', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 Deeg', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'een Dag', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 Deeg', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 Deeg', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ee Mount', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ee Mount', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ee Mount', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 Méint', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 Méint', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 Méint', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ee Mount', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 Méint', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ee Joer', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 Joer', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ee Joer', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 Joer', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'an e puer Sekonnen', 'prefix'); - assert.equal(moment(0).from(30000), 'virun e puer Sekonnen', 'suffix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'an e puer Sekonnen', 'in a few seconds'); - assert.equal(moment().add({d: 1}).fromNow(), 'an engem Dag', 'in one day'); - assert.equal(moment().add({d: 2}).fromNow(), 'an 2 Deeg', 'in 2 days'); - assert.equal(moment().add({d: 3}).fromNow(), 'an 3 Deeg', 'in 3 days'); - assert.equal(moment().add({d: 4}).fromNow(), 'a 4 Deeg', 'in 4 days'); - assert.equal(moment().add({d: 5}).fromNow(), 'a 5 Deeg', 'in 5 days'); - assert.equal(moment().add({d: 6}).fromNow(), 'a 6 Deeg', 'in 6 days'); - assert.equal(moment().add({d: 7}).fromNow(), 'a 7 Deeg', 'in 7 days'); - assert.equal(moment().add({d: 8}).fromNow(), 'an 8 Deeg', 'in 8 days'); - assert.equal(moment().add({d: 9}).fromNow(), 'an 9 Deeg', 'in 9 days'); - assert.equal(moment().add({d: 10}).fromNow(), 'an 10 Deeg', 'in 10 days'); - assert.equal(moment().add({y: 100}).fromNow(), 'an 100 Joer', 'in 100 years'); - assert.equal(moment().add({y: 400}).fromNow(), 'a 400 Joer', 'in 400 years'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Haut um 12:00 Auer', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Haut um 12:25 Auer', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Haut um 13:00 Auer', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Muer um 12:00 Auer', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Haut um 11:00 Auer', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Gëschter um 12:00 Auer', '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 [um] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [um] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [um] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m, weekday, datestring; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - - // Different date string for 'Dënschdeg' (Tuesday) and 'Donneschdeg' (Thursday) - weekday = parseInt(m.format('d'), 10); - datestring = (weekday === 2 || weekday === 4 ? '[Leschten] dddd [um] LT' : '[Leschte] dddd [um] 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(datestring), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(datestring), '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 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, 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'), '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'); - }); - -}))); - - -;(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('lo'); - - test('parse', function (assert) { - 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); - 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', 'ອາທິດ, ກຸມພາ ທີ່14 2010, 3:25:50 ຕອນແລງ'], - ['ddd, hA', 'ທິດ, 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', 'ຕອນແລງ ຕອນແລງ'], - ['[ວັນ]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'] - ], - 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 = 'ມັງກອນ ມັງກອນ_ກຸມພາ ກຸມພາ_ມີນາ ມີນາ_ເມສາ ເມສາ_ພຶດສະພາ ພຶດສະພາ_ມິຖຸນາ ມິຖຸນາ_ກໍລະກົດ ກໍລະກົດ_ສິງຫາ ສິງຫາ_ກັນຍາ ກັນຍາ_ຕຸລາ ຕຸລາ_ພະຈິກ ພະຈິກ_ທັນວາ ທັນວາ'.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; - 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), 'ບໍ່ເທົ່າໃດວິນາທີ', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), '1 ນາທີ', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '1 ນາທີ', '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), '1 ຊົ່ວໂມງ', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '1 ຊົ່ວໂມງ', '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), '1 ມື້', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '1 ມື້', '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 ມື້', '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), '1 ເດືອນ', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '1 ເດືອນ', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '1 ເດືອນ', '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 ເດືອນ', '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), '1 ປີ', '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 ປີ', '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'); - }); - - test('now from now', function (assert) { - 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'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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 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'); - }); - -}))); - - -;(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('lt'); - - test('parse', function (assert) { - var tests = 'sausis sau_vasaris vas_kovas kov_balandis bal_gegužė geg_birželis bir_liepa lie_rugpjūtis rgp_rugsėjis rgs_spalis spa_lapkritis lap_gruodis grd'.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, Do MMMM YYYY, h:mm:ss a', 'sekmadienis, 14-oji vasario 2010, 3:25:50 pm'], - ['ddd, hA', 'Sek, 3PM'], - ['M Mo MM MMMM MMM', '2 2-oji 02 vasaris vas'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14-oji 14'], - ['d do dddd ddd dd', '0 0-oji sekmadienis Sek S'], - ['DDD DDDo DDDD', '45 45-oji 045'], - ['w wo ww', '6 6-oji 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['DDDo [metų diena]', '45-oji metų diena'], - ['LTS', '15:25:50'], - ['L', '2010-02-14'], - ['LL', '2010 m. vasario 14 d.'], - ['LLL', '2010 m. vasario 14 d., 15:25 val.'], - ['LLLL', '2010 m. vasario 14 d., sekmadienis, 15:25 val.'], - ['l', '2010-02-14'], - ['ll', '2010 m. vasario 14 d.'], - ['lll', '2010 m. vasario 14 d., 15:25 val.'], - ['llll', '2010 m. vasario 14 d., Sek, 15:25 val.'] - ], - 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-oji', '1-oji'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2-oji', '2-oji'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3-oji', '3-oji'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4-oji', '4-oji'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5-oji', '5-oji'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6-oji', '6-oji'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7-oji', '7-oji'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8-oji', '8-oji'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9-oji', '9-oji'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10-oji', '10-oji'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11-oji', '11-oji'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12-oji', '12-oji'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13-oji', '13-oji'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14-oji', '14-oji'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15-oji', '15-oji'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16-oji', '16-oji'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17-oji', '17-oji'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18-oji', '18-oji'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19-oji', '19-oji'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20-oji', '20-oji'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21-oji', '21-oji'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22-oji', '22-oji'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23-oji', '23-oji'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24-oji', '24-oji'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25-oji', '25-oji'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26-oji', '26-oji'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27-oji', '27-oji'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28-oji', '28-oji'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29-oji', '29-oji'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30-oji', '30-oji'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31-oji', '31-oji'); - }); - - test('format month', function (assert) { - var expected = 'sausis sau_vasaris vas_kovas kov_balandis bal_gegužė geg_birželis bir_liepa lie_rugpjūtis rgp_rugsėjis rgs_spalis spa_lapkritis lap_gruodis grd'.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 = 'sekmadienis Sek S_pirmadienis Pir P_antradienis Ant A_trečiadienis Tre T_ketvirtadienis Ket K_penktadienis Pen Pn_šeštadienis Šeš Š'.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('format week on US calendar', function (assert) { - // Tests, whether the weekday names are correct, even if the week does not start on Monday - moment.updateLocale('lt', {week: {dow: 0, doy: 6}}); - var expected = 'sekmadienis Sek S_pirmadienis Pir P_antradienis Ant A_trečiadienis Tre T_ketvirtadienis Ket K_penktadienis Pen Pn_šeštadienis Šeš Š'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - moment.updateLocale('lt', null); - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'kelios sekundės', '44 seconds = seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minutė', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minutė', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutės', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 10}), true), '10 minučių', '10 minutes = 10 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 11}), true), '11 minučių', '11 minutes = 11 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 19}), true), '19 minučių', '19 minutes = 19 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 20}), true), '20 minučių', '20 minutes = 20 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutės', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'valanda', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'valanda', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 valandos', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 valandos', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 10}), true), '10 valandų', '10 hours = 10 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 valandos', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'diena', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'diena', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dienos', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'diena', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dienos', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 10}), true), '10 dienų', '10 days = 10 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dienos', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mėnuo', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mėnuo', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mėnuo', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mėnesiai', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mėnesiai', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mėnesiai', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mėnuo', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mėnesiai', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 10}), true), '10 mėnesių', '10 months = 10 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'metai', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 metai', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'metai', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 metai', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'po kelių sekundžių', 'prefix'); - assert.equal(moment(0).from(30000), 'prieš kelias sekundes', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'prieš kelias sekundes', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'po kelių sekundžių', 'in seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'po 5 dienų', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Šiandien 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Šiandien 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Šiandien 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Rytoj 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Šiandien 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Vakar 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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('[Praėjusį] dddd LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Praėjusį] dddd LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Praėjusį] dddd 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 52-oji', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1-oji', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1-oji', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2-oji', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2-oji', 'Jan 15 2012 should be week 2'); - }); - - test('month cases', function (assert) { - assert.equal(moment([2015, 4, 1]).format('LL'), '2015 m. gegužės 1 d.', 'uses format instead of standalone form'); - }); - -}))); - - -;(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('lv'); - - test('parse', function (assert) { - var tests = 'janvāris jan_februāris feb_marts mar_aprīlis apr_maijs mai_jūnijs jūn_jūlijs jūl_augusts aug_septembris sep_oktobris okt_novembris nov_decembris 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, Do MMMM YYYY, h:mm:ss a', 'svētdiena, 14. februāris 2010, 3:25:50 pm'], - ['ddd, hA', 'Sv, 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 februāris feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. svētdiena Sv Sv'], - ['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', '2010. gada 14. februāris'], - ['LLL', '2010. gada 14. februāris, 15:25'], - ['LLLL', '2010. gada 14. februāris, svētdiena, 15:25'], - ['l', '14.2.2010.'], - ['ll', '2010. gada 14. feb'], - ['lll', '2010. gada 14. feb, 15:25'], - ['llll', '2010. gada 14. feb, Sv, 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 = 'janvāris jan_februāris feb_marts mar_aprīlis apr_maijs mai_jūnijs jūn_jūlijs jūl_augusts aug_septembris sep_oktobris okt_novembris nov_decembris 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 = 'svētdiena Sv Sv_pirmdiena P P_otrdiena O O_trešdiena T T_ceturtdiena C C_piektdiena Pk Pk_sestdiena S 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]); - } - }); - - // Includes testing the cases of withoutSuffix = true and false. - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'dažas sekundes', '44 seconds = seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), false), 'pirms dažām sekundēm', '44 seconds with suffix = seconds ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minūte', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), false), 'pirms minūtes', '45 seconds with suffix = a minute ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minūte', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: -89}), false), 'pēc minūtes', '89 seconds with suffix/prefix = in a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minūtes', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), false), 'pirms 2 minūtēm', '90 seconds with suffix = 2 minutes ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minūtes', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), false), 'pirms 44 minūtēm', '44 minutes with suffix = 44 minutes ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'stunda', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), false), 'pirms stundas', '45 minutes with suffix = an hour ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'stunda', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 stundas', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: -90}), false), 'pēc 2 stundām', '90 minutes with suffix = in 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 stundas', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), false), 'pirms 5 stundām', '5 hours with suffix = 5 hours ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 stunda', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), false), 'pirms 21 stundas', '21 hours with suffix = 21 hours ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'diena', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), false), 'pirms dienas', '22 hours with suffix = a day ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'diena', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dienas', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), false), 'pirms 2 dienām', '36 hours with suffix = 2 days ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'diena', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dienas', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), false), 'pirms 5 dienām', '5 days with suffix = 5 days ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dienas', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), false), 'pirms 25 dienām', '25 days with suffix = 25 days ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mēnesis', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), false), 'pirms mēneša', '26 days with suffix = a month ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mēnesis', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mēnesis', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mēneši', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), false), 'pirms 2 mēnešiem', '46 days with suffix = 2 months ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mēneši', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mēneši', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), false), 'pirms 3 mēnešiem', '76 days with suffix = 3 months ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mēnesis', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mēneši', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), false), 'pirms 5 mēnešiem', '5 months with suffix = 5 months ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'gads', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), false), 'pirms gada', '345 days with suffix = a year ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 gadi', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), false), 'pirms 2 gadiem', '548 days with suffix = 2 years ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'gads', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 gadi', '5 years = 5 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), false), 'pirms 5 gadiem', '5 years with suffix = 5 years ago'); - - // test that numbers ending with 1 are singular except for when they end with 11 in which case they are plural - assert.equal(start.from(moment([2007, 1, 28]).add({y: 11}), true), '11 gadi', '11 years = 11 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 21}), true), '21 gads', '21 year = 21 year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 211}), true), '211 gadi', '211 years = 211 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 221}), false), 'pirms 221 gada', '221 year with suffix = 221 years ago'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'pēc dažām sekundēm', 'prefix'); - assert.equal(moment(0).from(30000), 'pirms dažām sekundēm', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'pirms dažām sekundēm', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'pēc dažām sekundēm', 'in seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'pēc 5 dienām', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Šodien pulksten 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Šodien pulksten 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Šodien pulksten 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Rīt pulksten 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Šodien pulksten 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Vakar pulksten 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 [pulksten] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [pulksten] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [pulksten] 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('[Pagājušā] dddd [pulksten] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Pagājušā] dddd [pulksten] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Pagājušā] dddd [pulksten] 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 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; - } - 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('me'); - - test('parse', function (assert) { - var tests = 'januar jan._februar feb._mart mar._april apr._maj maj_jun jun_jul jul_avgust avg._septembar sep._oktobar okt._novembar nov._decembar 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, Do MMMM YYYY, h:mm:ss a', 'nedjelja, 14. februar 2010, 3:25:50 pm'], - ['ddd, hA', 'ned., 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. 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. februar 2010'], - ['LLL', '14. februar 2010 15:25'], - ['LLLL', 'nedjelja, 14. februar 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14. feb. 2010'], - ['lll', '14. feb. 2010 15:25'], - ['llll', 'ned., 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'), '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 = 'januar jan._februar feb._mart mar._april apr._maj maj_jun jun_jul jul_avgust avg._septembar sep._oktobar okt._novembar nov._decembar 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; - 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), 'nekoliko sekundi', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'jedan minut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'jedan minut', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuta', '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), 'za nekoliko sekundi', 'prefix'); - assert.equal(moment(0).from(30000), 'prije nekoliko sekundi', 'prefix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'prije nekoliko sekundi', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'za nekoliko 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(), '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(), 'sjutra 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če 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(makeFormat(m)), '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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - 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) { - var lastWeekDay = [ - '[prošle] [nedjelje] [u] LT', - '[prošlog] [ponedjeljka] [u] LT', - '[prošlog] [utorka] [u] LT', - '[prošle] [srijede] [u] LT', - '[prošlog] [četvrtka] [u] LT', - '[prošlog] [petka] [u] LT', - '[prošle] [subote] [u] LT' - ]; - - return lastWeekDay[d.day()]; - } - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - 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(makeFormat(m)), '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'); - } - }); - - 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'); - }); - - // Monday is the first day of the week. - // The week that contains Jan 1st is the first week of the year. - - 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'); - }); - -}))); - - -;(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('mi'); - - test('parse', function (assert) { - var tests = 'Kohi-tāte Kohi_Hui-tanguru Hui_Poutū-te-rangi Pou_Paenga-whāwhā Pae_Haratua Hara_Pipiri Pipi_Hōngoingoi Hōngoi_Here-turi-kōkā Here_Mahuru Mahu_Whiringa-ā-nuku Whi-nu_Whiringa-ā-rangi Whi-ra_Hakihea Haki'.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', 'Rātapu, Hui-tanguru 14º 2010, 3:25:50 pm'], - ['ddd, hA', 'Ta, 3PM'], - ['M Mo MM MMMM MMM', '2 2º 02 Hui-tanguru Hui'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14º 14'], - ['d do dddd ddd dd', '0 0º Rātapu Ta Ta'], - ['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 Hui-tanguru 2010'], - ['LLL', '14 Hui-tanguru 2010 i 15:25'], - ['LLLL', 'Rātapu, 14 Hui-tanguru 2010 i 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Hui 2010'], - ['lll', '14 Hui 2010 i 15:25'], - ['llll', 'Ta, 14 Hui 2010 i 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 = 'Kohi-tāte Kohi_Hui-tanguru Hui_Poutū-te-rangi Pou_Paenga-whāwhā Pae_Haratua Hara_Pipiri Pipi_Hōngoingoi Hōngoi_Here-turi-kōkā Here_Mahuru Mahu_Whiringa-ā-nuku Whi-nu_Whiringa-ā-rangi Whi-ra_Hakihea Haki'.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 = 'Rātapu Ta Ta_Mane Ma Ma_Tūrei Tū Tū_Wenerei We We_Tāite Tāi Tāi_Paraire Pa Pa_Hātarei Hā Hā'.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), 'te hēkona ruarua', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'he meneti', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'he meneti', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 meneti', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 meneti', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'te haora', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'te haora', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 haora', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 haora', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 haora', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'he ra', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'he ra', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 ra', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'he ra', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 ra', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 ra', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'he marama', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'he marama', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'he marama', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 marama', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 marama', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 marama', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'he marama', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 marama', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'he tau', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 tau', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'he tau', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 tau', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'i roto i te hēkona ruarua', 'prefix'); - assert.equal(moment(0).from(30000), 'te hēkona ruarua i mua', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'te hēkona ruarua i mua', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'i roto i te hēkona ruarua', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'i roto i 5 ra', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'i teie mahana, i 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'i teie mahana, i 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'i teie mahana, i 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'apopo i 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'i teie mahana, i 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'inanahi i 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 [i] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [i] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [i] 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 [whakamutunga i] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [whakamutunga i] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [whakamutunga i] 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 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; - } - 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('mk'); - - test('parse', function (assert) { - 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); - 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', 'недела, февруари 14-ти 2010, 15:25:50'], - ['ddd, hA', 'нед, 3PM'], - ['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-ев недела нед нe'], - ['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 февруари 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; - 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 = 'јануари јан_февруари фев_март мар_април апр_мај мај_јуни јун_јули јул_август авг_септември сеп_октомври окт_ноември ное_декември дек'.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 = 'недела нед нe_понеделник пон пo_вторник вто вт_среда сре ср_четврток чет че_петок пет пе_сабота саб сa'.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), 'неколку секунди', '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), '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: 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), 'после неколку секунди', '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'); - }); - - 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'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - function makeFormat(d) { - switch (d.day()) { - case 0: - case 3: - case 6: - return '[Изминатата] dddd [во] LT'; - case 1: - case 2: - case 4: - case 5: - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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(makeFormat(m)), '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([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'); - }); - -}))); - - -;(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('ml'); - - test('parse', function (assert) { - 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); - 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, Do MMMM YYYY, a h:mm:ss -നു', 'ഞായറാഴ്ച, 14 ഫെബ്രുവരി 2010, ഉച്ച കഴിഞ്ഞ് 3:25:50 -നു'], - ['ddd, a h -നു', 'ഞായർ, ഉച്ച കഴിഞ്ഞ് 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', 'ഉച്ച കഴിഞ്ഞ് ഉച്ച കഴിഞ്ഞ്'], - ['LTS', 'ഉച്ച കഴിഞ്ഞ് 3:25:50 -നു'], - ['L', '14/02/2010'], - ['LL', '14 ഫെബ്രുവരി 2010'], - ['LLL', '14 ഫെബ്രുവരി 2010, ഉച്ച കഴിഞ്ഞ് 3:25 -നു'], - ['LLLL', 'ഞായറാഴ്ച, 14 ഫെബ്രുവരി 2010, ഉച്ച കഴിഞ്ഞ് 3:25 -നു'], - ['l', '14/2/2010'], - ['ll', '14 ഫെബ്രു. 2010'], - ['lll', '14 ഫെബ്രു. 2010, ഉച്ച കഴിഞ്ഞ് 3:25 -നു'], - ['llll', 'ഞായർ, 14 ഫെബ്രു. 2010, ഉച്ച കഴിഞ്ഞ് 3: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 = 'ജനുവരി ജനു._ഫെബ്രുവരി ഫെബ്രു._മാർച്ച് മാർ._ഏപ്രിൽ ഏപ്രി._മേയ് മേയ്_ജൂൺ ജൂൺ_ജൂലൈ ജൂലൈ._ഓഗസ്റ്റ് ഓഗ._സെപ്റ്റംബർ സെപ്റ്റ._ഒക്ടോബർ ഒക്ടോ._നവംബർ നവം._ഡിസംബർ ഡിസം.'.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; - 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), 'അൽപ നിമിഷങ്ങൾ', '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), '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: 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), 'അൽപ നിമിഷങ്ങൾ കഴിഞ്ഞ്', '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'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'അൽപ നിമിഷങ്ങൾ കഴിഞ്ഞ്', 'അൽപ നിമിഷങ്ങൾ കഴിഞ്ഞ്'); - assert.equal(moment().add({d: 5}).fromNow(), '5 ദിവസം കഴിഞ്ഞ്', '5 ദിവസം കഴിഞ്ഞ്'); - }); - - 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: 3}).calendar(), 'ഇന്ന് ഉച്ച കഴിഞ്ഞ് 3:00 -നു', 'Now plus 3 hours'); - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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('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'), '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'); - }); - -}))); - - -;(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('mn'); - - test('parse', function (assert) { - var i, - tests = 'Нэгдүгээр сар-1 сар_Хоёрдугаар сар-2 сар_Гуравдугаар сар-3 сар_Дөрөвдүгээр сар-4 сар_Тавдугаар сар-5 сар_Зургадугаар сар-6 сар_Долдугаар сар-7 сар_Наймдугаар сар-8 сар_Есдүгээр сар-9 сар_Аравдугаар сар-10 сар_Арван нэгдүгээр сар-11 сар_Арван хоёрдугаар сар-12 сар'.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); - 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); - } - - assert.equal(moment('5 сар 11 1989', ['MMM DD YYYY']).format('YYYY-MM-DD'), '1989-05-11'); - assert.equal(moment('1989 он, Арван хоёрдугаар сар 11', ['YYYY [он], MMMM DD']).format('YYYY-MM-DD'), '1989-12-11'); - assert.equal(moment('1989 оны 11 сарын 2', ['YYYY [оны] MMMM[ын] DD']).format('YYYY-MM-D'), '1989-11-2'); - assert.equal(moment('1989 оны 5 сарын 11 өдөр', ['YYYY [оны] MMMM[ын] Do']).format('YYYY-MM-DD'), '1989-05-11'); - assert.equal(moment('1989 оны 5 сарын 11 өдөр 11:25 ҮӨ', ['YYYY [оны] MMM[ын] Do h:mm a']).format('YYYY-MM-DD h:mm a'), '1989-05-11 11:25 ҮӨ'); - assert.equal(moment('2003 оны Дөрөвдүгээр сарын 11 өдөр 17:25 ҮХ', ['YYYY [оны] MMMM[ын] Do HH:mm a']).format('YYYY-MM-DD HH:mm a'), '2003-04-11 17:25 ҮХ'); - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM[ын] Do YYYY, h:mm:ss a', 'Ням, Хоёрдугаар сарын 14 өдөр 2010, 3:25:50 ҮХ'], - ['ddd, hA', 'Ням, 3ҮХ'], - ['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 өдөр Ням Ням Ня'], - ['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', '2010-02-14'], - ['LL', '2010 оны Хоёрдугаар сарын 14'], - ['LLL', '2010 оны Хоёрдугаар сарын 14 15:25'], - ['LLLL', 'Ням, 2010 оны Хоёрдугаар сарын 14 15:25'], - ['l', '2010-2-14'], - ['ll', '2010 оны 2 сарын 14'], - ['lll', '2010 оны 2 сарын 14 15:25'], - ['llll', 'Ням, 2010 оны 2 сарын 14 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 meridiem', function (assert) { - assert.equal(moment([2012, 11, 28, 0, 0]).format('A'), 'ҮӨ', 'AM'); - assert.equal(moment([2012, 11, 28, 11, 59]).format('A'), 'ҮӨ', 'AM'); - assert.equal(moment([2012, 11, 28, 12, 0]).format('A'), 'ҮХ', 'PM'); - assert.equal(moment([2012, 11, 28, 23, 59]).format('A'), 'ҮХ', 'PM'); - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1 өдөр', '1st'); - }); - - test('format month', function (assert) { - var i, - expected = 'Нэгдүгээр сар 1 сар_Хоёрдугаар сар 2 сар_Гуравдугаар сар 3 сар_Дөрөвдүгээр сар 4 сар_Тавдугаар сар 5 сар_Зургадугаар сар 6 сар_Долдугаар сар 7 сар_Наймдугаар сар 8 сар_Есдүгээр сар 9 сар_Аравдугаар сар 10 сар_Арван нэгдүгээр сар 11 сар_Арван хоёрдугаар сар 12 сар'.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 i, - expected = 'Ням Ням Ня_Даваа Дав Да_Мягмар Мяг Мя_Лхагва Лха Лх_Пүрэв Пүр Пү_Баасан Баа Ба_Бямба Бям Бя'.split('_'); - - 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), 'хэдхэн секунд', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), '1 минут', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '1 минут', '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), '1 цаг', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '1 цаг', '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), '1 өдөр', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '1 өдөр', '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 өдөр', '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), '1 сар', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '1 сар', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '1 сар', '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 сар', '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), '1 жил', '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 жил', '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'); - }); - - test('now from now', function (assert) { - 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({s: 50}).fromNow(), '1 минутын дараа', 'in a minute'); - assert.equal(moment().add({m: 5}).fromNow(), '5 минутын дараа', 'in 5 minutes'); - assert.equal(moment().add({h: 2}).fromNow(), '2 цагийн дараа', 'in 2 hours'); - assert.equal(moment().add({d: 5}).fromNow(), '5 өдрийн дараа', 'in 5 days'); - assert.equal(moment().add({M: 2}).fromNow(), '2 сарын дараа', 'in 2 months'); - assert.equal(moment().add({M: 15}).fromNow(), '1 жилийн дараа', 'in a year'); - assert.equal(moment().add({M: 16}).fromNow(), '1 жилийн дараа', 'in a year'); - assert.equal(moment().add({M: 23}).fromNow(), '2 жилийн дараа', 'in 2 years'); - assert.equal(moment().add({y: 7}).fromNow(), '7 жилийн дараа', 'in 7 years'); - - assert.equal(moment().subtract({s: 30}).fromNow(), 'хэдхэн секундын өмнө', 'a few seconds ago'); - assert.equal(moment().subtract({s: 50}).fromNow(), '1 минутын өмнө', 'a minute ago'); - assert.equal(moment().subtract({m: 5}).fromNow(), '5 минутын өмнө', '5 minutes ago'); - assert.equal(moment().subtract({h: 2}).fromNow(), '2 цагийн өмнө', '2 hours ago'); - assert.equal(moment().subtract({d: 5}).fromNow(), '5 өдрийн өмнө', '5 days ago'); - assert.equal(moment().subtract({M: 2}).fromNow(), '2 сарын өмнө', '2 months ago'); - assert.equal(moment().subtract({M: 15}).fromNow(), '1 жилийн өмнө', 'a year ago'); - assert.equal(moment().subtract({M: 16}).fromNow(), '1 жилийн өмнө', 'a year ago'); - assert.equal(moment().subtract({M: 23}).fromNow(), '2 жилийн өмнө', '2 years ago'); - assert.equal(moment().subtract({y: 7}).fromNow(), '7 жилийн өмнө', '7 years ago'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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 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'); - }); - -}))); - - -;(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('mr'); - - test('parse', function (assert) { - 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); - 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, 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'), '१', '१'); - 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; - 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; - 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), 'काही सेकंद', '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'); - }); - - test('now from now', function (assert) { - 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(), '५ दिवसांमध्ये', '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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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('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'); - }); - -}))); - - -;(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('ms-my'); - - test('parse', function (assert) { - var i, - tests = 'Januari Jan_Februari Feb_Mac Mac_April Apr_Mei Mei_Jun Jun_Julai Jul_Ogos Ogs_September Sep_Oktober Okt_November Nov_Disember Dis'.split('_'); - - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' sepatutnya bulan ' + (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', 'Ahad, Februari 14 2010, 3:25:50 petang'], - ['ddd, hA', 'Ahd, 3petang'], - ['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 Ahad Ahd Ah'], - ['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', 'petang petang'], - ['[hari] [ke] DDDo [tahun] ini', 'hari ke 45 tahun ini'], - ['LTS', '15.25.50'], - ['L', '14/02/2010'], - ['LL', '14 Februari 2010'], - ['LLL', '14 Februari 2010 pukul 15.25'], - ['LLLL', 'Ahad, 14 Februari 2010 pukul 15.25'], - ['l', '14/2/2010'], - ['ll', '14 Feb 2010'], - ['lll', '14 Feb 2010 pukul 15.25'], - ['llll', 'Ahd, 14 Feb 2010 pukul 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 i, - expected = 'Januari Jan_Februari Feb_Mac Mac_April Apr_Mei Mei_Jun Jun_Julai Jul_Ogos Ogs_September Sep_Oktober Okt_November Nov_Disember Dis'.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 i, - expected = 'Ahad Ahd Ah_Isnin Isn Is_Selasa Sel Sl_Rabu Rab Rb_Khamis Kha Km_Jumaat Jum Jm_Sabtu Sab Sb'.split('_'); - - 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), 'beberapa saat', '44 saat = beberapa saat'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'seminit', '45 saat = seminit'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'seminit', '89 saat = seminit'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minit', '90 saat = 2 minit'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minit', '44 minit = 44 minit'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'sejam', '45 minit = sejam'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'sejam', '89 minit = sejam'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 jam', '90 minit = 2 jam'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 jam', '5 jam = 5 jam'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 jam', '21 jam = 21 jam'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'sehari', '22 jam = sehari'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'sehari', '35 jam = sehari'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 hari', '36 jam = 2 hari'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'sehari', '1 hari = sehari'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 hari', '5 hari = 5 hari'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 hari', '25 hari = 25 hari'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'sebulan', '26 hari = sebulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'sebulan', '30 hari = sebulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'sebulan', '45 hari = sebulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 bulan', '46 hari = 2 bulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 bulan', '75 hari = 2 bulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 bulan', '76 hari = 3 bulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'sebulan', '1 bulan = sebulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 bulan', '5 bulan = 5 bulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'setahun', '345 hari = setahun'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 tahun', '548 hari = 2 tahun'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'setahun', '1 tahun = setahun'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 tahun', '5 tahun = 5 tahun'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'dalam beberapa saat', 'prefix'); - assert.equal(moment(0).from(30000), 'beberapa saat yang lepas', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'beberapa saat yang lepas', 'waktu sekarang dari sekarang sepatutnya menunjukkan sebagai telah lepas'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'dalam beberapa saat', 'dalam beberapa saat'); - assert.equal(moment().add({d: 5}).fromNow(), 'dalam 5 hari', 'dalam 5 hari'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Hari ini pukul 12.00', 'hari ini pada waktu yang sama'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Hari ini pukul 12.25', 'Sekarang tambah 25 minit'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Hari ini pukul 13.00', 'Sekarang tambah 1 jam'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Esok pukul 12.00', 'esok pada waktu yang sama'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hari ini pukul 11.00', 'Sekarang tolak 1 jam'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kelmarin pukul 12.00', 'kelmarin pada waktu yang sama'); - }); - - 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'), 'Hari ini + ' + i + ' hari waktu sekarang'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Hari ini + ' + i + ' hari permulaan hari'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Hari ini + ' + i + ' hari tamat hari'); - } - }); - - 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 [lepas] [pukul] LT'), 'Hari ini - ' + i + ' hari waktu sekarang'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [lepas] [pukul] LT'), 'Hari ini - ' + i + ' hari permulaan hari'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [lepas] [pukul] LT'), 'Hari ini - ' + i + ' hari tamat hari'); - } - }); - - 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 minggu lepas'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'dalam 1 minggu'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 minggu lepas'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'dalam 2 minggu'); - }); - - test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', 'Jan 1 2012 sepatutnya minggu 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '2 02 2', 'Jan 7 2012 sepatutnya minggu 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 sepatutnya minggu 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '3 03 3', 'Jan 14 2012 sepatutnya minggu 3'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 sepatutnya minggu 3'); - }); - -}))); - - -;(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('ms'); - - test('parse', function (assert) { - var i, - tests = 'Januari Jan_Februari Feb_Mac Mac_April Apr_Mei Mei_Jun Jun_Julai Jul_Ogos Ogs_September Sep_Oktober Okt_November Nov_Disember Dis'.split('_'); - - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' sepatutnya bulan ' + (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', 'Ahad, Februari 14 2010, 3:25:50 petang'], - ['ddd, hA', 'Ahd, 3petang'], - ['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 Ahad Ahd Ah'], - ['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', 'petang petang'], - ['[hari] [ke] DDDo [tahun] ini', 'hari ke 45 tahun ini'], - ['LTS', '15.25.50'], - ['L', '14/02/2010'], - ['LL', '14 Februari 2010'], - ['LLL', '14 Februari 2010 pukul 15.25'], - ['LLLL', 'Ahad, 14 Februari 2010 pukul 15.25'], - ['l', '14/2/2010'], - ['ll', '14 Feb 2010'], - ['lll', '14 Feb 2010 pukul 15.25'], - ['llll', 'Ahd, 14 Feb 2010 pukul 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 i, - expected = 'Januari Jan_Februari Feb_Mac Mac_April Apr_Mei Mei_Jun Jun_Julai Jul_Ogos Ogs_September Sep_Oktober Okt_November Nov_Disember Dis'.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 i, - expected = 'Ahad Ahd Ah_Isnin Isn Is_Selasa Sel Sl_Rabu Rab Rb_Khamis Kha Km_Jumaat Jum Jm_Sabtu Sab Sb'.split('_'); - - 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), 'beberapa saat', '44 saat = beberapa saat'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'seminit', '45 saat = seminit'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'seminit', '89 saat = seminit'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minit', '90 saat = 2 minit'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minit', '44 minit = 44 minit'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'sejam', '45 minit = sejam'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'sejam', '89 minit = sejam'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 jam', '90 minit = 2 jam'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 jam', '5 jam = 5 jam'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 jam', '21 jam = 21 jam'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'sehari', '22 jam = sehari'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'sehari', '35 jam = sehari'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 hari', '36 jam = 2 hari'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'sehari', '1 hari = sehari'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 hari', '5 hari = 5 hari'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 hari', '25 hari = 25 hari'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'sebulan', '26 hari = sebulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'sebulan', '30 hari = sebulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'sebulan', '45 hari = sebulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 bulan', '46 hari = 2 bulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 bulan', '75 hari = 2 bulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 bulan', '76 hari = 3 bulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'sebulan', '1 bulan = sebulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 bulan', '5 bulan = 5 bulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'setahun', '345 hari = setahun'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 tahun', '548 hari = 2 tahun'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'setahun', '1 tahun = setahun'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 tahun', '5 tahun = 5 tahun'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'dalam beberapa saat', 'prefix'); - assert.equal(moment(0).from(30000), 'beberapa saat yang lepas', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'beberapa saat yang lepas', 'waktu sekarang dari sekarang sepatutnya menunjukkan sebagai telah lepas'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'dalam beberapa saat', 'dalam beberapa saat'); - assert.equal(moment().add({d: 5}).fromNow(), 'dalam 5 hari', 'dalam 5 hari'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Hari ini pukul 12.00', 'hari ini pada waktu yang sama'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Hari ini pukul 12.25', 'Sekarang tambah 25 minit'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Hari ini pukul 13.00', 'Sekarang tambah 1 jam'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Esok pukul 12.00', 'esok pada waktu yang sama'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hari ini pukul 11.00', 'Sekarang tolak 1 jam'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kelmarin pukul 12.00', 'kelmarin pada waktu yang sama'); - }); - - 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'), 'Hari ini + ' + i + ' hari waktu sekarang'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Hari ini + ' + i + ' hari permulaan hari'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Hari ini + ' + i + ' hari tamat hari'); - } - }); - - 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 [lepas] [pukul] LT'), 'Hari ini - ' + i + ' hari waktu sekarang'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [lepas] [pukul] LT'), 'Hari ini - ' + i + ' hari permulaan hari'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [lepas] [pukul] LT'), 'Hari ini - ' + i + ' hari tamat hari'); - } - }); - - 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 minggu lepas'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'dalam 1 minggu'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 minggu lepas'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'dalam 2 minggu'); - }); - - test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', 'Jan 1 2012 sepatutnya minggu 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '2 02 2', 'Jan 7 2012 sepatutnya minggu 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 sepatutnya minggu 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '3 03 3', 'Jan 14 2012 sepatutnya minggu 3'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 sepatutnya minggu 3'); - }); - -}))); - - -;(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('mt'); - - test('parse', function (assert) { - var tests = 'Jannar Jan_Frar Fra_Marzu Mar_April Apr_Mejju Mej_Ġunju Ġun_Lulju Lul_Awwissu Aww_Settembru Set_Ottubru Ott_Novembru Nov_Diċembru Diċ'.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', 'Il-Ħadd, Frar 14º 2010, 3:25:50 pm'], - ['ddd, hA', 'Ħad, 3PM'], - ['M Mo MM MMMM MMM', '2 2º 02 Frar Fra'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14º 14'], - ['d do dddd ddd dd', '0 0º Il-Ħadd Ħad Ħa'], - ['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 Frar 2010'], - ['LLL', '14 Frar 2010 15:25'], - ['LLLL', 'Il-Ħadd, 14 Frar 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Fra 2010'], - ['lll', '14 Fra 2010 15:25'], - ['llll', 'Ħad, 14 Fra 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 = 'Jannar Jan_Frar Fra_Marzu Mar_April Apr_Mejju Mej_Ġunju Ġun_Lulju Lul_Awwissu Aww_Settembru Set_Ottubru Ott_Novembru Nov_Diċembru Diċ'.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 = 'Il-Ħadd Ħad Ħa_It-Tnejn Tne Tn_It-Tlieta Tli Tl_L-Erbgħa Erb Er_Il-Ħamis Ħam Ħa_Il-Ġimgħa Ġim Ġi_Is-Sibt Sib Si'.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), 'ftit sekondi', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minuta', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minuta', '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), 'siegħa', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'siegħa', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 siegħat', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 siegħat', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 siegħat', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ġurnata', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ġurnata', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 ġranet', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ġurnata', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 ġranet', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 ġranet', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'xahar', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'xahar', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'xahar', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 xhur', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 xhur', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 xhur', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'xahar', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 xhur', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'sena', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 sni', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'sena', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 sni', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'f’ ftit sekondi', 'prefix'); - assert.equal(moment(0).from(30000), 'ftit sekondi ilu', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'ftit sekondi ilu', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'f’ ftit sekondi', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'f’ 5 ġranet', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Illum fil-12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Illum fil-12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Illum fil-13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Għada fil-12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Illum fil-11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Il-bieraħ fil-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 [fil-]LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [fil-]LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [fil-]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 [li għadda] [fil-]LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [li għadda] [fil-]LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [li għadda] [fil-]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 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; - } - 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('my'); - - test('parse', function (assert) { - 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); - 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', 'တနင်္ဂနွေ, ဖေဖော်ဝါရီ ၁၄ ၂၀၁၀, ၃:၂၅:၅၀ pm'], - ['ddd, hA', 'နွေ, ၃PM'], - ['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', 'pm PM'], - ['[နှစ်၏] DDDo [ရက်မြောက်]', 'နှစ်၏ ၄၅ ရက်မြောက်'], - ['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'), '၁', '၁'); - 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; - 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; - - 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), 'စက္ကန်.အနည်းငယ်', '၄၄ စက္ကန်. = စက္ကန်.အနည်းငယ်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - s: 45 - }), true), 'တစ်မိနစ်', '၄၅ စက္ကန်. = တစ်မိနစ်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - s: 89 - }), true), 'တစ်မိနစ်', '၈၉ စက္ကန်. = တစ်မိနစ်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - s: 90 - }), true), '၂ မိနစ်', '၉၀ စက္ကန်. = ၂ မိနစ်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - m: 44 - }), true), '၄၄ မိနစ်', '၄၄ မိနစ် = ၄၄ မိနစ်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - m: 45 - }), true), 'တစ်နာရီ', '၄၅ မိနစ် = ၁ နာရီ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - m: 89 - }), true), 'တစ်နာရီ', '၈၉ မိနစ် = တစ်နာရီ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - m: 90 - }), true), '၂ နာရီ', 'မိနစ် ၉၀= ၂ နာရီ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - h: 5 - }), true), '၅ နာရီ', '၅ နာရီ= ၅ နာရီ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - h: 21 - }), true), '၂၁ နာရီ', '၂၁ နာရီ =၂၁ နာရီ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - h: 22 - }), true), 'တစ်ရက်', '၂၂ နာရီ =တစ်ရက်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - h: 35 - }), true), 'တစ်ရက်', '၃၅ နာရီ =တစ်ရက်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - h: 36 - }), true), '၂ ရက်', '၃၆ နာရီ = ၂ ရက်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 1 - }), true), 'တစ်ရက်', '၁ ရက်= တစ်ရက်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 5 - }), true), '၅ ရက်', '၅ ရက် = ၅ ရက်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 25 - }), true), '၂၅ ရက်', '၂၅ ရက်= ၂၅ ရက်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 26 - }), true), 'တစ်လ', '၂၆ ရက် = တစ်လ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 30 - }), true), 'တစ်လ', 'ရက် ၃၀ = တစ်လ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 43 - }), true), 'တစ်လ', '၄၃ ရက် = တစ်လ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 46 - }), true), '၂ လ', '၄၆ ရက် = ၂ လ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 74 - }), true), '၂ လ', '၇၅ ရက်= ၂ လ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 76 - }), true), '၃ လ', '၇၆ ရက် = ၃ လ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - M: 1 - }), true), 'တစ်လ', '၁ လ = တစ်လ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - M: 5 - }), true), '၅ လ', '၅ လ = ၅ လ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 345 - }), true), 'တစ်နှစ်', '၃၄၅ ရက် = တစ်နှစ်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 548 - }), true), '၂ နှစ်', '၅၄၈ ရက် = ၂ နှစ်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - y: 1 - }), true), 'တစ်နှစ်', '၁ နှစ် = တစ်နှစ်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - y: 5 - }), true), '၅ နှစ်', '၅ နှစ် = ၅ နှစ်'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'လာမည့် စက္ကန်.အနည်းငယ် မှာ', 'prefix'); - assert.equal(moment(0).from(30000), 'လွန်ခဲ့သော စက္ကန်.အနည်းငယ် က', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'လွန်ခဲ့သော စက္ကန်.အနည်းငယ် က', 'ယခုမှစပြီး အတိတ်တွင်ဖော်ပြသလိုဖော်ပြမည်'); - }); - - test('fromNow', function (assert) { - 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(), 'ယနေ. ၁၂:၀၀ မှာ', 'ယနေ. ဒီအချိန်'); - assert.equal(moment(a).add({m: 25}).calendar(), 'ယနေ. ၁၂:၂၅ မှာ', 'ယခုမှ ၂၅ မိနစ်ပေါင်းထည့်'); - assert.equal(moment(a).add({h: 1}).calendar(), 'ယနေ. ၁၃:၀၀ မှာ', 'ယခုမှ ၁ နာရီပေါင်းထည့်'); - assert.equal(moment(a).add({d: 1}).calendar(), 'မနက်ဖြန် ၁၂:၀၀ မှာ', 'မနက်ဖြန် ဒီအချိန်'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'ယနေ. ၁၁:၀၀ မှာ', 'ယခုမှ ၁ နာရီနှုတ်'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'မနေ.က ၁၂:၀၀ မှာ', 'မနေ.က ဒီအချိန်'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({ - w: 1 - }), - weeksFromNow = moment().add({ - w: 1 - }); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), 'လွန်ခဲ့သော ၁ ပတ်က'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), '၁ ပတ်အတွင်း'); - - weeksAgo = moment().subtract({ - w: 2 - }); - weeksFromNow = moment().add({ - w: 2 - }); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '၂ ပတ် အရင်က'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), '၂ ပတ် အတွင်း'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '၅၂ ၅၂ ၅၂', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '၁ ၀၁ ၁', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '၁ ၀၁ ၁', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '၂ ၀၂ ၂', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '၂ ၀၂ ၂', '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('nb'); - - test('parse', function (assert) { - var tests = 'januar jan._februar feb._mars mars_april april_mai mai_juni juni_juli juli_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); - 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', 'søndag, februar 14. 2010, 3:25:50 pm'], - ['ddd, hA', 'sø., 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. søndag sø. sø'], - ['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'], - ['[den] DDDo [dagen i året]', 'den 45. dagen i året'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14. februar 2010'], - ['LLL', '14. februar 2010 kl. 15:25'], - ['LLLL', 'søndag 14. februar 2010 kl. 15:25'], - ['l', '14.2.2010'], - ['ll', '14. feb. 2010'], - ['lll', '14. feb. 2010 kl. 15:25'], - ['llll', 'sø. 14. feb. 2010 kl. 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 = 'januar jan._februar feb._mars mars_april april_mai mai_juni juni_juli juli_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 expected = 'søndag sø. sø_mandag ma. ma_tirsdag ti. ti_onsdag on. on_torsdag to. to_fredag fr. fr_lørdag 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]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'noen sekunder', '44 sekunder = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ett minutt', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ett minutt', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutter', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutter', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'en time', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'en time', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 timer', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 timer', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 timer', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'en dag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'en dag', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dager', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'en dag', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dager', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dager', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'en måned', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'en måned', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'en måned', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 måneder', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 måneder', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 måneder', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'en måned', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 måneder', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ett å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), 'ett å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), 'om noen sekunder', 'prefix'); - assert.equal(moment(0).from(30000), 'noen sekunder siden', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'noen sekunder siden', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'om noen sekunder', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'om 5 dager', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'i dag kl. 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'i dag kl. 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'i dag kl. 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'i morgen kl. 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'i dag kl. 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'i 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 [kl.] 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - 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('[forrige] dddd [kl.] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[forrige] dddd [kl.] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[forrige] dddd [kl.] 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 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; - } - 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('ne'); - - test('parse', function (assert) { - 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); - 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, 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'), '१', '१'); - 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; - 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; - 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), 'केही क्षण', '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'); - }); - - test('now from now', function (assert) { - 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(), '५ दिनमा', '५ दिनमा'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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('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([2011, 11, 26]).format('w ww wo'), '५३ ५३ ५३', 'Dec 26 2011 should be week 53'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '१ ०१ १', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '१ ०१ १', 'Jan 2 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, 9]).format('w ww wo'), '२ ०२ २', 'Jan 9 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('nl-be'); - - test('parse', function (assert) { - var tests = 'januari jan._februari feb._maart mrt._april apr._mei mei._juni jun._juli jul._augustus aug._september sep._oktober 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)); - } - 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', 'zondag, februari 14de 2010, 15:25:50'], - ['ddd, HH', 'zo., 15'], - ['M Mo MM MMMM MMM', '2 2de 02 februari feb.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14de 14'], - ['d do dddd ddd dd', '0 0de zondag zo. zo'], - ['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 februari 2010'], - ['LLL', '14 februari 2010 15:25'], - ['LLLL', 'zondag 14 februari 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 feb. 2010'], - ['lll', '14 feb. 2010 15:25'], - ['llll', 'zo. 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 = 'januari jan._februari feb._maart mrt._april apr._mei mei_juni jun._juli jul._augustus aug._september sep._oktober 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 = 'zondag zo. zo_maandag ma. ma_dinsdag di. di_woensdag wo. wo_donderdag do. do_vrijdag vr. vr_zaterdag za. za'.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), 'een paar seconden', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'één minuut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'één minuut', '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), 'één uur', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'één uur', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 uur', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 uur', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 uur', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'één dag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'één dag', '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), 'één dag', '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), 'één maand', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'één maand', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'één maand', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 maanden', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 maanden', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 maanden', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'één maand', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 maanden', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'één jaar', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 jaar', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'één jaar', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 jaar', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'over een paar seconden', 'prefix'); - assert.equal(moment(0).from(30000), 'een paar seconden geleden', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'een paar seconden geleden', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'over een paar seconden', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'over 5 dagen', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'vandaag om 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'vandaag om 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'vandaag om 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'morgen om 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'vandaag om 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'gisteren 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('[afgelopen] dddd [om] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[afgelopen] dddd [om] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[afgelopen] 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]).unix(), moment('23-jun-2012', 'D-MMM-YYYY').unix(), 'parse month abbreviation surrounded by dashes without 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(moment([2012, 5, 23]).unix(), moment('23 jun. 2012', 'D MMM YYYY').unix(), 'parse month abbreviation not surrounded by dashes with 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('nl'); - - test('parse', function (assert) { - var tests = 'januari jan._februari feb._maart mrt._april apr._mei mei._juni jun._juli jul._augustus aug._september sep._oktober 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)); - } - 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', 'zondag, februari 14de 2010, 15:25:50'], - ['ddd, HH', 'zo., 15'], - ['M Mo MM MMMM MMM', '2 2de 02 februari feb.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14de 14'], - ['d do dddd ddd dd', '0 0de zondag zo. zo'], - ['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 februari 2010'], - ['LLL', '14 februari 2010 15:25'], - ['LLLL', 'zondag 14 februari 2010 15:25'], - ['l', '14-2-2010'], - ['ll', '14 feb. 2010'], - ['lll', '14 feb. 2010 15:25'], - ['llll', 'zo. 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 = 'januari jan._februari feb._maart mrt._april apr._mei mei_juni jun._juli jul._augustus aug._september sep._oktober 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 = 'zondag zo. zo_maandag ma. ma_dinsdag di. di_woensdag wo. wo_donderdag do. do_vrijdag vr. vr_zaterdag za. za'.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), 'een paar seconden', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'één minuut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'één minuut', '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), 'één uur', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'één uur', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 uur', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 uur', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 uur', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'één dag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'één dag', '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), 'één dag', '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), 'één maand', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'één maand', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'één maand', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 maanden', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 maanden', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 maanden', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'één maand', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 maanden', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'één jaar', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 jaar', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'één jaar', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 jaar', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'over een paar seconden', 'prefix'); - assert.equal(moment(0).from(30000), 'een paar seconden geleden', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'een paar seconden geleden', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'over een paar seconden', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'over 5 dagen', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'vandaag om 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'vandaag om 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'vandaag om 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'morgen om 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'vandaag om 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'gisteren 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('[afgelopen] dddd [om] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[afgelopen] dddd [om] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[afgelopen] 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]).unix(), moment('23-jun-2012', 'D-MMM-YYYY').unix(), 'parse month abbreviation surrounded by dashes without 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(moment([2012, 5, 23]).unix(), moment('23 jun. 2012', 'D MMM YYYY').unix(), 'parse month abbreviation not surrounded by dashes with 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('nn'); - - test('parse', function (assert) { - var tests = 'januar jan_februar feb_mars mar_april 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); - 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', 'sundag, februar 14. 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. sundag 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'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14. februar 2010'], - ['LLL', '14. februar 2010 kl. 15:25'], - ['LLLL', 'sundag 14. februar 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; - 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 = 'januar jan_februar feb_mars mar_april 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 expected = 'sundag sun su_måndag mån må_tysdag tys ty_onsdag ons on_torsdag tor to_fredag fre fr_laurdag lau 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]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'nokre sekund', '44 sekunder = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'eit minutt', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'eit minutt', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutt', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutt', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ein time', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ein time', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 timar', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 timar', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 timar', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ein dag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ein dag', '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 dag', '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ånad', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ein månad', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ein månad', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 månader', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 månader', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 månader', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ein månad', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 månader', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'eit å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), 'eit å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), 'om nokre sekund', 'prefix'); - assert.equal(moment(0).from(30000), 'nokre sekund sidan', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'nokre sekund sidan', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'om nokre sekund', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'om 5 dagar', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'I dag klokka 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'I dag klokka 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'I dag klokka 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'I morgon klokka 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'I dag klokka 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'I går klokka 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 [klokka] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [klokka] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [klokka] 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('[Føregåande] dddd [klokka] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Føregåande] dddd [klokka] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Føregåande] dddd [klokka] 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 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; - } - 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('pa-in'); - - test('parse', function (assert) { - 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); - 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, 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'), '੧', '੧'); - 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; - 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; - 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), 'ਕੁਝ ਸਕਿੰਟ', '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'); - }); - - test('now from now', function (assert) { - 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(), '੫ ਦਿਨ ਵਿੱਚ', '੫ ਦਿਨ ਵਿੱਚ'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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('meridiem invariant', 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', function (assert) { - assert.equal(moment([2012, 0, 1]).week(), 1, 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).week(), 1, 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).week(), 2, 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).week(), 2, 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).week(), 3, 'Jan 15 2012 should be week 3'); - }); - - test('weeks year starting monday', function (assert) { - assert.equal(moment([2006, 11, 31]).week(), 1, 'Dec 31 2006 should be week 1'); - assert.equal(moment([2007, 0, 1]).week(), 1, 'Jan 1 2007 should be week 1'); - assert.equal(moment([2007, 0, 6]).week(), 1, 'Jan 6 2007 should be week 1'); - assert.equal(moment([2007, 0, 7]).week(), 2, 'Jan 7 2007 should be week 2'); - assert.equal(moment([2007, 0, 13]).week(), 2, 'Jan 13 2007 should be week 2'); - assert.equal(moment([2007, 0, 14]).week(), 3, 'Jan 14 2007 should be week 3'); - }); - - test('weeks year starting tuesday', function (assert) { - assert.equal(moment([2007, 11, 29]).week(), 52, 'Dec 29 2007 should be week 52'); - assert.equal(moment([2008, 0, 1]).week(), 1, 'Jan 1 2008 should be week 1'); - assert.equal(moment([2008, 0, 5]).week(), 1, 'Jan 5 2008 should be week 1'); - assert.equal(moment([2008, 0, 6]).week(), 2, 'Jan 6 2008 should be week 2'); - assert.equal(moment([2008, 0, 12]).week(), 2, 'Jan 12 2008 should be week 2'); - assert.equal(moment([2008, 0, 13]).week(), 3, 'Jan 13 2008 should be week 3'); - }); - - test('weeks year starting wednesday', function (assert) { - assert.equal(moment([2002, 11, 29]).week(), 1, 'Dec 29 2002 should be week 1'); - assert.equal(moment([2003, 0, 1]).week(), 1, 'Jan 1 2003 should be week 1'); - assert.equal(moment([2003, 0, 4]).week(), 1, 'Jan 4 2003 should be week 1'); - assert.equal(moment([2003, 0, 5]).week(), 2, 'Jan 5 2003 should be week 2'); - assert.equal(moment([2003, 0, 11]).week(), 2, 'Jan 11 2003 should be week 2'); - assert.equal(moment([2003, 0, 12]).week(), 3, 'Jan 12 2003 should be week 3'); - }); - - test('weeks year starting thursday', function (assert) { - assert.equal(moment([2008, 11, 28]).week(), 1, 'Dec 28 2008 should be week 1'); - assert.equal(moment([2009, 0, 1]).week(), 1, 'Jan 1 2009 should be week 1'); - assert.equal(moment([2009, 0, 3]).week(), 1, 'Jan 3 2009 should be week 1'); - assert.equal(moment([2009, 0, 4]).week(), 2, 'Jan 4 2009 should be week 2'); - assert.equal(moment([2009, 0, 10]).week(), 2, 'Jan 10 2009 should be week 2'); - assert.equal(moment([2009, 0, 11]).week(), 3, 'Jan 11 2009 should be week 3'); - }); - - test('weeks year starting friday', function (assert) { - assert.equal(moment([2009, 11, 27]).week(), 1, 'Dec 27 2009 should be week 1'); - assert.equal(moment([2010, 0, 1]).week(), 1, 'Jan 1 2010 should be week 1'); - assert.equal(moment([2010, 0, 2]).week(), 1, 'Jan 2 2010 should be week 1'); - assert.equal(moment([2010, 0, 3]).week(), 2, 'Jan 3 2010 should be week 2'); - assert.equal(moment([2010, 0, 9]).week(), 2, 'Jan 9 2010 should be week 2'); - assert.equal(moment([2010, 0, 10]).week(), 3, 'Jan 10 2010 should be week 3'); - }); - - test('weeks year starting saturday', function (assert) { - assert.equal(moment([2010, 11, 26]).week(), 1, 'Dec 26 2010 should be week 1'); - assert.equal(moment([2011, 0, 1]).week(), 1, 'Jan 1 2011 should be week 1'); - assert.equal(moment([2011, 0, 2]).week(), 2, 'Jan 2 2011 should be week 2'); - assert.equal(moment([2011, 0, 8]).week(), 2, 'Jan 8 2011 should be week 2'); - assert.equal(moment([2011, 0, 9]).week(), 3, 'Jan 9 2011 should be week 3'); - }); - - 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('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); - } - }); - -}))); - - -;(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('pl'); - - test('parse', function (assert) { - var tests = 'styczeń stycznia sty_luty lutego lut_marzec marca mar_kwiecień kwietnia kwi_maj maja maj_czerwiec czerwca cze_lipiec lipca lip_sierpień sierpnia sie_wrzesień września wrz_październik października paź_listopad listopada lis_grudzień grudnia gru'.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][2], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][2], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][2].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][2].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('parse strict', function (assert) { - var tests = 'styczeń stycznia sty_luty lutego lut_marzec marca mar_kwiecień kwietnia kwi_maj maja maj_czerwiec czerwca cze_lipiec lipca lip_sierpień sierpnia sie_wrzesień września wrz_październik października paź_listopad listopada lis_grudzień grudnia gru'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm, true).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][2], 'MMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][2].toLocaleLowerCase(), 'MMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][2].toLocaleUpperCase(), 'MMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'niedziela, luty 14. 2010, 3:25:50 pm'], - ['ddd, hA', 'ndz, 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 luty lut'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. niedziela ndz Nd'], - ['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 lutego 2010'], - ['LLL', '14 lutego 2010 15:25'], - ['LLLL', 'niedziela, 14 lutego 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14 lut 2010'], - ['lll', '14 lut 2010 15:25'], - ['llll', 'ndz, 14 lut 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 = 'styczeń sty_luty lut_marzec mar_kwiecień kwi_maj maj_czerwiec cze_lipiec lip_sierpień sie_wrzesień wrz_październik paź_listopad lis_grudzień gru'.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 = 'niedziela ndz Nd_poniedziałek pon Pn_wtorek wt Wt_środa śr Śr_czwartek czw Cz_piątek pt Pt_sobota sob 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), 'kilka sekund', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minuta', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minuta', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuty', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuty', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'godzina', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'godzina', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 godziny', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 godzin', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 godzin', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), '1 dzień', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '1 dzień', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dni', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), '1 dzień', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dni', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dni', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'miesiąc', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'miesiąc', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'miesiąc', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 miesiące', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 miesiące', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 miesiące', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'miesiąc', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 miesięcy', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'rok', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 lata', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'rok', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 lat', '5 years = 5 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 112}), true), '112 lat', '112 years = 112 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 122}), true), '122 lata', '122 years = 122 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 213}), true), '213 lat', '213 years = 213 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 223}), true), '223 lata', '223 years = 223 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'za kilka sekund', 'prefix'); - assert.equal(moment(0).from(30000), 'kilka sekund temu', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'kilka sekund temu', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'za kilka sekund', 'in a few seconds'); - assert.equal(moment().add({h: 1}).fromNow(), 'za godzinę', 'in an hour'); - assert.equal(moment().add({d: 5}).fromNow(), 'za 5 dni', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Dziś o 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Dziś o 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Dziś o 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Jutro o 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Dziś o 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Wczoraj o 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 '[W niedzielę o] LT'; - - case 2: - return '[We wtorek o] LT'; - - case 3: - return '[W środę o] LT'; - - case 6: - return '[W sobotę o] LT'; - - default: - return '[W] dddd [o] 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'); - - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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(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: - return '[W zeszłą niedzielę o] LT'; - case 3: - return '[W zeszłą środę o] LT'; - case 6: - return '[W zeszłą sobotę o] LT'; - default: - return '[W zeszły] dddd [o] 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'); - - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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(makeFormat(m)), '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 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; - } - 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('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; - - 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, Fevereiro 14º 2010, 3:25:50 pm'], - ['ddd, hA', 'Dom, 3PM'], - ['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'], - ['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', '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 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'] - ], - 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 = '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]); - } - }); - - test('format week', function (assert) { - var expected = 'Domingo Dom Do_Segunda-feira Seg 2ª_Terça-feira Ter 3ª_Quarta-feira Qua 4ª_Quinta-feira Qui 5ª_Sexta-feira Sex 6ª_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), 'poucos segundos', '44 seconds = seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'um minuto', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'um 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), 'uma hora', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'uma 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), 'um dia', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'um dia', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dias', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'um dia', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dias', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dias', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'um mês', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'um mês', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'um mês', '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), 'um mês', '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), 'um 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), 'um 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), 'em poucos segundos', 'prefix'); - assert.equal(moment(0).from(30000), 'há poucos segundos', 'prefix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'em poucos segundos', 'in seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'em 5 dias', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Hoje às 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Hoje às 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Hoje às 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Amanhã às 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hoje às 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ontem às 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 [às] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [às] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [à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((m.day() === 0 || m.day() === 6) ? '[Último] dddd [às] LT' : '[Última] dddd [às] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format((m.day() === 0 || m.day() === 6) ? '[Último] dddd [às] LT' : '[Última] dddd [às] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format((m.day() === 0 || m.day() === 6) ? '[Último] dddd [às] LT' : '[Última] dddd [às] 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 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('relative time threshold', function (assert) { - var rts = moment(), - rtsDefault = moment.relativeTimeThreshold('ss'); - - moment.relativeTimeThreshold('ss', 3); - - rts.subtract(3, 'seconds'); - assert.equal(rts.fromNow(), 'há poucos segundos', 'Below custom a few seconds to seconds threshold'); - rts.subtract(1, 'seconds'); - assert.equal(rts.fromNow(), 'há 4 segundos', 'Above custom a few seconds to seconds threshold'); - - moment.relativeTimeThreshold('ss', rtsDefault); - }); - -}))); - - -;(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('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; - 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, Fevereiro 14º 2010, 3:25:50 pm'], - ['ddd, hA', 'Dom, 3PM'], - ['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'], - ['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 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'] - ], - 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 = '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]); - } - }); - - test('format week', function (assert) { - var expected = 'Domingo Dom Do_Segunda-feira Seg 2ª_Terça-feira Ter 3ª_Quarta-feira Qua 4ª_Quinta-feira Qui 5ª_Sexta-feira Sex 6ª_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), 'segundos', '44 seconds = seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'um minuto', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'um 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), 'uma hora', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'uma 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), 'um dia', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'um dia', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dias', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'um dia', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dias', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dias', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'um mês', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'um mês', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'um mês', '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), 'um mês', '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), 'um 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), 'um 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), 'em segundos', 'prefix'); - assert.equal(moment(0).from(30000), 'há segundos', 'suffix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'em segundos', 'in seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'em 5 dias', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Hoje às 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Hoje às 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Hoje às 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Amanhã às 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hoje às 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ontem às 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 [às] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [às] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [à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((m.day() === 0 || m.day() === 6) ? '[Último] dddd [às] LT' : '[Última] dddd [às] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format((m.day() === 0 || m.day() === 6) ? '[Último] dddd [às] LT' : '[Última] dddd [às] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format((m.day() === 0 || m.day() === 6) ? '[Último] dddd [às] LT' : '[Última] dddd [às] 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 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; - } - 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('ro'); - - test('parse', function (assert) { - var tests = 'ianuarie ian._februarie febr._martie mart._aprilie apr._mai mai_iunie iun._iulie iul._august aug._septembrie sept._octombrie oct._noiembrie nov._decembrie 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', 'duminică, februarie 14 2010, 3:25:50 PM'], - ['ddd, hA', 'Dum, 3PM'], - ['M Mo MM MMMM MMM', '2 2 02 februarie febr.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 duminică Dum Du'], - ['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'], - ['[a] DDDo[a zi a anului]', 'a 45a zi a anului'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 februarie 2010'], - ['LLL', '14 februarie 2010 15:25'], - ['LLLL', 'duminică, 14 februarie 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14 febr. 2010'], - ['lll', '14 febr. 2010 15:25'], - ['llll', 'Dum, 14 febr. 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 = 'ianuarie ian._februarie febr._martie mart._aprilie apr._mai mai_iunie iun._iulie iul._august aug._septembrie sept._octombrie oct._noiembrie nov._decembrie 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 = 'duminică Dum Du_luni Lun Lu_marți Mar Ma_miercuri Mie Mi_joi Joi Jo_vineri Vin Vi_sâmbătă Sâm 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), 'câteva secunde', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'un minut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'un minut', '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 de minute', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'o oră', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'o oră', '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 de ore', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'o zi', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'o zi', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 zile', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'o zi', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 zile', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 de zile', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'o lună', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'o lună', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'o lună', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 luni', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 luni', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 luni', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'o lună', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 luni', '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 ani', '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 ani', '5 years = 5 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 19}), true), '19 ani', '19 years = 19 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 20}), true), '20 de ani', '20 years = 20 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 100}), true), '100 de ani', '100 years = 100 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 101}), true), '101 ani', '101 years = 101 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 119}), true), '119 ani', '119 years = 119 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 120}), true), '120 de ani', '120 years = 120 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 219}), true), '219 ani', '219 years = 219 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 220}), true), '220 de ani', '220 years = 220 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'peste câteva secunde', 'prefix'); - assert.equal(moment(0).from(30000), 'câteva secunde în urmă', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'câteva secunde în urmă', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'peste câteva secunde', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'peste 5 zile', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'azi la 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'azi la 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'azi la 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'mâine la 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'azi la 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'ieri la 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 [la] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [la] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [la] 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('[fosta] dddd [la] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[fosta] dddd [la] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[fosta] dddd [la] 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([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'); - }); - -}))); - - -;(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('ru'); - - test('parse', function (assert) { - var tests = 'январь янв._февраль февр._март март_апрель апр._май май_июнь июнь_июль июль_август авг._сентябрь сент._октябрь окт._ноябрь нояб._декабрь дек.'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - function equalTestStrict(input, mmm, monthIndex) { - assert.equal(moment(input, mmm, true).month(), monthIndex, input + ' ' + mmm + ' should be strict month ' + (monthIndex + 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); - - equalTestStrict(tests[i][1], 'MMM', i); - equalTestStrict(tests[i][0], 'MMMM', i); - equalTestStrict(tests[i][1].toLocaleLowerCase(), 'MMM', i); - equalTestStrict(tests[i][1].toLocaleUpperCase(), 'MMM', i); - equalTestStrict(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTestStrict(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - } - }); - - 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 февраль февр.'], - ['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', '6 6-я 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'дня дня'], - ['DDDo [день года]', '45-й день года'], - ['LT', '15:25'], - ['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; - 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 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; - 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; - 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), 'несколько секунд', '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: 31}), true), '31 минута', '31 minutes = 31 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), 'через несколько секунд', 'prefix'); - assert.equal(moment(0).from(30000), 'несколько секунд назад', 'suffix'); - }); - - 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({m: 31}).fromNow(), 'через 31 минуту', 'in 31 minutes = in 31 minutes'); - assert.equal(moment().subtract({m: 31}).fromNow(), '31 минуту назад', '31 minutes ago = 31 minutes ago'); - }); - - 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({h: 4}).calendar(), 'Сегодня, в 8:00', 'Now minus 4 hours'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Вчера, в 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m, now; - - function makeFormatNext(d) { - switch (d.day()) { - case 0: - return '[В следующее] dddd, [в] LT'; - case 1: - case 2: - case 4: - return '[В следующий] dddd, [в] LT'; - case 3: - case 5: - case 6: - return '[В следующую] dddd, [в] LT'; - } - } - - function makeFormatThis(d) { - if (d.day() === 2) { - return '[Во] dddd, [в] LT'; - } - else { - return '[В] dddd, [в] LT'; - } - } - - now = moment().startOf('week'); - for (i = 2; i < 7; i++) { - m = moment(now).add({d: i}); - assert.equal(m.calendar(now), m.format(makeFormatThis(m)), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(now), m.format(makeFormatThis(m)), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(now), m.format(makeFormatThis(m)), 'Today + ' + i + ' days end of day'); - } - - now = moment().endOf('week'); - for (i = 2; i < 7; i++) { - m = moment(now).add({d: i}); - assert.equal(m.calendar(now), m.format(makeFormatNext(m)), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(now), m.format(makeFormatNext(m)), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(now), m.format(makeFormatNext(m)), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m, now; - - function makeFormatLast(d) { - switch (d.day()) { - case 0: - return '[В прошлое] dddd, [в] LT'; - case 1: - case 2: - case 4: - return '[В прошлый] dddd, [в] LT'; - case 3: - case 5: - case 6: - return '[В прошлую] dddd, [в] LT'; - } - } - - function makeFormatThis(d) { - if (d.day() === 2) { - return '[Во] dddd, [в] LT'; - } - else { - return '[В] dddd, [в] LT'; - } - } - - now = moment().startOf('week'); - for (i = 2; i < 7; i++) { - m = moment(now).subtract({d: i}); - assert.equal(m.calendar(now), m.format(makeFormatLast(m)), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(now), m.format(makeFormatLast(m)), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(now), m.format(makeFormatLast(m)), 'Today - ' + i + ' days end of day'); - } - - now = moment().endOf('week'); - for (i = 2; i < 7; i++) { - m = moment(now).subtract({d: i}); - assert.equal(m.calendar(now), m.format(makeFormatThis(m)), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(now), m.format(makeFormatThis(m)), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(now), m.format(makeFormatThis(m)), '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 monday 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'); - }); - -}))); - - -;(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('sd'); - - var months = [ - 'جنوري', - 'فيبروري', - 'مارچ', - 'اپريل', - 'مئي', - 'جون', - 'جولاءِ', - 'آگسٽ', - 'سيپٽمبر', - 'آڪٽوبر', - 'نومبر', - 'ڊسمبر' - ]; - var days = [ - 'آچر', - 'سومر', - 'اڱارو', - 'اربع', - 'خميس', - 'جمع', - 'ڇنڇر' - ]; - - test('parse', function (assert) { - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (var i = 0; i < 12; i++) { - equalTest(months[i], 'MMM', i); - equalTest(months[i], 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'آچر، فيبروري 14 2010، 3:25:50 شام'], - ['ddd, hA', 'آچر، 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', '6 6 06'], - ['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'] - ], - 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) { - for (var i = 0; i < months.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), months[i] + ' ' + months[i], months[i] + ' ' + months[i]); - } - }); - - test('format week', function (assert) { - for (var i = 0; i < days.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), days[i] + ' ' + days[i] + ' ' + days[i], days[i] + ' ' + days[i] + ' ' + days[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'چند سيڪنڊ', '44 seconds = چند سيڪنڊ'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'هڪ منٽ', '45 seconds = هڪ منٽ'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'هڪ منٽ', '89 seconds = هڪ منٽ'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 منٽ', '90 seconds = 2 منٽ'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 منٽ', '44 minutes = 44 منٽ'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'هڪ ڪلاڪ', '45 minutes = هڪ ڪلاڪ'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'هڪ ڪلاڪ', '89 minutes = هڪ ڪلاڪ'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 ڪلاڪ', '90 minutes = 2 ڪلاڪ'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ڪلاڪ', '5 hours = 5 ڪلاڪ'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 ڪلاڪ', '21 hours = 21 ڪلاڪ'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'هڪ ڏينهن', '22 hours = هڪ ڏينهن'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'هڪ ڏينهن', '35 hours = هڪ ڏينهن'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 ڏينهن', '36 hours = 2 ڏينهن'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'هڪ ڏينهن', '1 day = هڪ ڏينهن'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 ڏينهن', '5 days = 5 ڏينهن'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 ڏينهن', '25 days = 25 ڏينهن'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'هڪ مهينو', '26 days = هڪ مهينو'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'هڪ مهينو', '30 days = هڪ مهينو'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'هڪ مهينو', '43 days = هڪ مهينو'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 مهينا', '46 days = 2 مهينا'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 مهينا', '75 days = 2 مهينا'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 مهينا', '76 days = 3 مهينا'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'هڪ مهينو', '1 month = هڪ مهينو'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 مهينا', '5 months = 5 مهينا'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'هڪ سال', '345 days = هڪ سال'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 سال', '548 days = 2 سال'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'هڪ سال', '1 year = هڪ سال'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 سال', '5 years = 5 سال'); - }); - - test('suffix', function (assert) { - 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'); - }); - - 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'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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 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; - } - 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('se'); - - test('parse', function (assert) { - var i, - tests = 'ođđajagemánnu ođđj_guovvamánnu guov_njukčamánnu njuk_cuoŋománnu cuo_miessemánnu mies_geassemánnu geas_suoidnemánnu suoi_borgemánnu borg_čakčamánnu čakč_golggotmánnu golg_skábmamánnu skáb_juovlamánnu juov'.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); - 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', 'sotnabeaivi, guovvamánnu 14. 2010, 3:25:50 pm'], - ['ddd, hA', 'sotn, 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 guovvamánnu guov'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. sotnabeaivi sotn s'], - ['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'], - ['[jagi] DDDo [beaivi]', 'jagi 45. beaivi'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', 'guovvamánnu 14. b. 2010'], - ['LLL', 'guovvamánnu 14. b. 2010 ti. 15:25'], - ['LLLL', 'sotnabeaivi, guovvamánnu 14. b. 2010 ti. 15:25'], - ['l', '14.2.2010'], - ['ll', 'guov 14. b. 2010'], - ['lll', 'guov 14. b. 2010 ti. 15:25'], - ['llll', 'sotn, guov 14. b. 2010 ti. 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 i, - expected = 'ođđajagemánnu ođđj_guovvamánnu guov_njukčamánnu njuk_cuoŋománnu cuo_miessemánnu mies_geassemánnu geas_suoidnemánnu suoi_borgemánnu borg_čakčamánnu čakč_golggotmánnu golg_skábmamánnu skáb_juovlamánnu juov'.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 i, - expected = 'sotnabeaivi sotn s_vuossárga vuos v_maŋŋebárga maŋ m_gaskavahkku gask g_duorastat duor d_bearjadat bear b_lávvardat láv L'.split('_'); - - 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), 'moadde sekunddat', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'okta minuhta', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'okta minuhta', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuhtat', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuhtat', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'okta diimmu', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'okta diimmu', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 diimmut', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 diimmut', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 diimmut', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'okta beaivi', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'okta beaivi', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 beaivvit', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'okta beaivi', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 beaivvit', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 beaivvit', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'okta mánnu', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'okta mánnu', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'okta mánnu', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mánut', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mánut', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mánut', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'okta mánnu', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mánut', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'okta jahki', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 jagit', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'okta jahki', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 jagit', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'moadde sekunddat geažes', 'prefix'); - assert.equal(moment(0).from(30000), 'maŋit moadde sekunddat', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'maŋit moadde sekunddat', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'moadde sekunddat geažes', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5 beaivvit geažes', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'otne ti 12:00', 'Today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'otne ti 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'otne ti 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'ihttin ti 12:00', 'Tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'otne ti 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'ikte ti 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 [ti] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [ti] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [ti] 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('[ovddit] dddd [ti] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[ovddit] dddd [ti] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[ovddit] dddd [ti] 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 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; - } - 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('si'); - - /*jshint -W100*/ - test('parse', function (assert) { - 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); - 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 = [ - ['YYYY MMMM Do dddd, a h:mm:ss', '2010 පෙබරවාරි 14 වැනි ඉරිදා, ප.ව. 3:25:50'], - ['YYYY MMMM Do dddd, a h:mm:ss', '2010 පෙබරවාරි 14 වැනි ඉරිදා, ප.ව. 3:25:50'], - ['ddd, A h', 'ඉරි, පස් වරු 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'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'ප.ව. පස් වරු'], - ['[වසරේ] DDDo [දිනය]', 'වසරේ 45 වැනි දිනය'], - ['LTS', 'ප.ව. 3:25:50'], - ['LT', 'ප.ව. 3:25'], - ['L', '2010/02/14'], - ['LL', '2010 පෙබරවාරි 14'], - ['LLL', '2010 පෙබරවාරි 14, ප.ව. 3:25'], - ['LLLL', '2010 පෙබරවාරි 14 වැනි ඉරිදා, ප.ව. 3:25:50'], - ['l', '2010/2/14'], - ['ll', '2010 පෙබ 14'], - ['lll', '2010 පෙබ 14, ප.ව. 3:25'], - ['llll', '2010 පෙබ 14 වැනි ඉරි, ප.ව. 3:25:50'] - ], - 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 = 'ජනවාරි ජන_පෙබරවාරි පෙබ_මාර්තු මාර්_අප්‍රේල් අප්_මැයි මැයි_ජූනි ජූනි_ජූලි ජූලි_අගෝස්තු අගෝ_සැප්තැම්බර් සැප්_ඔක්තෝබර් ඔක්_නොවැම්බර් නොවැ_දෙසැම්බර් දෙසැ'.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; - 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), 'තත්පර කිහිපය', '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), 'පැය 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: 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), 'තත්පර කිහිපයකින්', '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'); - }); - - 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'); - }); - - 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(), 'අද ප.ව. 1: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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - }); - -}))); - - -;(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('sk'); - - test('parse', function (assert) { - var tests = 'január jan._február feb._marec mar._apríl apr._máj máj_jún jún._júl júl._august aug._september sep._október okt._november nov._december dec.'.split('_'), i; - function equalTest(input, mmm, monthIndex) { - assert.equal(moment(input, mmm).month(), monthIndex, input + ' should be month ' + (monthIndex + 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', 'nedeľa, február 14. 2010, 3:25:50'], - ['ddd, h', 'ne, 3'], - ['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. nedeľa ne ne'], - ['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'], - ['DDDo [deň v roku]', '45. deň v roku'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14. február 2010'], - ['LLL', '14. február 2010 15:25'], - ['LLLL', 'nedeľa 14. február 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14. feb 2010'], - ['lll', '14. feb 2010 15:25'], - ['llll', 'ne 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'), '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 = 'január jan_február feb_marec mar_apríl apr_máj máj_jún jún_júl júl_august aug_september sep_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 = 'nedeľa ne ne_pondelok po po_utorok ut ut_streda st st_štvrtok št št_piatok pi pi_sobota 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), 'pár sekúnd', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minúta', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minúta', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minúty', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minút', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'hodina', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'hodina', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 hodiny', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 hodín', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 hodín', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'deň', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'deň', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dni', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'deň', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dní', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dní', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mesiac', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mesiac', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mesiac', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mesiace', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mesiace', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mesiace', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mesiac', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mesiacov', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'rok', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 roky', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'rok', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 rokov', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'za pár sekúnd', 'prefix'); - assert.equal(moment(0).from(30000), 'pred pár sekundami', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'pred pár sekundami', 'now from now should display as in the past'); - }); - - test('fromNow (future)', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'za pár sekúnd', 'in a few seconds'); - assert.equal(moment().add({m: 1}).fromNow(), 'za minútu', 'in a minute'); - assert.equal(moment().add({m: 3}).fromNow(), 'za 3 minúty', 'in 3 minutes'); - assert.equal(moment().add({m: 10}).fromNow(), 'za 10 minút', 'in 10 minutes'); - assert.equal(moment().add({h: 1}).fromNow(), 'za hodinu', 'in an hour'); - assert.equal(moment().add({h: 3}).fromNow(), 'za 3 hodiny', 'in 3 hours'); - assert.equal(moment().add({h: 10}).fromNow(), 'za 10 hodín', 'in 10 hours'); - assert.equal(moment().add({d: 1}).fromNow(), 'za deň', 'in a day'); - assert.equal(moment().add({d: 3}).fromNow(), 'za 3 dni', 'in 3 days'); - assert.equal(moment().add({d: 10}).fromNow(), 'za 10 dní', 'in 10 days'); - assert.equal(moment().add({M: 1}).fromNow(), 'za mesiac', 'in a month'); - assert.equal(moment().add({M: 3}).fromNow(), 'za 3 mesiace', 'in 3 months'); - assert.equal(moment().add({M: 10}).fromNow(), 'za 10 mesiacov', 'in 10 months'); - assert.equal(moment().add({y: 1}).fromNow(), 'za rok', 'in a year'); - assert.equal(moment().add({y: 3}).fromNow(), 'za 3 roky', 'in 3 years'); - assert.equal(moment().add({y: 10}).fromNow(), 'za 10 rokov', 'in 10 years'); - }); - - test('fromNow (past)', function (assert) { - assert.equal(moment().subtract({s: 30}).fromNow(), 'pred pár sekundami', 'a few seconds ago'); - assert.equal(moment().subtract({m: 1}).fromNow(), 'pred minútou', 'a minute ago'); - assert.equal(moment().subtract({m: 3}).fromNow(), 'pred 3 minútami', '3 minutes ago'); - assert.equal(moment().subtract({m: 10}).fromNow(), 'pred 10 minútami', '10 minutes ago'); - assert.equal(moment().subtract({h: 1}).fromNow(), 'pred hodinou', 'an hour ago'); - assert.equal(moment().subtract({h: 3}).fromNow(), 'pred 3 hodinami', '3 hours ago'); - assert.equal(moment().subtract({h: 10}).fromNow(), 'pred 10 hodinami', '10 hours ago'); - assert.equal(moment().subtract({d: 1}).fromNow(), 'pred dňom', 'a day ago'); - assert.equal(moment().subtract({d: 3}).fromNow(), 'pred 3 dňami', '3 days ago'); - assert.equal(moment().subtract({d: 10}).fromNow(), 'pred 10 dňami', '10 days ago'); - assert.equal(moment().subtract({M: 1}).fromNow(), 'pred mesiacom', 'a month ago'); - assert.equal(moment().subtract({M: 3}).fromNow(), 'pred 3 mesiacmi', '3 months ago'); - assert.equal(moment().subtract({M: 10}).fromNow(), 'pred 10 mesiacmi', '10 months ago'); - assert.equal(moment().subtract({y: 1}).fromNow(), 'pred rokom', 'a year ago'); - assert.equal(moment().subtract({y: 3}).fromNow(), 'pred 3 rokmi', '3 years ago'); - assert.equal(moment().subtract({y: 10}).fromNow(), 'pred 10 rokmi', '10 years ago'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'dnes o 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'dnes o 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'dnes o 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'zajtra o 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'dnes o 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'včera o 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m, nextDay; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - nextDay = ''; - switch (m.day()) { - case 0: - nextDay = 'v nedeľu'; - break; - case 1: - nextDay = 'v pondelok'; - break; - case 2: - nextDay = 'v utorok'; - break; - case 3: - nextDay = 'v stredu'; - break; - case 4: - nextDay = 'vo štvrtok'; - break; - case 5: - nextDay = 'v piatok'; - break; - case 6: - nextDay = 'v sobotu'; - break; - } - assert.equal(m.calendar(), m.format('[' + nextDay + '] [o] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[' + nextDay + '] [o] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[' + nextDay + '] [o] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m, lastDay; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - lastDay = ''; - switch (m.day()) { - case 0: - lastDay = 'minulú nedeľu'; - break; - case 1: - lastDay = 'minulý pondelok'; - break; - case 2: - lastDay = 'minulý utorok'; - break; - case 3: - lastDay = 'minulú stredu'; - break; - case 4: - lastDay = 'minulý štvrtok'; - break; - case 5: - lastDay = 'minulý piatok'; - break; - case 6: - lastDay = 'minulú sobotu'; - break; - } - assert.equal(m.calendar(), m.format('[' + lastDay + '] [o] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[' + lastDay + '] [o] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[' + lastDay + '] [o] 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('humanize duration', function (assert) { - assert.equal(moment.duration(1, 'minutes').humanize(), 'minúta', 'a minute (future)'); - assert.equal(moment.duration(1, 'minutes').humanize(true), 'za minútu', 'in a minute'); - assert.equal(moment.duration(-1, 'minutes').humanize(), 'minúta', 'a minute (past)'); - assert.equal(moment.duration(-1, 'minutes').humanize(true), 'pred minútou', 'a minute ago'); - }); - - 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; - } - 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('sl'); - - test('parse', function (assert) { - var tests = 'januar jan._februar feb._marec mar._april apr._maj maj_junij jun._julij jul._avgust avg._september sep._oktober 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)); - } - 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, Do MMMM YYYY, h:mm:ss a', 'nedelja, 14. februar 2010, 3:25:50 pm'], - ['ddd, hA', 'ned., 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. nedelja 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. februar 2010'], - ['LLL', '14. februar 2010 15:25'], - ['LLLL', 'nedelja, 14. februar 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14. feb. 2010'], - ['lll', '14. feb. 2010 15:25'], - ['llll', 'ned., 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'), '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 = 'januar jan._februar feb._marec mar._april apr._maj maj._junij jun._julij jul._avgust avg._september sep._oktober 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 = 'nedelja ned. ne_ponedeljek pon. po_torek tor. to_sreda sre. sr_četrtek čet. če_petek pet. pe_sobota sob. 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), 'nekaj sekund', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ena minuta', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ena minuta', '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 minut', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ena ura', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ena ura', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 uri', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ur', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 ur', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'en dan', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'en dan', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dni', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'en dan', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dni', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dni', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'en mesec', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'en mesec', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'en mesec', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 meseca', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 meseca', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mesece', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'en mesec', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mesecev', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'eno leto', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 leti', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'eno leto', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 let', '5 years = 5 years'); - - assert.equal(start.from(moment([2007, 1, 28]).add({m: 1}), true), 'ena minuta', 'a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 2}), true), '2 minuti', '2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 3}), true), '3 minute', '3 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 4}), true), '4 minute', '4 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 5}), true), '5 minut', '5 minutes'); - - assert.equal(start.from(moment([2007, 1, 28]).add({h: 1}), true), 'ena ura', 'an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 2}), true), '2 uri', '2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 3}), true), '3 ure', '3 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 4}), true), '4 ure', '4 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ur', '5 hours'); - - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'en dan', 'a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 2}), true), '2 dni', '2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 3}), true), '3 dni', '3 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 4}), true), '4 dni', '4 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dni', '5 days'); - - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'en mesec', 'a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 2}), true), '2 meseca', '2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 3}), true), '3 mesece', '3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 4}), true), '4 mesece', '4 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mesecev', '5 months'); - - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'eno leto', 'a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 2}), true), '2 leti', '2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 3}), true), '3 leta', '3 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 4}), true), '4 leta', '4 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 let', '5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'čez nekaj sekund', 'prefix'); - assert.equal(moment(0).from(30000), 'pred nekaj sekundami', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'pred nekaj sekundami', 'now from now should display as in the past'); - }); - - test('fromNow (future)', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'čez nekaj sekund', 'in a few seconds'); - assert.equal(moment().add({m: 1}).fromNow(), 'čez eno minuto', 'in a minute'); - assert.equal(moment().add({m: 2}).fromNow(), 'čez 2 minuti', 'in 2 minutes'); - assert.equal(moment().add({m: 3}).fromNow(), 'čez 3 minute', 'in 3 minutes'); - assert.equal(moment().add({m: 4}).fromNow(), 'čez 4 minute', 'in 4 minutes'); - assert.equal(moment().add({m: 5}).fromNow(), 'čez 5 minut', 'in 5 minutes'); - - assert.equal(moment().add({h: 1}).fromNow(), 'čez eno uro', 'in an hour'); - assert.equal(moment().add({h: 2}).fromNow(), 'čez 2 uri', 'in 2 hours'); - assert.equal(moment().add({h: 3}).fromNow(), 'čez 3 ure', 'in 3 hours'); - assert.equal(moment().add({h: 4}).fromNow(), 'čez 4 ure', 'in 4 hours'); - assert.equal(moment().add({h: 5}).fromNow(), 'čez 5 ur', 'in 5 hours'); - - assert.equal(moment().add({d: 1}).fromNow(), 'čez en dan', 'in a day'); - assert.equal(moment().add({d: 2}).fromNow(), 'čez 2 dni', 'in 2 days'); - assert.equal(moment().add({d: 3}).fromNow(), 'čez 3 dni', 'in 3 days'); - assert.equal(moment().add({d: 4}).fromNow(), 'čez 4 dni', 'in 4 days'); - assert.equal(moment().add({d: 5}).fromNow(), 'čez 5 dni', 'in 5 days'); - - assert.equal(moment().add({M: 1}).fromNow(), 'čez en mesec', 'in a month'); - assert.equal(moment().add({M: 2}).fromNow(), 'čez 2 meseca', 'in 2 months'); - assert.equal(moment().add({M: 3}).fromNow(), 'čez 3 mesece', 'in 3 months'); - assert.equal(moment().add({M: 4}).fromNow(), 'čez 4 mesece', 'in 4 months'); - assert.equal(moment().add({M: 5}).fromNow(), 'čez 5 mesecev', 'in 5 months'); - - assert.equal(moment().add({y: 1}).fromNow(), 'čez eno leto', 'in a year'); - assert.equal(moment().add({y: 2}).fromNow(), 'čez 2 leti', 'in 2 years'); - assert.equal(moment().add({y: 3}).fromNow(), 'čez 3 leta', 'in 3 years'); - assert.equal(moment().add({y: 4}).fromNow(), 'čez 4 leta', 'in 4 years'); - assert.equal(moment().add({y: 5}).fromNow(), 'čez 5 let', 'in 5 years'); - - assert.equal(moment().subtract({s: 30}).fromNow(), 'pred nekaj sekundami', 'a few seconds ago'); - - assert.equal(moment().subtract({m: 1}).fromNow(), 'pred eno minuto', 'a minute ago'); - assert.equal(moment().subtract({m: 2}).fromNow(), 'pred 2 minutama', '2 minutes ago'); - assert.equal(moment().subtract({m: 3}).fromNow(), 'pred 3 minutami', '3 minutes ago'); - assert.equal(moment().subtract({m: 4}).fromNow(), 'pred 4 minutami', '4 minutes ago'); - assert.equal(moment().subtract({m: 5}).fromNow(), 'pred 5 minutami', '5 minutes ago'); - - assert.equal(moment().subtract({h: 1}).fromNow(), 'pred eno uro', 'an hour ago'); - assert.equal(moment().subtract({h: 2}).fromNow(), 'pred 2 urama', '2 hours ago'); - assert.equal(moment().subtract({h: 3}).fromNow(), 'pred 3 urami', '3 hours ago'); - assert.equal(moment().subtract({h: 4}).fromNow(), 'pred 4 urami', '4 hours ago'); - assert.equal(moment().subtract({h: 5}).fromNow(), 'pred 5 urami', '5 hours ago'); - - assert.equal(moment().subtract({d: 1}).fromNow(), 'pred enim dnem', 'a day ago'); - assert.equal(moment().subtract({d: 2}).fromNow(), 'pred 2 dnevoma', '2 days ago'); - assert.equal(moment().subtract({d: 3}).fromNow(), 'pred 3 dnevi', '3 days ago'); - assert.equal(moment().subtract({d: 4}).fromNow(), 'pred 4 dnevi', '4 days ago'); - assert.equal(moment().subtract({d: 5}).fromNow(), 'pred 5 dnevi', '5 days ago'); - - assert.equal(moment().subtract({M: 1}).fromNow(), 'pred enim mesecem', 'a month ago'); - assert.equal(moment().subtract({M: 2}).fromNow(), 'pred 2 mesecema', '2 months ago'); - assert.equal(moment().subtract({M: 3}).fromNow(), 'pred 3 meseci', '3 months ago'); - assert.equal(moment().subtract({M: 4}).fromNow(), 'pred 4 meseci', '4 months ago'); - assert.equal(moment().subtract({M: 5}).fromNow(), 'pred 5 meseci', '5 months ago'); - - assert.equal(moment().subtract({y: 1}).fromNow(), 'pred enim letom', 'a year ago'); - assert.equal(moment().subtract({y: 2}).fromNow(), 'pred 2 letoma', '2 years ago'); - assert.equal(moment().subtract({y: 3}).fromNow(), 'pred 3 leti', '3 years ago'); - assert.equal(moment().subtract({y: 4}).fromNow(), 'pred 4 leti', '4 years ago'); - assert.equal(moment().subtract({y: 5}).fromNow(), 'pred 5 leti', '5 years ago'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'danes ob 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'danes ob 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'danes ob 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'jutri ob 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'danes ob 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'včeraj ob 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 '[v] [nedeljo] [ob] LT'; - case 3: - return '[v] [sredo] [ob] LT'; - case 6: - return '[v] [soboto] [ob] LT'; - case 1: - case 2: - case 4: - case 5: - return '[v] dddd [ob] 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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(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: - return '[prejšnjo] [nedeljo] [ob] LT'; - case 3: - return '[prejšnjo] [sredo] [ob] LT'; - case 6: - return '[prejšnjo] [soboto] [ob] LT'; - case 1: - case 2: - case 4: - case 5: - return '[prejšnji] dddd [ob] 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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(makeFormat(m)), '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([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'); - }); - -}))); - - -;(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('sq'); - - test('parse', function (assert) { - var i, - tests = 'Janar Jan_Shkurt Shk_Mars Mar_Prill Pri_Maj Maj_Qershor Qer_Korrik Kor_Gusht Gus_Shtator Sht_Tetor Tet_Nëntor Nën_Dhjetor Dhj'.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); - 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', 'E Diel, Shkurt 14. 2010, 15:25:50'], - ['ddd, HH', 'Die, 15'], - ['M Mo MM MMMM MMM', '2 2. 02 Shkurt Shk'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. E Diel Die D'], - ['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', 'MD MD'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 Shkurt 2010'], - ['LLL', '14 Shkurt 2010 15:25'], - ['LLLL', 'E Diel, 14 Shkurt 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Shk 2010'], - ['lll', '14 Shk 2010 15:25'], - ['llll', 'Die, 14 Shk 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('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 0, 0]).format('A'), 'PD', 'before dawn'); - assert.equal(moment([2011, 2, 23, 12, 0]).format('A'), 'MD', 'noon'); - }); - - 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 i, - expected = 'Janar Jan_Shkurt Shk_Mars Mar_Prill Pri_Maj Maj_Qershor Qer_Korrik Kor_Gusht Gus_Shtator Sht_Tetor Tet_Nëntor Nën_Dhjetor Dhj'.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 i, - expected = 'E Diel Die D_E Hënë Hën H_E Martë Mar Ma_E Mërkurë Mër Më_E Enjte Enj E_E Premte Pre P_E Shtunë Sht Sh'.split('_'); - - 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), 'disa sekonda', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'një minutë', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'një minutë', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuta', '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), 'një orë', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'një orë', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 orë', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 orë', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 orë', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'një ditë', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'një ditë', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 ditë', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'një ditë', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 ditë', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 ditë', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'një muaj', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'një muaj', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'një muaj', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 muaj', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 muaj', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 muaj', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'një muaj', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 muaj', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'një vit', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 vite', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'një vit', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 vite', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'në disa sekonda', 'prefix'); - assert.equal(moment(0).from(30000), 'disa sekonda më parë', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'disa sekonda më parë', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'në disa sekonda', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'në 5 ditë', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Sot në 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Sot në 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Sot në 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Nesër në 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Sot në 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Dje në 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 [në] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [në] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [në] 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 [e kaluar në] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [e kaluar në] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [e kaluar në] 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 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; - } - 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('sr-cyrl'); - - test('parse', function (assert) { - 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); - 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, Do MMMM YYYY, h:mm:ss a', 'недеља, 14. фебруар 2010, 3:25:50 pm'], - ['ddd, hA', 'нед., 3PM'], - ['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', '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. фебруар 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; - 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 = 'јануар јан._фебруар феб._март мар._април апр._мај мај_јун јун_јул јул_август авг._септембар сеп._октобар окт._новембар нов._децембар дец.'.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; - 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), 'неколико секунди', '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), '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: 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), 'за неколико секунди', 'prefix'); - assert.equal(moment(0).from(30000), 'пре неколико секунди', 'prefix'); - }); - - test('now from now', function (assert) { - 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'); - }); - - 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'); - }); - - test('calendar next week', function (assert) { - var i, m; - - function makeFormat(d) { - switch (d.day()) { - case 0: - return '[у] [недељу] [у] LT'; - case 3: - return '[у] [среду] [у] LT'; - case 6: - return '[у] [суботу] [у] LT'; - case 1: - case 2: - case 4: - case 5: - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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(makeFormat(m)), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - function makeFormat(d) { - var lastWeekDay = [ - '[прошле] [недеље] [у] LT', - '[прошлог] [понедељка] [у] LT', - '[прошлог] [уторка] [у] LT', - '[прошле] [среде] [у] LT', - '[прошлог] [четвртка] [у] LT', - '[прошлог] [петка] [у] LT', - '[прошле] [суботе] [у] LT' - ]; - - return lastWeekDay[d.day()]; - } - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - 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(makeFormat(m)), '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'); - } - }); - - 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([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'); - }); - -}))); - - -;(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('sr'); - - test('parse', function (assert) { - var tests = 'januar jan._februar feb._mart mar._april apr._maj maj_jun jun_jul jul_avgust avg._septembar sep._oktobar okt._novembar nov._decembar 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, Do MMMM YYYY, h:mm:ss a', 'nedelja, 14. februar 2010, 3:25:50 pm'], - ['ddd, hA', 'ned., 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. nedelja 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. februar 2010'], - ['LLL', '14. februar 2010 15:25'], - ['LLLL', 'nedelja, 14. februar 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14. feb. 2010'], - ['lll', '14. feb. 2010 15:25'], - ['llll', 'ned., 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'), '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 = 'januar jan._februar feb._mart mar._april apr._maj maj_jun jun_jul jul_avgust avg._septembar sep._oktobar okt._novembar nov._decembar 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 = 'nedelja ned. ne_ponedeljak pon. po_utorak uto. ut_sreda sre. 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]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'nekoliko sekundi', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'jedan minut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'jedan minut', '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), 'mesec', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mesec', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mesec', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 meseca', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 meseca', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 meseca', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mesec', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 meseci', '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), 'za nekoliko sekundi', 'prefix'); - assert.equal(moment(0).from(30000), 'pre nekoliko sekundi', 'prefix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'pre nekoliko sekundi', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'za nekoliko 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(), '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če 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] [nedelju] [u] LT'; - case 3: - return '[u] [sredu] [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(makeFormat(m)), '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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - 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) { - var lastWeekDay = [ - '[prošle] [nedelje] [u] LT', - '[prošlog] [ponedeljka] [u] LT', - '[prošlog] [utorka] [u] LT', - '[prošle] [srede] [u] LT', - '[prošlog] [četvrtka] [u] LT', - '[prošlog] [petka] [u] LT', - '[prošle] [subote] [u] LT' - ]; - - return lastWeekDay[d.day()]; - } - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - 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(makeFormat(m)), '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'); - } - }); - - 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([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'); - }); - -}))); - - -;(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('ss'); - - test('parse', function (assert) { - var tests = "Bhimbidvwane Bhi_Indlovana Ina_Indlov'lenkhulu Inu_Mabasa Mab_Inkhwekhweti Ink_Inhlaba Inh_Kholwane Kho_Ingci Igc_Inyoni Iny_Imphala Imp_Lweti lwe_Ingongoni Igo".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('parse meridiem', function (assert) { - var i, - b = moment(), - meridiemTests = [ - // h a patterns, expected hours, isValid - ['10 ekuseni', 10, true], - ['11 emini', 11, true], - ['3 entsambama', 15, true], - ['4 entsambama', 16, true], - ['6 entsambama', 18, true], - ['7 ebusuku', 19, true], - ['12 ebusuku', 0, true], - ['10 am', 10, false], - ['10 pm', 10, false] - ], - parsed; - - // test that a formatted moment including meridiem string can be parsed back to the same moment - assert.ok(b.isSame(moment(b.format('h:mm:ss a'), 'h:mm:ss a', 'ss', true), 'seconds'), b.format('h:mm:ss a') + ' should be equal to ' + moment(b.format('h:mm:ss a'), 'h:mm:ss a', 'ss', true).format('h:mm:ss a')); - - // test that a formatted moment having a meridiem string can be parsed with strict flag - assert.ok(moment(b.format('h:mm:ss a'), 'h:mm:ss a', 'ss', true).isValid(), b.format('h:mm:ss a') + ' should be parsed as valid'); - - for (i = 0; i < meridiemTests.length; i++) { - parsed = moment(meridiemTests[i][0], 'h a', 'ss', true); - assert.equal(parsed.isValid(), meridiemTests[i][2], 'validity for ' + meridiemTests[i][0]); - if (parsed.isValid()) { - assert.equal(parsed.hours(), meridiemTests[i][1], 'hours for ' + meridiemTests[i][0]); - } - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Lisontfo, Indlovana 14 2010, 3:25:50 entsambama'], - ['ddd, h A', 'Lis, 3 entsambama'], - ['M Mo MM MMMM MMM', '2 2 02 Indlovana Ina'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 Lisontfo Lis Li'], - ['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', 'entsambama entsambama'], - ['[Lilanga] DDDo [lilanga lelinyaka]', 'Lilanga 45 lilanga lelinyaka'], - ['LTS', '3:25:50 entsambama'], - ['L', '14/02/2010'], - ['LL', '14 Indlovana 2010'], - ['LLL', '14 Indlovana 2010 3:25 entsambama'], - ['LLLL', 'Lisontfo, 14 Indlovana 2010 3:25 entsambama'], - ['l', '14/2/2010'], - ['ll', '14 Ina 2010'], - ['lll', '14 Ina 2010 3:25 entsambama'], - ['llll', 'Lis, 14 Ina 2010 3:25 entsambama'] - ], - 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 = "Bhimbidvwane Bhi_Indlovana Ina_Indlov'lenkhulu Inu_Mabasa Mab_Inkhwekhweti Ink_Inhlaba Inh_Kholwane Kho_Ingci Igc_Inyoni Iny_Imphala Imp_Lweti Lwe_Ingongoni Igo".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 = 'Lisontfo Lis Li_Umsombuluko Umb Us_Lesibili Lsb Lb_Lesitsatfu Les Lt_Lesine Lsi Ls_Lesihlanu Lsh Lh_Umgcibelo Umg Ug'.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), 'emizuzwana lomcane', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'umzuzu', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'umzuzu', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 emizuzu', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 emizuzu', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'lihora', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'lihora', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 emahora', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 emahora', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 emahora', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'lilanga', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'lilanga', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 emalanga', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'lilanga', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 emalanga', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 emalanga', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'inyanga', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'inyanga', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'inyanga', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 tinyanga', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 tinyanga', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 tinyanga', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'inyanga', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 tinyanga', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'umnyaka', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 iminyaka', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'umnyaka', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 iminyaka', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'nga emizuzwana lomcane', 'prefix'); - assert.equal(moment(0).from(30000), 'wenteka nga emizuzwana lomcane', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'wenteka nga emizuzwana lomcane', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'nga emizuzwana lomcane', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'nga 5 emalanga', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Namuhla nga 12:00 emini', 'Today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Namuhla nga 12:25 emini', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Namuhla nga 1:00 emini', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Kusasa nga 12:00 emini', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Namuhla nga 11:00 emini', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Itolo nga 12:00 emini', '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 [nga] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [nga] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [nga] 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 [leliphelile] [nga] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [leliphelile] [nga] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [leliphelile] [nga] 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 52', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1', 'Jan 4 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; - } - 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('sv'); - - test('parse', function (assert) { - var tests = 'januari jan_februari feb_mars mar_april apr_maj maj_juni jun_juli jul_augusti aug_september sep_oktober 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)); - } - 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', 'söndag, februari 14e 2010, 3:25:50 pm'], - ['ddd, hA', 'sön, 3PM'], - ['M Mo MM MMMM MMM', '2 2a 02 februari feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14e 14'], - ['d do dddd ddd dd', '0 0e söndag sön sö'], - ['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'], - ['[the] DDDo [day of the year]', 'the 45e day of the year'], - ['LTS', '15:25:50'], - ['L', '2010-02-14'], - ['LL', '14 februari 2010'], - ['LLL', '14 februari 2010 kl. 15:25'], - ['LLLL', 'söndag 14 februari 2010 kl. 15:25'], - ['l', '2010-2-14'], - ['ll', '14 feb 2010'], - ['lll', '14 feb 2010 15:25'], - ['llll', 'sön 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'), '1a', '1a'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2a', '2a'); - 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'), '21a', '21a'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22a', '22a'); - 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'), '31a', '31a'); - }); - - test('format month', function (assert) { - var expected = 'januari jan_februari feb_mars mar_april apr_maj maj_juni jun_juli jul_augusti aug_september sep_oktober 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 = 'söndag sön sö_måndag mån må_tisdag tis ti_onsdag ons on_torsdag tor to_fredag fre fr_lördag lör 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]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'några sekunder', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'en minut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'en minut', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuter', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuter', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'en timme', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'en timme', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 timmar', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 timmar', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 timmar', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'en dag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'en dag', '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), 'en dag', '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), 'en månad', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'en månad', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'en månad', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 månader', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 månader', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 månader', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'en månad', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 månader', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ett å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), 'ett å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), 'om några sekunder', 'prefix'); - assert.equal(moment(0).from(30000), 'för några sekunder sedan', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'för några sekunder sedan', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'om några sekunder', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'om 5 dagar', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Idag 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Idag 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Idag 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Imorgon 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Idag 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Igår 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('[På] dddd LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[På] dddd LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[På] 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('[I] dddd[s] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[I] dddd[s] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[I] dddd[s] 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 52a', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1a', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1a', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2a', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2a', '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('sw'); - - test('parse', function (assert) { - var tests = 'Januari Jan_Februari Feb_Machi Mac_Aprili Apr_Mei Mei_Juni Jun_Julai Jul_Agosti Ago_Septemba Sep_Oktoba Okt_Novemba Nov_Desemba 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, h:mm:ss a', 'Jumapili, Februari 14 2010, 3:25:50 pm'], - ['ddd, hA', 'Jpl, 3PM'], - ['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 Jumapili Jpl J2'], - ['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'], - ['[siku] DDDo [ya mwaka]', 'siku 45 ya mwaka'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 Februari 2010'], - ['LLL', '14 Februari 2010 15:25'], - ['LLLL', 'Jumapili, 14 Februari 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14 Feb 2010'], - ['lll', '14 Feb 2010 15:25'], - ['llll', 'Jpl, 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'), '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_Machi Mac_Aprili Apr_Mei Mei_Juni Jun_Julai Jul_Agosti Ago_Septemba Sep_Oktoba Okt_Novemba Nov_Desemba 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 = 'Jumapili Jpl J2_Jumatatu Jtat J3_Jumanne Jnne J4_Jumatano Jtan J5_Alhamisi Alh Al_Ijumaa Ijm Ij_Jumamosi Jmos J1'.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), 'hivi punde', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'dakika moja', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'dakika moja', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), 'dakika 2', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), 'dakika 44', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'saa limoja', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'saa limoja', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), 'masaa 2', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), 'masaa 5', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), 'masaa 21', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'siku moja', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'siku moja', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), 'masiku 2', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'siku moja', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), 'masiku 5', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), 'masiku 25', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mwezi mmoja', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mwezi mmoja', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mwezi mmoja', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), 'miezi 2', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), 'miezi 2', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), 'miezi 3', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mwezi mmoja', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), 'miezi 5', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'mwaka mmoja', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), 'miaka 2', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'mwaka mmoja', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), 'miaka 5', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'hivi punde baadaye', 'prefix'); - assert.equal(moment(0).from(30000), 'tokea hivi punde', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'tokea hivi punde', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'hivi punde baadaye', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'masiku 5 baadaye', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'leo saa 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'leo saa 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'leo saa 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'kesho saa 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'leo saa 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'jana 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('[wiki ijayo] dddd [saat] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[wiki ijayo] dddd [saat] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[wiki ijayo] dddd [saat] 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('[wiki iliyopita] dddd [saat] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[wiki iliyopita] dddd [saat] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[wiki iliyopita] dddd [saat] 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 format', 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'); - }); - -}))); - - -;(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('ta'); - - test('parse', function (assert) { - 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); - 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', 'ஞாயிற்றுக்கிழமை, பிப்ரவரி ௧௪வது ௨௦௧௦, ௩:௨௫:௫௦ எற்பாடு'], - ['ddd, hA', 'ஞாயிறு, ௩ எற்பாடு'], - ['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', ' எற்பாடு எற்பாடு'], - ['[ஆண்டின்] DDDo [நாள்]', 'ஆண்டின் ௪௫வது நாள்'], - ['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'), '௧வது', '௧வது'); - 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; - 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; - 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), 'ஒரு சில விநாடிகள்', '44 விநாடிகள் = ஒரு சில விநாடிகள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ஒரு நிமிடம்', '45 விநாடிகள் = ஒரு நிமிடம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ஒரு நிமிடம்', '89 விநாடிகள் = ஒரு நிமிடம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '௨ நிமிடங்கள்', '90 விநாடிகள் = ௨ நிமிடங்கள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '௪௪ நிமிடங்கள்', '44 நிமிடங்கள் = 44 நிமிடங்கள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ஒரு மணி நேரம்', '45 நிமிடங்கள் = ஒரு மணி நேரம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ஒரு மணி நேரம்', '89 நிமிடங்கள் = ஒரு மணி நேரம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '௨ மணி நேரம்', '90 நிமிடங்கள் = ௨ மணி நேரம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '௫ மணி நேரம்', '5 மணி நேரம் = 5 மணி நேரம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '௨௧ மணி நேரம்', '௨௧ மணி நேரம் = ௨௧ மணி நேரம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ஒரு நாள்', '௨௨ மணி நேரம் = ஒரு நாள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ஒரு நாள்', '௩5 மணி நேரம் = ஒரு நாள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '௨ நாட்கள்', '௩6 மணி நேரம் = ௨ days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ஒரு நாள்', '௧ நாள் = ஒரு நாள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '௫ நாட்கள்', '5 நாட்கள் = 5 நாட்கள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '௨௫ நாட்கள்', '௨5 நாட்கள் = ௨5 நாட்கள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ஒரு மாதம்', '௨6 நாட்கள் = ஒரு மாதம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ஒரு மாதம்', '௩0 நாட்கள் = ஒரு மாதம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ஒரு மாதம்', '45 நாட்கள் = ஒரு மாதம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '௨ மாதங்கள்', '46 நாட்கள் = ௨ மாதங்கள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '௨ மாதங்கள்', '75 நாட்கள் = ௨ மாதங்கள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '௩ மாதங்கள்', '76 நாட்கள் = ௩ மாதங்கள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ஒரு மாதம்', '௧ மாதம் = ஒரு மாதம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '௫ மாதங்கள்', '5 மாதங்கள் = 5 மாதங்கள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ஒரு வருடம்', '௩45 நாட்கள் = ஒரு வருடம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '௨ ஆண்டுகள்', '548 நாட்கள் = ௨ ஆண்டுகள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ஒரு வருடம்', '௧ வருடம் = ஒரு வருடம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '௫ ஆண்டுகள்', '5 ஆண்டுகள் = 5 ஆண்டுகள்'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'ஒரு சில விநாடிகள் இல்', 'prefix'); - assert.equal(moment(0).from(30000), 'ஒரு சில விநாடிகள் முன்', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'ஒரு சில விநாடிகள் முன்', 'இப்போது இருந்து கடந்த காலத்தில் காட்ட வேண்டும்'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'ஒரு சில விநாடிகள் இல்', 'ஒரு சில விநாடிகள் இல்'); - assert.equal(moment().add({d: 5}).fromNow(), '௫ நாட்கள் இல்', '5 நாட்கள் இல்'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'இன்று ௧௨:௦௦', 'இன்று 12:00'); - assert.equal(moment(a).add({m: 25}).calendar(), 'இன்று ௧௨:௨௫', 'இன்று 12:25'); - assert.equal(moment(a).add({h: 1}).calendar(), 'இன்று ௧௩:௦௦', 'இன்று 13:00'); - assert.equal(moment(a).add({d: 1}).calendar(), 'நாளை ௧௨:௦௦', 'நாளை 12:00'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'இன்று ௧௧:௦௦', 'இன்று 11:00'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'நேற்று ௧௨:௦௦', 'நேற்று 12:00'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 0, 30]).format('a'), ' யாமம்', '(after) midnight'); - 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, 23, 30]).format('a'), ' யாமம்', '(before) midnight'); - }); - -}))); - - -;(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('te'); - - test('parse', function (assert) { - 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); - 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, Do తేదీ MMMM YYYY, a h:mm:ss', 'ఆదివారం, 14వ తేదీ ఫిబ్రవరి 2010, మధ్యాహ్నం 3:25:50'], - ['ddd, a h గంటలు', 'ఆది, మధ్యాహ్నం 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', 'మధ్యాహ్నం మధ్యాహ్నం'], - ['LTS', 'మధ్యాహ్నం 3:25:50'], - ['L', '14/02/2010'], - ['LL', '14 ఫిబ్రవరి 2010'], - ['LLL', '14 ఫిబ్రవరి 2010, మధ్యాహ్నం 3:25'], - ['LLLL', 'ఆదివారం, 14 ఫిబ్రవరి 2010, మధ్యాహ్నం 3:25'], - ['l', '14/2/2010'], - ['ll', '14 ఫిబ్ర. 2010'], - ['lll', '14 ఫిబ్ర. 2010, మధ్యాహ్నం 3:25'], - ['llll', 'ఆది, 14 ఫిబ్ర. 2010, మధ్యాహ్నం 3: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 = 'జనవరి జన._ఫిబ్రవరి ఫిబ్ర._మార్చి మార్చి_ఏప్రిల్ ఏప్రి._మే మే_జూన్ జూన్_జులై జులై_ఆగస్టు ఆగ._సెప్టెంబర్ సెప్._అక్టోబర్ అక్టో._నవంబర్ నవ._డిసెంబర్ డిసె.'.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; - 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), 'కొన్ని క్షణాలు', '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), '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: 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), 'కొన్ని క్షణాలు లో', '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'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'కొన్ని క్షణాలు లో', 'కొన్ని క్షణాలు లో'); - assert.equal(moment().add({d: 5}).fromNow(), '5 రోజులు లో', '5 రోజులు లో'); - }); - - 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: 3}).calendar(), 'నేడు మధ్యాహ్నం 3:00', 'Now plus 3 hours'); - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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('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'), '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'); - }); - -}))); - - -;(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('tet'); - - test('parse', function (assert) { - var tests = 'Janeiru Jan_Fevereiru Fev_Marsu Mar_Abril Abr_Maiu Mai_Juñu Jun_Jullu Jul_Agustu Ago_Setembru Set_Outubru Out_Novembru Nov_Dezembru Dez'.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', 'Domingu, Fevereiru 14th 2010, 3:25:50 pm'], - ['ddd, hA', 'Dom, 3PM'], - ['M Mo MM MMMM MMM', '2 2nd 02 Fevereiru Fev'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14th 14'], - ['d do dddd ddd dd', '0 0th Domingu Dom Do'], - ['DDD DDDo DDDD', '45 45th 045'], - ['w wo ww', '6 6th 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 45th day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 Fevereiru 2010'], - ['LLL', '14 Fevereiru 2010 15:25'], - ['LLLL', 'Domingu, 14 Fevereiru 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Fev 2010'], - ['lll', '14 Fev 2010 15:25'], - ['llll', 'Dom, 14 Fev 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'), '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'), '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'), '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'), '31st', '31st'); - }); - - test('format month', function (assert) { - var expected = 'Janeiru Jan_Fevereiru Fev_Marsu Mar_Abril Abr_Maiu Mai_Juñu Jun_Jullu Jul_Agustu Ago_Setembru Set_Outubru Out_Novembru Nov_Dezembru Dez'.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 = 'Domingu Dom Do_Segunda Seg Seg_Tersa Ters Te_Kuarta Kua Ku_Kinta Kint Ki_Sesta Sest Ses_Sabadu 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]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'minutu balun', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minutu ida', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minutu ida', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), 'minutu 2', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), 'minutu 44', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'oras ida', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'oras ida', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), 'oras 2', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), 'oras 5', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), 'oras 21', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'loron ida', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'loron ida', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), 'loron 2', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'loron ida', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), 'loron 5', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), 'loron 25', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'fulan ida', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'fulan ida', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'fulan ida', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), 'fulan 2', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), 'fulan 2', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), 'fulan 3', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'fulan ida', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), 'fulan 5', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'tinan ida', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), 'tinan 2', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'tinan ida', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), 'tinan 5', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'iha minutu balun', 'prefix'); - assert.equal(moment(0).from(30000), 'minutu balun liuba', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'minutu balun liuba', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'iha minutu balun', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'iha loron 5', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Ohin iha 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Ohin iha 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Ohin iha 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Aban iha 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Ohin iha 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Horiseik iha 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 [iha] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [iha] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [iha] 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 [semana kotuk] [iha] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [semana kotuk] [iha] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [semana kotuk] [iha] 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 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'); - }); - -}))); - - -;(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('tg'); - - test('parse', function (assert) { - 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); - 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, Do MMMM YYYY, h:mm:ss', 'якшанбе, 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', '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'] - ], - 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 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, 10, 59]).format('A'), 'субҳ', 'morning'); - assert.equal(moment([2012, 11, 28, 12, 0]).format('A'), 'рӯз', 'afternoon'); - assert.equal(moment([2012, 11, 28, 15, 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-ум', '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-ум', '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-ум', '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-ум', '31st'); - }); - - test('format month', function (assert) { - 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; - 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), 'якчанд сония', '44 сония = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'як дақиқа', '45 сония = як дақиқа'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'як дақиқа', '89 сония = як дақиқа'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 дақиқа', '90 сония = 2 дақиқа'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 дақиқа', '44 дақиқа = 44 дақиқа'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'як соат', '45 дақиқа = як соат'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'як соат', '89 дақиқа = як соат'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 соат', '90 дақиқа = 2 соат'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 соат', '5 соат = 5 соат'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 соат', '21 соат = 21 соат'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'як рӯз', '22 соат = як рӯз'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'як рӯз', '35 соат = як рӯз'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 рӯз', '36 соат = 2 рӯз'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'як рӯз', '1 рӯз = як рӯз'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 рӯз', '5 рӯз = 5 рӯз'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 рӯз', '25 рӯз = 25 рӯз'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'як моҳ', '26 рӯз = як моҳ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'як моҳ', '30 рӯз = як моҳ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'як моҳ', '43 рӯз = як моҳ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 моҳ', '46 рӯз = 2 моҳ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 моҳ', '74 рӯз = 2 моҳ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 моҳ', '76 рӯз = 3 моҳ'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'як моҳ', 'як моҳ = як моҳ'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 моҳ', '5 моҳ = 5 моҳ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'як сол', '345 рӯз = як сол'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 сол', '548 рӯз = 2 сол'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'як сол', '1 сол = як сол'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 сол', '5 сол = 5 сол'); - }); - - test('suffix', function (assert) { - 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'); - }); - - 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'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'), '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, 15]).format('w ww wo'), '3 03 3-юм', 'Jan 15 2012 should be week 3'); - }); - -}))); - - -;(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('th'); - - test('parse', function (assert) { - 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); - 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, Do MMMM 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; - 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 month', function (assert) { - 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; - 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), 'ไม่กี่วินาที', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), '1 นาที', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '1 นาที', '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), '1 ชั่วโมง', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '1 ชั่วโมง', '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), '1 วัน', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '1 วัน', '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 วัน', '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), '1 เดือน', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '1 เดือน', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '1 เดือน', '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 เดือน', '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), '1 ปี', '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 ปี', '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'); - }); - - test('now from now', function (assert) { - 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'); - }); - - 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'); - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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 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'); - }); - -}))); - - -;(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('tl-ph'); - - test('parse', function (assert) { - var tests = 'Enero Ene_Pebrero Peb_Marso Mar_Abril Abr_Mayo May_Hunyo Hun_Hulyo Hul_Agosto Ago_Setyembre Set_Oktubre Okt_Nobyembre Nob_Disyembre Dis'.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', 'Linggo, Pebrero 14 2010, 3:25:50 pm'], - ['ddd, hA', 'Lin, 3PM'], - ['M Mo MM MMMM MMM', '2 2 02 Pebrero Peb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 Linggo Lin Li'], - ['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', '02/14/2010'], - ['LL', 'Pebrero 14, 2010'], - ['LLL', 'Pebrero 14, 2010 15:25'], - ['LLLL', 'Linggo, Pebrero 14, 2010 15:25'], - ['l', '2/14/2010'], - ['ll', 'Peb 14, 2010'], - ['lll', 'Peb 14, 2010 15:25'], - ['llll', 'Lin, Peb 14, 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 = 'Enero Ene_Pebrero Peb_Marso Mar_Abril Abr_Mayo May_Hunyo Hun_Hulyo Hul_Agosto Ago_Setyembre Set_Oktubre Okt_Nobyembre Nob_Disyembre Dis'.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 = 'Linggo Lin Li_Lunes Lun Lu_Martes Mar Ma_Miyerkules Miy Mi_Huwebes Huw Hu_Biyernes Biy Bi_Sabado Sab Sab'.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), 'ilang segundo', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'isang minuto', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'isang minuto', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuto', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuto', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'isang oras', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'isang oras', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 oras', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 oras', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 oras', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'isang araw', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'isang araw', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 araw', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'isang araw', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 araw', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 araw', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'isang buwan', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'isang buwan', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'isang buwan', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 buwan', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 buwan', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 buwan', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'isang buwan', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 buwan', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'isang taon', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 taon', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'isang taon', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 taon', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'sa loob ng ilang segundo', 'prefix'); - assert.equal(moment(0).from(30000), 'ilang segundo ang nakalipas', 'suffix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'sa loob ng ilang segundo', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'sa loob ng 5 araw', 'in 5 days'); - }); - - test('same day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), '12:00 ngayong araw', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), '12:25 ngayong araw', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), '13:00 ngayong araw', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Bukas ng 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), '11:00 ngayong araw', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), '12:00 kahapon', 'yesterday at the same time'); - }); - - 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('LT [sa susunod na] dddd'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('LT [sa susunod na] dddd'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('LT [sa susunod na] dddd'), 'Today + ' + i + ' days end of day'); - } - }); - - 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('LT [noong nakaraang] dddd'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('LT [noong nakaraang] dddd'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('LT [noong nakaraang] dddd'), 'Today - ' + i + ' days end of day'); - } - }); - - 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'); - - 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 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; - } - 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('tlh'); - - //Current parsing method doesn't allow parsing correctly months 10, 11 and 12. - /* - * test('parse', function (assert) { - var tests = 'tera’ jar wa’.jar wa’_tera’ jar cha’.jar cha’_tera’ jar wej.jar wej_tera’ jar loS.jar loS_tera’ jar vagh.jar vagh_tera’ jar jav.jar jav_tera’ jar Soch.jar Soch_tera’ jar chorgh.jar chorgh_tera’ jar Hut.jar Hut_tera’ jar wa’maH.jar wa’maH_tera’ jar wa’maH wa’.jar wa’maH wa’_tera’ jar wa’maH cha’.jar wa’maH cha’'.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', 'lojmItjaj, tera’ jar cha’ 14. 2010, 3:25:50 pm'], - ['ddd, hA', 'lojmItjaj, 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 tera’ jar cha’ jar cha’'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. lojmItjaj lojmItjaj lojmItjaj'], - ['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'], - ['[DIS jaj] DDDo', 'DIS jaj 45.'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 tera’ jar cha’ 2010'], - ['LLL', '14 tera’ jar cha’ 2010 15:25'], - ['LLLL', 'lojmItjaj, 14 tera’ jar cha’ 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14 jar cha’ 2010'], - ['lll', '14 jar cha’ 2010 15:25'], - ['llll', 'lojmItjaj, 14 jar cha’ 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 = 'tera’ jar wa’ jar wa’_tera’ jar cha’ jar cha’_tera’ jar wej jar wej_tera’ jar loS jar loS_tera’ jar vagh jar vagh_tera’ jar jav jar jav_tera’ jar Soch jar Soch_tera’ jar chorgh jar chorgh_tera’ jar Hut jar Hut_tera’ jar wa’maH jar wa’maH_tera’ jar wa’maH wa’ jar wa’maH wa’_tera’ jar wa’maH cha’ jar wa’maH cha’'.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 = 'lojmItjaj lojmItjaj lojmItjaj_DaSjaj DaSjaj DaSjaj_povjaj povjaj povjaj_ghItlhjaj ghItlhjaj ghItlhjaj_loghjaj loghjaj loghjaj_buqjaj buqjaj buqjaj_ghInjaj ghInjaj ghInjaj'.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), 'puS lup', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'wa’ tup', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'wa’ tup', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), 'cha’ tup', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), 'loSmaH loS tup', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'wa’ rep', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'wa’ rep', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), 'cha’ rep', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), 'vagh rep', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), 'cha’maH wa’ rep', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'wa’ jaj', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'wa’ jaj', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), 'cha’ jaj', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'wa’ jaj', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), 'vagh jaj', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), 'cha’maH vagh jaj', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'wa’ jar', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'wa’ jar', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'wa’ jar', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), 'cha’ jar', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), 'cha’ jar', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), 'wej jar', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'wa’ jar', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), 'vagh jar', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'wa’ DIS', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), 'cha’ DIS', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'wa’ DIS', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), 'vagh DIS', '5 years = 5 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 112}), true), 'wa’vatlh wa’maH cha’ DIS', '112 years = 112 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 122}), true), 'wa’vatlh cha’maH cha’ DIS', '122 years = 122 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 213}), true), 'cha’vatlh wa’maH wej DIS', '213 years = 213 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 223}), true), 'cha’vatlh cha’maH wej DIS', '223 years = 223 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'puS lup pIq', 'suffix'); - assert.equal(moment(0).from(30000), 'puS lup ret', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'puS lup ret', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'puS lup pIq', 'in a few seconds'); - assert.equal(moment().add({h: 1}).fromNow(), 'wa’ rep pIq', 'in an hour'); - assert.equal(moment().add({d: 5}).fromNow(), 'vagh leS', 'in 5 days'); - assert.equal(moment().add({M: 2}).fromNow(), 'cha’ waQ', 'in 2 months'); - assert.equal(moment().add({y: 1}).fromNow(), 'wa’ nem', 'in a year'); - assert.equal(moment().add({s: -30}).fromNow(), 'puS lup ret', 'a few seconds ago'); - assert.equal(moment().add({h: -1}).fromNow(), 'wa’ rep ret', 'an hour ago'); - assert.equal(moment().add({d: -5}).fromNow(), 'vagh Hu’', '5 days ago'); - assert.equal(moment().add({M: -2}).fromNow(), 'cha’ wen', '2 months ago'); - assert.equal(moment().add({y: -1}).fromNow(), 'wa’ ben', 'a year ago'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'DaHjaj 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'DaHjaj 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'DaHjaj 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'wa’leS 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'DaHjaj 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'wa’Hu’ 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('LLL'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('LLL'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('LLL'), '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('LLL'), 'Today - ' + i + ' days current time'); - - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('LLL'), 'Today - ' + i + ' days beginning of day'); - - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('LLL'), '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 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; - } - 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('tr'); - - test('parse', function (assert) { - var tests = 'Ocak Oca_Şubat Şub_Mart Mar_Nisan Nis_Mayıs May_Haziran Haz_Temmuz Tem_Ağustos Ağu_Eylül Eyl_Ekim Eki_Kasım Kas_Aralık Ara'.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', 'Pazar, Şubat 14 2010, 3:25:50 pm'], - ['ddd, hA', 'Paz, 3PM'], - ['M Mo MM MMMM MMM', '2 2\'nci 02 Şubat Şub'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 Pazar Paz Pz'], - ['DDD DDDo DDDD', '45 45\'inci 045'], - ['w wo ww', '7 7\'nci 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[yılın] DDDo [günü]', 'yılın 45\'inci günü'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 Şubat 2010'], - ['LLL', '14 Şubat 2010 15:25'], - ['LLLL', 'Pazar, 14 Şubat 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14 Şub 2010'], - ['lll', '14 Şub 2010 15:25'], - ['llll', 'Paz, 14 Şub 2010 15:25'] - ], - DDDo = [ - [359, '360\'ıncı'], - [199, '200\'üncü'], - [149, '150\'nci'] - ], - dt = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - DDDoDt, - i; - - for (i = 0; i < a.length; i++) { - assert.equal(dt.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - for (i = 0; i < DDDo.length; i++) { - DDDoDt = moment([2010]); - assert.equal(DDDoDt.add(DDDo[i][0], 'days').format('DDDo'), DDDo[i][1], DDDo[i][0] + ' ---> ' + DDDo[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1\'inci', '1st'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2\'nci', '2nd'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3\'üncü', '3rd'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4\'üncü', '4th'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5\'inci', '5th'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6\'ncı', '6th'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7\'nci', '7th'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8\'inci', '8th'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9\'uncu', '9th'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10\'uncu', '10th'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11\'inci', '11th'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12\'nci', '12th'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13\'üncü', '13th'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14\'üncü', '14th'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15\'inci', '15th'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16\'ncı', '16th'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17\'nci', '17th'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18\'inci', '18th'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19\'uncu', '19th'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20\'nci', '20th'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21\'inci', '21th'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22\'nci', '22th'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23\'üncü', '23th'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24\'üncü', '24th'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25\'inci', '25th'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26\'ncı', '26th'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27\'nci', '27th'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28\'inci', '28th'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29\'uncu', '29th'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30\'uncu', '30th'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31\'inci', '31st'); - }); - - test('format month', function (assert) { - var expected = 'Ocak Oca_Şubat Şub_Mart Mar_Nisan Nis_Mayıs May_Haziran Haz_Temmuz Tem_Ağustos Ağu_Eylül Eyl_Ekim Eki_Kasım Kas_Aralık Ara'.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 = 'Pazar Paz Pz_Pazartesi Pts Pt_Salı Sal Sa_Çarşamba Çar Ça_Perşembe Per Pe_Cuma Cum Cu_Cumartesi Cts Ct'.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), 'birkaç saniye', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'bir dakika', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'bir dakika', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 dakika', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 dakika', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'bir saat', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'bir saat', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 saat', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 saat', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 saat', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'bir gün', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'bir gün', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 gün', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'bir gün', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 gün', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 gün', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'bir ay', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'bir ay', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'bir ay', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 ay', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 ay', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 ay', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'bir ay', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 ay', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'bir yıl', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 yıl', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'bir yıl', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 yıl', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'birkaç saniye sonra', 'prefix'); - assert.equal(moment(0).from(30000), 'birkaç saniye önce', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'birkaç saniye önce', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'birkaç saniye sonra', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5 gün sonra', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'bugün saat 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'bugün saat 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'bugün saat 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'yarın saat 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'bugün saat 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'dün 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('[gelecek] dddd [saat] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[gelecek] dddd [saat] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[gelecek] dddd [saat] 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('[geçen] dddd [saat] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[geçen] dddd [saat] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[geçen] dddd [saat] 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([2011, 11, 26]).format('w ww wo'), '1 01 1\'inci', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1\'inci', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2\'nci', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2\'nci', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3\'üncü', 'Jan 9 2012 should be week 3'); - }); - -}))); - - -;(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('tzl'); - - test('parse', function (assert) { - var tests = 'Januar Jan_Fevraglh Fev_Març Mar_Avrïu Avr_Mai Mai_Gün Gün_Julia Jul_Guscht Gus_Setemvar Set_Listopäts Lis_Noemvar Noe_Zecemvar Zec'.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', 'Súladi, Fevraglh 14. 2010, 3.25.50 d\'o'], - ['ddd, hA', 'Súl, 3D\'O'], - ['M Mo MM MMMM MMM', '2 2. 02 Fevraglh Fev'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. Súladi Súl Sú'], - ['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', 'd\'o D\'O'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], - ['LTS', '15.25.50'], - ['L', '14.02.2010'], - ['LL', '14. Fevraglh dallas 2010'], - ['LLL', '14. Fevraglh dallas 2010 15.25'], - ['LLLL', 'Súladi, li 14. Fevraglh dallas 2010 15.25'], - ['l', '14.2.2010'], - ['ll', '14. Fev dallas 2010'], - ['lll', '14. Fev dallas 2010 15.25'], - ['llll', 'Súl, li 14. Fev dallas 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 = 'Januar Jan_Fevraglh Fev_Març Mar_Avrïu Avr_Mai Mai_Gün Gün_Julia Jul_Guscht Gus_Setemvar Set_Listopäts Lis_Noemvar Noe_Zecemvar Zec'.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 = 'Súladi Súl Sú_Lúneçi Lún Lú_Maitzi Mai Ma_Márcuri Már Má_Xhúadi Xhú Xh_Viénerçi Vié Vi_Sáturi Sát 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), 'viensas secunds', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), '\'n míut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '\'n míut', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 míuts', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 míuts', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), '\'n þora', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '\'n þora', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 þoras', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 þoras', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 þoras', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), '\'n ziua', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '\'n ziua', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 ziuas', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), '\'n ziua', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 ziuas', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 ziuas', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), '\'n mes', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '\'n mes', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '\'n mes', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mesen', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mesen', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mesen', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), '\'n mes', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mesen', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), '\'n ar', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 ars', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), '\'n ar', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 ars', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'osprei viensas secunds', 'prefix'); - assert.equal(moment(0).from(30000), 'ja\'iensas secunds', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'ja\'iensas secunds', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'osprei viensas secunds', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'osprei 5 ziuas', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'oxhi à 12.00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'oxhi à 12.25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'oxhi à 13.00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'demà à 12.00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'oxhi à 11.00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'ieiri à 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } - }); - - 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('[sür el] dddd [lasteu à] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[sür el] dddd [lasteu à] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[sür el] dddd [lasteu à] 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'); - }); - - // Monday is the first day of the week. - // The week that contains Jan 4th is the first week of the year. - - 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; - } - 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('tzm-latn'); - - test('parse', function (assert) { - var tests = 'innayr innayr_brˤayrˤ brˤayrˤ_marˤsˤ marˤsˤ_ibrir ibrir_mayyw mayyw_ywnyw ywnyw_ywlywz ywlywz_ɣwšt ɣwšt_šwtanbir šwtanbir_ktˤwbrˤ ktˤwbrˤ_nwwanbir nwwanbir_dwjnbir dwjnbir'.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', 'asamas, brˤayrˤ 14 2010, 3:25:50 pm'], - ['ddd, hA', 'asamas, 3PM'], - ['M Mo MM MMMM MMM', '2 2 02 brˤayrˤ brˤayrˤ'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 asamas asamas asamas'], - ['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', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45 day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 brˤayrˤ 2010'], - ['LLL', '14 brˤayrˤ 2010 15:25'], - ['LLLL', 'asamas 14 brˤayrˤ 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 brˤayrˤ 2010'], - ['lll', '14 brˤayrˤ 2010 15:25'], - ['llll', 'asamas 14 brˤayrˤ 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 = 'innayr innayr_brˤayrˤ brˤayrˤ_marˤsˤ marˤsˤ_ibrir ibrir_mayyw mayyw_ywnyw ywnyw_ywlywz ywlywz_ɣwšt ɣwšt_šwtanbir šwtanbir_ktˤwbrˤ ktˤwbrˤ_nwwanbir nwwanbir_dwjnbir dwjnbir'.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 = 'asamas asamas asamas_aynas aynas aynas_asinas asinas asinas_akras akras akras_akwas akwas akwas_asimwas asimwas asimwas_asiḍyas asiḍyas asiḍyas'.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), 'imik', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minuḍ', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minuḍ', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuḍ', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuḍ', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'saɛa', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'saɛa', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 tassaɛin', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 tassaɛin', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 tassaɛin', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ass', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ass', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 ossan', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ass', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 ossan', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 ossan', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ayowr', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ayowr', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ayowr', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 iyyirn', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 iyyirn', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 iyyirn', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ayowr', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 iyyirn', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'asgas', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 isgasn', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'asgas', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 isgasn', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'dadkh s yan imik', 'prefix'); - assert.equal(moment(0).from(30000), 'yan imik', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'yan imik', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'dadkh s yan imik', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'dadkh s yan 5 ossan', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'asdkh g 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'asdkh g 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'asdkh g 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'aska g 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'asdkh g 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'assant g 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 [g] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [g] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [g] 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 [g] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [g] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [g] 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([2011, 11, 31]).format('w ww wo'), '1 01 1', 'Dec 31 2011 should be week 1'); - assert.equal(moment([2012, 0, 6]).format('w ww wo'), '1 01 1', 'Jan 6 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '2 02 2', 'Jan 7 2012 should be week 2'); - assert.equal(moment([2012, 0, 13]).format('w ww wo'), '2 02 2', 'Jan 13 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '3 03 3', 'Jan 14 2012 should be week 3'); + // 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'); }); }))); @@ -59462,13 +802,16 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('tzm'); + localeModule('en-ca'); test('parse', function (assert) { - var tests = 'ⵉⵏⵏⴰⵢⵔ ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ ⴷⵓⵊⵏⴱⵉⵔ'.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); @@ -59484,83 +827,88 @@ test('format', function (assert) { var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'ⴰⵙⴰⵎⴰⵙ, ⴱⵕⴰⵢⵕ 14 2010, 3:25:50 pm'], - ['ddd, hA', 'ⴰⵙⴰⵎⴰⵙ, 3PM'], - ['M Mo MM MMMM MMM', '2 2 02 ⴱⵕⴰⵢⵕ ⴱⵕⴰⵢⵕ'], + ['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 14 14'], - ['d do dddd ddd dd', '0 0 ⴰⵙⴰⵎⴰⵙ ⴰⵙⴰⵎⴰⵙ ⴰⵙⴰⵎⴰⵙ'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '8 8 08'], + ['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', 'pm PM'], - ['[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'] + ['[the] DDDo [day of the year]', 'the 45th day of the year'], + ['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]); } }); 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'); + 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'), '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'), '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'), '31st', '31st'); }); test('format month', function (assert) { - var expected = 'ⵉⵏⵏⴰⵢⵔ ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ ⴷⵓⵊⵏⴱⵉⵔ'.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 = 'ⴰⵙⴰⵎⴰⵙ ⴰⵙⴰⵎⴰⵙ ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ ⴰⵢⵏⴰⵙ ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ ⴰⵙⵉⵏⴰⵙ ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ ⴰⴽⵔⴰⵙ ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ ⴰⴽⵡⴰⵙ ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ ⴰⵙⵉⵎⵡⴰⵙ ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ ⴰⵙⵉⴹⵢⴰⵙ ⴰⵙⵉⴹⵢⴰⵙ'.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]); } @@ -59568,82 +916,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), '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 oⵙⵙⴰⵏ', '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 oⵙⵙⴰⵏ', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 oⵙⵙⴰⵏ', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ⴰⵢoⵓⵔ', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ⴰⵢoⵓⵔ', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ⴰⵢoⵓⵔ', '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), 'ⴰⵢoⵓⵔ', '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), '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), 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ ⵉⵎⵉⴽ', 'prefix'); - assert.equal(moment(0).from(30000), 'ⵢⴰⵏ ⵉⵎⵉⴽ', 'suffix'); + 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(), 'ⵢⴰⵏ ⵉⵎⵉⴽ', '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(), 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ ⵉⵎⵉⴽ', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ 5 oⵙⵙⴰⵏ', 'in 5 days'); + 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(), 'ⴰⵙⴷⵅ ⴴ 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 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 [ⴴ] 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 [ⴴ] 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 [ⴴ] LT'), 'Today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('dddd [at] 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('[Last] dddd [at] 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('[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('dddd [ⴴ] LT'), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days end of day'); } }); @@ -59661,12 +1011,12 @@ assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); }); - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 31]).format('w ww wo'), '1 01 1', 'Dec 31 2011 should be week 1'); - assert.equal(moment([2012, 0, 6]).format('w ww wo'), '1 01 1', 'Jan 6 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '2 02 2', 'Jan 7 2012 should be week 2'); - assert.equal(moment([2012, 0, 13]).format('w ww wo'), '2 02 2', 'Jan 13 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '3 03 3', 'Jan 14 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'); }); }))); @@ -59954,11 +1304,11 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('ug-cn'); + localeModule('en-gb'); test('parse', function (assert) { - var tests = 'يانۋار يانۋار_فېۋرال فېۋرال_مارت مارت_ئاپرېل ئاپرېل_ماي ماي_ئىيۇن ئىيۇن_ئىيۇل ئىيۇل_ئاۋغۇست ئاۋغۇست_سېنتەبىر سېنتەبىر_ئۆكتەبىر ئۆكتەبىر_نويابىر نويابىر_دېكابىر دېكابىر'.split('_'), i; - function equalTest (input, mmm, i) { + 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++) { @@ -59976,46 +1326,83 @@ test('format', function (assert) { var a = [ - ['dddd, YYYY MMMM Do, a h:mm:ss', 'يەكشەنبە، 2010 فېۋرال 14-كۈنى، چۈشتىن كېيىن 3:25:50'], - ['dddd, A h', 'يەكشەنبە، چۈشتىن كېيىن 3'], - ['M Mo MM MMMM MMM', '2 2 02 فېۋرال فېۋرال'], + ['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 14-كۈنى 14'], - ['d do dddd ddd dd', '0 0-كۈنى يەكشەنبە يە يە'], - ['DDD DDDo DDDD', '45 45-كۈنى 045'], - ['w wo ww', '7 7-ھەپتە 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', '6 6th 06'], ['h hh', '3 03'], ['H HH', '15 15'], ['m mm', '25 25'], ['s ss', '50 50'], - ['a A', 'چۈشتىن كېيىن چۈشتىن كېيىن'], - ['[يىلنىڭ] DDDo', 'يىلنىڭ 45-كۈنى'], + ['a A', 'pm PM'], + ['[the] DDDo [day of the year]', 'the 45th day of the year'], ['LTS', '15:25:50'], - ['L', '2010-02-14'], - ['LL', '2010-يىلى2-ئاينىڭ14-كۈنى'], - ['LLL', '2010-يىلى2-ئاينىڭ14-كۈنى، 15:25'], - ['LLLL', 'يەكشەنبە، 2010-يىلى2-ئاينىڭ14-كۈنى، 15:25'] + ['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'] ], 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'), '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'), '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'), '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'), '31st', '31st'); + }); + test('format month', function (assert) { - var expected = 'يانۋار يانۋار_فېۋرال فېۋرال_مارت مارت_ئاپرېل ئاپرېل_ماي ماي_ئىيۇن ئىيۇن_ئىيۇل ئىيۇل_ئاۋغۇست ئاۋغۇست_سېنتەبىر سېنتەبىر_ئۆكتەبىر ئۆكتەبىر_نويابىر نويابىر_دېكابىر دېكابىر'.split('_'), i; + 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 expected = 'يەكشەنبە يە يە_دۈشەنبە دۈ دۈ_سەيشەنبە سە سە_چارشەنبە چا چا_پەيشەنبە پە پە_جۈمە جۈ جۈ_شەنبە شە شە'.split('_'), i; - + 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]); } @@ -60023,83 +1410,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), '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: 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), '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), 'نەچچە سېكونت كېيىن', 'prefix'); - assert.equal(moment(0).from(30000), 'نەچچە سېكونت بۇرۇن', 'suffix'); + 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(), 'نەچچە سېكونت بۇرۇن', '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(), 'نەچچە سېكونت كېيىن', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5 كۈن كېيىن', 'in 5 days'); + 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(), 'بۈگۈن سائەت 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 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) { 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 [at] 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 [at] 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 [at] 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('[Last] dddd [at] 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('[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('[ئالدىنقى] dddd [سائەت] LT'), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days end of day'); } }); @@ -60117,21 +1504,12 @@ assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); }); - test('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 0, 0]).format('A'), 'يېرىم كېچە', 'before dawn'); - assert.equal(moment([2011, 2, 23, 6, 0]).format('A'), 'سەھەر', 'morning'); - assert.equal(moment([2011, 2, 23, 9, 0]).format('A'), 'چۈشتىن بۇرۇن', 'before noon'); - assert.equal(moment([2011, 2, 23, 12, 0]).format('A'), 'چۈش', 'noon'); - assert.equal(moment([2011, 2, 23, 13, 0]).format('A'), 'چۈشتىن كېيىن', 'afternoon'); - assert.equal(moment([2011, 2, 23, 18, 0]).format('A'), 'كەچ', 'night'); - }); - - test('weeks year starting sunday format', 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'); + 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'); }); }))); @@ -60419,10 +1797,10 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('uk'); + localeModule('en-ie'); test('parse', function (assert) { - var tests = 'січень січ_лютий лют_березень бер_квітень квіт_травень трав_червень черв_липень лип_серпень серп_вересень вер_жовтень жовт_листопад лист_грудень груд'.split('_'), i; + 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)); } @@ -60441,25 +1819,29 @@ 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', '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 14-го 14'], - ['d do dddd ddd dd', '0 0-й неділя нд нд'], - ['DDD DDDo DDDD', '45 45-й 045'], - ['w wo ww', '7 7-й 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', '6 6th 06'], ['h hh', '3 03'], ['H HH', '15 15'], ['m mm', '25 25'], ['s ss', '50 50'], - ['a A', 'дня дня'], - ['DDDo [день року]', '45-й день року'], + ['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 лютого 2010 р.'], - ['LLL', '14 лютого 2010 р., 15:25'], - ['LLLL', 'неділя, 14 лютого 2010 р., 15:25'] + ['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'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; @@ -60468,74 +1850,52 @@ } }); - 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-й'); + 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'), '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'), '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'), '31st', '31st'); }); test('format month', function (assert) { - var expected = 'січень січ_лютий лют_березень бер_квітень квіт_травень трав_червень черв_липень лип_серпень серп_вересень вер_жовтень жовт_листопад лист_грудень груд'.split('_'), i; + 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 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 week', function (assert) { - var expected = 'неділя нд нд_понеділок пн пн_вівторок вт вт_середа ср ср_четвер чт чт_п’ятниця пт пт_субота сб сб'.split('_'), i; + 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]); } @@ -60543,97 +1903,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 = 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), '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), 'за декілька секунд', 'prefix'); - assert.equal(moment(0).from(30000), 'декілька секунд тому', 'suffix'); + 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(), 'a few seconds ago', '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(), '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(), 'Сьогодні о 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: 2}).calendar(), 'Сьогодні о 10:00', 'Now minus 2 hours'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Вчора о 12:00', 'yesterday at the same time'); - // A special case for Ukrainian since 11 hours have different preposition - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Сьогодні об 11:00', 'same day at 11 o\'clock'); + 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) { var i, m; for (i = 2; i < 7; i++) { m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('[У] dddd [о' + (m.hours() === 11 ? 'б' : '') + '] 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 [о] 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 [о] LT'), 'Today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('dddd [at] LT'), '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: - case 5: - case 6: - return '[Минулої] dddd [о' + (d.hours() === 11 ? 'б' : '') + '] LT'; - case 1: - case 2: - case 4: - return '[Минулого] dddd [о' + (d.hours() === 11 ? 'б' : '') + '] 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('[Last] dddd [at] 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('[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(makeFormat(m)), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days end of day'); } }); @@ -60652,11 +1998,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 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'); }); }))); @@ -60944,67 +2290,51 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('ur'); - - var months = [ - 'جنوری', - 'فروری', - 'مارچ', - 'اپریل', - 'مئی', - 'جون', - 'جولائی', - 'اگست', - 'ستمبر', - 'اکتوبر', - 'نومبر', - 'دسمبر' - ]; - var days = [ - 'اتوار', - 'پیر', - 'منگل', - 'بدھ', - 'جمعرات', - 'جمعہ', - 'ہفتہ' - ]; + 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; function equalTest(input, mmm, i) { assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); } - for (var i = 0; i < 12; i++) { - equalTest(months[i], 'MMM', i); - equalTest(months[i], 'MMMM', i); + 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', 'اتوار، فروری 14 2010، 3:25:50 شام'], - ['ddd, hA', 'اتوار، 3شام'], - ['M Mo MM MMMM MMM', '2 2 02 فروری فروری'], + ['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 14 14'], - ['d do dddd ddd dd', '0 0 اتوار اتوار اتوار'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '6 6 06'], + ['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', 'شام شام'], - ['[سال کا] DDDo[واں دن]', 'سال کا 45واں دن'], + ['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 فروری 2010'], - ['LLL', '14 فروری 2010 15:25'], - ['LLLL', 'اتوار، 14 فروری 2010 15:25'], + ['LL', '14 February 2010'], + ['LLL', '14 February 2010 15:25'], + ['LLLL', 'Sunday, 14 February 2010 15:25'], ['l', '14/2/2010'], - ['ll', '14 فروری 2010'], - ['lll', '14 فروری 2010 15:25'], - ['llll', 'اتوار، 14 فروری 2010 15:25'] + ['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; @@ -61014,120 +2344,122 @@ }); 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'); + 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'), '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'), '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'), '31st', '31st'); }); test('format month', function (assert) { - for (var i = 0; i < months.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), months[i] + ' ' + months[i], months[i] + ' ' + months[i]); + 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) { - for (var i = 0; i < days.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), days[i] + ' ' + days[i] + ' ' + days[i], days[i] + ' ' + days[i] + ' ' + days[i]); + 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]); } }); test('from', function (assert) { var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'چند سیکنڈ', '44 seconds = چند سیکنڈ'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ایک منٹ', '45 seconds = ایک منٹ'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ایک منٹ', '89 seconds = ایک منٹ'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 منٹ', '90 seconds = 2 منٹ'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 منٹ', '44 minutes = 44 منٹ'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ایک گھنٹہ', '45 minutes = ایک گھنٹہ'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ایک گھنٹہ', '89 minutes = ایک گھنٹہ'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 گھنٹے', '90 minutes = 2 گھنٹے'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 گھنٹے', '5 hours = 5 گھنٹے'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 گھنٹے', '21 hours = 21 گھنٹے'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ایک دن', '22 hours = ایک دن'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ایک دن', '35 hours = ایک دن'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 دن', '36 hours = 2 دن'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ایک دن', '1 day = ایک دن'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 دن', '5 days = 5 دن'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 دن', '25 days = 25 دن'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ایک ماہ', '26 days = ایک ماہ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ایک ماہ', '30 days = ایک ماہ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ایک ماہ', '43 days = ایک ماہ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 ماہ', '46 days = 2 ماہ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 ماہ', '75 days = 2 ماہ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 ماہ', '76 days = 3 ماہ'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ایک ماہ', '1 month = ایک ماہ'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 ماہ', '5 months = 5 ماہ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ایک سال', '345 days = ایک سال'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 سال', '548 days = 2 سال'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ایک سال', '1 year = ایک سال'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 سال', '5 years = 5 سال'); + 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), 'چند سیکنڈ بعد', 'prefix'); - assert.equal(moment(0).from(30000), 'چند سیکنڈ قبل', 'suffix'); + 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(), 'چند سیکنڈ قبل', '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(), 'چند سیکنڈ بعد', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5 دن بعد', 'in 5 days'); + 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(), 'آج بوقت 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 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) { 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 [at] 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 [at] 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 [at] LT'), 'Today + ' + i + ' days end of day'); } }); @@ -61136,11 +2468,11 @@ 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('[Last] dddd [at] 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('[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('[گذشتہ] dddd [بوقت] LT'), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days end of day'); } }); @@ -61159,11 +2491,15 @@ }); 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'), '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'); }); }))); @@ -61451,10 +2787,10 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('uz-latn'); + localeModule('en-nz'); test('parse', function (assert) { - var tests = 'Yanvar Yan_Fevral Fev_Mart Mar_Aprel Apr_May May_Iyun Iyun_Iyul Iyul_Avgust Avg_Sentabr Sen_Oktabr Okt_Noyabr Noy_Dekabr Dek'.split('_'), i; + 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)); } @@ -61473,29 +2809,29 @@ test('format', function (assert) { var a = [ - ['dddd, Do-MMMM YYYY, h:mm:ss', 'Yakshanba, 14-Fevral 2010, 3:25:50'], - ['ddd, h:mm', 'Yak, 3:25'], - ['M Mo MM MMMM MMM', '2 2 02 Fevral Fev'], + ['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 14 14'], - ['d do dddd ddd dd', '0 0 Yakshanba Yak Ya'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '7 7 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', '6 6th 06'], ['h hh', '3 03'], ['H HH', '15 15'], ['m mm', '25 25'], ['s ss', '50 50'], ['a A', 'pm PM'], - ['[yilning] DDDo-[kuni]', 'yilning 45-kuni'], - ['LTS', '15:25:50'], + ['[the] DDDo [day of the year]', 'the 45th day of the year'], + ['LTS', '3:25:50 PM'], ['L', '14/02/2010'], - ['LL', '14 Fevral 2010'], - ['LLL', '14 Fevral 2010 15:25'], - ['LLLL', '14 Fevral 2010, Yakshanba 15:25'], + ['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 Fev 2010'], - ['lll', '14 Fev 2010 15:25'], - ['llll', '14 Fev 2010, Yak 15:25'] + ['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; @@ -61505,122 +2841,122 @@ }); test('format ordinal', function (assert) { - assert.equal(moment([2016, 0, 1]).format('DDDo'), '1', '1'); - assert.equal(moment([2016, 0, 2]).format('DDDo'), '2', '2'); - assert.equal(moment([2016, 0, 3]).format('DDDo'), '3', '3'); - assert.equal(moment([2016, 0, 4]).format('DDDo'), '4', '4'); - assert.equal(moment([2016, 0, 5]).format('DDDo'), '5', '5'); - assert.equal(moment([2016, 0, 6]).format('DDDo'), '6', '6'); - assert.equal(moment([2016, 0, 7]).format('DDDo'), '7', '7'); - assert.equal(moment([2016, 0, 8]).format('DDDo'), '8', '8'); - assert.equal(moment([2016, 0, 9]).format('DDDo'), '9', '9'); - assert.equal(moment([2016, 0, 10]).format('DDDo'), '10', '10'); - - assert.equal(moment([2016, 0, 11]).format('DDDo'), '11', '11'); - assert.equal(moment([2016, 0, 12]).format('DDDo'), '12', '12'); - assert.equal(moment([2016, 0, 13]).format('DDDo'), '13', '13'); - assert.equal(moment([2016, 0, 14]).format('DDDo'), '14', '14'); - assert.equal(moment([2016, 0, 15]).format('DDDo'), '15', '15'); - assert.equal(moment([2016, 0, 16]).format('DDDo'), '16', '16'); - assert.equal(moment([2016, 0, 17]).format('DDDo'), '17', '17'); - assert.equal(moment([2016, 0, 18]).format('DDDo'), '18', '18'); - assert.equal(moment([2016, 0, 19]).format('DDDo'), '19', '19'); - assert.equal(moment([2016, 0, 20]).format('DDDo'), '20', '20'); - - assert.equal(moment([2016, 0, 21]).format('DDDo'), '21', '21'); - assert.equal(moment([2016, 0, 22]).format('DDDo'), '22', '22'); - assert.equal(moment([2016, 0, 23]).format('DDDo'), '23', '23'); - assert.equal(moment([2016, 0, 24]).format('DDDo'), '24', '24'); - assert.equal(moment([2016, 0, 25]).format('DDDo'), '25', '25'); - assert.equal(moment([2016, 0, 26]).format('DDDo'), '26', '26'); - assert.equal(moment([2016, 0, 27]).format('DDDo'), '27', '27'); - assert.equal(moment([2016, 0, 28]).format('DDDo'), '28', '28'); - assert.equal(moment([2016, 0, 29]).format('DDDo'), '29', '29'); - assert.equal(moment([2016, 0, 30]).format('DDDo'), '30', '30'); - - assert.equal(moment([2016, 0, 31]).format('DDDo'), '31', '31'); + 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'), '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'), '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'), '31st', '31st'); }); test('format month', function (assert) { - var expected = 'Yanvar Yan_Fevral Fev_Mart Mar_Aprel Apr_May May_Iyun Iyun_Iyul Iyul_Avgust Avg_Sentabr Sen_Oktabr Okt_Noyabr Noy_Dekabr Dek'.split('_'), i; + 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([2016, i, 1]).format('MMMM MMM'), expected[i], expected[i]); + assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); test('format week', function (assert) { - var expected = 'Yakshanba Yak Ya_Dushanba Dush Du_Seshanba Sesh Se_Chorshanba Chor Cho_Payshanba Pay Pa_Juma Jum Ju_Shanba Shan Sha'.split('_'), i; + 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([2016, 0, 3 + i]).format('dddd ddd dd'), 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([2017, 1, 28]); - assert.equal(start.from(moment([2017, 1, 28]).add({s: 44}), true), 'soniya', '44 soniya = soniya'); - assert.equal(start.from(moment([2017, 1, 28]).add({s: 45}), true), 'bir daqiqa', '45 soniya = bir daqiqa'); - assert.equal(start.from(moment([2017, 1, 28]).add({s: 89}), true), 'bir daqiqa', '89 soniya = bir daqiqa'); - assert.equal(start.from(moment([2017, 1, 28]).add({s: 90}), true), '2 daqiqa', '90 soniya = 2 daqiqa'); - assert.equal(start.from(moment([2017, 1, 28]).add({m: 44}), true), '44 daqiqa', '44 daqiqa = 44 daqiqa'); - assert.equal(start.from(moment([2017, 1, 28]).add({m: 45}), true), 'bir soat', '45 minut = bir soat'); - assert.equal(start.from(moment([2017, 1, 28]).add({m: 89}), true), 'bir soat', '89 minut = bir soat'); - assert.equal(start.from(moment([2017, 1, 28]).add({m: 90}), true), '2 soat', '90 minut = 2 soat'); - assert.equal(start.from(moment([2017, 1, 28]).add({h: 5}), true), '5 soat', '5 soat = 5 soat'); - assert.equal(start.from(moment([2017, 1, 28]).add({h: 21}), true), '21 soat', '21 soat = 21 soat'); - assert.equal(start.from(moment([2017, 1, 28]).add({h: 22}), true), 'bir kun', '22 soat = bir kun'); - assert.equal(start.from(moment([2017, 1, 28]).add({h: 35}), true), 'bir kun', '35 soat = bir kun'); - assert.equal(start.from(moment([2017, 1, 28]).add({h: 36}), true), '2 kun', '36 soat = 2 kun'); - assert.equal(start.from(moment([2017, 1, 28]).add({d: 1}), true), 'bir kun', '1 kun = 1 kun'); - assert.equal(start.from(moment([2017, 1, 28]).add({d: 5}), true), '5 kun', '5 kun = 5 kun'); - assert.equal(start.from(moment([2017, 1, 28]).add({d: 25}), true), '25 kun', '25 kun = 25 kun'); - assert.equal(start.from(moment([2017, 1, 28]).add({d: 26}), true), 'bir oy', '26 kun = bir oy'); - assert.equal(start.from(moment([2017, 1, 28]).add({d: 30}), true), 'bir oy', '30 kun = bir oy'); - assert.equal(start.from(moment([2017, 1, 28]).add({d: 43}), true), 'bir oy', '45 kun = bir oy'); - assert.equal(start.from(moment([2017, 1, 28]).add({d: 46}), true), '2 oy', '46 kun = 2 oy'); - assert.equal(start.from(moment([2017, 1, 28]).add({d: 74}), true), '2 oy', '75 kun = 2 oy'); - assert.equal(start.from(moment([2017, 1, 28]).add({d: 76}), true), '3 oy', '76 kun = 3 oy'); - assert.equal(start.from(moment([2017, 1, 28]).add({M: 1}), true), 'bir oy', 'bir oy = bir oy'); - assert.equal(start.from(moment([2017, 1, 28]).add({M: 5}), true), '5 oy', '5 oy = 5 oy'); - assert.equal(start.from(moment([2017, 1, 28]).add({d: 345}), true), 'bir yil', '345 kun = bir yil'); - assert.equal(start.from(moment([2017, 1, 28]).add({d: 548}), true), '2 yil', '548 kun = 2 yil'); - assert.equal(start.from(moment([2017, 1, 28]).add({y: 1}), true), 'bir yil', '1 yil = bir yil'); - assert.equal(start.from(moment([2017, 1, 28]).add({y: 5}), true), '5 yil', '5 yil = 5 yil'); + 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'); + 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), 'Yaqin soniya ichida', 'prefix'); - assert.equal(moment(0).from(30000), 'Bir necha soniya oldin', 'suffix'); + 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(), 'Bir necha soniya oldin', '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(), 'Yaqin soniya ichida', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'Yaqin 5 kun ichida', 'in 5 days'); + 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(), 'Bugun soat 12:00 da', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Bugun soat 12:25 da', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Bugun soat 13:00 da', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Ertaga 12:00 da', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Bugun soat 11:00 da', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kecha soat 12:00 da', '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 [kuni soat] LT [da]'), '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 [kuni soat] LT [da]'), '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 [kuni soat] LT [da]'), 'Today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days end of day'); } }); @@ -61629,11 +2965,11 @@ for (i = 2; i < 7; i++) { m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[O\'tgan] dddd [kuni soat] LT [da]'), '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('[O\'tgan] dddd [kuni soat] LT [da]'), '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('[O\'tgan] dddd [kuni soat] LT [da]'), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days end of day'); } }); @@ -61652,11 +2988,11 @@ }); 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 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 should be week 2'); + 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'); }); }))); @@ -61944,10 +3280,10 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('uz'); + localeModule('en-sg'); test('parse', function (assert) { - var tests = 'январ янв_феврал фев_март мар_апрел апр_май май_июн июн_июл июл_август авг_сентябр сен_октябр окт_ноябр ноя_декабр дек'.split('_'), i; + 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)); } @@ -61966,29 +3302,29 @@ test('format', function (assert) { var a = [ - ['dddd, Do-MMMM YYYY, h:mm:ss', 'Якшанба, 14-феврал 2010, 3:25:50'], - ['ddd, h:mm', 'Якш, 3:25'], - ['M Mo MM MMMM MMM', '2 2 02 феврал фев'], + ['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 14 14'], - ['d do dddd ddd dd', '0 0 Якшанба Якш Як'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '7 7 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', '6 6th 06'], ['h hh', '3 03'], ['H HH', '15 15'], ['m mm', '25 25'], ['s ss', '50 50'], ['a A', 'pm PM'], - ['[йилнинг] DDDo-[куни]', 'йилнинг 45-куни'], + ['[the] DDDo [day of the year]', 'the 45th 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'], + ['LL', '14 February 2010'], + ['LLL', '14 February 2010 15:25'], + ['LLLL', 'Sunday, 14 February 2010 15:25'], ['l', '14/2/2010'], - ['ll', '14 фев 2010'], - ['lll', '14 фев 2010 15:25'], - ['llll', '14 фев 2010, Якш 15:25'] + ['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; @@ -61998,51 +3334,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, 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'); + 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'), '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'), '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'), '31st', '31st'); }); test('format month', function (assert) { - var expected = 'январ янв_феврал фев_март мар_апрел апр_май май_июн июн_июл июл_август авг_сентябр сен_октябр окт_ноябр ноя_декабр дек'.split('_'), i; + 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 expected = 'Якшанба Якш Як_Душанба Душ Ду_Сешанба Сеш Се_Чоршанба Чор Чо_Пайшанба Пай Па_Жума Жум Жу_Шанба Шан Ша'.split('_'), i; + 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]); } @@ -62050,70 +3386,70 @@ test('from', function (assert) { var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'фурсат', '44 секунд = фурсат'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'бир дакика', '45 секунд = бир дакика'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'бир дакика', '89 секунд = бир дакика'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 дакика', '90 секунд = 2 дакика'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 дакика', '44 дакика = 44 дакика'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'бир соат', '45 минут = бир соат'); - 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 минут = 2 соат'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 соат', '5 соат = 5 соат'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 соат', '21 соат = 21 соат'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'бир кун', '22 соат = бир кун'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'бир кун', '35 соат = бир кун'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 кун', '36 соат = 2 кун'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'бир кун', '1 кун = 1 кун'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 кун', '5 кун = 5 кун'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 кун', '25 кун = 25 кун'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'бир ой', '26 кун = бир ой'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'бир ой', '30 кун = бир ой'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'бир ой', '45 кун = бир ой'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 ой', '46 кун = 2 ой'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 ой', '75 кун = 2 ой'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 ой', '76 кун = 3 ой'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'бир ой', 'бир ой = бир ой'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 ой', '5 ой = 5 ой'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'бир йил', '345 кун = бир йил'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 йил', '548 кун = 2 йил'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'бир йил', '1 йил = бир йил'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 йил', '5 йил = 5 йил'); + 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), 'Якин фурсат ичида', 'prefix'); - assert.equal(moment(0).from(30000), 'Бир неча фурсат олдин', 'suffix'); + 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(), 'Бир неча фурсат олдин', '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(), 'Якин фурсат ичида', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'Якин 5 кун ичида', 'in 5 days'); + 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(), 'Бугун соат 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 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) { 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 [at] 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 [at] 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 [at] LT'), 'Today + ' + i + ' days end of day'); } }); @@ -62122,11 +3458,11 @@ 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('[Last] dddd [at] 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('[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('[Утган] dddd [куни соат] LT [да]'), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days end of day'); } }); @@ -62145,11 +3481,11 @@ }); 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 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 should be week 2'); + 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'); }); }))); @@ -62437,54 +3773,54 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('vi'); + localeModule('en'); test('parse', function (assert) { var i, - tests = 'tháng 1,Th01_tháng 2,Th02_tháng 3,Th03_tháng 4,Th04_tháng 5,Th05_tháng 6,Th06_tháng 7,Th07_tháng 8,Th08_tháng 9,Th09_tháng 10,Th10_tháng 11,Th11_tháng 12,Th12'.split('_'); + 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); + 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], '[tháng] M', i); - equalTest(tests[i][1], '[Th]M', i); - equalTest(tests[i][0], '[tháng] MM', i); - equalTest(tests[i][1], '[Th]MM', i); - equalTest(tests[i][0].toLocaleLowerCase(), '[THÁNG] M', i); - equalTest(tests[i][1].toLocaleLowerCase(), '[TH]M', i); - equalTest(tests[i][0].toLocaleUpperCase(), '[THÁNG] MM', i); - equalTest(tests[i][1].toLocaleUpperCase(), '[TH]MM', 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', 'chủ nhật, tháng 2 14 2010, 3:25:50 ch'], - ['ddd, hA', 'CN, 3CH'], - ['M Mo MM MMMM MMM', '2 2 02 tháng 2 Th02'], + ['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 14 14'], - ['d do dddd ddd dd', '0 0 chủ nhật CN CN'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '6 6 06'], + ['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', 'ch CH'], - ['[ngày thứ] DDDo [của năm]', 'ngày thứ 45 của năm'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 tháng 2 năm 2010'], - ['LLL', '14 tháng 2 năm 2010 15:25'], - ['LLLL', 'chủ nhật, 14 tháng 2 năm 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Th02 2010'], - ['lll', '14 Th02 2010 15:25'], - ['llll', 'CN, 14 Th02 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; @@ -62495,54 +3831,54 @@ }); 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'); + 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'), '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'), '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'), '31st', '31st'); }); test('format month', function (assert) { var i, - expected = 'tháng 1,Th01_tháng 2,Th02_tháng 3,Th03_tháng 4,Th04_tháng 5,Th05_tháng 6,Th06_tháng 7,Th07_tháng 8,Th08_tháng 9,Th09_tháng 10,Th10_tháng 11,Th11_tháng 12,Th12'.split('_'); + 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]); + assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); test('format week', function (assert) { var i, - expected = 'chủ nhật CN CN_thứ hai T2 T2_thứ ba T3 T3_thứ tư T4 T4_thứ năm T5 T5_thứ sáu T6 T6_thứ bảy T7 T7'.split('_'); + 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]); @@ -62552,59 +3888,59 @@ test('from', function (assert) { var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'vài giây', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'một phút', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'một phút', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 phút', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 phút', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'một giờ', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'một giờ', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 giờ', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 giờ', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 giờ', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'một ngày', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'một ngày', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 ngày', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'một ngày', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 ngày', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 ngày', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'một tháng', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'một tháng', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'một tháng', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 tháng', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 tháng', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 tháng', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'một tháng', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 tháng', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'một năm', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 năm', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'một năm', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 năm', '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), 'vài giây tới', 'prefix'); - assert.equal(moment(0).from(30000), 'vài giây trước', 'suffix'); + 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(), 'vài giây trước', '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(), 'vài giây tới', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5 ngày tới', 'in 5 days'); + 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(), 'Hôm nay lúc 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Hôm nay lúc 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Hôm nay lúc 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Ngày mai lúc 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hôm nay lúc 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Hôm qua lúc 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) { @@ -62612,11 +3948,11 @@ for (i = 2; i < 7; i++) { m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [tuần tới lúc] 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 [tuần tới lúc] 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 [tuần tới lúc] LT'), 'Today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days end of day'); } }); @@ -62625,11 +3961,11 @@ for (i = 2; i < 7; i++) { m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [tuần rồi lúc] 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('dddd [tuần rồi lúc] 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('dddd [tuần rồi lúc] LT'), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days end of day'); } }); @@ -62647,12 +3983,27 @@ 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'); + 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); + } }); }))); @@ -62940,10 +4291,10 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('x-pseudo'); + localeModule('es-do'); test('parse', function (assert) { - var tests = 'J~áñúá~rý J~áñ_F~ébrú~árý ~Féb_~Márc~h ~Már_Áp~ríl ~Ápr_~Máý ~Máý_~Júñé~ ~Júñ_Júl~ý ~Júl_Áú~gúst~ ~Áúg_Sép~témb~ér ~Sép_Ó~ctób~ér ~Óct_Ñ~óvém~bér ~Ñóv_~Décé~mbér ~Déc'.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 + ' should be month ' + (i + 1)); } @@ -62962,29 +4313,30 @@ test('format', function (assert) { var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'S~úñdá~ý, F~ébrú~árý 14th 2010, 3:25:50 pm'], - ['ddd, hA', 'S~úñ, 3PM'], - ['M Mo MM MMMM MMM', '2 2nd 02 F~ébrú~árý ~Féb'], + ['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 14th 14'], - ['d do dddd ddd dd', '0 0th S~úñdá~ý S~úñ S~ú'], - ['DDD DDDo DDDD', '45 45th 045'], - ['w wo ww', '6 6th 06'], + ['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 45th day of the year'], - ['LT', '15:25'], + ['[the] DDDo [day of the year]', 'the 45º day of the year'], + ['LTS', '3:25:50 PM'], ['L', '14/02/2010'], - ['LL', '14 F~ébrú~árý 2010'], - ['LLL', '14 F~ébrú~árý 2010 15:25'], - ['LLLL', 'S~úñdá~ý, 14 F~ébrú~árý 2010 15:25'], + ['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 ~Féb 2010'], - ['lll', '14 ~Féb 2010 15:25'], - ['llll', 'S~úñ, 14 ~Féb 2010 15:25'] + ['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; @@ -62994,51 +4346,51 @@ }); test('format ordinal', function (assert) { - 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, 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'), '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, 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'), '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, 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'), '31st', '31st'); + assert.equal(moment([2011, 0, 31]).format('DDDo'), '31º', '31º'); }); test('format month', function (assert) { - var expected = 'J~áñúá~rý J~áñ_F~ébrú~árý ~Féb_~Márc~h ~Már_Áp~ríl ~Ápr_~Máý ~Máý_~Júñé~ ~Júñ_Júl~ý ~Júl_Áú~gúst~ ~Áúg_Sép~témb~ér ~Sép_Ó~ctób~ér ~Óct_Ñ~óvém~bér ~Ñóv_~Décé~mbér ~Déc'.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 = 'S~úñdá~ý S~úñ S~ú_Mó~ñdáý~ ~Móñ Mó~_Túé~sdáý~ ~Túé Tú_Wéd~ñésd~áý ~Wéd ~Wé_T~húrs~dáý ~Thú T~h_~Fríd~áý ~Frí Fr~_S~átúr~dáý ~Sát Sá'.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]); } @@ -63046,70 +4398,72 @@ test('from', function (assert) { var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'á ~féw ~sécó~ñds', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'á ~míñ~úté', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'á ~míñ~úté', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 m~íñú~tés', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 m~íñú~tés', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'á~ñ hó~úr', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'á~ñ hó~úr', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 h~óúrs', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 h~óúrs', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 h~óúrs', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'á ~dáý', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'á ~dáý', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 d~áýs', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'á ~dáý', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 d~áýs', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 d~áýs', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'á ~móñ~th', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'á ~móñ~th', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'á ~móñ~th', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 m~óñt~hs', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 m~óñt~hs', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 m~óñt~hs', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'á ~móñ~th', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 m~óñt~hs', '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 ý~éárs', '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 ý~éárs', '5 years = 5 years'); + 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), 'í~ñ á ~féw ~sécó~ñds', 'prefix'); - assert.equal(moment(0).from(30000), 'á ~féw ~sécó~ñds á~gó', '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(), 'á ~féw ~sécó~ñds á~gó', '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(), 'í~ñ á ~féw ~sécó~ñds', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'í~ñ 5 d~áýs', 'in 5 days'); + 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(2).minutes(0).seconds(0); + var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'T~ódá~ý át 02:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'T~ódá~ý át 02:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'T~ódá~ý át 03:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'T~ómó~rró~w át 02:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'T~ódá~ý át 01:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ý~ést~érdá~ý át 02: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) { var i, m; + for (i = 2; i < 7; i++) { m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [át] 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('dddd [át] 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('dddd [át] 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'); } }); @@ -63118,11 +4472,11 @@ for (i = 2; i < 7; i++) { m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[L~ást] dddd [át] 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('[L~ást] dddd [át] 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('[L~ást] dddd [át] 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'); } }); @@ -63141,11 +4495,17 @@ }); 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'), '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'); }); }))); @@ -63433,10 +4793,10 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('yo'); + localeModule('es-us'); test('parse', function (assert) { - var tests = 'Sẹ́rẹ́ Sẹ́r_Èrèlè Èrl_Ẹrẹ̀nà Ẹrn_Ìgbé Ìgb_Èbibi Èbi_Òkùdu Òkù_Agẹmo Agẹ_Ògún Ògú_Owewe Owe_Ọ̀wàrà Ọ̀wà_Bélú Bél_Ọ̀pẹ̀̀ Ọ̀pẹ̀̀'.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 + ' should be month ' + (i + 1)); } @@ -63455,29 +4815,31 @@ test('format', function (assert) { var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Àìkú, Èrèlè ọjọ́ 14 2010, 3:25:50 pm'], - ['ddd, hA', 'Àìk, 3PM'], - ['M Mo MM MMMM MMM', '2 ọjọ́ 2 02 Èrèlè Èrl'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 ọjọ́ 14 14'], - ['d do dddd ddd dd', '0 ọjọ́ 0 Àìkú Àìk Àì'], - ['DDD DDDo DDDD', '45 ọjọ́ 45 045'], - ['w wo ww', '6 ọjọ́ 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 ọjọ́ 45 day of the year'], - ['LTS', '3:25:50 PM'], - ['L', '14/02/2010'], - ['LL', '14 Èrèlè 2010'], - ['LLL', '14 Èrèlè 2010 3:25 PM'], - ['LLLL', 'Àìkú, 14 Èrèlè 2010 3:25 PM'], - ['l', '14/2/2010'], - ['ll', '14 Èrl 2010'], - ['lll', '14 Èrl 2010 3:25 PM'], - ['llll', 'Àìk, 14 Èrl 2010 3:25 PM'] + ['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', '8 8º 08'], + ['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'], + ['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 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 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; @@ -63487,53 +4849,55 @@ }); test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), 'ọjọ́ 1', 'ọjọ́ 1'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), 'ọjọ́ 2', 'ọjọ́ 2'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), 'ọjọ́ 3', 'ọjọ́ 3'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), 'ọjọ́ 4', 'ọjọ́ 4'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), 'ọjọ́ 5', 'ọjọ́ 5'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), 'ọjọ́ 6', 'ọjọ́ 6'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), 'ọjọ́ 7', 'ọjọ́ 7'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), 'ọjọ́ 8', 'ọjọ́ 8'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), 'ọjọ́ 9', 'ọjọ́ 9'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), 'ọjọ́ 10', 'ọjọ́ 10'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), 'ọjọ́ 11', 'ọjọ́ 11'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), 'ọjọ́ 12', 'ọjọ́ 12'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), 'ọjọ́ 13', 'ọjọ́ 13'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), 'ọjọ́ 14', 'ọjọ́ 14'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), 'ọjọ́ 15', 'ọjọ́ 15'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), 'ọjọ́ 16', 'ọjọ́ 16'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), 'ọjọ́ 17', 'ọjọ́ 17'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), 'ọjọ́ 18', 'ọjọ́ 18'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), 'ọjọ́ 19', 'ọjọ́ 19'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), 'ọjọ́ 20', 'ọjọ́ 20'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), 'ọjọ́ 21', 'ọjọ́ 21'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), 'ọjọ́ 22', 'ọjọ́ 22'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), 'ọjọ́ 23', 'ọjọ́ 23'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), 'ọjọ́ 24', 'ọjọ́ 24'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), 'ọjọ́ 25', 'ọjọ́ 25'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), 'ọjọ́ 26', 'ọjọ́ 26'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), 'ọjọ́ 27', 'ọjọ́ 27'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), 'ọjọ́ 28', 'ọjọ́ 28'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), 'ọjọ́ 29', 'ọjọ́ 29'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), 'ọjọ́ 30', 'ọjọ́ 30'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), 'ọjọ́ 31', 'ọjọ́ 31'); + 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 = 'Sẹ́rẹ́ Sẹ́r_Èrèlè Èrl_Ẹrẹ̀nà Ẹrn_Ìgbé Ìgb_Èbibi Èbi_Òkùdu Òkù_Agẹmo Agẹ_Ògún Ògú_Owewe Owe_Ọ̀wàrà Ọ̀wà_Bélú Bél_Ọ̀pẹ̀̀ Ọ̀pẹ̀̀'.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 = 'Àìkú Àìk Àì_Ajé Ajé Aj_Ìsẹ́gun Ìsẹ́ Ìs_Ọjọ́rú Ọjr Ọr_Ọjọ́bọ Ọjb Ọb_Ẹtì Ẹtì Ẹt_Àbámẹ́ta Àbá Àb'.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]); } @@ -63541,59 +4905,61 @@ test('from', function (assert) { var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ìsẹjú aayá die', '44 seconds = ìsẹjú aayá die'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ìsẹjú kan', '45 seconds = ìsẹjú kan'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ìsẹjú kan', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), 'ìsẹjú 2', '90 seconds = ìsẹjú 2'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), 'ìsẹjú 44', 'ìsẹjú 44 = ìsẹjú 44'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'wákati kan', 'ìsẹjú 45 = wákati kan'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'wákati kan', 'ìsẹjú 89 = wákati kan'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), 'wákati 2', 'ìsẹjú 90 = wákati 2'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), 'wákati 5', 'wákati 5 = wákati 5'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), 'wákati 21', 'wákati 21 = wákati 21'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ọjọ́ kan', '22 wákati = ọjọ́ kan'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ọjọ́ kan', '35 wákati = ọjọ́ kan'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), 'ọjọ́ 2', 'wákati 36 = ọjọ́ 2'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ọjọ́ kan', '1 = ọjọ́ kan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), 'ọjọ́ 5', 'ọjọ́ 5 = ọjọ́ 5'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), 'ọjọ́ 25', 'ọjọ́ 25 = ọjọ́ 25'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'osù kan', 'ọjọ́ 26 = osù kan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'osù kan', 'ọjọ́ 30 = osù kan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'osù kan', 'ọjọ́ 43 = osù kan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), 'osù 2', 'ọjọ́ 46 = osù 2'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), 'osù 2', 'ọjọ́ 75 = osù 2'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), 'osù 3', 'ọjọ́ 76 = osù 3'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'osù kan', 'osù 1 = osù kan'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), 'osù 5', 'osù 5 = osù 5'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ọdún kan', 'ọjọ 345 = ọdún kan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), 'ọdún 2', 'ọjọ 548 = ọdún 2'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ọdún kan', 'ọdún 1 = ọdún kan'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), 'ọdún 5', 'ọdún 5 = ọdún 5'); + + 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), 'ní ìsẹjú aayá die', 'prefix'); - assert.equal(moment(0).from(30000), 'ìsẹjú aayá die kọjá', '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(), 'ìsẹjú aayá die kọjá', '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(), 'ní ìsẹjú aayá die', 'ní ìsẹjú aayá die'); - assert.equal(moment().add({d: 5}).fromNow(), 'ní ọjọ́ 5', 'ní ọjọ́ 5'); + 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(), 'Ònì ni 12:00 PM', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Ònì ni 12:25 PM', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Ònì ni 1:00 PM', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Ọ̀la ni 12:00 PM', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Ònì ni 11:00 AM', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Àna ni 12:00 PM', '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) { @@ -63601,11 +4967,11 @@ for (i = 2; i < 7; i++) { m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [Ọsẹ̀ tón\'bọ] [ni] 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('dddd [Ọsẹ̀ tón\'bọ] [ni] 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('dddd [Ọsẹ̀ tón\'bọ] [ni] 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'); } }); @@ -63614,11 +4980,11 @@ for (i = 2; i < 7; i++) { m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [Ọsẹ̀ tólọ́] [ni] 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('dddd [Ọsẹ̀ tólọ́] [ni] 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('dddd [Ọsẹ̀ tólọ́] [ni] 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'); } }); @@ -63626,22 +4992,33 @@ 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'); + 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 format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 ọjọ́ 52', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 ọjọ́ 1', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 ọjọ́ 1', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 ọjọ́ 2', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 ọjọ́ 2', 'Jan 15 2012 should be week 2'); + 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, 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'); + }); + + 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'); + }); + + test('test lenient month parsing', function (assert) { + assert.ok(moment('nov 01, 2015', 'MMM D, YYYY', true).isValid(), 'nov 01, 2015 should parse correctly'); }); }))); @@ -63929,15 +5306,13 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('zh-cn'); + localeModule('es'); test('parse', function (assert) { - var tests = '一月 1月_二月 2月_三月 3月_四月 4月_五月 5月_六月 6月_七月 7月_八月 8月_九月 9月_十月 10月_十一月 11月_十二月 12月'.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 + ' should be month ' + (i + 1)); } - for (i = 0; i < 12; i++) { tests[i] = tests[i].split(' '); equalTest(tests[i][0], 'MMM', i); @@ -63953,49 +5328,84 @@ test('format', function (assert) { var a = [ - ['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月'], + ['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日 星期日 周日 日'], - ['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º 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', '下午 下午'], - ['[这年的第] DDDo', '这年的第 45日'], + ['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', '2010年2月14日'], - ['LLL', '2010年2月14日下午3点25分'], - ['LLLL', '2010年2月14日星期日下午3点25分'], - ['l', '2010/2/14'], - ['ll', '2010年2月14日'], - ['lll', '2010年2月14日 15:25'], - ['llll', '2010年2月14日星期日 15:25'] + ['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; - 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 month', function (assert) { - var expected = '一月 1月_二月 2月_三月 3月_四月 4月_五月 5月_六月 6月_七月 7月_八月 8月_九月 9月_十月 10月_十一月 11月_十二月 12月'.split('_'), i; + 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 = '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 = '星期日 周日 日_星期一 周一 一_星期二 周二 二_星期三 周三 三_星期四 周四 四_星期五 周五 五_星期六 周六 六'.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]); } @@ -64003,82 +5413,85 @@ 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), '1 分钟', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '1 分钟', '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), '1 小时', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '1 小时', '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), '1 天', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '1 天', '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 天', '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), '1 个月', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '1 个月', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '1 个月', '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 个月', '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), '1 年', '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 年', '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), '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), '几秒内', 'prefix'); - assert.equal(moment(0).from(30000), '几秒前', '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(), '几秒前', '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(), '几秒内', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5 天内', 'in 5 days'); + 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(), '今天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(), '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('[下]ddddLT'), '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('[下]ddddLT'), '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('[下]ddddLT'), '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('[上]ddddLT'), '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('[上]ddddLT'), '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('[上]ddddLT'), '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'); } }); @@ -64086,29 +5499,31 @@ var weeksAgo = moment().subtract({w: 1}), weeksFromNow = moment().add({w: 1}); - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); + 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(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); }); - test('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 0, 0]).format('A'), '凌晨', 'before dawn'); - assert.equal(moment([2011, 2, 23, 6, 0]).format('A'), '早上', 'morning'); - assert.equal(moment([2011, 2, 23, 9, 0]).format('A'), '上午', 'before noon'); - assert.equal(moment([2011, 2, 23, 12, 0]).format('A'), '中午', 'noon'); - assert.equal(moment([2011, 2, 23, 13, 0]).format('A'), '下午', 'afternoon'); - assert.equal(moment([2011, 2, 23, 18, 0]).format('A'), '晚上', 'night'); + 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'; + assert.equal(moment(str, 'DD-MMM-YYYY').month(), '7', '02-ago-2016 month should be 7'); }); - test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52周', 'Jan 1 2012 应该是第52周'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1周', 'Jan 7 2012 应该是第 1周'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2周', 'Jan 14 2012 应该是第 2周'); + test('translated invalid date', function (assert) { + assert.equal(moment('nonsense', 'DD-MMM-YYYY').format(), 'Fecha invalida', 'Invalid date should translate'); }); }))); @@ -64396,13 +5811,15 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('zh-hk'); + localeModule('pt-br'); test('parse', function (assert) { - var tests = '一月 1月_二月 2月_三月 3月_四月 4月_五月 5月_六月 6月_七月 7月_八月 8月_九月 9月_十月 10月_十一月 11月_十二月 12月'.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)); } + for (i = 0; i < 12; i++) { tests[i] = tests[i].split(' '); equalTest(tests[i][0], 'MMM', i); @@ -64418,49 +5835,83 @@ test('format', function (assert) { var a = [ - ['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月'], + ['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'], ['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'], + ['D Do DD', '14 14º 14'], + ['d do dddd ddd', '0 0º Domingo Dom'], + ['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', '下午 下午'], - ['[這年的第] DDDo', '這年的第 45日'], + ['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', '2010年2月14日'], - ['LLL', '2010年2月14日 15:25'], - ['LLLL', '2010年2月14日星期日 15:25'], - ['l', '2010/2/14'], - ['ll', '2010年2月14日'], - ['lll', '2010年2月14日 15:25'], - ['llll', '2010年2月14日星期日 15:25'] + ['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'], + ['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'] ], 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 month', function (assert) { - var expected = '一月 1月_二月 2月_三月 3月_四月 4月_五月 5月_六月 6月_七月 7月_八月 8月_九月 9月_十月 10月_十一月 11月_十二月 12月'.split('_'), i; + 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 = '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]); } }); test('format week', function (assert) { - var expected = '星期日 週日 日_星期一 週一 一_星期二 週二 二_星期三 週三 三_星期四 週四 四_星期五 週五 五_星期六 週六 六'.split('_'), i; - + var expected = 'Domingo Dom Do_Segunda-feira Seg 2ª_Terça-feira Ter 3ª_Quarta-feira Qua 4ª_Quinta-feira Qui 5ª_Sexta-feira Sex 6ª_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]); } @@ -64468,70 +5919,66 @@ 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), '1 分鐘', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '1 分鐘', '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), '1 小時', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '1 小時', '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), '1 天', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '1 天', '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 天', '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), '1 個月', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '1 個月', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '1 個月', '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 個月', '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), '1 年', '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 年', '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), 'poucos segundos', '44 seconds = seconds'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'um minuto', '45 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'um 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), 'uma hora', '45 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'uma 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), 'um dia', '22 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'um dia', '35 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dias', '36 hours = 2 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'um dia', '1 day = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dias', '5 days = 5 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dias', '25 days = 25 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'um mês', '26 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'um mês', '30 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'um mês', '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), 'um mês', '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), 'um 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), 'um 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), '幾秒內', '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(30000).from(0), 'em poucos segundos', 'prefix'); + assert.equal(moment(0).from(30000), 'há poucos segundos', 'prefix'); }); 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(), 'em poucos segundos', 'in seconds'); + assert.equal(moment().add({d: 5}).fromNow(), 'em 5 dias', '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(), 'Hoje às 12:00', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'Hoje às 12:25', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'Hoje às 13:00', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'Amanhã às 12:00', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hoje às 11:00', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ontem às 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('[下]ddddLT'), 'Today + ' + i + ' days current time'); + assert.equal(m.calendar(), m.format('dddd [às] LT'), 'Today + ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[下]ddddLT'), 'Today + ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('dddd [às] LT'), 'Today + ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[下]ddddLT'), 'Today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('dddd [às] LT'), 'Today + ' + i + ' days end of day'); } }); @@ -64539,11 +5986,11 @@ var i, m; for (i = 2; i < 7; i++) { m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[上]ddddLT'), 'Today - ' + i + ' days current time'); + assert.equal(m.calendar(), m.format((m.day() === 0 || m.day() === 6) ? '[Último] dddd [às] LT' : '[Última] dddd [às] LT'), 'Today - ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[上]ddddLT'), 'Today - ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format((m.day() === 0 || m.day() === 6) ? '[Último] dddd [às] LT' : '[Última] dddd [às] LT'), 'Today - ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[上]ddddLT'), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format((m.day() === 0 || m.day() === 6) ? '[Último] dddd [às] LT' : '[Última] dddd [às] LT'), 'Today - ' + i + ' days end of day'); } }); @@ -64551,38 +5998,36 @@ var weeksAgo = moment().subtract({w: 1}), weeksFromNow = moment().add({w: 1}); - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); + 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(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); }); - test('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 0, 0]).format('a'), '凌晨', 'before dawn'); - assert.equal(moment([2011, 2, 23, 6, 0]).format('a'), '早上', 'morning'); - assert.equal(moment([2011, 2, 23, 9, 0]).format('a'), '上午', 'before noon'); - assert.equal(moment([2011, 2, 23, 12, 0]).format('a'), '中午', 'noon'); - assert.equal(moment([2011, 2, 23, 13, 0]).format('a'), '下午', 'after noon'); - assert.equal(moment([2011, 2, 23, 18, 0]).format('a'), '晚上', 'night'); - - assert.equal(moment([2011, 2, 23, 0, 0]).format('A'), '凌晨', 'before dawn'); - assert.equal(moment([2011, 2, 23, 6, 0]).format('A'), '早上', 'morning'); - assert.equal(moment([2011, 2, 23, 9, 0]).format('A'), '上午', 'before noon'); - assert.equal(moment([2011, 2, 23, 12, 0]).format('A'), '中午', 'noon'); - assert.equal(moment([2011, 2, 23, 13, 0]).format('A'), '下午', 'afternoon'); - assert.equal(moment([2011, 2, 23, 18, 0]).format('A'), '晚上', 'night'); + 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('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1週', 'Jan 1 2012 應該是第 1週'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1週', 'Jan 7 2012 應該是第 1週'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2週', 'Jan 8 2012 應該是第 2週'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2週', 'Jan 14 2012 應該是第 2週'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3週', 'Jan 15 2012 應該是第 3週'); + test('relative time threshold', function (assert) { + var rts = moment(), + rtsDefault = moment.relativeTimeThreshold('ss'); + + moment.relativeTimeThreshold('ss', 3); + + rts.subtract(3, 'seconds'); + assert.equal(rts.fromNow(), 'há poucos segundos', 'Below custom a few seconds to seconds threshold'); + rts.subtract(1, 'seconds'); + assert.equal(rts.fromNow(), 'há 4 segundos', 'Above custom a few seconds to seconds threshold'); + + moment.relativeTimeThreshold('ss', rtsDefault); }); }))); @@ -64870,10 +6315,10 @@ defineCommonLocaleTests(name, -1, -1); } - localeModule('zh-tw'); + localeModule('pt'); test('parse', function (assert) { - var tests = '一月 1月_二月 2月_三月 3月_四月 4月_五月 5月_六月 6月_七月 7月_八月 8月_九月 9月_十月 10月_十一月 11月_十二月 12月'.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)); } @@ -64892,49 +6337,83 @@ test('format', function (assert) { var a = [ - ['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月'], + ['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'], ['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'], + ['D Do DD', '14 14º 14'], + ['d do dddd ddd', '0 0º Domingo Dom'], + ['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', '下午 下午'], - ['[這年的第] DDDo', '這年的第 45日'], + ['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', '2010年2月14日'], - ['LLL', '2010年2月14日 15:25'], - ['LLLL', '2010年2月14日星期日 15:25'], - ['l', '2010/2/14'], - ['ll', '2010年2月14日'], - ['lll', '2010年2月14日 15:25'], - ['llll', '2010年2月14日星期日 15:25'] + ['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'], + ['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'] ], 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 month', function (assert) { - var expected = '一月 1月_二月 2月_三月 3月_四月 4月_五月 5月_六月 6月_七月 7月_八月 8月_九月 9月_十月 10月_十一月 11月_十二月 12月'.split('_'), i; + 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 = '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]); } }); test('format week', function (assert) { - var expected = '星期日 週日 日_星期一 週一 一_星期二 週二 二_星期三 週三 三_星期四 週四 四_星期五 週五 五_星期六 週六 六'.split('_'), i; - + var expected = 'Domingo Dom Do_Segunda-feira Seg 2ª_Terça-feira Ter 3ª_Quarta-feira Qua 4ª_Quinta-feira Qui 5ª_Sexta-feira Sex 6ª_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]); } @@ -64942,70 +6421,66 @@ 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), '1 分鐘', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '1 分鐘', '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), '1 小時', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '1 小時', '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), '1 天', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '1 天', '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 天', '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), '1 個月', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '1 個月', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '1 個月', '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 個月', '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), '1 年', '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 年', '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), 'segundos', '44 seconds = seconds'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'um minuto', '45 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'um 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), 'uma hora', '45 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'uma 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), 'um dia', '22 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'um dia', '35 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dias', '36 hours = 2 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'um dia', '1 day = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dias', '5 days = 5 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dias', '25 days = 25 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'um mês', '26 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'um mês', '30 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'um mês', '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), 'um mês', '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), 'um 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), 'um 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), '幾秒內', '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(30000).from(0), 'em segundos', 'prefix'); + assert.equal(moment(0).from(30000), 'há segundos', 'suffix'); }); 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(), 'em segundos', 'in seconds'); + assert.equal(moment().add({d: 5}).fromNow(), 'em 5 dias', '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(), 'Hoje às 12:00', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'Hoje às 12:25', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'Hoje às 13:00', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'Amanhã às 12:00', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hoje às 11:00', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ontem às 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 [às] 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 [às] 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 [às] LT'), 'Today + ' + i + ' days end of day'); } }); @@ -65013,11 +6488,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((m.day() === 0 || m.day() === 6) ? '[Último] dddd [às] LT' : '[Última] dddd [às] 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((m.day() === 0 || m.day() === 6) ? '[Último] dddd [às] LT' : '[Última] dddd [às] 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((m.day() === 0 || m.day() === 6) ? '[Último] dddd [às] LT' : '[Última] dddd [às] LT'), 'Today - ' + i + ' days end of day'); } }); @@ -65025,38 +6500,22 @@ var weeksAgo = moment().subtract({w: 1}), weeksFromNow = moment().add({w: 1}); - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); + 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(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); }); - test('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 0, 0]).format('a'), '凌晨', 'before dawn'); - assert.equal(moment([2011, 2, 23, 6, 0]).format('a'), '早上', 'morning'); - assert.equal(moment([2011, 2, 23, 9, 0]).format('a'), '上午', 'before noon'); - assert.equal(moment([2011, 2, 23, 12, 0]).format('a'), '中午', 'noon'); - assert.equal(moment([2011, 2, 23, 13, 0]).format('a'), '下午', 'after noon'); - assert.equal(moment([2011, 2, 23, 18, 0]).format('a'), '晚上', 'night'); - - assert.equal(moment([2011, 2, 23, 0, 0]).format('A'), '凌晨', 'before dawn'); - assert.equal(moment([2011, 2, 23, 6, 0]).format('A'), '早上', 'morning'); - assert.equal(moment([2011, 2, 23, 9, 0]).format('A'), '上午', 'before noon'); - assert.equal(moment([2011, 2, 23, 12, 0]).format('A'), '中午', 'noon'); - assert.equal(moment([2011, 2, 23, 13, 0]).format('A'), '下午', 'afternoon'); - assert.equal(moment([2011, 2, 23, 18, 0]).format('A'), '晚上', 'night'); - }); - - test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1週', 'Jan 1 2012 應該是第 1週'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1週', 'Jan 7 2012 應該是第 1週'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2週', 'Jan 8 2012 應該是第 2週'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2週', 'Jan 14 2012 應該是第 2週'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3週', 'Jan 15 2012 應該是第 3週'); + 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'); }); }))); @@ -65671,7 +7130,6 @@ try { assert.equal(a.calendar('2016-01-01'), 'This month on the 29th', 'Ad hoc calendar format for this month'); assert.equal(b.calendar('2016-01-01'), 'Next month on the 1st', 'Ad hoc calendar format for next month'); - assert.equal(a.locale('fr').calendar('2016-01-01'), a.locale('fr').format('L'), 'French falls back to default because thisMonth is not defined in that locale'); } finally { moment.calendarFormat = calendarFormat; moment.updateLocale('en', null); @@ -66524,21 +7982,21 @@ assert.ok(moment('Thu 08-10-2017', 'ddd MM-DD-YYYY').isValid(), 'because day of week is correct for the date'); }); - test('parsing weekday on utc dates verifies day acccording to utc time', function (assert) { + test('parsing weekday on utc dates verifies day according to utc time', function (assert) { assert.ok(moment.utc('Mon 03:59', 'ddd HH:mm').isValid(), 'Monday 03:59'); }); - test('parsing weekday on local dates verifies day acccording to local time', function (assert) { + test('parsing weekday on local dates verifies day according to local time', function (assert) { // this doesn't do much useful if you're not in the US or at least close to it assert.ok(moment('Mon 03:59', 'ddd HH:mm').isValid(), 'Monday 03:59'); }); - test('parsing weekday on utc dates with specified offsets verifies day acccording to that offset', function (assert) { + test('parsing weekday on utc dates with specified offsets verifies day according to that offset', function (assert) { assert.ok(moment.utc('Mon 03:59 +12:00', 'ddd HH:mm Z', true).isValid(), 'Monday 03:59'); }); - test('parsing weekday on local dates with specified offsets verifies day acccording to that offset', function (assert) { - // if you're in the US, these times will all be sometime Sunday, but they shoud parse as Monday + test('parsing weekday on local dates with specified offsets verifies day according to that offset', function (assert) { + // if you're in the US, these times will all be sometime Sunday, but they should parse as Monday assert.ok(moment('Mon 03:59 +12:00', 'ddd HH:mm Z', true).isValid(), 'Monday 03:59'); }); @@ -67122,13 +8580,6 @@ assert.equal(orig.isUTC, false, 'not a UTC date'); }); - test('valid date at fr locale', function (assert) { - var dat = moment('1992-10-22', 'YYYY-MM-DD', 'fr'); - var orig = dat.creationData(); - - assert.equal(orig.locale._abbr, 'fr', 'locale is fr'); - }); - test('valid date with formats', function (assert) { var dat = moment('29-06-1995', ['MM-DD-YYYY', 'DD-MM', 'DD-MM-YYYY']); var orig = dat.creationData(); @@ -68679,7 +10130,7 @@ assert.equal(moment.duration('26:45').milliseconds(), 0, '0 milliseconds'); }); - test('instatiation from serialized C# TimeSpan zero', function (assert) { + test('instantiation from serialized C# TimeSpan zero', function (assert) { assert.equal(moment.duration('00:00:00').years(), 0, '0 years'); assert.equal(moment.duration('00:00:00').days(), 0, '0 days'); assert.equal(moment.duration('00:00:00').hours(), 0, '0 hours'); @@ -68688,7 +10139,7 @@ assert.equal(moment.duration('00:00:00').milliseconds(), 0, '0 milliseconds'); }); - test('instatiation from serialized C# TimeSpan with days', function (assert) { + test('instantiation from serialized C# TimeSpan with days', function (assert) { assert.equal(moment.duration('1.02:03:04.9999999').years(), 0, '0 years'); assert.equal(moment.duration('1.02:03:04.9999999').days(), 1, '1 day'); assert.equal(moment.duration('1.02:03:04.9999999').hours(), 2, '2 hours'); @@ -68704,7 +10155,7 @@ assert.equal(moment.duration('1 02:03:04.9999999').milliseconds(), 0, '0 milliseconds'); }); - test('instatiation from serialized C# TimeSpan without days', function (assert) { + test('instantiation from serialized C# TimeSpan without days', function (assert) { assert.equal(moment.duration('01:02:03.9999999').years(), 0, '0 years'); assert.equal(moment.duration('01:02:03.9999999').days(), 0, '0 days'); assert.equal(moment.duration('01:02:03.9999999').hours(), 1, '1 hour'); @@ -68722,7 +10173,7 @@ assert.equal(moment.duration('500:59:59.8888888').hours(), 20, '500 hours overflows to 20 hours'); }); - test('instatiation from serialized C# TimeSpan without days or milliseconds', function (assert) { + test('instantiation from serialized C# TimeSpan without days or milliseconds', function (assert) { assert.equal(moment.duration('01:02:03').years(), 0, '0 years'); assert.equal(moment.duration('01:02:03').days(), 0, '0 days'); assert.equal(moment.duration('01:02:03').hours(), 1, '1 hour'); @@ -68731,7 +10182,7 @@ assert.equal(moment.duration('01:02:03').milliseconds(), 0, '0 milliseconds'); }); - test('instatiation from serialized C# TimeSpan without milliseconds', function (assert) { + test('instantiation from serialized C# TimeSpan without milliseconds', function (assert) { assert.equal(moment.duration('1.02:03:04').years(), 0, '0 years'); assert.equal(moment.duration('1.02:03:04').days(), 1, '1 day'); assert.equal(moment.duration('1.02:03:04').hours(), 2, '2 hours'); @@ -68770,7 +10221,7 @@ assert.equal(moment.duration('+00:00:15.7205000').milliseconds(), 721, '721 milliseconds'); }); - test('instatiation from serialized C# TimeSpan maxValue', function (assert) { + test('instantiation from serialized C# TimeSpan maxValue', function (assert) { var d = moment.duration('10675199.02:48:05.4775807'); assert.equal(d.years(), 29227, '29227 years'); @@ -68783,7 +10234,7 @@ assert.equal(d.milliseconds(), 478, '478 milliseconds'); }); - test('instatiation from serialized C# TimeSpan minValue', function (assert) { + test('instantiation from serialized C# TimeSpan minValue', function (assert) { var d = moment.duration('-10675199.02:48:05.4775808'); assert.equal(d.years(), -29227, '29653 years'); @@ -68796,7 +10247,7 @@ assert.equal(d.milliseconds(), -478, '478 milliseconds'); }); - test('instatiation from serialized C# TimeSpan maxValue with + sign', function (assert) { + test('instantiation from serialized C# TimeSpan maxValue with + sign', function (assert) { var d = moment.duration('+10675199.02:48:05.4775808'); assert.equal(d.years(), 29227, '29653 years'); @@ -71437,7 +12888,7 @@ assert.equal(m.isAfter(moment(new Date(2011, 3, 3, 3, 4, 9, 10)), 'minute'), false, 'day is later'); assert.equal(m.isAfter(moment(new Date(2011, 3, 1, 3, 4, 9, 10)), 'minute'), true, 'day is earlier'); assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 4, 4, 9, 10)), 'minute'), false, 'hour is later'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 2, 4, 9, 10)), 'minute'), true, 'hour is earler'); + assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 2, 4, 9, 10)), 'minute'), true, 'hour is earlier'); assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 5, 9, 10)), 'minute'), false, 'minute is later'); assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 3, 9, 10)), 'minute'), true, 'minute is earlier'); assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 4, 0, 0)), 'minute'), false, 'exact start of minute'); @@ -71739,7 +13190,7 @@ assert.equal(m.isBefore(moment(new Date(2011, 3, 3, 3, 4, 9, 10)), 'minute'), true, 'day is later'); assert.equal(m.isBefore(moment(new Date(2011, 3, 1, 3, 4, 9, 10)), 'minute'), false, 'day is earlier'); assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 4, 4, 9, 10)), 'minute'), true, 'hour is later'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 2, 4, 9, 10)), 'minute'), false, 'hour is earler'); + assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 2, 4, 9, 10)), 'minute'), false, 'hour is earlier'); assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 5, 9, 10)), 'minute'), true, 'minute is later'); assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 3, 9, 10)), 'minute'), false, 'minute is earlier'); assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 4, 0, 0)), 'minute'), false, 'exact start of minute'); @@ -74943,7 +16394,7 @@ }); moment.defineLocale('child-months', { parentLocale: 'base-months', - months : 'First_Second_Third_Fourth_Fifth_Sixth_Seventh_Eighth_Ninth_Tenth_Eleventh_Twelveth '.split('_') + months : 'First_Second_Third_Fourth_Fifth_Sixth_Seventh_Eighth_Ninth_Tenth_Eleventh_Twelfth '.split('_') }); assert.ok(moment.utc('2015-01-01', 'YYYY-MM-DD').format('MMMM'), 'First', 'months uses child'); }); @@ -74954,7 +16405,7 @@ moment.defineLocale('months-x', { parentLocale: 'base-months-x', - months : 'First_Second_Third_Fourth_Fifth_Sixth_Seventh_Eighth_Ninth_Tenth_Eleventh_Twelveth '.split('_') + months : 'First_Second_Third_Fourth_Fifth_Sixth_Seventh_Eighth_Ninth_Tenth_Eleventh_Twelfth '.split('_') }); assert.equal(moment.locale(), 'en', 'failed to set a locale requiring missing parent'); @@ -74969,11 +16420,11 @@ }); test('lazy load parentLocale', function (assert) { - moment.defineLocale('de_test', { - parentLocale: 'de', + moment.defineLocale('en_test', { + parentLocale: 'en', monthsShort: ['M1', 'M2', 'M3', 'M4', 'M5', 'M6', 'M7', 'M8', 'M9', 'M10', 'M11', 'M12'] }); - assert.equal(moment.locale(), 'de_test', 'failed to lazy load parentLocale'); + assert.equal(moment.locale(), 'en_test', 'failed to lazy load parentLocale'); }); }))); @@ -75228,17 +16679,27 @@ }); moment.updateLocale('months', { parentLocale: 'base-months', - months : 'First_Second_Third_Fourth_Fifth_Sixth_Seventh_Eighth_Ninth_Tenth_Eleventh_Twelveth '.split('_') + months : 'First_Second_Third_Fourth_Fifth_Sixth_Seventh_Eighth_Ninth_Tenth_Eleventh_Twelfth '.split('_') }); assert.ok(moment.utc('2015-01-01', 'YYYY-MM-DD').format('MMMM'), 'First', 'months uses child'); }); test('update existing locale', function (assert) { - moment.updateLocale('de', { + moment.updateLocale('es', { + monthsShort: ['JAN', 'FEB', 'MÄR', 'APR', 'MAI', 'JUN', 'JUL', 'AUG', 'SEP', 'OKT', 'NOV', 'DEZ'] + }); + assert.equal(moment('2017-02-01').format('YYYY MMM MMMM'), '2017 FEB febrero'); + moment.updateLocale('es', null); + }); + + test('reset locale', function (assert) { + moment.locale('es'); + var resultBeforeUpdate = moment('2017-02-01').format('YYYY MMM MMMM'); + moment.updateLocale('es', { monthsShort: ['JAN', 'FEB', 'MÄR', 'APR', 'MAI', 'JUN', 'JUL', 'AUG', 'SEP', 'OKT', 'NOV', 'DEZ'] }); - assert.equal(moment('2017-02-01').format('YYYY MMM MMMM'), '2017 FEB Februar'); - moment.updateLocale('de', null); + moment.updateLocale('es', null); + assert.equal(moment('2017-02-01').format('YYYY MMM MMMM'), resultBeforeUpdate); }); }))); @@ -78830,7 +20291,7 @@ assert.equal(moment([2029, 8, 19]).weekday(), 1, 'Sep 19 2029 is Wednesday -- 1st day'); assert.equal(moment([2013, 3, 25]).weekday(), 2, 'Apr 25 2013 is Thursday -- 2nd day'); assert.equal(moment([2015, 2, 6]).weekday(), 3, 'Mar 6 2015 is Friday -- 3nd day'); - assert.equal(moment([1970, 0, 3]).weekday(), 4, 'Jan 3 1970 is Staturday -- 4th day'); + assert.equal(moment([1970, 0, 3]).weekday(), 4, 'Jan 3 1970 is Saturday -- 4th day'); assert.equal(moment([2001, 4, 13]).weekday(), 5, 'May 13 2001 is Sunday -- 5th day'); assert.equal(moment([2000, 0, 3]).weekday(), 6, 'Jan 3 2000 is Monday -- 6th day'); }); @@ -78861,7 +20322,7 @@ test('weekday first day of week Friday (dow 5)', function (assert) { moment.locale('dow: 5,doy: 6', {week: {dow: 5, doy: 6}}); assert.equal(moment([1985, 1, 8]).weekday(), 0, 'Feb 8 1985 is Friday -- 0th day'); - assert.equal(moment([2029, 8, 22]).weekday(), 1, 'Sep 22 2029 is Staturday -- 1st day'); + assert.equal(moment([2029, 8, 22]).weekday(), 1, 'Sep 22 2029 is Saturday -- 1st day'); assert.equal(moment([2013, 3, 28]).weekday(), 2, 'Apr 28 2013 is Sunday -- 2nd day'); assert.equal(moment([2015, 2, 9]).weekday(), 3, 'Mar 9 2015 is Monday -- 3nd day'); assert.equal(moment([1970, 0, 6]).weekday(), 4, 'Jan 6 1970 is Tuesday -- 4th day'); @@ -78871,7 +20332,7 @@ test('weekday first day of week Saturday (dow 6)', function (assert) { moment.locale('dow: 6,doy: 6', {week: {dow: 6, doy: 6}}); - assert.equal(moment([1985, 1, 9]).weekday(), 0, 'Feb 9 1985 is Staturday -- 0th day'); + assert.equal(moment([1985, 1, 9]).weekday(), 0, 'Feb 9 1985 is Saturday -- 0th day'); assert.equal(moment([2029, 8, 23]).weekday(), 1, 'Sep 23 2029 is Sunday -- 1st day'); assert.equal(moment([2013, 3, 29]).weekday(), 2, 'Apr 29 2013 is Monday -- 2nd day'); assert.equal(moment([2015, 2, 10]).weekday(), 3, 'Mar 10 2015 is Tuesday -- 3nd day'); @@ -80168,7 +21629,7 @@ assert.equal(o.hour(), 0); }); - test('parse zone with weekday on verifies day acccording to the offset', function (assert) { + test('parse zone with weekday on verifies day according to the offset', function (assert) { test.expectedDeprecations(); assert.ok(moment.parseZone('Mon 03:59 +12:00', 'ddd HH:mm Z', true).isValid(), 'Monday 03:59'); }); diff --git a/moment.d.ts b/moment.d.ts index ec72fbc357..03cfec47ed 100644 --- a/moment.d.ts +++ b/moment.d.ts @@ -55,7 +55,7 @@ declare namespace moment { interface WeekSpec { dow: number; - doy: number; + doy?: number; } type CalendarSpecVal = string | ((m?: MomentInput, now?: Moment) => string); diff --git a/moment.js b/moment.js index 1b129716ac..3baaa04917 100644 --- a/moment.js +++ b/moment.js @@ -1957,6 +1957,9 @@ if (locales[name] != null) { if (locales[name].parentLocale != null) { locales[name] = locales[name].parentLocale; + if (name === getSetGlobalLocale()) { + getSetGlobalLocale(name); + } } else if (locales[name] != null) { delete locales[name]; } @@ -2299,7 +2302,7 @@ function checkWeekday(weekdayStr, parsedInput, config) { if (weekdayStr) { - // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check. + // TODO: Replace the vanilla JS Date object with an independent day-of-week check. var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay(); if (weekdayProvided !== weekdayActual) { diff --git a/package-lock.json b/package-lock.json index 151876c750..ada40e4aa0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "moment", - "version": "2.23.0", + "version": "2.24.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -610,7 +610,7 @@ }, "chai": { "version": "1.9.2", - "resolved": "http://registry.npmjs.org/chai/-/chai-1.9.2.tgz", + "resolved": "https://registry.npmjs.org/chai/-/chai-1.9.2.tgz", "integrity": "sha1-Pxog+CsLnXQ3V30k1vErGmnTtZA=", "dev": true, "requires": { @@ -620,7 +620,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -849,7 +849,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -864,7 +864,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -917,7 +917,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -932,7 +932,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -1004,9 +1004,9 @@ "dev": true }, "core-js": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.0.tgz", - "integrity": "sha512-kLRC6ncVpuEW/1kwrOXYX6KQASCVtrh1gQr/UiaVgFlf9WE5Vp+lNe5+h3LuMr5PAucWnnEXwH0nQHRH/gpGtw==", + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.2.tgz", + "integrity": "sha512-NdBPF/RVwPW6jr0NCILuyN9RiqLo2b1mddWHkUL+VnvcB7dzlnBJ1bXYntjpTGOgkZiiLWj2JxmOr7eGE3qK6g==", "dev": true }, "core-util-is": { @@ -1153,7 +1153,7 @@ }, "deep-eql": { "version": "0.1.3", - "resolved": "http://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", "integrity": "sha1-71WKyrjeJSBs1xOQbXTlaTDrafI=", "dev": true, "requires": { @@ -1274,7 +1274,7 @@ "dependencies": { "domelementtype": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", "dev": true }, @@ -1313,7 +1313,7 @@ }, "duplexer": { "version": "0.1.1", - "resolved": "http://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", "dev": true }, @@ -1381,7 +1381,7 @@ }, "engine.io-client": { "version": "3.2.1", - "resolved": "http://registry.npmjs.org/engine.io-client/-/engine.io-client-3.2.1.tgz", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.2.1.tgz", "integrity": "sha512-y5AbkytWeM4jQr7m/koQLc5AxpRKC1hEVUb/s1FUAWEJq5AzJJ4NLvzuKPuxtDi5Mq755WuDvZ6Iv2rXj4PTzw==", "dev": true, "requires": { @@ -1442,7 +1442,7 @@ }, "entities": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/entities/-/entities-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz", "integrity": "sha1-sph6o4ITR/zeZCsk/fyeT7cSvyY=", "dev": true }, @@ -1464,7 +1464,7 @@ }, "es6-promisify": { "version": "5.0.0", - "resolved": "http://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", "dev": true, "requires": { @@ -1633,7 +1633,7 @@ }, "expand-range": { "version": "0.1.1", - "resolved": "http://registry.npmjs.org/expand-range/-/expand-range-0.1.1.tgz", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-0.1.1.tgz", "integrity": "sha1-TLjtoJk8pW+k9B/ELzy7TMrf8EQ=", "dev": true, "requires": { @@ -2000,9 +2000,9 @@ "dev": true }, "follow-redirects": { - "version": "1.5.10", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", - "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.6.1.tgz", + "integrity": "sha512-t2JCjbzxQpWvbhts3l6SH1DKzSrx8a+SsaVf4h6bG4kOXUuPYS/kg2Lr4gQSb7eemaHqJkOThF1BGyjlUkO1GQ==", "dev": true, "requires": { "debug": "=3.1.0" @@ -2068,7 +2068,7 @@ }, "fs-access": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/fs-access/-/fs-access-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/fs-access/-/fs-access-1.0.1.tgz", "integrity": "sha1-1qh/JiJxzv6+wwxVNAf7mV2od3o=", "dev": true, "requires": { @@ -2077,7 +2077,7 @@ }, "fs-extra": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz", "integrity": "sha1-zTzl9+fLYUWIP8rjGR6Yd/hYeVA=", "dev": true, "requires": { @@ -2101,9 +2101,9 @@ "dev": true }, "fsevents": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.4.tgz", - "integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.7.tgz", + "integrity": "sha512-Pxm6sI2MeBD7RdD12RYsqaP0nMiwx8eZBXCa6z2L+mRHm2DYrOYwihmhjpkdjUHwQhslWQjRpEgNq4XvBmaAuw==", "dev": true, "optional": true, "requires": { @@ -2129,7 +2129,7 @@ "optional": true }, "are-we-there-yet": { - "version": "1.1.4", + "version": "1.1.5", "bundled": true, "dev": true, "optional": true, @@ -2153,7 +2153,7 @@ } }, "chownr": { - "version": "1.0.1", + "version": "1.1.1", "bundled": true, "dev": true, "optional": true @@ -2189,7 +2189,7 @@ } }, "deep-extend": { - "version": "0.5.1", + "version": "0.6.0", "bundled": true, "dev": true, "optional": true @@ -2238,7 +2238,7 @@ } }, "glob": { - "version": "7.1.2", + "version": "7.1.3", "bundled": true, "dev": true, "optional": true, @@ -2258,12 +2258,12 @@ "optional": true }, "iconv-lite": { - "version": "0.4.21", + "version": "0.4.24", "bundled": true, "dev": true, "optional": true, "requires": { - "safer-buffer": "^2.1.0" + "safer-buffer": ">= 2.1.2 < 3" } }, "ignore-walk": { @@ -2324,16 +2324,16 @@ "dev": true }, "minipass": { - "version": "2.2.4", + "version": "2.3.5", "bundled": true, "dev": true, "requires": { - "safe-buffer": "^5.1.1", + "safe-buffer": "^5.1.2", "yallist": "^3.0.0" } }, "minizlib": { - "version": "1.1.0", + "version": "1.2.1", "bundled": true, "dev": true, "optional": true, @@ -2356,7 +2356,7 @@ "optional": true }, "needle": { - "version": "2.2.0", + "version": "2.2.4", "bundled": true, "dev": true, "optional": true, @@ -2367,18 +2367,18 @@ } }, "node-pre-gyp": { - "version": "0.10.0", + "version": "0.10.3", "bundled": true, "dev": true, "optional": true, "requires": { "detect-libc": "^1.0.2", "mkdirp": "^0.5.1", - "needle": "^2.2.0", + "needle": "^2.2.1", "nopt": "^4.0.1", "npm-packlist": "^1.1.6", "npmlog": "^4.0.2", - "rc": "^1.1.7", + "rc": "^1.2.7", "rimraf": "^2.6.1", "semver": "^5.3.0", "tar": "^4" @@ -2395,13 +2395,13 @@ } }, "npm-bundled": { - "version": "1.0.3", + "version": "1.0.5", "bundled": true, "dev": true, "optional": true }, "npm-packlist": { - "version": "1.1.10", + "version": "1.2.0", "bundled": true, "dev": true, "optional": true, @@ -2476,12 +2476,12 @@ "optional": true }, "rc": { - "version": "1.2.7", + "version": "1.2.8", "bundled": true, "dev": true, "optional": true, "requires": { - "deep-extend": "^0.5.1", + "deep-extend": "^0.6.0", "ini": "~1.3.0", "minimist": "^1.2.0", "strip-json-comments": "~2.0.1" @@ -2511,16 +2511,16 @@ } }, "rimraf": { - "version": "2.6.2", + "version": "2.6.3", "bundled": true, "dev": true, "optional": true, "requires": { - "glob": "^7.0.5" + "glob": "^7.1.3" } }, "safe-buffer": { - "version": "5.1.1", + "version": "5.1.2", "bundled": true, "dev": true }, @@ -2537,7 +2537,7 @@ "optional": true }, "semver": { - "version": "5.5.0", + "version": "5.6.0", "bundled": true, "dev": true, "optional": true @@ -2588,17 +2588,17 @@ "optional": true }, "tar": { - "version": "4.4.1", + "version": "4.4.8", "bundled": true, "dev": true, "optional": true, "requires": { - "chownr": "^1.0.1", + "chownr": "^1.1.1", "fs-minipass": "^1.2.5", - "minipass": "^2.2.4", - "minizlib": "^1.1.0", + "minipass": "^2.3.4", + "minizlib": "^1.1.1", "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.1", + "safe-buffer": "^5.1.2", "yallist": "^3.0.2" } }, @@ -2609,12 +2609,12 @@ "optional": true }, "wide-align": { - "version": "1.1.2", + "version": "1.1.3", "bundled": true, "dev": true, "optional": true, "requires": { - "string-width": "^1.0.2" + "string-width": "^1.0.2 || 2" } }, "wrappy": { @@ -2623,7 +2623,7 @@ "dev": true }, "yallist": { - "version": "3.0.2", + "version": "3.0.3", "bundled": true, "dev": true } @@ -2876,7 +2876,7 @@ "dependencies": { "benchmark": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/benchmark/-/benchmark-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-1.0.0.tgz", "integrity": "sha1-Lx4vpMNZ8REiqhgwgiGOlX45DHM=", "dev": true } @@ -2950,12 +2950,12 @@ } }, "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", "dev": true, "requires": { - "glob": "^7.0.5" + "glob": "^7.1.3" } } } @@ -3001,9 +3001,9 @@ } }, "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, "requires": { "ansi-styles": "^3.2.1", @@ -3050,9 +3050,9 @@ } }, "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, "requires": { "ansi-styles": "^3.2.1", @@ -3112,7 +3112,7 @@ "dependencies": { "lodash": { "version": "2.4.2", - "resolved": "http://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=", "dev": true } @@ -3138,7 +3138,7 @@ "dependencies": { "lodash": { "version": "4.6.1", - "resolved": "http://registry.npmjs.org/lodash/-/lodash-4.6.1.tgz", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.6.1.tgz", "integrity": "sha1-3wDBFkrSNrGDz8OIel6NOMxjy7w=", "dev": true } @@ -3463,7 +3463,7 @@ }, "htmlparser2": { "version": "3.8.3", - "resolved": "http://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz", "integrity": "sha1-mWwosZFRaovoZQGn15dX5ccMEGg=", "dev": true, "requires": { @@ -3476,7 +3476,7 @@ }, "http-errors": { "version": "1.6.3", - "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", "dev": true, "requires": { @@ -3818,7 +3818,7 @@ "dependencies": { "commander": { "version": "2.9.0", - "resolved": "http://registry.npmjs.org/commander/-/commander-2.9.0.tgz", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", "dev": true, "requires": { @@ -3851,7 +3851,7 @@ }, "lodash": { "version": "3.10.1", - "resolved": "http://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", "dev": true }, @@ -3893,7 +3893,7 @@ "dependencies": { "lodash": { "version": "3.10.1", - "resolved": "http://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", "dev": true } @@ -3946,7 +3946,7 @@ }, "jsonfile": { "version": "2.4.0", - "resolved": "http://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", "dev": true, "requires": { @@ -4007,13 +4007,13 @@ "dependencies": { "core-js": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/core-js/-/core-js-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.3.0.tgz", "integrity": "sha1-+rg/uwstjchfpjbEudNMdUIMbWU=", "dev": true }, "es6-promise": { "version": "3.0.2", - "resolved": "http://registry.npmjs.org/es6-promise/-/es6-promise-3.0.2.tgz", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.0.2.tgz", "integrity": "sha1-AQ1YWEI6XxGJeWZfRkhqlcbuK7Y=", "dev": true }, @@ -4031,7 +4031,7 @@ }, "readable-stream": { "version": "2.0.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", "dev": true, "requires": { @@ -4046,9 +4046,9 @@ } }, "karma": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/karma/-/karma-3.1.3.tgz", - "integrity": "sha512-JU4FYUtFEGsLZd6ZJzLrivcPj0TkteBiIRDcXWFsltPMGgZMDtby/MIzNOzgyZv/9dahs9vHpSxerC/ZfeX9Qw==", + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/karma/-/karma-3.1.4.tgz", + "integrity": "sha512-31Vo8Qr5glN+dZEVIpnPCxEGleqE0EY6CtC2X9TagRV3rRQ3SNrvfhddICkJgUK3AgqpeKSZau03QumTGhGoSw==", "dev": true, "requires": { "bluebird": "^3.3.0", @@ -4117,12 +4117,12 @@ } }, "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", "dev": true, "requires": { - "glob": "^7.0.5" + "glob": "^7.1.3" } }, "source-map": { @@ -4179,7 +4179,7 @@ }, "kew": { "version": "0.7.0", - "resolved": "http://registry.npmjs.org/kew/-/kew-0.7.0.tgz", + "resolved": "https://registry.npmjs.org/kew/-/kew-0.7.0.tgz", "integrity": "sha1-edk9LTM2PW/dKXCzNdkUGtWR15s=", "dev": true }, @@ -4415,7 +4415,7 @@ }, "media-typer": { "version": "0.3.0", - "resolved": "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", "dev": true }, @@ -4559,15 +4559,15 @@ } }, "mute-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", - "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, "nan": { - "version": "2.12.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.12.0.tgz", - "integrity": "sha512-zT5nC0JhbljmyEf+Z456nvm7iO7XgRV2hYxoBtPpnyp+0Q4aCoP6uWNn76v/I6k2kCYNLWqWbwBWQcjsNI/bjw==", + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.12.1.tgz", + "integrity": "sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw==", "dev": true, "optional": true }, @@ -4612,7 +4612,7 @@ }, "ncp": { "version": "0.4.2", - "resolved": "http://registry.npmjs.org/ncp/-/ncp-0.4.2.tgz", + "resolved": "https://registry.npmjs.org/ncp/-/ncp-0.4.2.tgz", "integrity": "sha1-q8xsvT7C7Spyn/bnwfqPAXhKhXQ=", "dev": true }, @@ -4796,7 +4796,7 @@ }, "chalk": { "version": "0.4.0", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz", "integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=", "dev": true, "requires": { @@ -4807,13 +4807,13 @@ }, "strip-ansi": { "version": "0.1.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz", "integrity": "sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE=", "dev": true }, "underscore": { "version": "1.6.0", - "resolved": "http://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", "dev": true } @@ -7621,13 +7621,13 @@ }, "os-homedir": { "version": "1.0.2", - "resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, "os-tmpdir": { "version": "1.0.2", - "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, @@ -7648,9 +7648,9 @@ "dev": true }, "pako": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.7.tgz", - "integrity": "sha512-3HNK5tW4x8o5mO8RuHZp3Ydw9icZXx0RANAOMzlMzx7LVXhMJ4mo3MOBpzyd7r/+RUu8BmndP47LXT+vzjtWcQ==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.8.tgz", + "integrity": "sha512-6i0HVbUfcKaTv+EG8ZTr75az7GFXcLYk9UyLEg7Notv/Ma+z/UG3TCoz6GiNeOrn1E/e63I0X/Hpw18jHOTUnA==", "dev": true }, "parse-filepath": { @@ -7844,7 +7844,7 @@ }, "pretty-bytes": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/pretty-bytes/-/pretty-bytes-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-3.0.1.tgz", "integrity": "sha1-J9AAjXeAY6C0gRuzXHnxvV1fvM8=", "dev": true, "requires": { @@ -7859,7 +7859,7 @@ }, "progress": { "version": "1.1.8", - "resolved": "http://registry.npmjs.org/progress/-/progress-1.1.8.tgz", + "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", "dev": true }, @@ -8011,7 +8011,7 @@ }, "minimist": { "version": "0.0.10", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", "dev": true }, @@ -8034,7 +8034,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { @@ -8069,7 +8069,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -8084,7 +8084,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -8413,12 +8413,12 @@ } }, "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", "dev": true, "requires": { - "glob": "^7.0.5" + "glob": "^7.1.3" } } } @@ -8474,12 +8474,12 @@ } }, "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", "dev": true, "requires": { - "glob": "^7.0.5" + "glob": "^7.1.3" } }, "tmp": { @@ -8545,7 +8545,7 @@ }, "shelljs": { "version": "0.3.0", - "resolved": "http://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz", "integrity": "sha1-NZbmMHp4FUT1kfN9phg2DzHbV7E=", "dev": true }, @@ -8756,7 +8756,7 @@ }, "socket.io-parser": { "version": "3.2.0", - "resolved": "http://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.2.0.tgz", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.2.0.tgz", "integrity": "sha512-FYiBx7rc/KORMJlgsXysflWx/RIvtqZbyGLlHZvjfmPTPeuD/I8MaW7cfFrj5tRltICJdgwflhfZ3NVVbVLFQA==", "dev": true, "requires": { @@ -8852,7 +8852,7 @@ }, "graceful-fs": { "version": "3.0.11", - "resolved": "http://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.11.tgz", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.11.tgz", "integrity": "sha1-dhPHeKGv6mLyXGMKCG1/Osu92Bg=", "dev": true, "requires": { @@ -8871,7 +8871,7 @@ }, "semver": { "version": "4.1.0", - "resolved": "http://registry.npmjs.org/semver/-/semver-4.1.0.tgz", + "resolved": "https://registry.npmjs.org/semver/-/semver-4.1.0.tgz", "integrity": "sha1-vICp/2hTKBQ2LMPP2jx7de2cMhw=", "dev": true } @@ -8969,7 +8969,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -8984,7 +8984,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -9007,7 +9007,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -9402,7 +9402,7 @@ "dependencies": { "async": { "version": "0.2.10", - "resolved": "http://registry.npmjs.org/async/-/async-0.2.10.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", "integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E=", "dev": true } @@ -9416,14 +9416,14 @@ }, "uuid": { "version": "2.0.3", - "resolved": "http://registry.npmjs.org/uuid/-/uuid-2.0.3.tgz", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.3.tgz", "integrity": "sha1-Z+LoY3lyFVMN/zGOW/nc6/1Hsho=", "dev": true }, "v8flags": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.1.1.tgz", - "integrity": "sha512-iw/1ViSEaff8NJ3HLyEjawk/8hjJib3E7pvG4pddVXfUg1983s3VGsiClDjhK64MQVDGqc1Q8r18S4VKQZS9EQ==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.1.2.tgz", + "integrity": "sha512-MtivA7GF24yMPte9Rp/BWGCYQNaUj86zeYxV/x2RRJMKagImbbv3u8iJC57lNhWLPcGLJmHcHmFWkNsplbbLWw==", "dev": true, "requires": { "homedir-polyfill": "^1.0.1" @@ -9577,7 +9577,7 @@ }, "winston": { "version": "0.8.3", - "resolved": "http://registry.npmjs.org/winston/-/winston-0.8.3.tgz", + "resolved": "https://registry.npmjs.org/winston/-/winston-0.8.3.tgz", "integrity": "sha1-ZLar9M0Brcrv1QCTk7HY6L7BnbA=", "dev": true, "requires": { @@ -9592,7 +9592,7 @@ "dependencies": { "async": { "version": "0.2.10", - "resolved": "http://registry.npmjs.org/async/-/async-0.2.10.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", "integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E=", "dev": true }, @@ -9639,7 +9639,7 @@ "dependencies": { "xmlbuilder": { "version": "9.0.7", - "resolved": "http://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=", "dev": true } @@ -9647,7 +9647,7 @@ }, "xmlbuilder": { "version": "3.1.0", - "resolved": "http://registry.npmjs.org/xmlbuilder/-/xmlbuilder-3.1.0.tgz", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-3.1.0.tgz", "integrity": "sha1-LIaIjy1OrehQ+jjKf3Ij9yCVFuE=", "dev": true, "requires": { @@ -9656,7 +9656,7 @@ "dependencies": { "lodash": { "version": "3.10.1", - "resolved": "http://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", "dev": true } diff --git a/src/lib/create/from-string.js b/src/lib/create/from-string.js index c5ad56bab8..9ea014ab26 100644 --- a/src/lib/create/from-string.js +++ b/src/lib/create/from-string.js @@ -133,7 +133,7 @@ function preprocessRFC2822(s) { function checkWeekday(weekdayStr, parsedInput, config) { if (weekdayStr) { - // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check. + // TODO: Replace the vanilla JS Date object with an independent day-of-week check. var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay(); if (weekdayProvided !== weekdayActual) { diff --git a/src/lib/locale/locales.js b/src/lib/locale/locales.js index af28bfe27f..b0e030dba8 100644 --- a/src/lib/locale/locales.js +++ b/src/lib/locale/locales.js @@ -160,6 +160,9 @@ export function updateLocale(name, config) { if (locales[name] != null) { if (locales[name].parentLocale != null) { locales[name] = locales[name].parentLocale; + if (name === getSetGlobalLocale()) { + getSetGlobalLocale(name); + } } else if (locales[name] != null) { delete locales[name]; } diff --git a/src/locale/af.js b/src/locale/af.js deleted file mode 100644 index 7af03241e1..0000000000 --- a/src/locale/af.js +++ /dev/null @@ -1,64 +0,0 @@ -//! moment.js locale configuration -//! locale : Afrikaans [af] -//! author : Werner Mollentze : https://github.com/wernerm - -import moment from '../moment'; - -export default moment.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 (input) { - return /^nm$/i.test(input); - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 12) { - return isLower ? 'vm' : 'VM'; - } else { - return isLower ? '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ôre 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 (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); // Thanks to Joris Röling : https://github.com/jjupiter - }, - week : { - dow : 1, // Maandag is die eerste dag van die week. - doy : 4 // Die week wat die 4de Januarie bevat is die eerste week van die jaar. - } -}); diff --git a/src/locale/ar-dz.js b/src/locale/ar-dz.js deleted file mode 100644 index b485b5a781..0000000000 --- a/src/locale/ar-dz.js +++ /dev/null @@ -1,51 +0,0 @@ -//! moment.js locale configuration -//! locale : Arabic (Algeria) [ar-dz] -//! author : Noureddine LOUAHEDJ : https://github.com/noureddineme - -import moment from '../moment'; - -export default moment.defineLocale('ar-dz', { - months : 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - monthsShort : 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'احد_اثنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'أح_إث_ثلا_أر_خم_جم_سب'.split('_'), - weekdaysParseExact : true, - 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: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'في %s', - past : 'منذ %s', - s : 'ثوان', - ss : '%d ثانية', - m : 'دقيقة', - mm : '%d دقائق', - h : 'ساعة', - hh : '%d ساعات', - d : 'يوم', - dd : '%d أيام', - M : 'شهر', - MM : '%d أشهر', - y : 'سنة', - yy : '%d سنوات' - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/locale/ar-kw.js b/src/locale/ar-kw.js deleted file mode 100644 index 90df0edb7c..0000000000 --- a/src/locale/ar-kw.js +++ /dev/null @@ -1,50 +0,0 @@ -//! moment.js locale configuration -//! locale : Arabic (Kuwait) [ar-kw] -//! author : Nusret Parlak: https://github.com/nusretparlak - -import moment from '../moment'; - -export default moment.defineLocale('ar-kw', { - months : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), - monthsShort : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), - weekdays : 'الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - 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: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'في %s', - past : 'منذ %s', - s : 'ثوان', - ss : '%d ثانية', - m : 'دقيقة', - mm : '%d دقائق', - h : 'ساعة', - hh : '%d ساعات', - d : 'يوم', - dd : '%d أيام', - M : 'شهر', - MM : '%d أشهر', - y : 'سنة', - yy : '%d سنوات' - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } -}); diff --git a/src/locale/ar-ly.js b/src/locale/ar-ly.js deleted file mode 100644 index 77fe8d86ea..0000000000 --- a/src/locale/ar-ly.js +++ /dev/null @@ -1,113 +0,0 @@ -//! moment.js locale configuration -//! locale : Arabic (Lybia) [ar-ly] -//! author : Ali Hmer: https://github.com/kikoanis - -import moment from '../moment'; - -var symbolMap = { - '1': '1', - '2': '2', - '3': '3', - '4': '4', - '5': '5', - '6': '6', - '7': '7', - '8': '8', - '9': '9', - '0': '0' -}, pluralForm = function (n) { - return n === 0 ? 0 : n === 1 ? 1 : n === 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5; -}, plurals = { - s : ['أقل من ثانية', 'ثانية واحدة', ['ثانيتان', 'ثانيتين'], '%d ثوان', '%d ثانية', '%d ثانية'], - m : ['أقل من دقيقة', 'دقيقة واحدة', ['دقيقتان', 'دقيقتين'], '%d دقائق', '%d دقيقة', '%d دقيقة'], - h : ['أقل من ساعة', 'ساعة واحدة', ['ساعتان', 'ساعتين'], '%d ساعات', '%d ساعة', '%d ساعة'], - d : ['أقل من يوم', 'يوم واحد', ['يومان', 'يومين'], '%d أيام', '%d يومًا', '%d يوم'], - M : ['أقل من شهر', 'شهر واحد', ['شهران', 'شهرين'], '%d أشهر', '%d شهرا', '%d شهر'], - y : ['أقل من عام', 'عام واحد', ['عامان', 'عامين'], '%d أعوام', '%d عامًا', '%d عام'] -}, pluralize = function (u) { - return function (number, withoutSuffix, string, isFuture) { - var f = pluralForm(number), - str = plurals[u][pluralForm(number)]; - if (f === 2) { - str = str[withoutSuffix ? 0 : 1]; - } - return str.replace(/%d/i, number); - }; -}, months = [ - 'يناير', - 'فبراير', - 'مارس', - 'أبريل', - 'مايو', - 'يونيو', - 'يوليو', - 'أغسطس', - 'سبتمبر', - 'أكتوبر', - 'نوفمبر', - 'ديسمبر' -]; - -export default moment.defineLocale('ar-ly', { - months : months, - monthsShort : months, - weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - 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: /ص|م/, - isPM : function (input) { - return 'م' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ص'; - } else { - return 'م'; - } - }, - calendar : { - sameDay: '[اليوم عند الساعة] LT', - nextDay: '[غدًا عند الساعة] LT', - nextWeek: 'dddd [عند الساعة] LT', - lastDay: '[أمس عند الساعة] LT', - lastWeek: 'dddd [عند الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'بعد %s', - past : 'منذ %s', - s : pluralize('s'), - ss : pluralize('s'), - m : pluralize('m'), - mm : pluralize('m'), - h : pluralize('h'), - hh : pluralize('h'), - d : pluralize('d'), - dd : pluralize('d'), - M : pluralize('M'), - MM : pluralize('M'), - y : pluralize('y'), - yy : pluralize('y') - }, - preparse: function (string) { - return string.replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }).replace(/,/g, '،'); - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } -}); diff --git a/src/locale/ar-ma.js b/src/locale/ar-ma.js deleted file mode 100644 index fa99b0783c..0000000000 --- a/src/locale/ar-ma.js +++ /dev/null @@ -1,52 +0,0 @@ -//! moment.js locale configuration -//! locale : Arabic (Morocco) [ar-ma] -//! author : ElFadili Yassine : https://github.com/ElFadiliY -//! author : Abdel Said : https://github.com/abdelsaid - -import moment from '../moment'; - -export default moment.defineLocale('ar-ma', { - months : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), - monthsShort : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), - weekdays : 'الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - 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: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'في %s', - past : 'منذ %s', - s : 'ثوان', - ss : '%d ثانية', - m : 'دقيقة', - mm : '%d دقائق', - h : 'ساعة', - hh : '%d ساعات', - d : 'يوم', - dd : '%d أيام', - M : 'شهر', - MM : '%d أشهر', - y : 'سنة', - yy : '%d سنوات' - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } -}); - diff --git a/src/locale/ar-sa.js b/src/locale/ar-sa.js deleted file mode 100644 index 129c367b3c..0000000000 --- a/src/locale/ar-sa.js +++ /dev/null @@ -1,96 +0,0 @@ -//! moment.js locale configuration -//! locale : Arabic (Saudi Arabia) [ar-sa] -//! author : Suhail Alkowaileet : https://github.com/xsoh - -import moment from '../moment'; - -var symbolMap = { - '1': '١', - '2': '٢', - '3': '٣', - '4': '٤', - '5': '٥', - '6': '٦', - '7': '٧', - '8': '٨', - '9': '٩', - '0': '٠' -}, numberMap = { - '١': '1', - '٢': '2', - '٣': '3', - '٤': '4', - '٥': '5', - '٦': '6', - '٧': '7', - '٨': '8', - '٩': '9', - '٠': '0' -}; - -export default moment.defineLocale('ar-sa', { - months : 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - monthsShort : 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - 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: /ص|م/, - isPM : function (input) { - return 'م' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ص'; - } else { - return 'م'; - } - }, - calendar : { - sameDay: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'في %s', - past : 'منذ %s', - s : 'ثوان', - ss : '%d ثانية', - m : 'دقيقة', - mm : '%d دقائق', - h : 'ساعة', - hh : '%d ساعات', - d : 'يوم', - dd : '%d أيام', - M : 'شهر', - MM : '%d أشهر', - y : 'سنة', - yy : '%d سنوات' - }, - preparse: function (string) { - return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { - return numberMap[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }).replace(/,/g, '،'); - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } -}); - diff --git a/src/locale/ar-tn.js b/src/locale/ar-tn.js deleted file mode 100644 index 952f3bfda9..0000000000 --- a/src/locale/ar-tn.js +++ /dev/null @@ -1,51 +0,0 @@ -//! moment.js locale configuration -//! locale : Arabic (Tunisia) [ar-tn] -//! author : Nader Toukabri : https://github.com/naderio - -import moment from '../moment'; - -export default moment.defineLocale('ar-tn', { - months: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - monthsShort: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - 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: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' - }, - relativeTime: { - future: 'في %s', - past: 'منذ %s', - s: 'ثوان', - ss : '%d ثانية', - m: 'دقيقة', - mm: '%d دقائق', - h: 'ساعة', - hh: '%d ساعات', - d: 'يوم', - dd: '%d أيام', - M: 'شهر', - MM: '%d أشهر', - y: 'سنة', - yy: '%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. - } -}); - diff --git a/src/locale/ar.js b/src/locale/ar.js deleted file mode 100644 index bbae8d5e8d..0000000000 --- a/src/locale/ar.js +++ /dev/null @@ -1,128 +0,0 @@ -//! moment.js locale configuration -//! locale : Arabic [ar] -//! author : Abdel Said: https://github.com/abdelsaid -//! author : Ahmed Elkhatib -//! author : forabi https://github.com/forabi - -import moment from '../moment'; - -var symbolMap = { - '1': '١', - '2': '٢', - '3': '٣', - '4': '٤', - '5': '٥', - '6': '٦', - '7': '٧', - '8': '٨', - '9': '٩', - '0': '٠' -}, numberMap = { - '١': '1', - '٢': '2', - '٣': '3', - '٤': '4', - '٥': '5', - '٦': '6', - '٧': '7', - '٨': '8', - '٩': '9', - '٠': '0' -}, pluralForm = function (n) { - return n === 0 ? 0 : n === 1 ? 1 : n === 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5; -}, plurals = { - s : ['أقل من ثانية', 'ثانية واحدة', ['ثانيتان', 'ثانيتين'], '%d ثوان', '%d ثانية', '%d ثانية'], - m : ['أقل من دقيقة', 'دقيقة واحدة', ['دقيقتان', 'دقيقتين'], '%d دقائق', '%d دقيقة', '%d دقيقة'], - h : ['أقل من ساعة', 'ساعة واحدة', ['ساعتان', 'ساعتين'], '%d ساعات', '%d ساعة', '%d ساعة'], - d : ['أقل من يوم', 'يوم واحد', ['يومان', 'يومين'], '%d أيام', '%d يومًا', '%d يوم'], - M : ['أقل من شهر', 'شهر واحد', ['شهران', 'شهرين'], '%d أشهر', '%d شهرا', '%d شهر'], - y : ['أقل من عام', 'عام واحد', ['عامان', 'عامين'], '%d أعوام', '%d عامًا', '%d عام'] -}, pluralize = function (u) { - return function (number, withoutSuffix, string, isFuture) { - var f = pluralForm(number), - str = plurals[u][pluralForm(number)]; - if (f === 2) { - str = str[withoutSuffix ? 0 : 1]; - } - return str.replace(/%d/i, number); - }; -}, months = [ - 'يناير', - 'فبراير', - 'مارس', - 'أبريل', - 'مايو', - 'يونيو', - 'يوليو', - 'أغسطس', - 'سبتمبر', - 'أكتوبر', - 'نوفمبر', - 'ديسمبر' -]; - -export default moment.defineLocale('ar', { - months : months, - monthsShort : months, - weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - 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: /ص|م/, - isPM : function (input) { - return 'م' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ص'; - } else { - return 'م'; - } - }, - calendar : { - sameDay: '[اليوم عند الساعة] LT', - nextDay: '[غدًا عند الساعة] LT', - nextWeek: 'dddd [عند الساعة] LT', - lastDay: '[أمس عند الساعة] LT', - lastWeek: 'dddd [عند الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'بعد %s', - past : 'منذ %s', - s : pluralize('s'), - ss : pluralize('s'), - m : pluralize('m'), - mm : pluralize('m'), - h : pluralize('h'), - hh : pluralize('h'), - d : pluralize('d'), - dd : pluralize('d'), - M : pluralize('M'), - MM : pluralize('M'), - y : pluralize('y'), - yy : pluralize('y') - }, - preparse: function (string) { - return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { - return numberMap[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }).replace(/,/g, '،'); - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } -}); diff --git a/src/locale/az.js b/src/locale/az.js deleted file mode 100644 index 09acef76b5..0000000000 --- a/src/locale/az.js +++ /dev/null @@ -1,97 +0,0 @@ -//! moment.js locale configuration -//! locale : Azerbaijani [az] -//! author : topchiyev : https://github.com/topchiyev - -import moment from '../moment'; - -var suffixes = { - 1: '-inci', - 5: '-inci', - 8: '-inci', - 70: '-inci', - 80: '-inci', - 2: '-nci', - 7: '-nci', - 20: '-nci', - 50: '-nci', - 3: '-üncü', - 4: '-üncü', - 100: '-üncü', - 6: '-ncı', - 9: '-uncu', - 10: '-uncu', - 30: '-uncu', - 60: '-ıncı', - 90: '-ıncı' -}; - -export default moment.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əsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə'.split('_'), - weekdaysShort : 'Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən'.split('_'), - weekdaysMin : 'Bz_BE_ÇA_Çə_CA_Cü_Şə'.split('_'), - weekdaysParseExact : true, - 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ün saat] LT', - nextDay : '[sabah saat] LT', - nextWeek : '[gələn həftə] dddd [saat] LT', - lastDay : '[dünən] LT', - lastWeek : '[keçən həftə] dddd [saat] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s sonra', - past : '%s əvvəl', - s : 'birneçə saniyə', - ss : '%d saniyə', - m : 'bir dəqiqə', - mm : '%d dəqiqə', - h : 'bir saat', - hh : '%d saat', - d : 'bir gün', - dd : '%d gün', - M : 'bir ay', - MM : '%d ay', - y : 'bir il', - yy : '%d il' - }, - meridiemParse: /gecə|səhər|gündüz|axşam/, - isPM : function (input) { - return /^(gündüz|axşam)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'gecə'; - } else if (hour < 12) { - return 'səhər'; - } else if (hour < 17) { - return 'gündüz'; - } else { - return 'axşam'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}-(ıncı|inci|nci|üncü|ncı|uncu)/, - ordinal : function (number) { - if (number === 0) { // special case for zero - return number + '-ıncı'; - } - var a = number % 10, - b = number % 100 - a, - c = number >= 100 ? 100 : null; - return number + (suffixes[a] || suffixes[b] || suffixes[c]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); - diff --git a/src/locale/be.js b/src/locale/be.js deleted file mode 100644 index e163c01b01..0000000000 --- a/src/locale/be.js +++ /dev/null @@ -1,126 +0,0 @@ -//! moment.js locale configuration -//! locale : Belarusian [be] -//! author : Dmitry Demidov : https://github.com/demidov91 -//! author: Praleska: http://praleska.pro/ -//! Author : Menelion Elensúle : https://github.com/Oire - -import moment from '../moment'; - -function plural(word, num) { - var forms = word.split('_'); - return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]); -} -function relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'ss': withoutSuffix ? 'секунда_секунды_секунд' : 'секунду_секунды_секунд', - 'mm': withoutSuffix ? 'хвіліна_хвіліны_хвілін' : 'хвіліну_хвіліны_хвілін', - 'hh': withoutSuffix ? 'гадзіна_гадзіны_гадзін' : 'гадзіну_гадзіны_гадзін', - 'dd': 'дзень_дні_дзён', - 'MM': 'месяц_месяцы_месяцаў', - 'yy': 'год_гады_гадоў' - }; - if (key === 'm') { - return withoutSuffix ? 'хвіліна' : 'хвіліну'; - } - else if (key === 'h') { - return withoutSuffix ? 'гадзіна' : 'гадзіну'; - } - else { - return number + ' ' + plural(format[key], +number); - } -} - -export default moment.defineLocale('be', { - months : { - format: 'студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня'.split('_'), - standalone: 'студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань'.split('_') - }, - monthsShort : 'студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж'.split('_'), - weekdays : { - format: 'нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу'.split('_'), - standalone: 'нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота'.split('_'), - isFormat: /\[ ?[Ууў] ?(?:мінулую|наступную)? ?\] ?dddd/ - }, - weekdaysShort : 'нд_пн_ат_ср_чц_пт_сб'.split('_'), - weekdaysMin : 'нд_пн_ат_ср_чц_пт_сб'.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: '[Сёння ў] LT', - nextDay: '[Заўтра ў] LT', - lastDay: '[Учора ў] LT', - nextWeek: function () { - return '[У] dddd [ў] LT'; - }, - lastWeek: function () { - switch (this.day()) { - case 0: - case 3: - case 5: - case 6: - return '[У мінулую] dddd [ў] LT'; - case 1: - case 2: - case 4: - return '[У мінулы] dddd [ў] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'праз %s', - past : '%s таму', - s : 'некалькі секунд', - m : relativeTimeWithPlural, - mm : relativeTimeWithPlural, - h : relativeTimeWithPlural, - hh : relativeTimeWithPlural, - d : 'дзень', - dd : relativeTimeWithPlural, - M : 'месяц', - MM : relativeTimeWithPlural, - y : 'год', - yy : relativeTimeWithPlural - }, - meridiemParse: /ночы|раніцы|дня|вечара/, - isPM : function (input) { - return /^(дня|вечара)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ночы'; - } else if (hour < 12) { - return 'раніцы'; - } else if (hour < 17) { - return 'дня'; - } else { - return 'вечара'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}-(і|ы|га)/, - ordinal: function (number, period) { - switch (period) { - case 'M': - case 'd': - case 'DDD': - case 'w': - case 'W': - return (number % 10 === 2 || number % 10 === 3) && (number % 100 !== 12 && number % 100 !== 13) ? number + '-і' : number + '-ы'; - case 'D': - return number + '-га'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); - diff --git a/src/locale/bg.js b/src/locale/bg.js deleted file mode 100644 index ebe9a903e6..0000000000 --- a/src/locale/bg.js +++ /dev/null @@ -1,82 +0,0 @@ -//! moment.js locale configuration -//! locale : Bulgarian [bg] -//! author : Krasen Borisov : https://github.com/kraz - -import moment from '../moment'; - -export default moment.defineLocale('bg', { - months : 'януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември'.split('_'), - monthsShort : 'янр_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек'.split('_'), - weekdays : 'неделя_понеделник_вторник_сряда_четвъртък_петък_събота'.split('_'), - weekdaysShort : 'нед_пон_вто_сря_чет_пет_съб'.split('_'), - weekdaysMin : 'нд_пн_вт_ср_чт_пт_сб'.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 : '[Днес в] LT', - nextDay : '[Утре в] LT', - nextWeek : 'dddd [в] LT', - lastDay : '[Вчера в] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - case 3: - case 6: - return '[В изминалата] dddd [в] LT'; - case 1: - case 2: - case 4: - case 5: - return '[В изминалия] dddd [в] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'след %s', - past : 'преди %s', - s : 'няколко секунди', - ss : '%d секунди', - m : 'минута', - mm : '%d минути', - h : 'час', - hh : '%d часа', - d : 'ден', - dd : '%d дни', - M : 'месец', - MM : '%d месеца', - y : 'година', - yy : '%d години' - }, - dayOfMonthOrdinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/, - ordinal : function (number) { - var lastDigit = number % 10, - last2Digits = number % 100; - if (number === 0) { - return number + '-ев'; - } else if (last2Digits === 0) { - return number + '-ен'; - } else if (last2Digits > 10 && last2Digits < 20) { - return number + '-ти'; - } else if (lastDigit === 1) { - return number + '-ви'; - } else if (lastDigit === 2) { - return number + '-ри'; - } else if (lastDigit === 7 || lastDigit === 8) { - return number + '-ми'; - } else { - return number + '-ти'; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); - diff --git a/src/locale/bm.js b/src/locale/bm.js deleted file mode 100644 index 887a750343..0000000000 --- a/src/locale/bm.js +++ /dev/null @@ -1,50 +0,0 @@ -//! moment.js locale configuration -//! locale : Bambara [bm] -//! author : Estelle Comment : https://github.com/estellecomment -// Language contact person : Abdoufata Kane : https://github.com/abdoufata - -import moment from '../moment'; - -export default moment.defineLocale('bm', { - months : 'Zanwuyekalo_Fewuruyekalo_Marisikalo_Awirilikalo_Mɛkalo_Zuwɛnkalo_Zuluyekalo_Utikalo_Sɛtanburukalo_ɔkutɔburukalo_Nowanburukalo_Desanburukalo'.split('_'), - monthsShort : 'Zan_Few_Mar_Awi_Mɛ_Zuw_Zul_Uti_Sɛt_ɔku_Now_Des'.split('_'), - weekdays : 'Kari_Ntɛnɛn_Tarata_Araba_Alamisa_Juma_Sibiri'.split('_'), - weekdaysShort : 'Kar_Ntɛ_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ɛrɛ] HH:mm', - LLLL : 'dddd MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm' - }, - calendar : { - sameDay : '[Bi lɛrɛ] LT', - nextDay : '[Sini lɛrɛ] LT', - nextWeek : 'dddd [don lɛrɛ] LT', - lastDay : '[Kunu lɛrɛ] LT', - lastWeek : 'dddd [tɛmɛnen lɛrɛ] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s kɔnɔ', - past : 'a bɛ %s bɔ', - s : 'sanga dama dama', - ss : 'sekondi %d', - m : 'miniti kelen', - mm : 'miniti %d', - h : 'lɛrɛ kelen', - hh : 'lɛrɛ %d', - d : 'tile kelen', - dd : 'tile %d', - M : 'kalo kelen', - MM : 'kalo %d', - y : 'san kelen', - yy : 'san %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. - } -}); diff --git a/src/locale/bn.js b/src/locale/bn.js deleted file mode 100644 index b0db27ebd2..0000000000 --- a/src/locale/bn.js +++ /dev/null @@ -1,110 +0,0 @@ -//! moment.js locale configuration -//! locale : Bengali [bn] -//! author : Kaushik Gandhi : https://github.com/kaushikgandhi - -import moment from '../moment'; - -var symbolMap = { - '1': '১', - '2': '২', - '3': '৩', - '4': '৪', - '5': '৫', - '6': '৬', - '7': '৭', - '8': '৮', - '9': '৯', - '0': '০' -}, -numberMap = { - '১': '1', - '২': '2', - '৩': '3', - '৪': '4', - '৫': '5', - '৬': '6', - '৭': '7', - '৮': '8', - '৯': '9', - '০': '0' -}; - -export default moment.defineLocale('bn', { - months : 'জানুয়ারী_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর'.split('_'), - monthsShort : 'জানু_ফেব_মার্চ_এপ্র_মে_জুন_জুল_আগ_সেপ্ট_অক্টো_নভে_ডিসে'.split('_'), - weekdays : 'রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার'.split('_'), - weekdaysShort : 'রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি'.split('_'), - weekdaysMin : 'রবি_সোম_মঙ্গ_বুধ_বৃহঃ_শুক্র_শনি'.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 : '[আজ] LT', - nextDay : '[আগামীকাল] LT', - nextWeek : 'dddd, LT', - lastDay : '[গতকাল] LT', - lastWeek : '[গত] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s পরে', - past : '%s আগে', - s : 'কয়েক সেকেন্ড', - ss : '%d সেকেন্ড', - m : 'এক মিনিট', - mm : '%d মিনিট', - h : 'এক ঘন্টা', - hh : '%d ঘন্টা', - d : 'এক দিন', - dd : '%d দিন', - M : 'এক মাস', - MM : '%d মাস', - y : 'এক বছর', - yy : '%d বছর' - }, - preparse: function (string) { - return string.replace(/[১২৩৪৫৬৭৮৯০]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - meridiemParse: /রাত|সকাল|দুপুর|বিকাল|রাত/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ((meridiem === 'রাত' && hour >= 4) || - (meridiem === 'দুপুর' && hour < 5) || - meridiem === 'বিকাল') { - return hour + 12; - } else { - return hour; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'রাত'; - } else if (hour < 10) { - return 'সকাল'; - } else if (hour < 17) { - return 'দুপুর'; - } else if (hour < 20) { - return 'বিকাল'; - } else { - return 'রাত'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } -}); diff --git a/src/locale/bo.js b/src/locale/bo.js deleted file mode 100644 index b4a04be05b..0000000000 --- a/src/locale/bo.js +++ /dev/null @@ -1,111 +0,0 @@ -//! moment.js locale configuration -//! locale : Tibetan [bo] -//! author : Thupten N. Chakrishar : https://github.com/vajradog - -import moment from '../moment'; - -var symbolMap = { - '1': '༡', - '2': '༢', - '3': '༣', - '4': '༤', - '5': '༥', - '6': '༦', - '7': '༧', - '8': '༨', - '9': '༩', - '0': '༠' -}, -numberMap = { - '༡': '1', - '༢': '2', - '༣': '3', - '༤': '4', - '༥': '5', - '༦': '6', - '༧': '7', - '༨': '8', - '༩': '9', - '༠': '0' -}; - -export default moment.defineLocale('bo', { - months : 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split('_'), - monthsShort : 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split('_'), - weekdays : 'གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་'.split('_'), - weekdaysShort : 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split('_'), - weekdaysMin : 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.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 : '[དི་རིང] LT', - nextDay : '[སང་ཉིན] LT', - nextWeek : '[བདུན་ཕྲག་རྗེས་མ], LT', - lastDay : '[ཁ་སང] LT', - lastWeek : '[བདུན་ཕྲག་མཐའ་མ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ལ་', - past : '%s སྔན་ལ', - s : 'ལམ་སང', - ss : '%d སྐར་ཆ།', - m : 'སྐར་མ་གཅིག', - mm : '%d སྐར་མ', - h : 'ཆུ་ཚོད་གཅིག', - hh : '%d ཆུ་ཚོད', - d : 'ཉིན་གཅིག', - dd : '%d ཉིན་', - M : 'ཟླ་བ་གཅིག', - MM : '%d ཟླ་བ', - y : 'ལོ་གཅིག', - yy : '%d ལོ' - }, - preparse: function (string) { - return string.replace(/[༡༢༣༤༥༦༧༨༩༠]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - meridiemParse: /མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ((meridiem === 'མཚན་མོ' && hour >= 4) || - (meridiem === 'ཉིན་གུང' && hour < 5) || - meridiem === 'དགོང་དག') { - return hour + 12; - } else { - return hour; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'མཚན་མོ'; - } else if (hour < 10) { - return 'ཞོགས་ཀས'; - } else if (hour < 17) { - return 'ཉིན་གུང'; - } else if (hour < 20) { - return 'དགོང་དག'; - } else { - return 'མཚན་མོ'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } -}); - diff --git a/src/locale/br.js b/src/locale/br.js deleted file mode 100644 index 7208f79396..0000000000 --- a/src/locale/br.js +++ /dev/null @@ -1,100 +0,0 @@ -//! moment.js locale configuration -//! locale : Breton [br] -//! author : Jean-Baptiste Le Duigou : https://github.com/jbleduigou - -import moment from '../moment'; - -function relativeTimeWithMutation(number, withoutSuffix, key) { - var format = { - 'mm': 'munutenn', - 'MM': 'miz', - 'dd': 'devezh' - }; - return number + ' ' + mutation(format[key], number); -} -function specialMutationForYears(number) { - switch (lastNumber(number)) { - case 1: - case 3: - case 4: - case 5: - case 9: - return number + ' bloaz'; - default: - return number + ' vloaz'; - } -} -function lastNumber(number) { - if (number > 9) { - return lastNumber(number % 10); - } - return number; -} -function mutation(text, number) { - if (number === 2) { - return softMutation(text); - } - return text; -} -function softMutation(text) { - var mutationTable = { - 'm': 'v', - 'b': 'v', - 'd': 'z' - }; - if (mutationTable[text.charAt(0)] === undefined) { - return text; - } - return mutationTable[text.charAt(0)] + text.substring(1); -} - -export default moment.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 : true, - 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ù', - ss : '%d eilenn', - m : 'ur vunutenn', - mm : relativeTimeWithMutation, - h : 'un eur', - hh : '%d eur', - d : 'un devezh', - dd : relativeTimeWithMutation, - M : 'ur miz', - MM : relativeTimeWithMutation, - y : 'ur bloaz', - yy : specialMutationForYears - }, - dayOfMonthOrdinalParse: /\d{1,2}(añ|vet)/, - ordinal : function (number) { - var output = (number === 1) ? 'añ' : 'vet'; - 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. - } -}); - diff --git a/src/locale/bs.js b/src/locale/bs.js deleted file mode 100644 index 8a0f640df8..0000000000 --- a/src/locale/bs.js +++ /dev/null @@ -1,143 +0,0 @@ -//! moment.js locale configuration -//! locale : Bosnian [bs] -//! author : Nedim Cholich : https://github.com/frontyard -//! based on (hr) translation by Bojan Marković - -import moment from '../moment'; - -function translate(number, withoutSuffix, key) { - var result = number + ' '; - switch (key) { - case 'ss': - if (number === 1) { - result += 'sekunda'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'sekunde'; - } else { - result += 'sekundi'; - } - return result; - case 'm': - return withoutSuffix ? 'jedna minuta' : 'jedne minute'; - case 'mm': - if (number === 1) { - result += 'minuta'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'minute'; - } else { - result += 'minuta'; - } - return result; - case 'h': - return withoutSuffix ? 'jedan sat' : 'jednog sata'; - case 'hh': - if (number === 1) { - result += 'sat'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'sata'; - } else { - result += 'sati'; - } - return result; - case 'dd': - if (number === 1) { - result += 'dan'; - } else { - result += 'dana'; - } - return result; - case 'MM': - if (number === 1) { - result += 'mjesec'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'mjeseca'; - } else { - result += 'mjeseci'; - } - return result; - case 'yy': - if (number === 1) { - result += 'godina'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'godine'; - } else { - result += 'godina'; - } - return result; - } -} - -export default moment.defineLocale('bs', { - months : 'januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar'.split('_'), - monthsShort : 'jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), - weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), - weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[danas u] LT', - nextDay : '[sutra u] LT', - nextWeek : function () { - switch (this.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'; - } - }, - lastDay : '[jučer u] LT', - lastWeek : function () { - switch (this.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'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'prije %s', - s : 'par sekundi', - ss : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : 'dan', - dd : translate, - M : 'mjesec', - MM : translate, - y : 'godinu', - yy : translate - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); diff --git a/src/locale/ca.js b/src/locale/ca.js deleted file mode 100644 index 8d1df57216..0000000000 --- a/src/locale/ca.js +++ /dev/null @@ -1,80 +0,0 @@ -//! moment.js locale configuration -//! locale : Catalan [ca] -//! author : Juan G. Hurtado : https://github.com/juanghurtado - -import moment from '../moment'; - -export default moment.defineLocale('ca', { - months : { - standalone: 'gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre'.split('_'), - format: 'de gener_de febrer_de març_d\'abril_de maig_de juny_de juliol_d\'agost_de setembre_d\'octubre_de novembre_de desembre'.split('_'), - isFormat: /D[oD]?(\s)+MMMM/ - }, - monthsShort : 'gen._febr._març_abr._maig_juny_jul._ag._set._oct._nov._des.'.split('_'), - monthsParseExact : true, - weekdays : 'diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte'.split('_'), - weekdaysShort : 'dg._dl._dt._dc._dj._dv._ds.'.split('_'), - weekdaysMin : 'dg_dl_dt_dc_dj_dv_ds'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM [de] YYYY', - ll : 'D MMM YYYY', - LLL : 'D MMMM [de] YYYY [a les] H:mm', - lll : 'D MMM YYYY, H:mm', - LLLL : 'dddd D MMMM [de] YYYY [a les] H:mm', - llll : 'ddd D MMM YYYY, H:mm' - }, - calendar : { - sameDay : function () { - return '[avui a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - nextDay : function () { - return '[demà a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - nextWeek : function () { - return 'dddd [a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - lastDay : function () { - return '[ahir a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - lastWeek : function () { - return '[el] dddd [passat a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'd\'aquí %s', - past : 'fa %s', - s : 'uns segons', - ss : '%d segons', - m : 'un minut', - mm : '%d minuts', - h : 'una hora', - hh : '%d hores', - d : 'un dia', - dd : '%d dies', - M : 'un mes', - MM : '%d mesos', - y : 'un any', - yy : '%d anys' - }, - dayOfMonthOrdinalParse: /\d{1,2}(r|n|t|è|a)/, - ordinal : function (number, period) { - var output = (number === 1) ? 'r' : - (number === 2) ? 'n' : - (number === 3) ? 'r' : - (number === 4) ? 't' : 'è'; - if (period === 'w' || period === 'W') { - output = 'a'; - } - 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. - } -}); - diff --git a/src/locale/cs.js b/src/locale/cs.js deleted file mode 100644 index 143a7095f0..0000000000 --- a/src/locale/cs.js +++ /dev/null @@ -1,164 +0,0 @@ -//! moment.js locale configuration -//! locale : Czech [cs] -//! author : petrbela : https://github.com/petrbela - -import moment from '../moment'; - -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); -} -function translate(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': // a few seconds / in a few seconds / a few seconds ago - return (withoutSuffix || isFuture) ? 'pár sekund' : 'pár sekundami'; - case 'ss': // 9 seconds / in 9 seconds / 9 seconds ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'sekundy' : 'sekund'); - } else { - return result + 'sekundami'; - } - break; - case 'm': // a minute / in a minute / a minute ago - return withoutSuffix ? 'minuta' : (isFuture ? 'minutu' : 'minutou'); - case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'minuty' : 'minut'); - } else { - return result + 'minutami'; - } - break; - case 'h': // an hour / in an hour / an hour ago - return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou'); - case 'hh': // 9 hours / in 9 hours / 9 hours ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'hodiny' : 'hodin'); - } else { - return result + 'hodinami'; - } - break; - case 'd': // a day / in a day / a day ago - return (withoutSuffix || isFuture) ? 'den' : 'dnem'; - case 'dd': // 9 days / in 9 days / 9 days ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'dny' : 'dní'); - } else { - return result + 'dny'; - } - break; - case 'M': // a month / in a month / a month ago - return (withoutSuffix || isFuture) ? 'měsíc' : 'měsícem'; - case 'MM': // 9 months / in 9 months / 9 months ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'měsíce' : 'měsíců'); - } else { - return result + 'měsíci'; - } - break; - case 'y': // a year / in a year / a year ago - return (withoutSuffix || isFuture) ? 'rok' : 'rokem'; - case 'yy': // 9 years / in 9 years / 9 years ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'roky' : 'let'); - } else { - return result + 'lety'; - } - break; - } -} - -export default moment.defineLocale('cs', { - months : months, - monthsShort : monthsShort, - 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('_'), - longDateFormat : { - LT: 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd D. MMMM YYYY H:mm', - l : 'D. M. YYYY' - }, - calendar : { - sameDay: '[dnes v] LT', - nextDay: '[zítra v] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[v neděli v] LT'; - case 1: - case 2: - return '[v] dddd [v] LT'; - case 3: - return '[ve středu v] LT'; - case 4: - return '[ve čtvrtek v] LT'; - case 5: - return '[v pátek v] LT'; - case 6: - return '[v sobotu v] LT'; - } - }, - lastDay: '[včera v] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[minulou neděli v] LT'; - case 1: - case 2: - return '[minulé] dddd [v] LT'; - case 3: - return '[minulou středu v] LT'; - case 4: - case 5: - return '[minulý] dddd [v] LT'; - case 6: - return '[minulou sobotu v] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'za %s', - past : 'před %s', - s : translate, - ss : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : translate, - dd : translate, - M : translate, - MM : translate, - y : translate, - yy : translate - }, - 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. - } -}); - diff --git a/src/locale/cv.js b/src/locale/cv.js deleted file mode 100644 index 2443f0aaa9..0000000000 --- a/src/locale/cv.js +++ /dev/null @@ -1,54 +0,0 @@ -//! moment.js locale configuration -//! locale : Chuvash [cv] -//! author : Anatoly Mironov : https://github.com/mirontoli - -import moment from '../moment'; - -export default moment.defineLocale('cv', { - months : 'кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав'.split('_'), - monthsShort : 'кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш'.split('_'), - weekdays : 'вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун'.split('_'), - weekdaysShort : 'выр_тун_ытл_юн_кӗҫ_эрн_шӑм'.split('_'), - weekdaysMin : 'вр_тн_ыт_юн_кҫ_эр_шм'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD-MM-YYYY', - LL : 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]', - LLL : 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm', - LLLL : 'dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm' - }, - calendar : { - sameDay: '[Паян] LT [сехетре]', - nextDay: '[Ыран] LT [сехетре]', - lastDay: '[Ӗнер] LT [сехетре]', - nextWeek: '[Ҫитес] dddd LT [сехетре]', - lastWeek: '[Иртнӗ] dddd LT [сехетре]', - sameElse: 'L' - }, - relativeTime : { - future : function (output) { - var affix = /сехет$/i.exec(output) ? 'рен' : /ҫул$/i.exec(output) ? 'тан' : 'ран'; - return output + affix; - }, - past : '%s каялла', - s : 'пӗр-ик ҫеккунт', - ss : '%d ҫеккунт', - m : 'пӗр минут', - mm : '%d минут', - h : 'пӗр сехет', - hh : '%d сехет', - d : 'пӗр кун', - dd : '%d кун', - M : 'пӗр уйӑх', - MM : '%d уйӑх', - y : 'пӗр ҫул', - yy : '%d ҫул' - }, - dayOfMonthOrdinalParse: /\d{1,2}-мӗш/, - ordinal : '%d-мӗш', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); diff --git a/src/locale/cy.js b/src/locale/cy.js deleted file mode 100644 index eb2e54c9bc..0000000000 --- a/src/locale/cy.js +++ /dev/null @@ -1,73 +0,0 @@ -//! moment.js locale configuration -//! locale : Welsh [cy] -//! author : Robert Allen : https://github.com/robgallen -//! author : https://github.com/ryangreaves - -import moment from '../moment'; - -export default moment.defineLocale('cy', { - months: 'Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr'.split('_'), - monthsShort: 'Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag'.split('_'), - weekdays: 'Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn'.split('_'), - weekdaysShort: 'Sul_Llun_Maw_Mer_Iau_Gwe_Sad'.split('_'), - weekdaysMin: 'Su_Ll_Ma_Me_Ia_Gw_Sa'.split('_'), - weekdaysParseExact : true, - // time formats are the same as en-gb - 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: '[Heddiw am] LT', - nextDay: '[Yfory am] LT', - nextWeek: 'dddd [am] LT', - lastDay: '[Ddoe am] LT', - lastWeek: 'dddd [diwethaf am] LT', - sameElse: 'L' - }, - relativeTime: { - future: 'mewn %s', - past: '%s yn ôl', - s: 'ychydig eiliadau', - ss: '%d eiliad', - m: 'munud', - mm: '%d munud', - h: 'awr', - hh: '%d awr', - d: 'diwrnod', - dd: '%d diwrnod', - M: 'mis', - MM: '%d mis', - y: 'blwyddyn', - yy: '%d flynedd' - }, - dayOfMonthOrdinalParse: /\d{1,2}(fed|ain|af|il|ydd|ed|eg)/, - // traditional ordinal numbers above 31 are not commonly used in colloquial Welsh - ordinal: function (number) { - var b = number, - output = '', - lookup = [ - '', 'af', 'il', 'ydd', 'ydd', 'ed', 'ed', 'ed', 'fed', 'fed', 'fed', // 1af to 10fed - 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'fed' // 11eg to 20fed - ]; - if (b > 20) { - if (b === 40 || b === 50 || b === 60 || b === 80 || b === 100) { - output = 'fed'; // not 30ain, 70ain or 90ain - } else { - output = 'ain'; - } - } else if (b > 0) { - output = lookup[b]; - } - 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. - } -}); - diff --git a/src/locale/da.js b/src/locale/da.js deleted file mode 100644 index a06c6e0211..0000000000 --- a/src/locale/da.js +++ /dev/null @@ -1,51 +0,0 @@ -//! moment.js locale configuration -//! locale : Danish [da] -//! author : Ulrik Nielsen : https://github.com/mrbase - -import moment from '../moment'; - -export default moment.defineLocale('da', { - months : 'januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december'.split('_'), - monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), - weekdays : 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'), - weekdaysShort : 'søn_man_tir_ons_tor_fre_lør'.split('_'), - weekdaysMin : 'sø_ma_ti_on_to_fr_lø'.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.] D. MMMM YYYY [kl.] HH:mm' - }, - calendar : { - sameDay : '[i dag kl.] LT', - nextDay : '[i morgen kl.] LT', - nextWeek : 'på dddd [kl.] LT', - lastDay : '[i går kl.] LT', - lastWeek : '[i] dddd[s kl.] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'om %s', - past : '%s siden', - s : 'få sekunder', - ss : '%d sekunder', - m : 'et minut', - mm : '%d minutter', - h : 'en time', - hh : '%d timer', - d : 'en dag', - dd : '%d dage', - M : 'en måned', - MM : '%d måneder', - y : 'et år', - yy : '%d år' - }, - 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. - } -}); diff --git a/src/locale/de-at.js b/src/locale/de-at.js deleted file mode 100644 index 4ed974c9ba..0000000000 --- a/src/locale/de-at.js +++ /dev/null @@ -1,70 +0,0 @@ -//! moment.js locale configuration -//! locale : German (Austria) [de-at] -//! author : lluchs : https://github.com/lluchs -//! author: Menelion Elensúle: https://github.com/Oire -//! author : Martin Groller : https://github.com/MadMG -//! author : Mikolaj Dadela : https://github.com/mik01aj - -import moment from '../moment'; - -function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eine Minute', 'einer Minute'], - 'h': ['eine Stunde', 'einer Stunde'], - 'd': ['ein Tag', 'einem Tag'], - 'dd': [number + ' Tage', number + ' Tagen'], - 'M': ['ein Monat', 'einem Monat'], - 'MM': [number + ' Monate', number + ' Monaten'], - 'y': ['ein Jahr', 'einem Jahr'], - 'yy': [number + ' Jahre', number + ' Jahren'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; -} - -export default moment.defineLocale('de-at', { - months : 'Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort : 'Jän._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'), - weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), - weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - 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: '[heute um] LT [Uhr]', - sameElse: 'L', - nextDay: '[morgen um] LT [Uhr]', - nextWeek: 'dddd [um] LT [Uhr]', - lastDay: '[gestern um] LT [Uhr]', - lastWeek: '[letzten] dddd [um] LT [Uhr]' - }, - relativeTime : { - future : 'in %s', - past : 'vor %s', - s : 'ein paar Sekunden', - ss : '%d Sekunden', - m : processRelativeTime, - mm : '%d Minuten', - h : processRelativeTime, - hh : '%d Stunden', - d : processRelativeTime, - dd : processRelativeTime, - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - 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. - } -}); diff --git a/src/locale/de-ch.js b/src/locale/de-ch.js deleted file mode 100644 index c448345a65..0000000000 --- a/src/locale/de-ch.js +++ /dev/null @@ -1,69 +0,0 @@ -//! moment.js locale configuration -//! locale : German (Switzerland) [de-ch] -//! author : sschueller : https://github.com/sschueller - -// based on: https://www.bk.admin.ch/dokumentation/sprachen/04915/05016/index.html?lang=de# - -import moment from '../moment'; - -function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eine Minute', 'einer Minute'], - 'h': ['eine Stunde', 'einer Stunde'], - 'd': ['ein Tag', 'einem Tag'], - 'dd': [number + ' Tage', number + ' Tagen'], - 'M': ['ein Monat', 'einem Monat'], - 'MM': [number + ' Monate', number + ' Monaten'], - 'y': ['ein Jahr', 'einem Jahr'], - 'yy': [number + ' Jahre', number + ' Jahren'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; -} - -export default moment.defineLocale('de-ch', { - months : 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort : 'Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'), - weekdaysShort : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - 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: '[heute um] LT [Uhr]', - sameElse: 'L', - nextDay: '[morgen um] LT [Uhr]', - nextWeek: 'dddd [um] LT [Uhr]', - lastDay: '[gestern um] LT [Uhr]', - lastWeek: '[letzten] dddd [um] LT [Uhr]' - }, - relativeTime : { - future : 'in %s', - past : 'vor %s', - s : 'ein paar Sekunden', - ss : '%d Sekunden', - m : processRelativeTime, - mm : '%d Minuten', - h : processRelativeTime, - hh : '%d Stunden', - d : processRelativeTime, - dd : processRelativeTime, - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - 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. - } -}); diff --git a/src/locale/de.js b/src/locale/de.js deleted file mode 100644 index 4574656bb0..0000000000 --- a/src/locale/de.js +++ /dev/null @@ -1,69 +0,0 @@ -//! moment.js locale configuration -//! locale : German [de] -//! author : lluchs : https://github.com/lluchs -//! author: Menelion Elensúle: https://github.com/Oire -//! author : Mikolaj Dadela : https://github.com/mik01aj - -import moment from '../moment'; - -function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eine Minute', 'einer Minute'], - 'h': ['eine Stunde', 'einer Stunde'], - 'd': ['ein Tag', 'einem Tag'], - 'dd': [number + ' Tage', number + ' Tagen'], - 'M': ['ein Monat', 'einem Monat'], - 'MM': [number + ' Monate', number + ' Monaten'], - 'y': ['ein Jahr', 'einem Jahr'], - 'yy': [number + ' Jahre', number + ' Jahren'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; -} - -export default moment.defineLocale('de', { - months : 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort : 'Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'), - weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), - weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - 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: '[heute um] LT [Uhr]', - sameElse: 'L', - nextDay: '[morgen um] LT [Uhr]', - nextWeek: 'dddd [um] LT [Uhr]', - lastDay: '[gestern um] LT [Uhr]', - lastWeek: '[letzten] dddd [um] LT [Uhr]' - }, - relativeTime : { - future : 'in %s', - past : 'vor %s', - s : 'ein paar Sekunden', - ss : '%d Sekunden', - m : processRelativeTime, - mm : '%d Minuten', - h : processRelativeTime, - hh : '%d Stunden', - d : processRelativeTime, - dd : processRelativeTime, - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - 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. - } -}); diff --git a/src/locale/dv.js b/src/locale/dv.js deleted file mode 100644 index 67c40be3b1..0000000000 --- a/src/locale/dv.js +++ /dev/null @@ -1,90 +0,0 @@ -//! moment.js locale configuration -//! locale : Maldivian [dv] -//! author : Jawish Hameed : https://github.com/jawish - -import moment from '../moment'; - -var months = [ - 'ޖެނުއަރީ', - 'ފެބްރުއަރީ', - 'މާރިޗު', - 'އޭޕްރީލު', - 'މޭ', - 'ޖޫން', - 'ޖުލައި', - 'އޯގަސްޓު', - 'ސެޕްޓެމްބަރު', - 'އޮކްޓޯބަރު', - 'ނޮވެމްބަރު', - 'ޑިސެމްބަރު' -], weekdays = [ - 'އާދިއްތަ', - 'ހޯމަ', - 'އަންގާރަ', - 'ބުދަ', - 'ބުރާސްފަތި', - 'ހުކުރު', - 'ހޮނިހިރު' -]; - -export default moment.defineLocale('dv', { - months : months, - monthsShort : months, - weekdays : weekdays, - weekdaysShort : weekdays, - weekdaysMin : 'އާދި_ހޯމަ_އަން_ބުދަ_ބުރާ_ހުކު_ހޮނި'.split('_'), - longDateFormat : { - - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'D/M/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - meridiemParse: /މކ|މފ/, - isPM : function (input) { - return 'މފ' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'މކ'; - } else { - return 'މފ'; - } - }, - calendar : { - sameDay : '[މިއަދު] LT', - nextDay : '[މާދަމާ] LT', - nextWeek : 'dddd LT', - lastDay : '[އިއްޔެ] LT', - lastWeek : '[ފާއިތުވި] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ތެރޭގައި %s', - past : 'ކުރިން %s', - s : 'ސިކުންތުކޮޅެއް', - ss : 'd% ސިކުންތު', - m : 'މިނިޓެއް', - mm : 'މިނިޓު %d', - h : 'ގަޑިއިރެއް', - hh : 'ގަޑިއިރު %d', - d : 'ދުވަހެއް', - dd : 'ދުވަސް %d', - M : 'މަހެއް', - MM : 'މަސް %d', - y : 'އަހަރެއް', - yy : 'އަހަރު %d' - }, - preparse: function (string) { - return string.replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/,/g, '،'); - }, - week : { - dow : 7, // Sunday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } -}); diff --git a/src/locale/el.js b/src/locale/el.js deleted file mode 100644 index 5e43ae3a93..0000000000 --- a/src/locale/el.js +++ /dev/null @@ -1,89 +0,0 @@ -//! moment.js locale configuration -//! locale : Greek [el] -//! author : Aggelos Karalias : https://github.com/mehiel - -import moment from '../moment'; -import isFunction from '../lib/utils/is-function'; - -export default moment.defineLocale('el', { - monthsNominativeEl : 'Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος'.split('_'), - monthsGenitiveEl : 'Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου'.split('_'), - months : function (momentToFormat, format) { - if (!momentToFormat) { - return this._monthsNominativeEl; - } else if (typeof format === 'string' && /D/.test(format.substring(0, format.indexOf('MMMM')))) { // if there is a day number before 'MMMM' - return this._monthsGenitiveEl[momentToFormat.month()]; - } else { - return this._monthsNominativeEl[momentToFormat.month()]; - } - }, - monthsShort : 'Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ'.split('_'), - weekdays : 'Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο'.split('_'), - weekdaysShort : 'Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ'.split('_'), - weekdaysMin : 'Κυ_Δε_Τρ_Τε_Πε_Πα_Σα'.split('_'), - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'μμ' : 'ΜΜ'; - } else { - return isLower ? 'πμ' : 'ΠΜ'; - } - }, - isPM : function (input) { - return ((input + '').toLowerCase()[0] === 'μ'); - }, - meridiemParse : /[ΠΜ]\.?Μ?\.?/i, - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendarEl : { - sameDay : '[Σήμερα {}] LT', - nextDay : '[Αύριο {}] LT', - nextWeek : 'dddd [{}] LT', - lastDay : '[Χθες {}] LT', - lastWeek : function () { - switch (this.day()) { - case 6: - return '[το προηγούμενο] dddd [{}] LT'; - default: - return '[την προηγούμενη] dddd [{}] LT'; - } - }, - sameElse : 'L' - }, - calendar : function (key, mom) { - var output = this._calendarEl[key], - hours = mom && mom.hours(); - if (isFunction(output)) { - output = output.apply(mom); - } - return output.replace('{}', (hours % 12 === 1 ? 'στη' : 'στις')); - }, - relativeTime : { - future : 'σε %s', - past : '%s πριν', - s : 'λίγα δευτερόλεπτα', - ss : '%d δευτερόλεπτα', - m : 'ένα λεπτό', - mm : '%d λεπτά', - h : 'μία ώρα', - hh : '%d ώρες', - d : 'μία μέρα', - dd : '%d μέρες', - M : 'ένας μήνας', - MM : '%d μήνες', - y : 'ένας χρόνος', - yy : '%d χρόνια' - }, - dayOfMonthOrdinalParse: /\d{1,2}η/, - ordinal: '%dη', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4st is the first week of the year. - } -}); - diff --git a/src/locale/en-SG.js b/src/locale/en-sg.js similarity index 95% rename from src/locale/en-SG.js rename to src/locale/en-sg.js index 1cab9d6f9f..e46d901e93 100644 --- a/src/locale/en-SG.js +++ b/src/locale/en-sg.js @@ -1,10 +1,10 @@ //! moment.js locale configuration -//! locale : English (Singapore) [en-SG] +//! locale : English (Singapore) [en-sg] //! author : Matthew Castrillon-Madrigal : https://github.com/techdimension import moment from '../moment'; -export default moment.defineLocale('en-SG', { +export default 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('_'), diff --git a/src/locale/eo.js b/src/locale/eo.js deleted file mode 100644 index 0345d8c29c..0000000000 --- a/src/locale/eo.js +++ /dev/null @@ -1,65 +0,0 @@ -//! moment.js locale configuration -//! locale : Esperanto [eo] -//! author : Colin Dean : https://github.com/colindean -//! author : Mia Nordentoft Imperatori : https://github.com/miestasmia -//! comment : miestasmia corrected the translation by colindean - -import moment from '../moment'; - -export default moment.defineLocale('eo', { - months : 'januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro'.split('_'), - monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aŭg_sep_okt_nov_dec'.split('_'), - weekdays : 'dimanĉo_lundo_mardo_merkredo_ĵaŭdo_vendredo_sabato'.split('_'), - weekdaysShort : 'dim_lun_mard_merk_ĵaŭ_ven_sab'.split('_'), - weekdaysMin : 'di_lu_ma_me_ĵa_ve_sa'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'D[-a de] MMMM, YYYY', - LLL : 'D[-a de] MMMM, YYYY HH:mm', - LLLL : 'dddd, [la] D[-a de] MMMM, YYYY HH:mm' - }, - meridiemParse: /[ap]\.t\.m/i, - isPM: function (input) { - return input.charAt(0).toLowerCase() === 'p'; - }, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'p.t.m.' : 'P.T.M.'; - } else { - return isLower ? 'a.t.m.' : 'A.T.M.'; - } - }, - calendar : { - sameDay : '[Hodiaŭ je] LT', - nextDay : '[Morgaŭ je] LT', - nextWeek : 'dddd [je] LT', - lastDay : '[Hieraŭ je] LT', - lastWeek : '[pasinta] dddd [je] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'post %s', - past : 'antaŭ %s', - s : 'sekundoj', - ss : '%d sekundoj', - m : 'minuto', - mm : '%d minutoj', - h : 'horo', - hh : '%d horoj', - d : 'tago',//ne 'diurno', ĉar estas uzita por proksimumo - dd : '%d tagoj', - M : 'monato', - MM : '%d monatoj', - y : 'jaro', - yy : '%d jaroj' - }, - dayOfMonthOrdinalParse: /\d{1,2}a/, - ordinal : '%da', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); - diff --git a/src/locale/es.js b/src/locale/es.js index 4dc588a07f..67362d665c 100644 --- a/src/locale/es.js +++ b/src/locale/es.js @@ -79,5 +79,6 @@ export default moment.defineLocale('es', { 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. - } + }, + invalidDate: 'Fecha invalida' }); diff --git a/src/locale/et.js b/src/locale/et.js deleted file mode 100644 index 22415e7c78..0000000000 --- a/src/locale/et.js +++ /dev/null @@ -1,73 +0,0 @@ -//! moment.js locale configuration -//! locale : Estonian [et] -//! author : Henry Kehlmann : https://github.com/madhenry -//! improvements : Illimar Tambek : https://github.com/ragulka - -import moment from '../moment'; - -function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 's' : ['mõne sekundi', 'mõni sekund', 'paar sekundit'], - 'ss': [number + 'sekundi', number + 'sekundit'], - 'm' : ['ühe minuti', 'üks minut'], - 'mm': [number + ' minuti', number + ' minutit'], - 'h' : ['ühe tunni', 'tund aega', 'üks tund'], - 'hh': [number + ' tunni', number + ' tundi'], - 'd' : ['ühe päeva', 'üks päev'], - 'M' : ['kuu aja', 'kuu aega', 'üks kuu'], - 'MM': [number + ' kuu', number + ' kuud'], - 'y' : ['ühe aasta', 'aasta', 'üks aasta'], - 'yy': [number + ' aasta', number + ' aastat'] - }; - if (withoutSuffix) { - return format[key][2] ? format[key][2] : format[key][1]; - } - return isFuture ? format[key][0] : format[key][1]; -} - -export default moment.defineLocale('et', { - months : 'jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember'.split('_'), - monthsShort : 'jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets'.split('_'), - weekdays : 'pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev'.split('_'), - weekdaysShort : 'P_E_T_K_N_R_L'.split('_'), - weekdaysMin : 'P_E_T_K_N_R_L'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[Täna,] LT', - nextDay : '[Homme,] LT', - nextWeek : '[Järgmine] dddd LT', - lastDay : '[Eile,] LT', - lastWeek : '[Eelmine] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s pärast', - past : '%s tagasi', - s : processRelativeTime, - ss : processRelativeTime, - m : processRelativeTime, - mm : processRelativeTime, - h : processRelativeTime, - hh : processRelativeTime, - d : processRelativeTime, - dd : '%d päeva', - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - 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. - } -}); - diff --git a/src/locale/eu.js b/src/locale/eu.js deleted file mode 100644 index d7658de632..0000000000 --- a/src/locale/eu.js +++ /dev/null @@ -1,58 +0,0 @@ -//! moment.js locale configuration -//! locale : Basque [eu] -//! author : Eneko Illarramendi : https://github.com/eillarra - -import moment from '../moment'; - -export default moment.defineLocale('eu', { - months : 'urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua'.split('_'), - monthsShort : 'urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.'.split('_'), - monthsParseExact : true, - weekdays : 'igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata'.split('_'), - weekdaysShort : 'ig._al._ar._az._og._ol._lr.'.split('_'), - weekdaysMin : 'ig_al_ar_az_og_ol_lr'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'YYYY[ko] MMMM[ren] D[a]', - LLL : 'YYYY[ko] MMMM[ren] D[a] HH:mm', - LLLL : 'dddd, YYYY[ko] MMMM[ren] D[a] HH:mm', - l : 'YYYY-M-D', - ll : 'YYYY[ko] MMM D[a]', - lll : 'YYYY[ko] MMM D[a] HH:mm', - llll : 'ddd, YYYY[ko] MMM D[a] HH:mm' - }, - calendar : { - sameDay : '[gaur] LT[etan]', - nextDay : '[bihar] LT[etan]', - nextWeek : 'dddd LT[etan]', - lastDay : '[atzo] LT[etan]', - lastWeek : '[aurreko] dddd LT[etan]', - sameElse : 'L' - }, - relativeTime : { - future : '%s barru', - past : 'duela %s', - s : 'segundo batzuk', - ss : '%d segundo', - m : 'minutu bat', - mm : '%d minutu', - h : 'ordu bat', - hh : '%d ordu', - d : 'egun bat', - dd : '%d egun', - M : 'hilabete bat', - MM : '%d hilabete', - y : 'urte bat', - yy : '%d urte' - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); - diff --git a/src/locale/fa.js b/src/locale/fa.js deleted file mode 100644 index 0d377a5d64..0000000000 --- a/src/locale/fa.js +++ /dev/null @@ -1,98 +0,0 @@ -//! moment.js locale configuration -//! locale : Persian [fa] -//! author : Ebrahim Byagowi : https://github.com/ebraminio - -import moment from '../moment'; - -var symbolMap = { - '1': '۱', - '2': '۲', - '3': '۳', - '4': '۴', - '5': '۵', - '6': '۶', - '7': '۷', - '8': '۸', - '9': '۹', - '0': '۰' -}, numberMap = { - '۱': '1', - '۲': '2', - '۳': '3', - '۴': '4', - '۵': '5', - '۶': '6', - '۷': '7', - '۸': '8', - '۹': '9', - '۰': '0' -}; - -export default moment.defineLocale('fa', { - months : 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), - monthsShort : 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), - weekdays : 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'), - weekdaysShort : 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'), - weekdaysMin : 'ی_د_س_چ_پ_ج_ش'.split('_'), - weekdaysParseExact : true, - 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: /قبل از ظهر|بعد از ظهر/, - isPM: function (input) { - return /بعد از ظهر/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'قبل از ظهر'; - } else { - return 'بعد از ظهر'; - } - }, - calendar : { - sameDay : '[امروز ساعت] LT', - nextDay : '[فردا ساعت] LT', - nextWeek : 'dddd [ساعت] LT', - lastDay : '[دیروز ساعت] LT', - lastWeek : 'dddd [پیش] [ساعت] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'در %s', - past : '%s پیش', - s : 'چند ثانیه', - ss : 'ثانیه d%', - m : 'یک دقیقه', - mm : '%d دقیقه', - h : 'یک ساعت', - hh : '%d ساعت', - d : 'یک روز', - dd : '%d روز', - M : 'یک ماه', - MM : '%d ماه', - y : 'یک سال', - yy : '%d سال' - }, - preparse: function (string) { - return string.replace(/[۰-۹]/g, function (match) { - return numberMap[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }).replace(/,/g, '،'); - }, - dayOfMonthOrdinalParse: /\d{1,2}م/, - ordinal : '%dم', - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } -}); - diff --git a/src/locale/fi.js b/src/locale/fi.js deleted file mode 100644 index c505292bbe..0000000000 --- a/src/locale/fi.js +++ /dev/null @@ -1,101 +0,0 @@ -//! moment.js locale configuration -//! locale : Finnish [fi] -//! author : Tarmo Aidantausta : https://github.com/bleadof - -import moment from '../moment'; - -var numbersPast = 'nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän'.split(' '), - numbersFuture = [ - 'nolla', 'yhden', 'kahden', 'kolmen', 'neljän', 'viiden', 'kuuden', - numbersPast[7], numbersPast[8], numbersPast[9] - ]; -function translate(number, withoutSuffix, key, isFuture) { - var result = ''; - switch (key) { - case 's': - return isFuture ? 'muutaman sekunnin' : 'muutama sekunti'; - case 'ss': - return isFuture ? 'sekunnin' : 'sekuntia'; - case 'm': - return isFuture ? 'minuutin' : 'minuutti'; - case 'mm': - result = isFuture ? 'minuutin' : 'minuuttia'; - break; - case 'h': - return isFuture ? 'tunnin' : 'tunti'; - case 'hh': - result = isFuture ? 'tunnin' : 'tuntia'; - break; - case 'd': - return isFuture ? 'päivän' : 'päivä'; - case 'dd': - result = isFuture ? 'päivän' : 'päivää'; - break; - case 'M': - return isFuture ? 'kuukauden' : 'kuukausi'; - case 'MM': - result = isFuture ? 'kuukauden' : 'kuukautta'; - break; - case 'y': - return isFuture ? 'vuoden' : 'vuosi'; - case 'yy': - result = isFuture ? 'vuoden' : 'vuotta'; - break; - } - result = verbalNumber(number, isFuture) + ' ' + result; - return result; -} -function verbalNumber(number, isFuture) { - return number < 10 ? (isFuture ? numbersFuture[number] : numbersPast[number]) : number; -} - -export default moment.defineLocale('fi', { - months : 'tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu'.split('_'), - monthsShort : 'tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu'.split('_'), - weekdays : 'sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai'.split('_'), - weekdaysShort : 'su_ma_ti_ke_to_pe_la'.split('_'), - weekdaysMin : 'su_ma_ti_ke_to_pe_la'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD.MM.YYYY', - LL : 'Do MMMM[ta] YYYY', - LLL : 'Do MMMM[ta] YYYY, [klo] HH.mm', - LLLL : 'dddd, Do MMMM[ta] YYYY, [klo] HH.mm', - l : 'D.M.YYYY', - ll : 'Do MMM YYYY', - lll : 'Do MMM YYYY, [klo] HH.mm', - llll : 'ddd, Do MMM YYYY, [klo] HH.mm' - }, - calendar : { - sameDay : '[tänään] [klo] LT', - nextDay : '[huomenna] [klo] LT', - nextWeek : 'dddd [klo] LT', - lastDay : '[eilen] [klo] LT', - lastWeek : '[viime] dddd[na] [klo] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s päästä', - past : '%s sitten', - s : translate, - ss : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : translate, - dd : translate, - M : translate, - MM : translate, - y : translate, - yy : translate - }, - 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. - } -}); - diff --git a/src/locale/fo.js b/src/locale/fo.js deleted file mode 100644 index 039563f731..0000000000 --- a/src/locale/fo.js +++ /dev/null @@ -1,53 +0,0 @@ -//! moment.js locale configuration -//! locale : Faroese [fo] -//! author : Ragnar Johannesen : https://github.com/ragnar123 -//! author : Kristian Sakarisson : https://github.com/sakarisson - -import moment from '../moment'; - -export default moment.defineLocale('fo', { - months : 'januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember'.split('_'), - monthsShort : 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'), - weekdays : 'sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur'.split('_'), - weekdaysShort : 'sun_mán_týs_mik_hós_frí_ley'.split('_'), - weekdaysMin : 'su_má_tý_mi_hó_fr_le'.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 : '[Í dag kl.] LT', - nextDay : '[Í morgin kl.] LT', - nextWeek : 'dddd [kl.] LT', - lastDay : '[Í gjár kl.] LT', - lastWeek : '[síðstu] dddd [kl] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'um %s', - past : '%s síðani', - s : 'fá sekund', - ss : '%d sekundir', - m : 'ein minuttur', - mm : '%d minuttir', - h : 'ein tími', - hh : '%d tímar', - d : 'ein dagur', - dd : '%d dagar', - M : 'ein mánaður', - MM : '%d mánaðir', - y : 'eitt ár', - yy : '%d ár' - }, - 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. - } -}); - diff --git a/src/locale/fr-ca.js b/src/locale/fr-ca.js deleted file mode 100644 index 4825a6db91..0000000000 --- a/src/locale/fr-ca.js +++ /dev/null @@ -1,66 +0,0 @@ -//! moment.js locale configuration -//! locale : French (Canada) [fr-ca] -//! author : Jonathan Abourbih : https://github.com/jonbca - -import moment from '../moment'; - -export default moment.defineLocale('fr-ca', { - months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), - monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), - monthsParseExact : true, - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'di_lu_ma_me_je_ve_sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Aujourd’hui à] LT', - nextDay : '[Demain à] LT', - nextWeek : 'dddd [à] LT', - lastDay : '[Hier à] LT', - lastWeek : 'dddd [dernier à] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dans %s', - past : 'il y a %s', - s : 'quelques secondes', - ss : '%d secondes', - m : 'une minute', - mm : '%d minutes', - h : 'une heure', - hh : '%d heures', - d : 'un jour', - dd : '%d jours', - M : 'un mois', - MM : '%d mois', - y : 'un an', - yy : '%d ans' - }, - dayOfMonthOrdinalParse: /\d{1,2}(er|e)/, - ordinal : function (number, period) { - switch (period) { - // Words with masculine grammatical gender: mois, trimestre, jour - default: - case 'M': - case 'Q': - case 'D': - case 'DDD': - case 'd': - return number + (number === 1 ? 'er' : 'e'); - - // Words with feminine grammatical gender: semaine - case 'w': - case 'W': - return number + (number === 1 ? 're' : 'e'); - } - } -}); - diff --git a/src/locale/fr-ch.js b/src/locale/fr-ch.js deleted file mode 100644 index febd401dfb..0000000000 --- a/src/locale/fr-ch.js +++ /dev/null @@ -1,70 +0,0 @@ -//! moment.js locale configuration -//! locale : French (Switzerland) [fr-ch] -//! author : Gaspard Bucher : https://github.com/gaspard - -import moment from '../moment'; - -export default moment.defineLocale('fr-ch', { - months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), - monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), - monthsParseExact : true, - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'di_lu_ma_me_je_ve_sa'.split('_'), - weekdaysParseExact : true, - 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 : '[Aujourd’hui à] LT', - nextDay : '[Demain à] LT', - nextWeek : 'dddd [à] LT', - lastDay : '[Hier à] LT', - lastWeek : 'dddd [dernier à] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dans %s', - past : 'il y a %s', - s : 'quelques secondes', - ss : '%d secondes', - m : 'une minute', - mm : '%d minutes', - h : 'une heure', - hh : '%d heures', - d : 'un jour', - dd : '%d jours', - M : 'un mois', - MM : '%d mois', - y : 'un an', - yy : '%d ans' - }, - dayOfMonthOrdinalParse: /\d{1,2}(er|e)/, - ordinal : function (number, period) { - switch (period) { - // Words with masculine grammatical gender: mois, trimestre, jour - default: - case 'M': - case 'Q': - case 'D': - case 'DDD': - case 'd': - return number + (number === 1 ? 'er' : 'e'); - - // Words with feminine grammatical gender: semaine - case 'w': - case 'W': - return number + (number === 1 ? 're' : 'e'); - } - }, - 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. - } -}); - diff --git a/src/locale/fr.js b/src/locale/fr.js deleted file mode 100644 index 81399dcffa..0000000000 --- a/src/locale/fr.js +++ /dev/null @@ -1,75 +0,0 @@ -//! moment.js locale configuration -//! locale : French [fr] -//! author : John Fischer : https://github.com/jfroffice - -import moment from '../moment'; - -export default moment.defineLocale('fr', { - months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), - monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), - monthsParseExact : true, - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'di_lu_ma_me_je_ve_sa'.split('_'), - weekdaysParseExact : true, - 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 : '[Aujourd’hui à] LT', - nextDay : '[Demain à] LT', - nextWeek : 'dddd [à] LT', - lastDay : '[Hier à] LT', - lastWeek : 'dddd [dernier à] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dans %s', - past : 'il y a %s', - s : 'quelques secondes', - ss : '%d secondes', - m : 'une minute', - mm : '%d minutes', - h : 'une heure', - hh : '%d heures', - d : 'un jour', - dd : '%d jours', - M : 'un mois', - MM : '%d mois', - y : 'un an', - yy : '%d ans' - }, - dayOfMonthOrdinalParse: /\d{1,2}(er|)/, - ordinal : function (number, period) { - switch (period) { - // TODO: Return 'e' when day of month > 1. Move this case inside - // block for masculine words below. - // See https://github.com/moment/moment/issues/3375 - case 'D': - return number + (number === 1 ? 'er' : ''); - - // Words with masculine grammatical gender: mois, trimestre, jour - default: - case 'M': - case 'Q': - case 'DDD': - case 'd': - return number + (number === 1 ? 'er' : 'e'); - - // Words with feminine grammatical gender: semaine - case 'w': - case 'W': - return number + (number === 1 ? 're' : 'e'); - } - }, - 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. - } -}); - diff --git a/src/locale/fy.js b/src/locale/fy.js deleted file mode 100644 index b4b2096060..0000000000 --- a/src/locale/fy.js +++ /dev/null @@ -1,67 +0,0 @@ -//! moment.js locale configuration -//! locale : Frisian [fy] -//! author : Robin van der Vliet : https://github.com/robin0van0der0v - -import moment from '../moment'; - -var monthsShortWithDots = 'jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.'.split('_'), - monthsShortWithoutDots = 'jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'); - -export default moment.defineLocale('fy', { - months : 'jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber'.split('_'), - monthsShort : function (m, format) { - if (!m) { - return monthsShortWithDots; - } else if (/-MMM-/.test(format)) { - return monthsShortWithoutDots[m.month()]; - } else { - return monthsShortWithDots[m.month()]; - } - }, - monthsParseExact : true, - weekdays : 'snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon'.split('_'), - weekdaysShort : 'si._mo._ti._wo._to._fr._so.'.split('_'), - weekdaysMin : 'Si_Mo_Ti_Wo_To_Fr_So'.split('_'), - weekdaysParseExact : true, - 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: '[hjoed om] LT', - nextDay: '[moarn om] LT', - nextWeek: 'dddd [om] LT', - lastDay: '[juster om] LT', - lastWeek: '[ôfrûne] dddd [om] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'oer %s', - past : '%s lyn', - s : 'in pear sekonden', - ss : '%d sekonden', - m : 'ien minút', - mm : '%d minuten', - h : 'ien oere', - hh : '%d oeren', - d : 'ien dei', - dd : '%d dagen', - M : 'ien moanne', - MM : '%d moannen', - y : 'ien jier', - yy : '%d jierren' - }, - dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/, - ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); - }, - 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. - } -}); - diff --git a/src/locale/ga.js b/src/locale/ga.js deleted file mode 100644 index b603c41761..0000000000 --- a/src/locale/ga.js +++ /dev/null @@ -1,68 +0,0 @@ -//! moment.js locale configuration -//! locale : Irish or Irish Gaelic [gd] -//! author : André Silva : https://github.com/askpt - -import moment from '../moment'; - - -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']; - -export default 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. - } -}); diff --git a/src/locale/gd.js b/src/locale/gd.js deleted file mode 100644 index b3653d2978..0000000000 --- a/src/locale/gd.js +++ /dev/null @@ -1,68 +0,0 @@ -//! moment.js locale configuration -//! locale : Scottish Gaelic [gd] -//! author : Jon Ashdown : https://github.com/jonashdown - -import moment from '../moment'; - -var months = [ - '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 = ['Faoi', 'Gear', 'Màrt', 'Gibl', 'Cèit', 'Ògmh', 'Iuch', 'Lùn', 'Sult', 'Dàmh', 'Samh', 'Dùbh']; - -var weekdays = ['Didòmhnaich', 'Diluain', 'Dimàirt', 'Diciadain', 'Diardaoin', 'Dihaoine', 'Disathairne']; - -var weekdaysShort = ['Did', 'Dil', 'Dim', 'Dic', 'Dia', 'Dih', 'Dis']; - -var weekdaysMin = ['Dò', 'Lu', 'Mà', 'Ci', 'Ar', 'Ha', 'Sa']; - -export default moment.defineLocale('gd', { - 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 : '[An-diugh aig] LT', - nextDay : '[A-màireach aig] LT', - nextWeek : 'dddd [aig] LT', - lastDay : '[An-dè aig] LT', - lastWeek : 'dddd [seo chaidh] [aig] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ann an %s', - past : 'bho chionn %s', - s : 'beagan diogan', - ss : '%d diogan', - m : 'mionaid', - mm : '%d mionaidean', - h : 'uair', - hh : '%d uairean', - d : 'latha', - dd : '%d latha', - M : 'mìos', - MM : '%d mìosan', - y : 'bliadhna', - yy : '%d bliadhna' - }, - 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. - } -}); - diff --git a/src/locale/gl.js b/src/locale/gl.js deleted file mode 100644 index 206a8f6c87..0000000000 --- a/src/locale/gl.js +++ /dev/null @@ -1,69 +0,0 @@ -//! moment.js locale configuration -//! locale : Galician [gl] -//! author : Juan G. Hurtado : https://github.com/juanghurtado - -import moment from '../moment'; - -export default moment.defineLocale('gl', { - months : 'xaneiro_febreiro_marzo_abril_maio_xuño_xullo_agosto_setembro_outubro_novembro_decembro'.split('_'), - monthsShort : 'xan._feb._mar._abr._mai._xuñ._xul._ago._set._out._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'domingo_luns_martes_mércores_xoves_venres_sábado'.split('_'), - weekdaysShort : 'dom._lun._mar._mér._xov._ven._sáb.'.split('_'), - weekdaysMin : 'do_lu_ma_mé_xo_ve_sá'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [de] MMMM [de] YYYY', - LLL : 'D [de] MMMM [de] YYYY H:mm', - LLLL : 'dddd, D [de] MMMM [de] YYYY H:mm' - }, - calendar : { - sameDay : function () { - return '[hoxe ' + ((this.hours() !== 1) ? 'ás' : 'á') + '] LT'; - }, - nextDay : function () { - return '[mañá ' + ((this.hours() !== 1) ? 'ás' : 'á') + '] LT'; - }, - nextWeek : function () { - return 'dddd [' + ((this.hours() !== 1) ? 'ás' : 'a') + '] LT'; - }, - lastDay : function () { - return '[onte ' + ((this.hours() !== 1) ? 'á' : 'a') + '] LT'; - }, - lastWeek : function () { - return '[o] dddd [pasado ' + ((this.hours() !== 1) ? 'ás' : 'a') + '] LT'; - }, - sameElse : 'L' - }, - relativeTime : { - future : function (str) { - if (str.indexOf('un') === 0) { - return 'n' + str; - } - return 'en ' + str; - }, - past : 'hai %s', - s : 'uns segundos', - ss : '%d segundos', - m : 'un minuto', - mm : '%d minutos', - h : 'unha hora', - hh : '%d horas', - d : 'un día', - dd : '%d días', - M : 'un mes', - MM : '%d meses', - y : 'un ano', - yy : '%d anos' - }, - 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. - } -}); - diff --git a/src/locale/gom-latn.js b/src/locale/gom-latn.js deleted file mode 100644 index 149f87411b..0000000000 --- a/src/locale/gom-latn.js +++ /dev/null @@ -1,114 +0,0 @@ -//! moment.js locale configuration -//! locale : Konkani Latin script [gom-latn] -//! author : The Discoverer : https://github.com/WikiDiscoverer - -import moment from '../moment'; - -function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 's': ['thodde secondanim', 'thodde second'], - 'ss': [number + ' secondanim', number + ' second'], - 'm': ['eka mintan', 'ek minute'], - 'mm': [number + ' mintanim', number + ' mintam'], - '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'], - 'MM': [number + ' mhoineanim', number + ' mhoine'], - 'y': ['eka vorsan', 'ek voros'], - 'yy': [number + ' vorsanim', number + ' vorsam'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; -} - -export default moment.defineLocale('gom-latn', { - months : 'Janer_Febrer_Mars_Abril_Mai_Jun_Julai_Agost_Setembr_Otubr_Novembr_Dezembr'.split('_'), - monthsShort : 'Jan._Feb._Mars_Abr._Mai_Jun_Jul._Ago._Set._Otu._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays : 'Aitar_Somar_Mongllar_Budvar_Brestar_Sukrar_Son\'var'.split('_'), - weekdaysShort : 'Ait._Som._Mon._Bud._Bre._Suk._Son.'.split('_'), - weekdaysMin : 'Ai_Sm_Mo_Bu_Br_Su_Sn'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'A h:mm [vazta]', - LTS : 'A h:mm:ss [vazta]', - L : 'DD-MM-YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY A h:mm [vazta]', - LLLL : 'dddd, MMMM[achea] Do, YYYY, A h:mm [vazta]', - llll: 'ddd, D MMM YYYY, A h:mm [vazta]' - }, - calendar : { - sameDay: '[Aiz] LT', - nextDay: '[Faleam] LT', - nextWeek: '[Ieta to] dddd[,] LT', - lastDay: '[Kal] LT', - lastWeek: '[Fatlo] dddd[,] LT', - sameElse: 'L' - }, - relativeTime : { - future : '%s', - past : '%s adim', - s : processRelativeTime, - ss : processRelativeTime, - m : processRelativeTime, - mm : processRelativeTime, - h : processRelativeTime, - hh : processRelativeTime, - d : processRelativeTime, - dd : processRelativeTime, - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - dayOfMonthOrdinalParse : /\d{1,2}(er)/, - ordinal : function (number, period) { - switch (period) { - // the ordinal 'er' only applies to day of the month - case 'D': - return number + 'er'; - default: - case 'M': - case 'Q': - case 'DDD': - case 'd': - case 'w': - case 'W': - return number; - } - }, - 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. - }, - meridiemParse: /rati|sokalli|donparam|sanje/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'rati') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'sokalli') { - return hour; - } else if (meridiem === 'donparam') { - return hour > 12 ? hour : hour + 12; - } else if (meridiem === 'sanje') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'rati'; - } else if (hour < 12) { - return 'sokalli'; - } else if (hour < 16) { - return 'donparam'; - } else if (hour < 20) { - return 'sanje'; - } else { - return 'rati'; - } - } -}); diff --git a/src/locale/gu.js b/src/locale/gu.js deleted file mode 100644 index af91dfc384..0000000000 --- a/src/locale/gu.js +++ /dev/null @@ -1,115 +0,0 @@ -//! moment.js locale configuration -//! locale : Gujarati [gu] -//! author : Kaushik Thanki : https://github.com/Kaushik1987 - -import moment from '../moment'; - -var symbolMap = { - '1': '૧', - '2': '૨', - '3': '૩', - '4': '૪', - '5': '૫', - '6': '૬', - '7': '૭', - '8': '૮', - '9': '૯', - '0': '૦' - }, - numberMap = { - '૧': '1', - '૨': '2', - '૩': '3', - '૪': '4', - '૫': '5', - '૬': '6', - '૭': '7', - '૮': '8', - '૯': '9', - '૦': '0' - }; - -export default moment.defineLocale('gu', { - months: 'જાન્યુઆરી_ફેબ્રુઆરી_માર્ચ_એપ્રિલ_મે_જૂન_જુલાઈ_ઑગસ્ટ_સપ્ટેમ્બર_ઑક્ટ્બર_નવેમ્બર_ડિસેમ્બર'.split('_'), - monthsShort: 'જાન્યુ._ફેબ્રુ._માર્ચ_એપ્રિ._મે_જૂન_જુલા._ઑગ._સપ્ટે._ઑક્ટ્._નવે._ડિસે.'.split('_'), - monthsParseExact: true, - weekdays: 'રવિવાર_સોમવાર_મંગળવાર_બુધ્વાર_ગુરુવાર_શુક્રવાર_શનિવાર'.split('_'), - weekdaysShort: 'રવિ_સોમ_મંગળ_બુધ્_ગુરુ_શુક્ર_શનિ'.split('_'), - weekdaysMin: 'ર_સો_મં_બુ_ગુ_શુ_શ'.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: '[આજ] LT', - nextDay: '[કાલે] LT', - nextWeek: 'dddd, LT', - lastDay: '[ગઇકાલે] LT', - lastWeek: '[પાછલા] dddd, LT', - sameElse: 'L' - }, - relativeTime: { - future: '%s મા', - past: '%s પેહલા', - s: 'અમુક પળો', - ss: '%d સેકંડ', - m: 'એક મિનિટ', - mm: '%d મિનિટ', - h: 'એક કલાક', - hh: '%d કલાક', - d: 'એક દિવસ', - dd: '%d દિવસ', - M: 'એક મહિનો', - MM: '%d મહિનો', - y: 'એક વર્ષ', - yy: '%d વર્ષ' - }, - preparse: function (string) { - return string.replace(/[૧૨૩૪૫૬૭૮૯૦]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - // Gujarati notation for meridiems are quite fuzzy in practice. While there exists - // a rigid notion of a 'Pahar' it is not used as rigidly in modern Gujarati. - meridiemParse: /રાત|બપોર|સવાર|સાંજ/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'રાત') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'સવાર') { - return hour; - } else if (meridiem === 'બપોર') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'સાંજ') { - return hour + 12; - } - }, - meridiem: function (hour, minute, isLower) { - if (hour < 4) { - return 'રાત'; - } else if (hour < 10) { - return 'સવાર'; - } else if (hour < 17) { - return 'બપોર'; - } else if (hour < 20) { - return 'સાંજ'; - } else { - return 'રાત'; - } - }, - week: { - dow: 0, // Sunday is the first day of the week. - doy: 6 // The week that contains Jan 6th is the first week of the year. - } -}); diff --git a/src/locale/he.js b/src/locale/he.js deleted file mode 100644 index 02af63448f..0000000000 --- a/src/locale/he.js +++ /dev/null @@ -1,91 +0,0 @@ -//! moment.js locale configuration -//! locale : Hebrew [he] -//! author : Tomer Cohen : https://github.com/tomer -//! author : Moshe Simantov : https://github.com/DevelopmentIL -//! author : Tal Ater : https://github.com/TalAter - -import moment from '../moment'; - -export default moment.defineLocale('he', { - months : 'ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר'.split('_'), - monthsShort : 'ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳'.split('_'), - weekdays : 'ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת'.split('_'), - weekdaysShort : 'א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳'.split('_'), - weekdaysMin : 'א_ב_ג_ד_ה_ו_ש'.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', - l : 'D/M/YYYY', - ll : 'D MMM YYYY', - lll : 'D MMM YYYY HH:mm', - llll : 'ddd, D MMM YYYY HH:mm' - }, - calendar : { - sameDay : '[היום ב־]LT', - nextDay : '[מחר ב־]LT', - nextWeek : 'dddd [בשעה] LT', - lastDay : '[אתמול ב־]LT', - lastWeek : '[ביום] dddd [האחרון בשעה] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'בעוד %s', - past : 'לפני %s', - s : 'מספר שניות', - ss : '%d שניות', - m : 'דקה', - mm : '%d דקות', - h : 'שעה', - hh : function (number) { - if (number === 2) { - return 'שעתיים'; - } - return number + ' שעות'; - }, - d : 'יום', - dd : function (number) { - if (number === 2) { - return 'יומיים'; - } - return number + ' ימים'; - }, - M : 'חודש', - MM : function (number) { - if (number === 2) { - return 'חודשיים'; - } - return number + ' חודשים'; - }, - y : 'שנה', - yy : function (number) { - if (number === 2) { - return 'שנתיים'; - } else if (number % 10 === 0 && number !== 10) { - return number + ' שנה'; - } - return number + ' שנים'; - } - }, - meridiemParse: /אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i, - isPM : function (input) { - return /^(אחה"צ|אחרי הצהריים|בערב)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 5) { - return 'לפנות בוקר'; - } else if (hour < 10) { - return 'בבוקר'; - } else if (hour < 12) { - return isLower ? 'לפנה"צ' : 'לפני הצהריים'; - } else if (hour < 18) { - return isLower ? 'אחה"צ' : 'אחרי הצהריים'; - } else { - return 'בערב'; - } - } -}); - diff --git a/src/locale/hi.js b/src/locale/hi.js deleted file mode 100644 index 0ac41faf08..0000000000 --- a/src/locale/hi.js +++ /dev/null @@ -1,116 +0,0 @@ -//! moment.js locale configuration -//! locale : Hindi [hi] -//! author : Mayank Singhal : https://github.com/mayanksinghal - -import moment from '../moment'; - -var symbolMap = { - '1': '१', - '2': '२', - '3': '३', - '4': '४', - '5': '५', - '6': '६', - '7': '७', - '8': '८', - '9': '९', - '0': '०' -}, -numberMap = { - '१': '1', - '२': '2', - '३': '3', - '४': '4', - '५': '5', - '६': '6', - '७': '7', - '८': '8', - '९': '9', - '०': '0' -}; - -export default moment.defineLocale('hi', { - months : 'जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर'.split('_'), - monthsShort : 'जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.'.split('_'), - monthsParseExact: true, - weekdays : 'रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'), - weekdaysShort : 'रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि'.split('_'), - weekdaysMin : 'र_सो_मं_बु_गु_शु_श'.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 : '[आज] LT', - nextDay : '[कल] LT', - nextWeek : 'dddd, LT', - lastDay : '[कल] LT', - lastWeek : '[पिछले] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s में', - past : '%s पहले', - s : 'कुछ ही क्षण', - ss : '%d सेकंड', - m : 'एक मिनट', - mm : '%d मिनट', - h : 'एक घंटा', - hh : '%d घंटे', - d : 'एक दिन', - dd : '%d दिन', - M : 'एक महीने', - MM : '%d महीने', - y : 'एक वर्ष', - yy : '%d वर्ष' - }, - preparse: function (string) { - return string.replace(/[१२३४५६७८९०]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - // Hindi notation for meridiems are quite fuzzy in practice. While there exists - // a rigid notion of a 'Pahar' it is not used as rigidly in modern Hindi. - meridiemParse: /रात|सुबह|दोपहर|शाम/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'रात') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'सुबह') { - return hour; - } else if (meridiem === 'दोपहर') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'शाम') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'रात'; - } else if (hour < 10) { - return 'सुबह'; - } else if (hour < 17) { - return 'दोपहर'; - } else if (hour < 20) { - return 'शाम'; - } else { - return 'रात'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } -}); - diff --git a/src/locale/hr.js b/src/locale/hr.js deleted file mode 100644 index 188b8c3a55..0000000000 --- a/src/locale/hr.js +++ /dev/null @@ -1,145 +0,0 @@ -//! moment.js locale configuration -//! locale : Croatian [hr] -//! author : Bojan Marković : https://github.com/bmarkovic - -import moment from '../moment'; - -function translate(number, withoutSuffix, key) { - var result = number + ' '; - switch (key) { - case 'ss': - if (number === 1) { - result += 'sekunda'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'sekunde'; - } else { - result += 'sekundi'; - } - return result; - case 'm': - return withoutSuffix ? 'jedna minuta' : 'jedne minute'; - case 'mm': - if (number === 1) { - result += 'minuta'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'minute'; - } else { - result += 'minuta'; - } - return result; - case 'h': - return withoutSuffix ? 'jedan sat' : 'jednog sata'; - case 'hh': - if (number === 1) { - result += 'sat'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'sata'; - } else { - result += 'sati'; - } - return result; - case 'dd': - if (number === 1) { - result += 'dan'; - } else { - result += 'dana'; - } - return result; - case 'MM': - if (number === 1) { - result += 'mjesec'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'mjeseca'; - } else { - result += 'mjeseci'; - } - return result; - case 'yy': - if (number === 1) { - result += 'godina'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'godine'; - } else { - result += 'godina'; - } - return result; - } -} - -export default moment.defineLocale('hr', { - months : { - format: 'siječnja_veljače_ožujka_travnja_svibnja_lipnja_srpnja_kolovoza_rujna_listopada_studenoga_prosinca'.split('_'), - standalone: 'siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac'.split('_') - }, - monthsShort : 'sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.'.split('_'), - monthsParseExact: true, - weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), - weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), - weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[danas u] LT', - nextDay : '[sutra u] LT', - nextWeek : function () { - switch (this.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'; - } - }, - lastDay : '[jučer u] LT', - lastWeek : function () { - switch (this.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'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'prije %s', - s : 'par sekundi', - ss : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : 'dan', - dd : translate, - M : 'mjesec', - MM : translate, - y : 'godinu', - yy : translate - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); diff --git a/src/locale/hu.js b/src/locale/hu.js deleted file mode 100644 index 1e075de936..0000000000 --- a/src/locale/hu.js +++ /dev/null @@ -1,103 +0,0 @@ -//! moment.js locale configuration -//! locale : Hungarian [hu] -//! author : Adam Brunner : https://github.com/adambrunner - -import moment from '../moment'; - -var weekEndings = 'vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton'.split(' '); -function translate(number, withoutSuffix, key, isFuture) { - var num = number, - suffix; - switch (key) { - case 's': - return (isFuture || withoutSuffix) ? 'néhány másodperc' : 'néhány másodperce'; - case 'ss': - return num + (isFuture || withoutSuffix) ? ' másodperc' : ' másodperce'; - case 'm': - return 'egy' + (isFuture || withoutSuffix ? ' perc' : ' perce'); - case 'mm': - return num + (isFuture || withoutSuffix ? ' perc' : ' perce'); - case 'h': - return 'egy' + (isFuture || withoutSuffix ? ' óra' : ' órája'); - case 'hh': - return num + (isFuture || withoutSuffix ? ' óra' : ' órája'); - case 'd': - return 'egy' + (isFuture || withoutSuffix ? ' nap' : ' napja'); - case 'dd': - return num + (isFuture || withoutSuffix ? ' nap' : ' napja'); - case 'M': - return 'egy' + (isFuture || withoutSuffix ? ' hónap' : ' hónapja'); - case 'MM': - return num + (isFuture || withoutSuffix ? ' hónap' : ' hónapja'); - case 'y': - return 'egy' + (isFuture || withoutSuffix ? ' év' : ' éve'); - case 'yy': - return num + (isFuture || withoutSuffix ? ' év' : ' éve'); - } - return ''; -} -function week(isFuture) { - return (isFuture ? '' : '[múlt] ') + '[' + weekEndings[this.day()] + '] LT[-kor]'; -} - -export default moment.defineLocale('hu', { - months : 'január_február_március_április_május_június_július_augusztus_szeptember_október_november_december'.split('_'), - monthsShort : 'jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec'.split('_'), - weekdays : 'vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat'.split('_'), - weekdaysShort : 'vas_hét_kedd_sze_csüt_pén_szo'.split('_'), - weekdaysMin : 'v_h_k_sze_cs_p_szo'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'YYYY.MM.DD.', - LL : 'YYYY. MMMM D.', - LLL : 'YYYY. MMMM D. H:mm', - LLLL : 'YYYY. MMMM D., dddd H:mm' - }, - meridiemParse: /de|du/i, - isPM: function (input) { - return input.charAt(1).toLowerCase() === 'u'; - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 12) { - return isLower === true ? 'de' : 'DE'; - } else { - return isLower === true ? 'du' : 'DU'; - } - }, - calendar : { - sameDay : '[ma] LT[-kor]', - nextDay : '[holnap] LT[-kor]', - nextWeek : function () { - return week.call(this, true); - }, - lastDay : '[tegnap] LT[-kor]', - lastWeek : function () { - return week.call(this, false); - }, - sameElse : 'L' - }, - relativeTime : { - future : '%s múlva', - past : '%s', - s : translate, - ss : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : translate, - dd : translate, - M : translate, - MM : translate, - y : translate, - yy : translate - }, - 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. - } -}); - diff --git a/src/locale/hy-am.js b/src/locale/hy-am.js deleted file mode 100644 index 6fd533b0c7..0000000000 --- a/src/locale/hy-am.js +++ /dev/null @@ -1,87 +0,0 @@ -//! moment.js locale configuration -//! locale : Armenian [hy-am] -//! author : Armendarabyan : https://github.com/armendarabyan - -import moment from '../moment'; - -export default moment.defineLocale('hy-am', { - months : { - format: 'հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի'.split('_'), - standalone: 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split('_') - }, - monthsShort : 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_'), - weekdays : 'կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ'.split('_'), - weekdaysShort : 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'), - weekdaysMin : 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.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: '[այսօր] LT', - nextDay: '[վաղը] LT', - lastDay: '[երեկ] LT', - nextWeek: function () { - return 'dddd [օրը ժամը] LT'; - }, - lastWeek: function () { - return '[անցած] dddd [օրը ժամը] LT'; - }, - sameElse: 'L' - }, - relativeTime : { - future : '%s հետո', - past : '%s առաջ', - s : 'մի քանի վայրկյան', - ss : '%d վայրկյան', - m : 'րոպե', - mm : '%d րոպե', - h : 'ժամ', - hh : '%d ժամ', - d : 'օր', - dd : '%d օր', - M : 'ամիս', - MM : '%d ամիս', - y : 'տարի', - yy : '%d տարի' - }, - meridiemParse: /գիշերվա|առավոտվա|ցերեկվա|երեկոյան/, - isPM: function (input) { - return /^(ցերեկվա|երեկոյան)$/.test(input); - }, - meridiem : function (hour) { - if (hour < 4) { - return 'գիշերվա'; - } else if (hour < 12) { - return 'առավոտվա'; - } else if (hour < 17) { - return 'ցերեկվա'; - } else { - return 'երեկոյան'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}|\d{1,2}-(ին|րդ)/, - ordinal: function (number, period) { - switch (period) { - case 'DDD': - case 'w': - case 'W': - case 'DDDo': - if (number === 1) { - return number + '-ին'; - } - return number + '-րդ'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); - diff --git a/src/locale/id.js b/src/locale/id.js deleted file mode 100644 index 9fa7bffad5..0000000000 --- a/src/locale/id.js +++ /dev/null @@ -1,74 +0,0 @@ -//! moment.js locale configuration -//! locale : Indonesian [id] -//! author : Mohammad Satrio Utomo : https://github.com/tyok -//! reference: http://id.wikisource.org/wiki/Pedoman_Umum_Ejaan_Bahasa_Indonesia_yang_Disempurnakan - -import moment from '../moment'; - -export default moment.defineLocale('id', { - months : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Agt_Sep_Okt_Nov_Des'.split('_'), - weekdays : 'Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu'.split('_'), - weekdaysShort : 'Min_Sen_Sel_Rab_Kam_Jum_Sab'.split('_'), - weekdaysMin : 'Mg_Sn_Sl_Rb_Km_Jm_Sb'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /pagi|siang|sore|malam/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'pagi') { - return hour; - } else if (meridiem === 'siang') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'sore' || meridiem === 'malam') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'pagi'; - } else if (hours < 15) { - return 'siang'; - } else if (hours < 19) { - return 'sore'; - } else { - return 'malam'; - } - }, - calendar : { - sameDay : '[Hari ini pukul] LT', - nextDay : '[Besok pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kemarin pukul] LT', - lastWeek : 'dddd [lalu pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dalam %s', - past : '%s yang lalu', - s : 'beberapa detik', - ss : '%d detik', - m : 'semenit', - mm : '%d menit', - h : 'sejam', - hh : '%d jam', - d : 'sehari', - dd : '%d hari', - M : 'sebulan', - MM : '%d bulan', - y : 'setahun', - yy : '%d tahun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); diff --git a/src/locale/is.js b/src/locale/is.js deleted file mode 100644 index 51fb8e661f..0000000000 --- a/src/locale/is.js +++ /dev/null @@ -1,124 +0,0 @@ -//! moment.js locale configuration -//! locale : Icelandic [is] -//! author : Hinrik Örn Sigurðsson : https://github.com/hinrik - -import moment from '../moment'; - -function plural(n) { - if (n % 100 === 11) { - return true; - } else if (n % 10 === 1) { - return false; - } - return true; -} -function translate(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': - return withoutSuffix || isFuture ? 'nokkrar sekúndur' : 'nokkrum sekúndum'; - case 'ss': - if (plural(number)) { - return result + (withoutSuffix || isFuture ? 'sekúndur' : 'sekúndum'); - } - return result + 'sekúnda'; - case 'm': - return withoutSuffix ? 'mínúta' : 'mínútu'; - case 'mm': - if (plural(number)) { - return result + (withoutSuffix || isFuture ? 'mínútur' : 'mínútum'); - } else if (withoutSuffix) { - return result + 'mínúta'; - } - return result + 'mínútu'; - case 'hh': - if (plural(number)) { - return result + (withoutSuffix || isFuture ? 'klukkustundir' : 'klukkustundum'); - } - return result + 'klukkustund'; - case 'd': - if (withoutSuffix) { - return 'dagur'; - } - return isFuture ? 'dag' : 'degi'; - case 'dd': - if (plural(number)) { - if (withoutSuffix) { - return result + 'dagar'; - } - return result + (isFuture ? 'daga' : 'dögum'); - } else if (withoutSuffix) { - return result + 'dagur'; - } - return result + (isFuture ? 'dag' : 'degi'); - case 'M': - if (withoutSuffix) { - return 'mánuður'; - } - return isFuture ? 'mánuð' : 'mánuði'; - case 'MM': - if (plural(number)) { - if (withoutSuffix) { - return result + 'mánuðir'; - } - return result + (isFuture ? 'mánuði' : 'mánuðum'); - } else if (withoutSuffix) { - return result + 'mánuður'; - } - return result + (isFuture ? 'mánuð' : 'mánuði'); - case 'y': - return withoutSuffix || isFuture ? 'ár' : 'ári'; - case 'yy': - if (plural(number)) { - return result + (withoutSuffix || isFuture ? 'ár' : 'árum'); - } - return result + (withoutSuffix || isFuture ? 'ár' : 'ári'); - } -} - -export default moment.defineLocale('is', { - months : 'janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember'.split('_'), - monthsShort : 'jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des'.split('_'), - weekdays : 'sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur'.split('_'), - weekdaysShort : 'sun_mán_þri_mið_fim_fös_lau'.split('_'), - weekdaysMin : 'Su_Má_Þr_Mi_Fi_Fö_La'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY [kl.] H:mm', - LLLL : 'dddd, D. MMMM YYYY [kl.] H:mm' - }, - calendar : { - sameDay : '[í dag kl.] LT', - nextDay : '[á morgun kl.] LT', - nextWeek : 'dddd [kl.] LT', - lastDay : '[í gær kl.] LT', - lastWeek : '[síðasta] dddd [kl.] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'eftir %s', - past : 'fyrir %s síðan', - s : translate, - ss : translate, - m : translate, - mm : translate, - h : 'klukkustund', - hh : translate, - d : translate, - dd : translate, - M : translate, - MM : translate, - y : translate, - yy : translate - }, - 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. - } -}); - diff --git a/src/locale/it-ch.js b/src/locale/it-ch.js deleted file mode 100644 index bcfe60351c..0000000000 --- a/src/locale/it-ch.js +++ /dev/null @@ -1,61 +0,0 @@ -//! moment.js locale configuration -//! locale : Italian (Switzerland) [it-ch] -//! author : xfh : https://github.com/xfh - -import moment from '../moment'; - -export default 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. - } -}); - diff --git a/src/locale/it.js b/src/locale/it.js deleted file mode 100644 index a7ce1173eb..0000000000 --- a/src/locale/it.js +++ /dev/null @@ -1,62 +0,0 @@ -//! moment.js locale configuration -//! locale : Italian [it] -//! author : Lorenzo : https://github.com/aliem -//! author: Mattia Larentis: https://github.com/nostalgiaz - -import moment from '../moment'; - -export default 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('_'), - 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. - } -}); - diff --git a/src/locale/ja.js b/src/locale/ja.js deleted file mode 100644 index af3e1da015..0000000000 --- a/src/locale/ja.js +++ /dev/null @@ -1,84 +0,0 @@ -//! moment.js locale configuration -//! locale : Japanese [ja] -//! author : LI Long : https://github.com/baryon - -import moment from '../moment'; - -export default moment.defineLocale('ja', { - months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日'.split('_'), - weekdaysShort : '日_月_火_水_木_金_土'.split('_'), - weekdaysMin : '日_月_火_水_木_金_土'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY/MM/DD', - LL : 'YYYY年M月D日', - LLL : 'YYYY年M月D日 HH:mm', - LLLL : 'YYYY年M月D日 dddd HH:mm', - l : 'YYYY/MM/DD', - ll : 'YYYY年M月D日', - lll : 'YYYY年M月D日 HH:mm', - llll : 'YYYY年M月D日(ddd) HH:mm' - }, - meridiemParse: /午前|午後/i, - isPM : function (input) { - return input === '午後'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return '午前'; - } else { - return '午後'; - } - }, - calendar : { - sameDay : '[今日] LT', - nextDay : '[明日] LT', - nextWeek : function (now) { - if (now.week() < this.week()) { - return '[来週]dddd LT'; - } else { - return 'dddd LT'; - } - }, - lastDay : '[昨日] LT', - lastWeek : function (now) { - if (this.week() < now.week()) { - return '[先週]dddd LT'; - } else { - return 'dddd LT'; - } - }, - sameElse : 'L' - }, - dayOfMonthOrdinalParse : /\d{1,2}日/, - ordinal : function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '日'; - default: - return number; - } - }, - relativeTime : { - future : '%s後', - past : '%s前', - s : '数秒', - ss : '%d秒', - m : '1分', - mm : '%d分', - h : '1時間', - hh : '%d時間', - d : '1日', - dd : '%d日', - M : '1ヶ月', - MM : '%dヶ月', - y : '1年', - yy : '%d年' - } -}); - diff --git a/src/locale/jv.js b/src/locale/jv.js deleted file mode 100644 index f648f16806..0000000000 --- a/src/locale/jv.js +++ /dev/null @@ -1,74 +0,0 @@ -//! moment.js locale configuration -//! locale : Javanese [jv] -//! author : Rony Lantip : https://github.com/lantip -//! reference: http://jv.wikipedia.org/wiki/Basa_Jawa - -import moment from '../moment'; - -export default moment.defineLocale('jv', { - months : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des'.split('_'), - weekdays : 'Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu'.split('_'), - weekdaysShort : 'Min_Sen_Sel_Reb_Kem_Jem_Sep'.split('_'), - weekdaysMin : 'Mg_Sn_Sl_Rb_Km_Jm_Sp'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /enjing|siyang|sonten|ndalu/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'enjing') { - return hour; - } else if (meridiem === 'siyang') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'sonten' || meridiem === 'ndalu') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'enjing'; - } else if (hours < 15) { - return 'siyang'; - } else if (hours < 19) { - return 'sonten'; - } else { - return 'ndalu'; - } - }, - calendar : { - sameDay : '[Dinten puniko pukul] LT', - nextDay : '[Mbenjang pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kala wingi pukul] LT', - lastWeek : 'dddd [kepengker pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'wonten ing %s', - past : '%s ingkang kepengker', - s : 'sawetawis detik', - ss : '%d detik', - m : 'setunggal menit', - mm : '%d menit', - h : 'setunggal jam', - hh : '%d jam', - d : 'sedinten', - dd : '%d dinten', - M : 'sewulan', - MM : '%d wulan', - y : 'setaun', - yy : '%d taun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); diff --git a/src/locale/ka.js b/src/locale/ka.js deleted file mode 100644 index 169734b13c..0000000000 --- a/src/locale/ka.js +++ /dev/null @@ -1,81 +0,0 @@ -//! moment.js locale configuration -//! locale : Georgian [ka] -//! author : Irakli Janiashvili : https://github.com/irakli-janiashvili - -import moment from '../moment'; - -export default moment.defineLocale('ka', { - months : { - standalone: 'იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი'.split('_'), - format: 'იანვარს_თებერვალს_მარტს_აპრილის_მაისს_ივნისს_ივლისს_აგვისტს_სექტემბერს_ოქტომბერს_ნოემბერს_დეკემბერს'.split('_') - }, - monthsShort : 'იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ'.split('_'), - weekdays : { - standalone: 'კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი'.split('_'), - format: 'კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს'.split('_'), - isFormat: /(წინა|შემდეგ)/ - }, - weekdaysShort : 'კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ'.split('_'), - weekdaysMin : 'კვ_ორ_სა_ოთ_ხუ_პა_შა'.split('_'), - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[დღეს] LT[-ზე]', - nextDay : '[ხვალ] LT[-ზე]', - lastDay : '[გუშინ] LT[-ზე]', - nextWeek : '[შემდეგ] dddd LT[-ზე]', - lastWeek : '[წინა] dddd LT-ზე', - sameElse : 'L' - }, - relativeTime : { - future : function (s) { - return (/(წამი|წუთი|საათი|წელი)/).test(s) ? - s.replace(/ი$/, 'ში') : - s + 'ში'; - }, - past : function (s) { - if ((/(წამი|წუთი|საათი|დღე|თვე)/).test(s)) { - return s.replace(/(ი|ე)$/, 'ის წინ'); - } - if ((/წელი/).test(s)) { - return s.replace(/წელი$/, 'წლის წინ'); - } - }, - s : 'რამდენიმე წამი', - ss : '%d წამი', - m : 'წუთი', - mm : '%d წუთი', - h : 'საათი', - hh : '%d საათი', - d : 'დღე', - dd : '%d დღე', - M : 'თვე', - MM : '%d თვე', - y : 'წელი', - yy : '%d წელი' - }, - dayOfMonthOrdinalParse: /0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/, - ordinal : function (number) { - if (number === 0) { - return number; - } - if (number === 1) { - return number + '-ლი'; - } - if ((number < 20) || (number <= 100 && (number % 20 === 0)) || (number % 100 === 0)) { - return 'მე-' + number; - } - return number + '-ე'; - }, - week : { - dow : 1, - doy : 7 - } -}); - diff --git a/src/locale/kk.js b/src/locale/kk.js deleted file mode 100644 index ab79a21b1e..0000000000 --- a/src/locale/kk.js +++ /dev/null @@ -1,78 +0,0 @@ -//! moment.js locale configuration -//! locale : Kazakh [kk] -//! authors : Nurlan Rakhimzhanov : https://github.com/nurlan - -import moment from '../moment'; - -var suffixes = { - 0: '-ші', - 1: '-ші', - 2: '-ші', - 3: '-ші', - 4: '-ші', - 5: '-ші', - 6: '-шы', - 7: '-ші', - 8: '-ші', - 9: '-шы', - 10: '-шы', - 20: '-шы', - 30: '-шы', - 40: '-шы', - 50: '-ші', - 60: '-шы', - 70: '-ші', - 80: '-ші', - 90: '-шы', - 100: '-ші' -}; - -export default moment.defineLocale('kk', { - months : 'қаңтар_ақпан_наурыз_сәуір_мамыр_маусым_шілде_тамыз_қыркүйек_қазан_қараша_желтоқсан'.split('_'), - monthsShort : 'қаң_ақп_нау_сәу_мам_мау_шіл_там_қыр_қаз_қар_жел'.split('_'), - weekdays : 'жексенбі_дүйсенбі_сейсенбі_сәрсенбі_бейсенбі_жұма_сенбі'.split('_'), - weekdaysShort : 'жек_дүй_сей_сәр_бей_жұм_сен'.split('_'), - weekdaysMin : 'жк_дй_сй_ср_бй_жм_сн'.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 : '[Бүгін сағат] LT', - nextDay : '[Ертең сағат] LT', - nextWeek : 'dddd [сағат] LT', - lastDay : '[Кеше сағат] LT', - lastWeek : '[Өткен аптаның] dddd [сағат] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ішінде', - past : '%s бұрын', - s : 'бірнеше секунд', - ss : '%d секунд', - m : 'бір минут', - mm : '%d минут', - h : 'бір сағат', - hh : '%d сағат', - d : 'бір күн', - dd : '%d күн', - M : 'бір ай', - MM : '%d ай', - y : 'бір жыл', - yy : '%d жыл' - }, - dayOfMonthOrdinalParse: /\d{1,2}-(ші|шы)/, - ordinal : function (number) { - var a = number % 10, - b = number >= 100 ? 100 : null; - return number + (suffixes[number] || suffixes[a] || suffixes[b]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); diff --git a/src/locale/km.js b/src/locale/km.js deleted file mode 100644 index b364ffeb13..0000000000 --- a/src/locale/km.js +++ /dev/null @@ -1,101 +0,0 @@ -//! moment.js locale configuration -//! locale : Cambodian [km] -//! author : Kruy Vanna : https://github.com/kruyvanna - -import moment from '../moment'; - -var symbolMap = { - '1': '១', - '2': '២', - '3': '៣', - '4': '៤', - '5': '៥', - '6': '៦', - '7': '៧', - '8': '៨', - '9': '៩', - '0': '០' -}, numberMap = { - '១': '1', - '២': '2', - '៣': '3', - '៤': '4', - '៥': '5', - '៦': '6', - '៧': '7', - '៨': '8', - '៩': '9', - '០': '0' -}; - -export default moment.defineLocale('km', { - months: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split( - '_' - ), - monthsShort: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split( - '_' - ), - weekdays: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'), - weekdaysShort: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'), - weekdaysMin: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'), - weekdaysParseExact: true, - 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: /ព្រឹក|ល្ងាច/, - isPM: function (input) { - return input === 'ល្ងាច'; - }, - meridiem: function (hour, minute, isLower) { - if (hour < 12) { - return 'ព្រឹក'; - } else { - return 'ល្ងាច'; - } - }, - calendar: { - sameDay: '[ថ្ងៃនេះ ម៉ោង] LT', - nextDay: '[ស្អែក ម៉ោង] LT', - nextWeek: 'dddd [ម៉ោង] LT', - lastDay: '[ម្សិលមិញ ម៉ោង] LT', - lastWeek: 'dddd [សប្តាហ៍មុន] [ម៉ោង] LT', - sameElse: 'L' - }, - relativeTime: { - future: '%sទៀត', - past: '%sមុន', - s: 'ប៉ុន្មានវិនាទី', - ss: '%d វិនាទី', - m: 'មួយនាទី', - mm: '%d នាទី', - h: 'មួយម៉ោង', - hh: '%d ម៉ោង', - d: 'មួយថ្ងៃ', - dd: '%d ថ្ងៃ', - M: 'មួយខែ', - MM: '%d ខែ', - y: 'មួយឆ្នាំ', - yy: '%d ឆ្នាំ' - }, - dayOfMonthOrdinalParse : /ទី\d{1,2}/, - ordinal : 'ទី%d', - preparse: function (string) { - return string.replace(/[១២៣៤៥៦៧៨៩០]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - 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. - } -}); diff --git a/src/locale/kn.js b/src/locale/kn.js deleted file mode 100644 index 0228e74b3c..0000000000 --- a/src/locale/kn.js +++ /dev/null @@ -1,117 +0,0 @@ -//! moment.js locale configuration -//! locale : Kannada [kn] -//! author : Rajeev Naik : https://github.com/rajeevnaikte - -import moment from '../moment'; - -var symbolMap = { - '1': '೧', - '2': '೨', - '3': '೩', - '4': '೪', - '5': '೫', - '6': '೬', - '7': '೭', - '8': '೮', - '9': '೯', - '0': '೦' -}, -numberMap = { - '೧': '1', - '೨': '2', - '೩': '3', - '೪': '4', - '೫': '5', - '೬': '6', - '೭': '7', - '೮': '8', - '೯': '9', - '೦': '0' -}; - -export default moment.defineLocale('kn', { - months : 'ಜನವರಿ_ಫೆಬ್ರವರಿ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂಬರ್_ಅಕ್ಟೋಬರ್_ನವೆಂಬರ್_ಡಿಸೆಂಬರ್'.split('_'), - monthsShort : 'ಜನ_ಫೆಬ್ರ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂ_ಅಕ್ಟೋ_ನವೆಂ_ಡಿಸೆಂ'.split('_'), - monthsParseExact: true, - weekdays : 'ಭಾನುವಾರ_ಸೋಮವಾರ_ಮಂಗಳವಾರ_ಬುಧವಾರ_ಗುರುವಾರ_ಶುಕ್ರವಾರ_ಶನಿವಾರ'.split('_'), - weekdaysShort : 'ಭಾನು_ಸೋಮ_ಮಂಗಳ_ಬುಧ_ಗುರು_ಶುಕ್ರ_ಶನಿ'.split('_'), - weekdaysMin : 'ಭಾ_ಸೋ_ಮಂ_ಬು_ಗು_ಶು_ಶ'.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 : '[ಇಂದು] LT', - nextDay : '[ನಾಳೆ] LT', - nextWeek : 'dddd, LT', - lastDay : '[ನಿನ್ನೆ] LT', - lastWeek : '[ಕೊನೆಯ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ನಂತರ', - past : '%s ಹಿಂದೆ', - s : 'ಕೆಲವು ಕ್ಷಣಗಳು', - ss : '%d ಸೆಕೆಂಡುಗಳು', - m : 'ಒಂದು ನಿಮಿಷ', - mm : '%d ನಿಮಿಷ', - h : 'ಒಂದು ಗಂಟೆ', - hh : '%d ಗಂಟೆ', - d : 'ಒಂದು ದಿನ', - dd : '%d ದಿನ', - M : 'ಒಂದು ತಿಂಗಳು', - MM : '%d ತಿಂಗಳು', - y : 'ಒಂದು ವರ್ಷ', - yy : '%d ವರ್ಷ' - }, - preparse: function (string) { - return string.replace(/[೧೨೩೪೫೬೭೮೯೦]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - meridiemParse: /ರಾತ್ರಿ|ಬೆಳಿಗ್ಗೆ|ಮಧ್ಯಾಹ್ನ|ಸಂಜೆ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'ರಾತ್ರಿ') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'ಬೆಳಿಗ್ಗೆ') { - return hour; - } else if (meridiem === 'ಮಧ್ಯಾಹ್ನ') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'ಸಂಜೆ') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ರಾತ್ರಿ'; - } else if (hour < 10) { - return 'ಬೆಳಿಗ್ಗೆ'; - } else if (hour < 17) { - return 'ಮಧ್ಯಾಹ್ನ'; - } else if (hour < 20) { - return 'ಸಂಜೆ'; - } else { - return 'ರಾತ್ರಿ'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}(ನೇ)/, - ordinal : function (number) { - return number + 'ನೇ'; - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } -}); diff --git a/src/locale/ko.js b/src/locale/ko.js deleted file mode 100644 index d2da13d9ba..0000000000 --- a/src/locale/ko.js +++ /dev/null @@ -1,74 +0,0 @@ -//! moment.js locale configuration -//! locale : Korean [ko] -//! author : Kyungwook, Park : https://github.com/kyungw00k -//! author : Jeeeyul Lee - -import moment from '../moment'; - -export default moment.defineLocale('ko', { - months : '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'), - monthsShort : '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'), - weekdays : '일요일_월요일_화요일_수요일_목요일_금요일_토요일'.split('_'), - weekdaysShort : '일_월_화_수_목_금_토'.split('_'), - weekdaysMin : '일_월_화_수_목_금_토'.split('_'), - longDateFormat : { - LT : 'A h:mm', - LTS : 'A h:mm:ss', - L : 'YYYY.MM.DD.', - LL : 'YYYY년 MMMM D일', - LLL : 'YYYY년 MMMM D일 A h:mm', - LLLL : 'YYYY년 MMMM D일 dddd A h:mm', - l : 'YYYY.MM.DD.', - ll : 'YYYY년 MMMM D일', - lll : 'YYYY년 MMMM D일 A h:mm', - llll : 'YYYY년 MMMM D일 dddd A h:mm' - }, - calendar : { - sameDay : '오늘 LT', - nextDay : '내일 LT', - nextWeek : 'dddd LT', - lastDay : '어제 LT', - lastWeek : '지난주 dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s 후', - past : '%s 전', - s : '몇 초', - ss : '%d초', - m : '1분', - mm : '%d분', - h : '한 시간', - hh : '%d시간', - d : '하루', - dd : '%d일', - M : '한 달', - MM : '%d달', - y : '일 년', - yy : '%d년' - }, - dayOfMonthOrdinalParse : /\d{1,2}(일|월|주)/, - ordinal : function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '일'; - case 'M': - return number + '월'; - case 'w': - case 'W': - return number + '주'; - default: - return number; - } - }, - meridiemParse : /오전|오후/, - isPM : function (token) { - return token === '오후'; - }, - meridiem : function (hour, minute, isUpper) { - return hour < 12 ? '오전' : '오후'; - } -}); - diff --git a/src/locale/ku.js b/src/locale/ku.js deleted file mode 100644 index c31ba0592c..0000000000 --- a/src/locale/ku.js +++ /dev/null @@ -1,110 +0,0 @@ -//! moment.js locale configuration -//! locale : Kurdish [ku] -//! author : Shahram Mebashar : https://github.com/ShahramMebashar - -import moment from '../moment'; - -var symbolMap = { - '1': '١', - '2': '٢', - '3': '٣', - '4': '٤', - '5': '٥', - '6': '٦', - '7': '٧', - '8': '٨', - '9': '٩', - '0': '٠' -}, numberMap = { - '١': '1', - '٢': '2', - '٣': '3', - '٤': '4', - '٥': '5', - '٦': '6', - '٧': '7', - '٨': '8', - '٩': '9', - '٠': '0' -}, -months = [ - 'کانونی دووەم', - 'شوبات', - 'ئازار', - 'نیسان', - 'ئایار', - 'حوزەیران', - 'تەمموز', - 'ئاب', - 'ئەیلوول', - 'تشرینی یەكەم', - 'تشرینی دووەم', - 'كانونی یەکەم' -]; - - -export default moment.defineLocale('ku', { - months : months, - monthsShort : months, - weekdays : 'یه‌كشه‌ممه‌_دووشه‌ممه‌_سێشه‌ممه‌_چوارشه‌ممه‌_پێنجشه‌ممه‌_هه‌ینی_شه‌ممه‌'.split('_'), - weekdaysShort : 'یه‌كشه‌م_دووشه‌م_سێشه‌م_چوارشه‌م_پێنجشه‌م_هه‌ینی_شه‌ممه‌'.split('_'), - weekdaysMin : 'ی_د_س_چ_پ_ه_ش'.split('_'), - weekdaysParseExact : true, - 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: /ئێواره‌|به‌یانی/, - isPM: function (input) { - return /ئێواره‌/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'به‌یانی'; - } else { - return 'ئێواره‌'; - } - }, - calendar : { - sameDay : '[ئه‌مرۆ كاتژمێر] LT', - nextDay : '[به‌یانی كاتژمێر] LT', - nextWeek : 'dddd [كاتژمێر] LT', - lastDay : '[دوێنێ كاتژمێر] LT', - lastWeek : 'dddd [كاتژمێر] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'له‌ %s', - past : '%s', - s : 'چه‌ند چركه‌یه‌ك', - ss : 'چركه‌ %d', - m : 'یه‌ك خوله‌ك', - mm : '%d خوله‌ك', - h : 'یه‌ك كاتژمێر', - hh : '%d كاتژمێر', - d : 'یه‌ك ڕۆژ', - dd : '%d ڕۆژ', - M : 'یه‌ك مانگ', - MM : '%d مانگ', - y : 'یه‌ك ساڵ', - yy : '%d ساڵ' - }, - preparse: function (string) { - return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { - return numberMap[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }).replace(/,/g, '،'); - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } -}); diff --git a/src/locale/ky.js b/src/locale/ky.js deleted file mode 100644 index 8bd78f7c60..0000000000 --- a/src/locale/ky.js +++ /dev/null @@ -1,79 +0,0 @@ -//! moment.js locale configuration -//! locale : Kyrgyz [ky] -//! author : Chyngyz Arystan uulu : https://github.com/chyngyz - - -import moment from '../moment'; - -var suffixes = { - 0: '-чү', - 1: '-чи', - 2: '-чи', - 3: '-чү', - 4: '-чү', - 5: '-чи', - 6: '-чы', - 7: '-чи', - 8: '-чи', - 9: '-чу', - 10: '-чу', - 20: '-чы', - 30: '-чу', - 40: '-чы', - 50: '-чү', - 60: '-чы', - 70: '-чи', - 80: '-чи', - 90: '-чу', - 100: '-чү' -}; - -export default moment.defineLocale('ky', { - months : 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_'), - monthsShort : 'янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек'.split('_'), - weekdays : 'Жекшемби_Дүйшөмбү_Шейшемби_Шаршемби_Бейшемби_Жума_Ишемби'.split('_'), - weekdaysShort : 'Жек_Дүй_Шей_Шар_Бей_Жум_Ише'.split('_'), - weekdaysMin : 'Жк_Дй_Шй_Шр_Бй_Жм_Иш'.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 : '[Бүгүн саат] LT', - nextDay : '[Эртең саат] LT', - nextWeek : 'dddd [саат] LT', - lastDay : '[Кечээ саат] LT', - lastWeek : '[Өткөн аптанын] dddd [күнү] [саат] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ичинде', - past : '%s мурун', - s : 'бирнече секунд', - ss : '%d секунд', - m : 'бир мүнөт', - mm : '%d мүнөт', - h : 'бир саат', - hh : '%d саат', - d : 'бир күн', - dd : '%d күн', - M : 'бир ай', - MM : '%d ай', - y : 'бир жыл', - yy : '%d жыл' - }, - dayOfMonthOrdinalParse: /\d{1,2}-(чи|чы|чү|чу)/, - ordinal : function (number) { - var a = number % 10, - b = number >= 100 ? 100 : null; - return number + (suffixes[number] || suffixes[a] || suffixes[b]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); diff --git a/src/locale/lb.js b/src/locale/lb.js deleted file mode 100644 index 8574277a51..0000000000 --- a/src/locale/lb.js +++ /dev/null @@ -1,129 +0,0 @@ -//! moment.js locale configuration -//! locale : Luxembourgish [lb] -//! author : mweimerskirch : https://github.com/mweimerskirch -//! author : David Raison : https://github.com/kwisatz - -import moment from '../moment'; - -function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eng Minutt', 'enger Minutt'], - 'h': ['eng Stonn', 'enger Stonn'], - 'd': ['een Dag', 'engem Dag'], - 'M': ['ee Mount', 'engem Mount'], - 'y': ['ee Joer', 'engem Joer'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; -} -function processFutureTime(string) { - var number = string.substr(0, string.indexOf(' ')); - if (eifelerRegelAppliesToNumber(number)) { - return 'a ' + string; - } - return 'an ' + string; -} -function processPastTime(string) { - var number = string.substr(0, string.indexOf(' ')); - if (eifelerRegelAppliesToNumber(number)) { - return 'viru ' + string; - } - return 'virun ' + string; -} -/** - * Returns true if the word before the given number loses the '-n' ending. - * e.g. 'an 10 Deeg' but 'a 5 Deeg' - * - * @param number {integer} - * @returns {boolean} - */ -function eifelerRegelAppliesToNumber(number) { - number = parseInt(number, 10); - if (isNaN(number)) { - return false; - } - if (number < 0) { - // Negative Number --> always true - return true; - } else if (number < 10) { - // Only 1 digit - if (4 <= number && number <= 7) { - return true; - } - return false; - } else if (number < 100) { - // 2 digits - var lastDigit = number % 10, firstDigit = number / 10; - if (lastDigit === 0) { - return eifelerRegelAppliesToNumber(firstDigit); - } - return eifelerRegelAppliesToNumber(lastDigit); - } else if (number < 10000) { - // 3 or 4 digits --> recursively check first digit - while (number >= 10) { - number = number / 10; - } - return eifelerRegelAppliesToNumber(number); - } else { - // Anything larger than 4 digits: recursively check first n-3 digits - number = number / 1000; - return eifelerRegelAppliesToNumber(number); - } -} - -export default moment.defineLocale('lb', { - months: 'Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort: 'Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays: 'Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg'.split('_'), - weekdaysShort: 'So._Mé._Dë._Më._Do._Fr._Sa.'.split('_'), - weekdaysMin: 'So_Mé_Dë_Më_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm [Auer]', - LTS: 'H:mm:ss [Auer]', - L: 'DD.MM.YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm [Auer]', - LLLL: 'dddd, D. MMMM YYYY H:mm [Auer]' - }, - calendar: { - sameDay: '[Haut um] LT', - sameElse: 'L', - nextDay: '[Muer um] LT', - nextWeek: 'dddd [um] LT', - lastDay: '[Gëschter um] LT', - lastWeek: function () { - // Different date string for 'Dënschdeg' (Tuesday) and 'Donneschdeg' (Thursday) due to phonological rule - switch (this.day()) { - case 2: - case 4: - return '[Leschten] dddd [um] LT'; - default: - return '[Leschte] dddd [um] LT'; - } - } - }, - relativeTime : { - future : processFutureTime, - past : processPastTime, - s : 'e puer Sekonnen', - ss : '%d Sekonnen', - m : processRelativeTime, - mm : '%d Minutten', - h : processRelativeTime, - hh : '%d Stonnen', - d : processRelativeTime, - dd : '%d Deeg', - M : processRelativeTime, - MM : '%d Méint', - y : processRelativeTime, - yy : '%d Joer' - }, - 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. - } -}); - diff --git a/src/locale/lo.js b/src/locale/lo.js deleted file mode 100644 index 3226dd5a07..0000000000 --- a/src/locale/lo.js +++ /dev/null @@ -1,62 +0,0 @@ -//! moment.js locale configuration -//! locale : Lao [lo] -//! author : Ryan Hart : https://github.com/ryanhart2 - -import moment from '../moment'; - -export default moment.defineLocale('lo', { - months : 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split('_'), - monthsShort : 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split('_'), - weekdays : 'ອາທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'), - weekdaysShort : 'ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'), - weekdaysMin : 'ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ'.split('_'), - weekdaysParseExact : true, - 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: /ຕອນເຊົ້າ|ຕອນແລງ/, - isPM: function (input) { - return input === 'ຕອນແລງ'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ຕອນເຊົ້າ'; - } else { - return 'ຕອນແລງ'; - } - }, - calendar : { - sameDay : '[ມື້ນີ້ເວລາ] LT', - nextDay : '[ມື້ອື່ນເວລາ] LT', - nextWeek : '[ວັນ]dddd[ໜ້າເວລາ] LT', - lastDay : '[ມື້ວານນີ້ເວລາ] LT', - lastWeek : '[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ອີກ %s', - past : '%sຜ່ານມາ', - s : 'ບໍ່ເທົ່າໃດວິນາທີ', - ss : '%d ວິນາທີ' , - m : '1 ນາທີ', - mm : '%d ນາທີ', - h : '1 ຊົ່ວໂມງ', - hh : '%d ຊົ່ວໂມງ', - d : '1 ມື້', - dd : '%d ມື້', - M : '1 ເດືອນ', - MM : '%d ເດືອນ', - y : '1 ປີ', - yy : '%d ປີ' - }, - dayOfMonthOrdinalParse: /(ທີ່)\d{1,2}/, - ordinal : function (number) { - return 'ທີ່' + number; - } -}); - diff --git a/src/locale/lt.js b/src/locale/lt.js deleted file mode 100644 index d006e07c41..0000000000 --- a/src/locale/lt.js +++ /dev/null @@ -1,110 +0,0 @@ -//! moment.js locale configuration -//! locale : Lithuanian [lt] -//! author : Mindaugas Mozūras : https://github.com/mmozuras - -import moment from '../moment'; - -var units = { - 'ss' : 'sekundė_sekundžių_sekundes', - 'm' : 'minutė_minutės_minutę', - 'mm': 'minutės_minučių_minutes', - 'h' : 'valanda_valandos_valandą', - 'hh': 'valandos_valandų_valandas', - 'd' : 'diena_dienos_dieną', - 'dd': 'dienos_dienų_dienas', - 'M' : 'mėnuo_mėnesio_mėnesį', - 'MM': 'mėnesiai_mėnesių_mėnesius', - 'y' : 'metai_metų_metus', - 'yy': 'metai_metų_metus' -}; -function translateSeconds(number, withoutSuffix, key, isFuture) { - if (withoutSuffix) { - return 'kelios sekundės'; - } else { - return isFuture ? 'kelių sekundžių' : 'kelias sekundes'; - } -} -function translateSingular(number, withoutSuffix, key, isFuture) { - return withoutSuffix ? forms(key)[0] : (isFuture ? forms(key)[1] : forms(key)[2]); -} -function special(number) { - return number % 10 === 0 || (number > 10 && number < 20); -} -function forms(key) { - return units[key].split('_'); -} -function translate(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - if (number === 1) { - return result + translateSingular(number, withoutSuffix, key[0], isFuture); - } else if (withoutSuffix) { - return result + (special(number) ? forms(key)[1] : forms(key)[0]); - } else { - if (isFuture) { - return result + forms(key)[1]; - } else { - return result + (special(number) ? forms(key)[1] : forms(key)[2]); - } - } -} -export default moment.defineLocale('lt', { - months : { - format: 'sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio'.split('_'), - standalone: 'sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis'.split('_'), - isFormat: /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|MMMM?(\[[^\[\]]*\]|\s)+D[oD]?/ - }, - monthsShort : 'sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd'.split('_'), - weekdays : { - format: 'sekmadienį_pirmadienį_antradienį_trečiadienį_ketvirtadienį_penktadienį_šeštadienį'.split('_'), - standalone: 'sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis'.split('_'), - isFormat: /dddd HH:mm/ - }, - weekdaysShort : 'Sek_Pir_Ant_Tre_Ket_Pen_Šeš'.split('_'), - weekdaysMin : 'S_P_A_T_K_Pn_Š'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'YYYY [m.] MMMM D [d.]', - LLL : 'YYYY [m.] MMMM D [d.], HH:mm [val.]', - LLLL : 'YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]', - l : 'YYYY-MM-DD', - ll : 'YYYY [m.] MMMM D [d.]', - lll : 'YYYY [m.] MMMM D [d.], HH:mm [val.]', - llll : 'YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]' - }, - calendar : { - sameDay : '[Šiandien] LT', - nextDay : '[Rytoj] LT', - nextWeek : 'dddd LT', - lastDay : '[Vakar] LT', - lastWeek : '[Praėjusį] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : 'po %s', - past : 'prieš %s', - s : translateSeconds, - ss : translate, - m : translateSingular, - mm : translate, - h : translateSingular, - hh : translate, - d : translateSingular, - dd : translate, - M : translateSingular, - MM : translate, - y : translateSingular, - yy : translate - }, - dayOfMonthOrdinalParse: /\d{1,2}-oji/, - ordinal : function (number) { - return number + '-oji'; - }, - 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. - } -}); - diff --git a/src/locale/lv.js b/src/locale/lv.js deleted file mode 100644 index d13b47b247..0000000000 --- a/src/locale/lv.js +++ /dev/null @@ -1,90 +0,0 @@ -//! moment.js locale configuration -//! locale : Latvian [lv] -//! author : Kristaps Karlsons : https://github.com/skakri -//! author : Jānis Elmeris : https://github.com/JanisE - -import moment from '../moment'; - -var units = { - 'ss': 'sekundes_sekundēm_sekunde_sekundes'.split('_'), - 'm': 'minūtes_minūtēm_minūte_minūtes'.split('_'), - 'mm': 'minūtes_minūtēm_minūte_minūtes'.split('_'), - 'h': 'stundas_stundām_stunda_stundas'.split('_'), - 'hh': 'stundas_stundām_stunda_stundas'.split('_'), - 'd': 'dienas_dienām_diena_dienas'.split('_'), - 'dd': 'dienas_dienām_diena_dienas'.split('_'), - 'M': 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'), - 'MM': 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'), - 'y': 'gada_gadiem_gads_gadi'.split('_'), - 'yy': 'gada_gadiem_gads_gadi'.split('_') -}; -/** - * @param withoutSuffix boolean true = a length of time; false = before/after a period of time. - */ -function format(forms, number, withoutSuffix) { - if (withoutSuffix) { - // E.g. "21 minūte", "3 minūtes". - return number % 10 === 1 && number % 100 !== 11 ? forms[2] : forms[3]; - } else { - // E.g. "21 minūtes" as in "pēc 21 minūtes". - // E.g. "3 minūtēm" as in "pēc 3 minūtēm". - return number % 10 === 1 && number % 100 !== 11 ? forms[0] : forms[1]; - } -} -function relativeTimeWithPlural(number, withoutSuffix, key) { - return number + ' ' + format(units[key], number, withoutSuffix); -} -function relativeTimeWithSingular(number, withoutSuffix, key) { - return format(units[key], number, withoutSuffix); -} -function relativeSeconds(number, withoutSuffix) { - return withoutSuffix ? 'dažas sekundes' : 'dažām sekundēm'; -} - -export default moment.defineLocale('lv', { - months : 'janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris'.split('_'), - monthsShort : 'jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec'.split('_'), - weekdays : 'svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena'.split('_'), - weekdaysShort : 'Sv_P_O_T_C_Pk_S'.split('_'), - weekdaysMin : 'Sv_P_O_T_C_Pk_S'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY.', - LL : 'YYYY. [gada] D. MMMM', - LLL : 'YYYY. [gada] D. MMMM, HH:mm', - LLLL : 'YYYY. [gada] D. MMMM, dddd, HH:mm' - }, - calendar : { - sameDay : '[Šodien pulksten] LT', - nextDay : '[Rīt pulksten] LT', - nextWeek : 'dddd [pulksten] LT', - lastDay : '[Vakar pulksten] LT', - lastWeek : '[Pagājušā] dddd [pulksten] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'pēc %s', - past : 'pirms %s', - s : relativeSeconds, - ss : relativeTimeWithPlural, - m : relativeTimeWithSingular, - mm : relativeTimeWithPlural, - h : relativeTimeWithSingular, - hh : relativeTimeWithPlural, - d : relativeTimeWithSingular, - dd : relativeTimeWithPlural, - M : relativeTimeWithSingular, - MM : relativeTimeWithPlural, - y : relativeTimeWithSingular, - yy : relativeTimeWithPlural - }, - 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. - } -}); - diff --git a/src/locale/me.js b/src/locale/me.js deleted file mode 100644 index b42e9c8037..0000000000 --- a/src/locale/me.js +++ /dev/null @@ -1,103 +0,0 @@ -//! moment.js locale configuration -//! locale : Montenegrin [me] -//! author : Miodrag Nikač : https://github.com/miodragnikac - -import moment from '../moment'; - -var translator = { - words: { //Different grammatical cases - ss: ['sekund', 'sekunda', 'sekundi'], - m: ['jedan minut', 'jednog minuta'], - mm: ['minut', 'minuta', 'minuta'], - h: ['jedan sat', 'jednog sata'], - hh: ['sat', 'sata', 'sati'], - dd: ['dan', 'dana', 'dana'], - MM: ['mjesec', 'mjeseca', 'mjeseci'], - yy: ['godina', 'godine', 'godina'] - }, - correctGrammaticalCase: function (number, wordKey) { - return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]); - }, - translate: function (number, withoutSuffix, key) { - var wordKey = translator.words[key]; - if (key.length === 1) { - return withoutSuffix ? wordKey[0] : wordKey[1]; - } else { - return number + ' ' + translator.correctGrammaticalCase(number, wordKey); - } - } -}; - -export default moment.defineLocale('me', { - months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split('_'), - monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'), - monthsParseExact : true, - weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), - weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), - weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm', - LTS : 'H:mm:ss', - L: 'DD.MM.YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm', - LLLL: 'dddd, D. MMMM YYYY H:mm' - }, - calendar: { - sameDay: '[danas u] LT', - nextDay: '[sjutra u] LT', - - nextWeek: function () { - switch (this.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'; - } - }, - lastDay : '[juče u] LT', - lastWeek : function () { - var lastWeekDays = [ - '[prošle] [nedjelje] [u] LT', - '[prošlog] [ponedjeljka] [u] LT', - '[prošlog] [utorka] [u] LT', - '[prošle] [srijede] [u] LT', - '[prošlog] [četvrtka] [u] LT', - '[prošlog] [petka] [u] LT', - '[prošle] [subote] [u] LT' - ]; - return lastWeekDays[this.day()]; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'prije %s', - s : 'nekoliko sekundi', - ss : translator.translate, - m : translator.translate, - mm : translator.translate, - h : translator.translate, - hh : translator.translate, - d : 'dan', - dd : translator.translate, - M : 'mjesec', - MM : translator.translate, - y : 'godinu', - yy : translator.translate - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); diff --git a/src/locale/mi.js b/src/locale/mi.js deleted file mode 100644 index 0c105e5d26..0000000000 --- a/src/locale/mi.js +++ /dev/null @@ -1,55 +0,0 @@ -//! moment.js locale configuration -//! locale : Maori [mi] -//! author : John Corrigan : https://github.com/johnideal - -import moment from '../moment'; - -export default moment.defineLocale('mi', { - months: 'Kohi-tāte_Hui-tanguru_Poutū-te-rangi_Paenga-whāwhā_Haratua_Pipiri_Hōngoingoi_Here-turi-kōkā_Mahuru_Whiringa-ā-nuku_Whiringa-ā-rangi_Hakihea'.split('_'), - monthsShort: 'Kohi_Hui_Pou_Pae_Hara_Pipi_Hōngoi_Here_Mahu_Whi-nu_Whi-ra_Haki'.split('_'), - monthsRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i, - monthsStrictRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i, - monthsShortRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i, - monthsShortStrictRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,2}/i, - weekdays: 'Rātapu_Mane_Tūrei_Wenerei_Tāite_Paraire_Hātarei'.split('_'), - weekdaysShort: 'Ta_Ma_Tū_We_Tāi_Pa_Hā'.split('_'), - weekdaysMin: 'Ta_Ma_Tū_We_Tāi_Pa_Hā'.split('_'), - longDateFormat: { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L: 'DD/MM/YYYY', - LL: 'D MMMM YYYY', - LLL: 'D MMMM YYYY [i] HH:mm', - LLLL: 'dddd, D MMMM YYYY [i] HH:mm' - }, - calendar: { - sameDay: '[i teie mahana, i] LT', - nextDay: '[apopo i] LT', - nextWeek: 'dddd [i] LT', - lastDay: '[inanahi i] LT', - lastWeek: 'dddd [whakamutunga i] LT', - sameElse: 'L' - }, - relativeTime: { - future: 'i roto i %s', - past: '%s i mua', - s: 'te hēkona ruarua', - ss: '%d hēkona', - m: 'he meneti', - mm: '%d meneti', - h: 'te haora', - hh: '%d haora', - d: 'he ra', - dd: '%d ra', - M: 'he marama', - MM: '%d marama', - y: 'he tau', - yy: '%d tau' - }, - 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. - } -}); diff --git a/src/locale/mk.js b/src/locale/mk.js deleted file mode 100644 index 701ab6554a..0000000000 --- a/src/locale/mk.js +++ /dev/null @@ -1,82 +0,0 @@ -//! moment.js locale configuration -//! locale : Macedonian [mk] -//! author : Borislav Mickov : https://github.com/B0k0 - -import moment from '../moment'; - -export default moment.defineLocale('mk', { - months : 'јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември'.split('_'), - monthsShort : 'јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек'.split('_'), - weekdays : 'недела_понеделник_вторник_среда_четврток_петок_сабота'.split('_'), - weekdaysShort : 'нед_пон_вто_сре_чет_пет_саб'.split('_'), - weekdaysMin : 'нe_пo_вт_ср_че_пе_сa'.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 : '[Денес во] LT', - nextDay : '[Утре во] LT', - nextWeek : '[Во] dddd [во] LT', - lastDay : '[Вчера во] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - case 3: - case 6: - return '[Изминатата] dddd [во] LT'; - case 1: - case 2: - case 4: - case 5: - return '[Изминатиот] dddd [во] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'после %s', - past : 'пред %s', - s : 'неколку секунди', - ss : '%d секунди', - m : 'минута', - mm : '%d минути', - h : 'час', - hh : '%d часа', - d : 'ден', - dd : '%d дена', - M : 'месец', - MM : '%d месеци', - y : 'година', - yy : '%d години' - }, - dayOfMonthOrdinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/, - ordinal : function (number) { - var lastDigit = number % 10, - last2Digits = number % 100; - if (number === 0) { - return number + '-ев'; - } else if (last2Digits === 0) { - return number + '-ен'; - } else if (last2Digits > 10 && last2Digits < 20) { - return number + '-ти'; - } else if (lastDigit === 1) { - return number + '-ви'; - } else if (lastDigit === 2) { - return number + '-ри'; - } else if (lastDigit === 7 || lastDigit === 8) { - return number + '-ми'; - } else { - return number + '-ти'; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); - diff --git a/src/locale/ml.js b/src/locale/ml.js deleted file mode 100644 index 306566d48d..0000000000 --- a/src/locale/ml.js +++ /dev/null @@ -1,73 +0,0 @@ -//! moment.js locale configuration -//! locale : Malayalam [ml] -//! author : Floyd Pink : https://github.com/floydpink - -import moment from '../moment'; - -export default moment.defineLocale('ml', { - months : 'ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ'.split('_'), - monthsShort : 'ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.'.split('_'), - monthsParseExact : true, - weekdays : 'ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച'.split('_'), - weekdaysShort : 'ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി'.split('_'), - weekdaysMin : 'ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ'.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 : '[ഇന്ന്] LT', - nextDay : '[നാളെ] LT', - nextWeek : 'dddd, LT', - lastDay : '[ഇന്നലെ] LT', - lastWeek : '[കഴിഞ്ഞ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s കഴിഞ്ഞ്', - past : '%s മുൻപ്', - s : 'അൽപ നിമിഷങ്ങൾ', - ss : '%d സെക്കൻഡ്', - m : 'ഒരു മിനിറ്റ്', - mm : '%d മിനിറ്റ്', - h : 'ഒരു മണിക്കൂർ', - hh : '%d മണിക്കൂർ', - d : 'ഒരു ദിവസം', - dd : '%d ദിവസം', - M : 'ഒരു മാസം', - MM : '%d മാസം', - y : 'ഒരു വർഷം', - yy : '%d വർഷം' - }, - meridiemParse: /രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ((meridiem === 'രാത്രി' && hour >= 4) || - meridiem === 'ഉച്ച കഴിഞ്ഞ്' || - meridiem === 'വൈകുന്നേരം') { - return hour + 12; - } else { - return hour; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'രാത്രി'; - } else if (hour < 12) { - return 'രാവിലെ'; - } else if (hour < 17) { - return 'ഉച്ച കഴിഞ്ഞ്'; - } else if (hour < 20) { - return 'വൈകുന്നേരം'; - } else { - return 'രാത്രി'; - } - } -}); - diff --git a/src/locale/mn.js b/src/locale/mn.js deleted file mode 100644 index 80a3c2f6d3..0000000000 --- a/src/locale/mn.js +++ /dev/null @@ -1,96 +0,0 @@ -//! moment.js locale configuration -//! locale : Mongolian [mn] -//! author : Javkhlantugs Nyamdorj : https://github.com/javkhaanj7 - -import moment from '../moment'; - -function translate(number, withoutSuffix, key, isFuture) { - switch (key) { - case 's': - return withoutSuffix ? 'хэдхэн секунд' : 'хэдхэн секундын'; - case 'ss': - return number + (withoutSuffix ? ' секунд' : ' секундын'); - case 'm': - case 'mm': - return number + (withoutSuffix ? ' минут' : ' минутын'); - case 'h': - case 'hh': - return number + (withoutSuffix ? ' цаг' : ' цагийн'); - case 'd': - case 'dd': - return number + (withoutSuffix ? ' өдөр' : ' өдрийн'); - case 'M': - case 'MM': - return number + (withoutSuffix ? ' сар' : ' сарын'); - case 'y': - case 'yy': - return number + (withoutSuffix ? ' жил' : ' жилийн'); - default: - return number; - } -} - -export default moment.defineLocale('mn', { - months : 'Нэгдүгээр сар_Хоёрдугаар сар_Гуравдугаар сар_Дөрөвдүгээр сар_Тавдугаар сар_Зургадугаар сар_Долдугаар сар_Наймдугаар сар_Есдүгээр сар_Аравдугаар сар_Арван нэгдүгээр сар_Арван хоёрдугаар сар'.split('_'), - monthsShort : '1 сар_2 сар_3 сар_4 сар_5 сар_6 сар_7 сар_8 сар_9 сар_10 сар_11 сар_12 сар'.split('_'), - monthsParseExact : true, - weekdays : 'Ням_Даваа_Мягмар_Лхагва_Пүрэв_Баасан_Бямба'.split('_'), - weekdaysShort : 'Ням_Дав_Мяг_Лха_Пүр_Баа_Бям'.split('_'), - weekdaysMin : 'Ня_Да_Мя_Лх_Пү_Ба_Бя'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'YYYY оны MMMMын D', - LLL : 'YYYY оны MMMMын D HH:mm', - LLLL : 'dddd, YYYY оны MMMMын D HH:mm' - }, - meridiemParse: /ҮӨ|ҮХ/i, - isPM : function (input) { - return input === 'ҮХ'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ҮӨ'; - } else { - return 'ҮХ'; - } - }, - calendar : { - sameDay : '[Өнөөдөр] LT', - nextDay : '[Маргааш] LT', - nextWeek : '[Ирэх] dddd LT', - lastDay : '[Өчигдөр] LT', - lastWeek : '[Өнгөрсөн] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s дараа', - past : '%s өмнө', - s : translate, - ss : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : translate, - dd : translate, - M : translate, - MM : translate, - y : translate, - yy : translate - }, - dayOfMonthOrdinalParse: /\d{1,2} өдөр/, - ordinal : function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + ' өдөр'; - default: - return number; - } - } -}); - diff --git a/src/locale/mr.js b/src/locale/mr.js deleted file mode 100644 index 8086ba281d..0000000000 --- a/src/locale/mr.js +++ /dev/null @@ -1,153 +0,0 @@ -//! moment.js locale configuration -//! locale : Marathi [mr] -//! author : Harshad Kale : https://github.com/kalehv -//! author : Vivek Athalye : https://github.com/vnathalye - -import moment from '../moment'; - -var symbolMap = { - '1': '१', - '2': '२', - '3': '३', - '4': '४', - '5': '५', - '6': '६', - '7': '७', - '8': '८', - '9': '९', - '0': '०' -}, -numberMap = { - '१': '1', - '२': '2', - '३': '3', - '४': '4', - '५': '5', - '६': '6', - '७': '7', - '८': '8', - '९': '9', - '०': '0' -}; - -function relativeTimeMr(number, withoutSuffix, string, isFuture) -{ - var output = ''; - if (withoutSuffix) { - switch (string) { - case 's': output = 'काही सेकंद'; break; - case 'ss': output = '%d सेकंद'; break; - case 'm': output = 'एक मिनिट'; break; - case 'mm': output = '%d मिनिटे'; break; - case 'h': output = 'एक तास'; break; - case 'hh': output = '%d तास'; break; - case 'd': output = 'एक दिवस'; break; - case 'dd': output = '%d दिवस'; break; - case 'M': output = 'एक महिना'; break; - case 'MM': output = '%d महिने'; break; - case 'y': output = 'एक वर्ष'; break; - case 'yy': output = '%d वर्षे'; break; - } - } - else { - switch (string) { - case 's': output = 'काही सेकंदां'; break; - case 'ss': output = '%d सेकंदां'; break; - case 'm': output = 'एका मिनिटा'; break; - case 'mm': output = '%d मिनिटां'; break; - case 'h': output = 'एका तासा'; break; - case 'hh': output = '%d तासां'; break; - case 'd': output = 'एका दिवसा'; break; - case 'dd': output = '%d दिवसां'; break; - case 'M': output = 'एका महिन्या'; break; - case 'MM': output = '%d महिन्यां'; break; - case 'y': output = 'एका वर्षा'; break; - case 'yy': output = '%d वर्षां'; break; - } - } - return output.replace(/%d/i, number); -} - -export default moment.defineLocale('mr', { - months : 'जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर'.split('_'), - monthsShort: 'जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.'.split('_'), - monthsParseExact : true, - weekdays : 'रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'), - weekdaysShort : 'रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि'.split('_'), - weekdaysMin : 'र_सो_मं_बु_गु_शु_श'.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 : '[आज] LT', - nextDay : '[उद्या] LT', - nextWeek : 'dddd, LT', - lastDay : '[काल] LT', - lastWeek: '[मागील] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future: '%sमध्ये', - past: '%sपूर्वी', - s: relativeTimeMr, - ss: relativeTimeMr, - m: relativeTimeMr, - mm: relativeTimeMr, - h: relativeTimeMr, - hh: relativeTimeMr, - d: relativeTimeMr, - dd: relativeTimeMr, - M: relativeTimeMr, - MM: relativeTimeMr, - y: relativeTimeMr, - yy: relativeTimeMr - }, - preparse: function (string) { - return string.replace(/[१२३४५६७८९०]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - meridiemParse: /रात्री|सकाळी|दुपारी|सायंकाळी/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'रात्री') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'सकाळी') { - return hour; - } else if (meridiem === 'दुपारी') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'सायंकाळी') { - return hour + 12; - } - }, - meridiem: function (hour, minute, isLower) { - if (hour < 4) { - return 'रात्री'; - } else if (hour < 10) { - return 'सकाळी'; - } else if (hour < 17) { - return 'दुपारी'; - } else if (hour < 20) { - return 'सायंकाळी'; - } else { - return 'रात्री'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } -}); - diff --git a/src/locale/ms-my.js b/src/locale/ms-my.js deleted file mode 100644 index bd255aed54..0000000000 --- a/src/locale/ms-my.js +++ /dev/null @@ -1,75 +0,0 @@ -//! moment.js locale configuration -//! locale : Malay [ms-my] -//! note : DEPRECATED, the correct one is [ms] -//! author : Weldan Jamili : https://github.com/weldan - -import moment from '../moment'; - -export default moment.defineLocale('ms-my', { - months : 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split('_'), - monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'), - weekdays : 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'), - weekdaysShort : 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'), - weekdaysMin : 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /pagi|tengahari|petang|malam/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'pagi') { - return hour; - } else if (meridiem === 'tengahari') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'petang' || meridiem === 'malam') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'pagi'; - } else if (hours < 15) { - return 'tengahari'; - } else if (hours < 19) { - return 'petang'; - } else { - return 'malam'; - } - }, - calendar : { - sameDay : '[Hari ini pukul] LT', - nextDay : '[Esok pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kelmarin pukul] LT', - lastWeek : 'dddd [lepas pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dalam %s', - past : '%s yang lepas', - s : 'beberapa saat', - ss : '%d saat', - m : 'seminit', - mm : '%d minit', - h : 'sejam', - hh : '%d jam', - d : 'sehari', - dd : '%d hari', - M : 'sebulan', - MM : '%d bulan', - y : 'setahun', - yy : '%d tahun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); - diff --git a/src/locale/ms.js b/src/locale/ms.js deleted file mode 100644 index 83ad1ac132..0000000000 --- a/src/locale/ms.js +++ /dev/null @@ -1,74 +0,0 @@ -//! moment.js locale configuration -//! locale : Malay [ms] -//! author : Weldan Jamili : https://github.com/weldan - -import moment from '../moment'; - -export default moment.defineLocale('ms', { - months : 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split('_'), - monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'), - weekdays : 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'), - weekdaysShort : 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'), - weekdaysMin : 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /pagi|tengahari|petang|malam/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'pagi') { - return hour; - } else if (meridiem === 'tengahari') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'petang' || meridiem === 'malam') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'pagi'; - } else if (hours < 15) { - return 'tengahari'; - } else if (hours < 19) { - return 'petang'; - } else { - return 'malam'; - } - }, - calendar : { - sameDay : '[Hari ini pukul] LT', - nextDay : '[Esok pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kelmarin pukul] LT', - lastWeek : 'dddd [lepas pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dalam %s', - past : '%s yang lepas', - s : 'beberapa saat', - ss : '%d saat', - m : 'seminit', - mm : '%d minit', - h : 'sejam', - hh : '%d jam', - d : 'sehari', - dd : '%d hari', - M : 'sebulan', - MM : '%d bulan', - y : 'setahun', - yy : '%d tahun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); - diff --git a/src/locale/mt.js b/src/locale/mt.js deleted file mode 100644 index 4953fa2226..0000000000 --- a/src/locale/mt.js +++ /dev/null @@ -1,51 +0,0 @@ -//! moment.js locale configuration -//! locale : Maltese (Malta) [mt] -//! author : Alessandro Maruccia : https://github.com/alesma - -import moment from '../moment'; - -export default moment.defineLocale('mt', { - months : 'Jannar_Frar_Marzu_April_Mejju_Ġunju_Lulju_Awwissu_Settembru_Ottubru_Novembru_Diċembru'.split('_'), - monthsShort : 'Jan_Fra_Mar_Apr_Mej_Ġun_Lul_Aww_Set_Ott_Nov_Diċ'.split('_'), - weekdays : 'Il-Ħadd_It-Tnejn_It-Tlieta_L-Erbgħa_Il-Ħamis_Il-Ġimgħa_Is-Sibt'.split('_'), - weekdaysShort : 'Ħad_Tne_Tli_Erb_Ħam_Ġim_Sib'.split('_'), - weekdaysMin : 'Ħa_Tn_Tl_Er_Ħa_Ġi_Si'.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 : '[Illum fil-]LT', - nextDay : '[Għada fil-]LT', - nextWeek : 'dddd [fil-]LT', - lastDay : '[Il-bieraħ fil-]LT', - lastWeek : 'dddd [li għadda] [fil-]LT', - sameElse : 'L' - }, - relativeTime : { - future : 'f’ %s', - past : '%s ilu', - s : 'ftit sekondi', - ss : '%d sekondi', - m : 'minuta', - mm : '%d minuti', - h : 'siegħa', - hh : '%d siegħat', - d : 'ġurnata', - dd : '%d ġranet', - M : 'xahar', - MM : '%d xhur', - y : 'sena', - yy : '%d sni' - }, - 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. - } -}); diff --git a/src/locale/my.js b/src/locale/my.js deleted file mode 100644 index b2ba866440..0000000000 --- a/src/locale/my.js +++ /dev/null @@ -1,87 +0,0 @@ -//! moment.js locale configuration -//! locale : Burmese [my] -//! author : Squar team, mysquar.com -//! author : David Rossellat : https://github.com/gholadr -//! author : Tin Aung Lin : https://github.com/thanyawzinmin - -import moment from '../moment'; - -var symbolMap = { - '1': '၁', - '2': '၂', - '3': '၃', - '4': '၄', - '5': '၅', - '6': '၆', - '7': '၇', - '8': '၈', - '9': '၉', - '0': '၀' -}, numberMap = { - '၁': '1', - '၂': '2', - '၃': '3', - '၄': '4', - '၅': '5', - '၆': '6', - '၇': '7', - '၈': '8', - '၉': '9', - '၀': '0' -}; - -export default moment.defineLocale('my', { - months: 'ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ'.split('_'), - monthsShort: 'ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ'.split('_'), - weekdays: 'တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ'.split('_'), - weekdaysShort: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'), - weekdaysMin: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.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: '[ယနေ.] LT [မှာ]', - nextDay: '[မနက်ဖြန်] LT [မှာ]', - nextWeek: 'dddd LT [မှာ]', - lastDay: '[မနေ.က] LT [မှာ]', - lastWeek: '[ပြီးခဲ့သော] dddd LT [မှာ]', - sameElse: 'L' - }, - relativeTime: { - future: 'လာမည့် %s မှာ', - past: 'လွန်ခဲ့သော %s က', - s: 'စက္ကန်.အနည်းငယ်', - ss : '%d စက္ကန့်', - m: 'တစ်မိနစ်', - mm: '%d မိနစ်', - h: 'တစ်နာရီ', - hh: '%d နာရီ', - d: 'တစ်ရက်', - dd: '%d ရက်', - M: 'တစ်လ', - MM: '%d လ', - y: 'တစ်နှစ်', - yy: '%d နှစ်' - }, - preparse: function (string) { - return string.replace(/[၁၂၃၄၅၆၇၈၉၀]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - 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. - } -}); - diff --git a/src/locale/nb.js b/src/locale/nb.js deleted file mode 100644 index 27bb88e8c3..0000000000 --- a/src/locale/nb.js +++ /dev/null @@ -1,55 +0,0 @@ -//! moment.js locale configuration -//! locale : Norwegian Bokmål [nb] -//! authors : Espen Hovlandsdal : https://github.com/rexxars -//! Sigurd Gartmann : https://github.com/sigurdga - -import moment from '../moment'; - -export default moment.defineLocale('nb', { - months : 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split('_'), - monthsShort : 'jan._feb._mars_april_mai_juni_juli_aug._sep._okt._nov._des.'.split('_'), - monthsParseExact : true, - weekdays : 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'), - weekdaysShort : 'sø._ma._ti._on._to._fr._lø.'.split('_'), - weekdaysMin : 'sø_ma_ti_on_to_fr_lø'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY [kl.] HH:mm', - LLLL : 'dddd D. MMMM YYYY [kl.] HH:mm' - }, - calendar : { - sameDay: '[i dag kl.] LT', - nextDay: '[i morgen kl.] LT', - nextWeek: 'dddd [kl.] LT', - lastDay: '[i går kl.] LT', - lastWeek: '[forrige] dddd [kl.] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'om %s', - past : '%s siden', - s : 'noen sekunder', - ss : '%d sekunder', - m : 'ett minutt', - mm : '%d minutter', - h : 'en time', - hh : '%d timer', - d : 'en dag', - dd : '%d dager', - M : 'en måned', - MM : '%d måneder', - y : 'ett år', - yy : '%d år' - }, - 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. - } -}); - diff --git a/src/locale/ne.js b/src/locale/ne.js deleted file mode 100644 index 38e5e821b7..0000000000 --- a/src/locale/ne.js +++ /dev/null @@ -1,115 +0,0 @@ -//! moment.js locale configuration -//! locale : Nepalese [ne] -//! author : suvash : https://github.com/suvash - -import moment from '../moment'; - -var symbolMap = { - '1': '१', - '2': '२', - '3': '३', - '4': '४', - '5': '५', - '6': '६', - '7': '७', - '8': '८', - '9': '९', - '0': '०' -}, -numberMap = { - '१': '1', - '२': '2', - '३': '3', - '४': '4', - '५': '5', - '६': '6', - '७': '7', - '८': '8', - '९': '9', - '०': '0' -}; - -export default moment.defineLocale('ne', { - months : 'जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर'.split('_'), - monthsShort : 'जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.'.split('_'), - monthsParseExact : true, - weekdays : 'आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार'.split('_'), - weekdaysShort : 'आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.'.split('_'), - weekdaysMin : 'आ._सो._मं._बु._बि._शु._श.'.split('_'), - weekdaysParseExact : true, - 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 बजे' - }, - preparse: function (string) { - return string.replace(/[१२३४५६७८९०]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - meridiemParse: /राति|बिहान|दिउँसो|साँझ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'राति') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'बिहान') { - return hour; - } else if (meridiem === 'दिउँसो') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'साँझ') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 3) { - return 'राति'; - } else if (hour < 12) { - return 'बिहान'; - } else if (hour < 16) { - return 'दिउँसो'; - } else if (hour < 20) { - return 'साँझ'; - } else { - return 'राति'; - } - }, - calendar : { - sameDay : '[आज] LT', - nextDay : '[भोलि] LT', - nextWeek : '[आउँदो] dddd[,] LT', - lastDay : '[हिजो] LT', - lastWeek : '[गएको] dddd[,] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%sमा', - past : '%s अगाडि', - s : 'केही क्षण', - ss : '%d सेकेण्ड', - m : 'एक मिनेट', - mm : '%d मिनेट', - h : 'एक घण्टा', - hh : '%d घण्टा', - d : 'एक दिन', - dd : '%d दिन', - M : 'एक महिना', - MM : '%d महिना', - y : 'एक बर्ष', - yy : '%d बर्ष' - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } -}); - diff --git a/src/locale/nl-be.js b/src/locale/nl-be.js deleted file mode 100644 index d0bde0938b..0000000000 --- a/src/locale/nl-be.js +++ /dev/null @@ -1,80 +0,0 @@ -//! moment.js locale configuration -//! locale : Dutch (Belgium) [nl-be] -//! author : Joris Röling : https://github.com/jorisroling -//! author : Jacob Middag : https://github.com/middagj - -import moment from '../moment'; - -var monthsShortWithDots = 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'), - monthsShortWithoutDots = 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_'); - -var monthsParse = [/^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 = /^(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; - -export default moment.defineLocale('nl-be', { - months : 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split('_'), - monthsShort : function (m, format) { - if (!m) { - return monthsShortWithDots; - } else if (/-MMM-/.test(format)) { - return monthsShortWithoutDots[m.month()]; - } else { - return monthsShortWithDots[m.month()]; - } - }, - - monthsRegex: monthsRegex, - monthsShortRegex: monthsRegex, - 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, - longMonthsParse : monthsParse, - shortMonthsParse : monthsParse, - - weekdays : 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split('_'), - weekdaysShort : 'zo._ma._di._wo._do._vr._za.'.split('_'), - weekdaysMin : 'zo_ma_di_wo_do_vr_za'.split('_'), - weekdaysParseExact : true, - 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: '[vandaag om] LT', - nextDay: '[morgen om] LT', - nextWeek: 'dddd [om] LT', - lastDay: '[gisteren om] LT', - lastWeek: '[afgelopen] dddd [om] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'over %s', - past : '%s geleden', - s : 'een paar seconden', - ss : '%d seconden', - m : 'één minuut', - mm : '%d minuten', - h : 'één uur', - hh : '%d uur', - d : 'één dag', - dd : '%d dagen', - M : 'één maand', - MM : '%d maanden', - y : 'één jaar', - yy : '%d jaar' - }, - dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/, - ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); - }, - 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. - } -}); - diff --git a/src/locale/nl.js b/src/locale/nl.js deleted file mode 100644 index fcd6a404bf..0000000000 --- a/src/locale/nl.js +++ /dev/null @@ -1,80 +0,0 @@ -//! moment.js locale configuration -//! locale : Dutch [nl] -//! author : Joris Röling : https://github.com/jorisroling -//! author : Jacob Middag : https://github.com/middagj - -import moment from '../moment'; - -var monthsShortWithDots = 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'), - monthsShortWithoutDots = 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_'); - -var monthsParse = [/^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 = /^(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; - -export default moment.defineLocale('nl', { - months : 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split('_'), - monthsShort : function (m, format) { - if (!m) { - return monthsShortWithDots; - } else if (/-MMM-/.test(format)) { - return monthsShortWithoutDots[m.month()]; - } else { - return monthsShortWithDots[m.month()]; - } - }, - - monthsRegex: monthsRegex, - monthsShortRegex: monthsRegex, - 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, - longMonthsParse : monthsParse, - shortMonthsParse : monthsParse, - - weekdays : 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split('_'), - weekdaysShort : 'zo._ma._di._wo._do._vr._za.'.split('_'), - weekdaysMin : 'zo_ma_di_wo_do_vr_za'.split('_'), - weekdaysParseExact : true, - 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: '[vandaag om] LT', - nextDay: '[morgen om] LT', - nextWeek: 'dddd [om] LT', - lastDay: '[gisteren om] LT', - lastWeek: '[afgelopen] dddd [om] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'over %s', - past : '%s geleden', - s : 'een paar seconden', - ss : '%d seconden', - m : 'één minuut', - mm : '%d minuten', - h : 'één uur', - hh : '%d uur', - d : 'één dag', - dd : '%d dagen', - M : 'één maand', - MM : '%d maanden', - y : 'één jaar', - yy : '%d jaar' - }, - dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/, - ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); - }, - 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. - } -}); - diff --git a/src/locale/nn.js b/src/locale/nn.js deleted file mode 100644 index ea8ca7b82c..0000000000 --- a/src/locale/nn.js +++ /dev/null @@ -1,52 +0,0 @@ -//! moment.js locale configuration -//! locale : Nynorsk [nn] -//! author : https://github.com/mechuwind - -import moment from '../moment'; - -export default moment.defineLocale('nn', { - months : 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split('_'), - monthsShort : 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'), - weekdays : 'sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag'.split('_'), - weekdaysShort : 'sun_mån_tys_ons_tor_fre_lau'.split('_'), - weekdaysMin : 'su_må_ty_on_to_fr_lø'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY [kl.] H:mm', - LLLL : 'dddd D. MMMM YYYY [kl.] HH:mm' - }, - calendar : { - sameDay: '[I dag klokka] LT', - nextDay: '[I morgon klokka] LT', - nextWeek: 'dddd [klokka] LT', - lastDay: '[I går klokka] LT', - lastWeek: '[Føregåande] dddd [klokka] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'om %s', - past : '%s sidan', - s : 'nokre sekund', - ss : '%d sekund', - m : 'eit minutt', - mm : '%d minutt', - h : 'ein time', - hh : '%d timar', - d : 'ein dag', - dd : '%d dagar', - M : 'ein månad', - MM : '%d månader', - y : 'eit år', - yy : '%d år' - }, - 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. - } -}); - diff --git a/src/locale/pa-in.js b/src/locale/pa-in.js deleted file mode 100644 index 74b3126fcb..0000000000 --- a/src/locale/pa-in.js +++ /dev/null @@ -1,116 +0,0 @@ -//! moment.js locale configuration -//! locale : Punjabi (India) [pa-in] -//! author : Harpreet Singh : https://github.com/harpreetkhalsagtbit - -import moment from '../moment'; - -var symbolMap = { - '1': '੧', - '2': '੨', - '3': '੩', - '4': '੪', - '5': '੫', - '6': '੬', - '7': '੭', - '8': '੮', - '9': '੯', - '0': '੦' -}, -numberMap = { - '੧': '1', - '੨': '2', - '੩': '3', - '੪': '4', - '੫': '5', - '੬': '6', - '੭': '7', - '੮': '8', - '੯': '9', - '੦': '0' -}; - -export default moment.defineLocale('pa-in', { - // There are months name as per Nanakshahi Calendar but they are not used as rigidly in modern Punjabi. - months : 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split('_'), - monthsShort : 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split('_'), - weekdays : 'ਐਤਵਾਰ_ਸੋਮਵਾਰ_ਮੰਗਲਵਾਰ_ਬੁਧਵਾਰ_ਵੀਰਵਾਰ_ਸ਼ੁੱਕਰਵਾਰ_ਸ਼ਨੀਚਰਵਾਰ'.split('_'), - weekdaysShort : 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'), - weekdaysMin : 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.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 : '[ਅਜ] LT', - nextDay : '[ਕਲ] LT', - nextWeek : '[ਅਗਲਾ] dddd, LT', - lastDay : '[ਕਲ] LT', - lastWeek : '[ਪਿਛਲੇ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ਵਿੱਚ', - past : '%s ਪਿਛਲੇ', - s : 'ਕੁਝ ਸਕਿੰਟ', - ss : '%d ਸਕਿੰਟ', - m : 'ਇਕ ਮਿੰਟ', - mm : '%d ਮਿੰਟ', - h : 'ਇੱਕ ਘੰਟਾ', - hh : '%d ਘੰਟੇ', - d : 'ਇੱਕ ਦਿਨ', - dd : '%d ਦਿਨ', - M : 'ਇੱਕ ਮਹੀਨਾ', - MM : '%d ਮਹੀਨੇ', - y : 'ਇੱਕ ਸਾਲ', - yy : '%d ਸਾਲ' - }, - preparse: function (string) { - return string.replace(/[੧੨੩੪੫੬੭੮੯੦]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - // Punjabi notation for meridiems are quite fuzzy in practice. While there exists - // a rigid notion of a 'Pahar' it is not used as rigidly in modern Punjabi. - meridiemParse: /ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'ਰਾਤ') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'ਸਵੇਰ') { - return hour; - } else if (meridiem === 'ਦੁਪਹਿਰ') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'ਸ਼ਾਮ') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ਰਾਤ'; - } else if (hour < 10) { - return 'ਸਵੇਰ'; - } else if (hour < 17) { - return 'ਦੁਪਹਿਰ'; - } else if (hour < 20) { - return 'ਸ਼ਾਮ'; - } else { - return 'ਰਾਤ'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } -}); - diff --git a/src/locale/pl.js b/src/locale/pl.js deleted file mode 100644 index 4a46277f18..0000000000 --- a/src/locale/pl.js +++ /dev/null @@ -1,117 +0,0 @@ -//! moment.js locale configuration -//! locale : Polish [pl] -//! author : Rafal Hirsz : https://github.com/evoL - -import moment from '../moment'; - -var monthsNominative = 'styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień'.split('_'), - monthsSubjective = 'stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia'.split('_'); -function plural(n) { - return (n % 10 < 5) && (n % 10 > 1) && ((~~(n / 10) % 10) !== 1); -} -function translate(number, withoutSuffix, key) { - var result = number + ' '; - switch (key) { - case 'ss': - return result + (plural(number) ? 'sekundy' : 'sekund'); - case 'm': - return withoutSuffix ? 'minuta' : 'minutę'; - case 'mm': - return result + (plural(number) ? 'minuty' : 'minut'); - case 'h': - return withoutSuffix ? 'godzina' : 'godzinę'; - case 'hh': - return result + (plural(number) ? 'godziny' : 'godzin'); - case 'MM': - return result + (plural(number) ? 'miesiące' : 'miesięcy'); - case 'yy': - return result + (plural(number) ? 'lata' : 'lat'); - } -} - -export default moment.defineLocale('pl', { - months : function (momentToFormat, format) { - if (!momentToFormat) { - return monthsNominative; - } else if (format === '') { - // Hack: if format empty we know this is used to generate - // RegExp by moment. Give then back both valid forms of months - // in RegExp ready format. - return '(' + monthsSubjective[momentToFormat.month()] + '|' + monthsNominative[momentToFormat.month()] + ')'; - } else if (/D MMMM/.test(format)) { - return monthsSubjective[momentToFormat.month()]; - } else { - return monthsNominative[momentToFormat.month()]; - } - }, - monthsShort : 'sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru'.split('_'), - weekdays : 'niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota'.split('_'), - weekdaysShort : 'ndz_pon_wt_śr_czw_pt_sob'.split('_'), - weekdaysMin : 'Nd_Pn_Wt_Śr_Cz_Pt_So'.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: '[Dziś o] LT', - nextDay: '[Jutro o] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[W niedzielę o] LT'; - - case 2: - return '[We wtorek o] LT'; - - case 3: - return '[W środę o] LT'; - - case 6: - return '[W sobotę o] LT'; - - default: - return '[W] dddd [o] LT'; - } - }, - lastDay: '[Wczoraj o] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[W zeszłą niedzielę o] LT'; - case 3: - return '[W zeszłą środę o] LT'; - case 6: - return '[W zeszłą sobotę o] LT'; - default: - return '[W zeszły] dddd [o] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'za %s', - past : '%s temu', - s : 'kilka sekund', - ss : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : '1 dzień', - dd : '%d dni', - M : 'miesiąc', - MM : translate, - y : 'rok', - yy : translate - }, - 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. - } -}); diff --git a/src/locale/ro.js b/src/locale/ro.js deleted file mode 100644 index 2d4f19e782..0000000000 --- a/src/locale/ro.js +++ /dev/null @@ -1,68 +0,0 @@ -//! moment.js locale configuration -//! locale : Romanian [ro] -//! author : Vlad Gurdiga : https://github.com/gurdiga -//! author : Valentin Agachi : https://github.com/avaly - -import moment from '../moment'; - -function relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'ss': 'secunde', - 'mm': 'minute', - 'hh': 'ore', - 'dd': 'zile', - 'MM': 'luni', - 'yy': 'ani' - }, - separator = ' '; - if (number % 100 >= 20 || (number >= 100 && number % 100 === 0)) { - separator = ' de '; - } - return number + separator + format[key]; -} - -export default moment.defineLocale('ro', { - months : 'ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie'.split('_'), - monthsShort : 'ian._febr._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'duminică_luni_marți_miercuri_joi_vineri_sâmbătă'.split('_'), - weekdaysShort : 'Dum_Lun_Mar_Mie_Joi_Vin_Sâm'.split('_'), - weekdaysMin : 'Du_Lu_Ma_Mi_Jo_Vi_Sâ'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY H:mm', - LLLL : 'dddd, D MMMM YYYY H:mm' - }, - calendar : { - sameDay: '[azi la] LT', - nextDay: '[mâine la] LT', - nextWeek: 'dddd [la] LT', - lastDay: '[ieri la] LT', - lastWeek: '[fosta] dddd [la] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'peste %s', - past : '%s în urmă', - s : 'câteva secunde', - ss : relativeTimeWithPlural, - m : 'un minut', - mm : relativeTimeWithPlural, - h : 'o oră', - hh : relativeTimeWithPlural, - d : 'o zi', - dd : relativeTimeWithPlural, - M : 'o lună', - MM : relativeTimeWithPlural, - y : 'un an', - yy : relativeTimeWithPlural - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); - diff --git a/src/locale/ru.js b/src/locale/ru.js deleted file mode 100644 index 29046afb10..0000000000 --- a/src/locale/ru.js +++ /dev/null @@ -1,175 +0,0 @@ -//! moment.js locale configuration -//! locale : Russian [ru] -//! author : Viktorminator : https://github.com/Viktorminator -//! Author : Menelion Elensúle : https://github.com/Oire -//! author : Коренберг Марк : https://github.com/socketpair - -import moment from '../moment'; - -function plural(word, num) { - var forms = word.split('_'); - return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]); -} -function relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'ss': withoutSuffix ? 'секунда_секунды_секунд' : 'секунду_секунды_секунд', - 'mm': withoutSuffix ? 'минута_минуты_минут' : 'минуту_минуты_минут', - 'hh': 'час_часа_часов', - 'dd': 'день_дня_дней', - 'MM': 'месяц_месяца_месяцев', - 'yy': 'год_года_лет' - }; - if (key === 'm') { - return withoutSuffix ? 'минута' : 'минуту'; - } - else { - return number + ' ' + plural(format[key], +number); - } -} -var monthsParse = [/^янв/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 -// CLDR data: http://www.unicode.org/cldr/charts/28/summary/ru.html#1753 -export default moment.defineLocale('ru', { - months : { - format: 'января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря'.split('_'), - standalone: 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_') - }, - monthsShort : { - // по CLDR именно "июл." и "июн.", но какой смысл менять букву на точку ? - format: 'янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.'.split('_'), - standalone: 'янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.'.split('_') - }, - weekdays : { - standalone: 'воскресенье_понедельник_вторник_среда_четверг_пятница_суббота'.split('_'), - format: 'воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу'.split('_'), - isFormat: /\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?\] ?dddd/ - }, - weekdaysShort : 'вс_пн_вт_ср_чт_пт_сб'.split('_'), - weekdaysMin : 'вс_пн_вт_ср_чт_пт_сб'.split('_'), - monthsParse : monthsParse, - longMonthsParse : monthsParse, - shortMonthsParse : monthsParse, - - // полные названия с падежами, по три буквы, для некоторых, по 4 буквы, сокращения с точкой и без точки - monthsRegex: /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i, - - // копия предыдущего - monthsShortRegex: /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i, - - // полные названия с падежами - monthsStrictRegex: /^(январ[яь]|феврал[яь]|марта?|апрел[яь]|ма[яй]|июн[яь]|июл[яь]|августа?|сентябр[яь]|октябр[яь]|ноябр[яь]|декабр[яь])/i, - - // Выражение, которое соотвествует только сокращённым формам - monthsShortStrictRegex: /^(янв\.|февр?\.|мар[т.]|апр\.|ма[яй]|июн[ья.]|июл[ья.]|авг\.|сент?\.|окт\.|нояб?\.|дек\.)/i, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY г.', - LLL : 'D MMMM YYYY г., H:mm', - LLLL : 'dddd, D MMMM YYYY г., H:mm' - }, - calendar : { - sameDay: '[Сегодня, в] LT', - nextDay: '[Завтра, в] LT', - lastDay: '[Вчера, в] LT', - nextWeek: function (now) { - if (now.week() !== this.week()) { - switch (this.day()) { - case 0: - return '[В следующее] dddd, [в] LT'; - case 1: - case 2: - case 4: - return '[В следующий] dddd, [в] LT'; - case 3: - case 5: - case 6: - return '[В следующую] dddd, [в] LT'; - } - } else { - if (this.day() === 2) { - return '[Во] dddd, [в] LT'; - } else { - return '[В] dddd, [в] LT'; - } - } - }, - lastWeek: function (now) { - if (now.week() !== this.week()) { - switch (this.day()) { - case 0: - return '[В прошлое] dddd, [в] LT'; - case 1: - case 2: - case 4: - return '[В прошлый] dddd, [в] LT'; - case 3: - case 5: - case 6: - return '[В прошлую] dddd, [в] LT'; - } - } else { - if (this.day() === 2) { - return '[Во] dddd, [в] LT'; - } else { - return '[В] dddd, [в] LT'; - } - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'через %s', - past : '%s назад', - s : 'несколько секунд', - ss : relativeTimeWithPlural, - m : relativeTimeWithPlural, - mm : relativeTimeWithPlural, - h : 'час', - hh : relativeTimeWithPlural, - d : 'день', - dd : relativeTimeWithPlural, - M : 'месяц', - MM : relativeTimeWithPlural, - y : 'год', - yy : relativeTimeWithPlural - }, - meridiemParse: /ночи|утра|дня|вечера/i, - isPM : function (input) { - return /^(дня|вечера)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ночи'; - } else if (hour < 12) { - return 'утра'; - } else if (hour < 17) { - return 'дня'; - } else { - return 'вечера'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}-(й|го|я)/, - ordinal: function (number, period) { - switch (period) { - case 'M': - case 'd': - case 'DDD': - return number + '-й'; - case 'D': - return number + '-го'; - case 'w': - case 'W': - return number + '-я'; - default: - return number; - } - }, - 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. - } -}); diff --git a/src/locale/sd.js b/src/locale/sd.js deleted file mode 100644 index 9747ad499a..0000000000 --- a/src/locale/sd.js +++ /dev/null @@ -1,89 +0,0 @@ -//! moment.js locale configuration -//! locale : Sindhi [sd] -//! author : Narain Sagar : https://github.com/narainsagar - -import moment from '../moment'; - -var months = [ - 'جنوري', - 'فيبروري', - 'مارچ', - 'اپريل', - 'مئي', - 'جون', - 'جولاءِ', - 'آگسٽ', - 'سيپٽمبر', - 'آڪٽوبر', - 'نومبر', - 'ڊسمبر' -]; -var days = [ - 'آچر', - 'سومر', - 'اڱارو', - 'اربع', - 'خميس', - 'جمع', - 'ڇنڇر' -]; - -export default moment.defineLocale('sd', { - months : months, - monthsShort : months, - weekdays : days, - weekdaysShort : days, - weekdaysMin : days, - 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: /صبح|شام/, - isPM : function (input) { - return 'شام' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'صبح'; - } - return 'شام'; - }, - calendar : { - sameDay : '[اڄ] LT', - nextDay : '[سڀاڻي] LT', - nextWeek : 'dddd [اڳين هفتي تي] LT', - lastDay : '[ڪالهه] LT', - lastWeek : '[گزريل هفتي] dddd [تي] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s پوء', - past : '%s اڳ', - s : 'چند سيڪنڊ', - ss : '%d سيڪنڊ', - m : 'هڪ منٽ', - mm : '%d منٽ', - h : 'هڪ ڪلاڪ', - hh : '%d ڪلاڪ', - d : 'هڪ ڏينهن', - dd : '%d ڏينهن', - M : 'هڪ مهينو', - MM : '%d مهينا', - y : 'هڪ سال', - yy : '%d سال' - }, - preparse: function (string) { - return string.replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/,/g, '،'); - }, - 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. - } -}); diff --git a/src/locale/se.js b/src/locale/se.js deleted file mode 100644 index dd10cdaf38..0000000000 --- a/src/locale/se.js +++ /dev/null @@ -1,52 +0,0 @@ -//! moment.js locale configuration -//! locale : Northern Sami [se] -//! authors : Bård Rolstad Henriksen : https://github.com/karamell - - -import moment from '../moment'; - -export default moment.defineLocale('se', { - months : 'ođđajagemánnu_guovvamánnu_njukčamánnu_cuoŋománnu_miessemánnu_geassemánnu_suoidnemánnu_borgemánnu_čakčamánnu_golggotmánnu_skábmamánnu_juovlamánnu'.split('_'), - monthsShort : 'ođđj_guov_njuk_cuo_mies_geas_suoi_borg_čakč_golg_skáb_juov'.split('_'), - weekdays : 'sotnabeaivi_vuossárga_maŋŋebárga_gaskavahkku_duorastat_bearjadat_lávvardat'.split('_'), - weekdaysShort : 'sotn_vuos_maŋ_gask_duor_bear_láv'.split('_'), - weekdaysMin : 's_v_m_g_d_b_L'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'MMMM D. [b.] YYYY', - LLL : 'MMMM D. [b.] YYYY [ti.] HH:mm', - LLLL : 'dddd, MMMM D. [b.] YYYY [ti.] HH:mm' - }, - calendar : { - sameDay: '[otne ti] LT', - nextDay: '[ihttin ti] LT', - nextWeek: 'dddd [ti] LT', - lastDay: '[ikte ti] LT', - lastWeek: '[ovddit] dddd [ti] LT', - sameElse: 'L' - }, - relativeTime : { - future : '%s geažes', - past : 'maŋit %s', - s : 'moadde sekunddat', - ss: '%d sekunddat', - m : 'okta minuhta', - mm : '%d minuhtat', - h : 'okta diimmu', - hh : '%d diimmut', - d : 'okta beaivi', - dd : '%d beaivvit', - M : 'okta mánnu', - MM : '%d mánut', - y : 'okta jahki', - yy : '%d jagit' - }, - 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. - } -}); diff --git a/src/locale/si.js b/src/locale/si.js deleted file mode 100644 index ed3caf3d6c..0000000000 --- a/src/locale/si.js +++ /dev/null @@ -1,62 +0,0 @@ -//! moment.js locale configuration -//! locale : Sinhalese [si] -//! author : Sampath Sitinamaluwa : https://github.com/sampathsris - -import moment from '../moment'; - -/*jshint -W100*/ -export default moment.defineLocale('si', { - months : 'ජනවාරි_පෙබරවාරි_මාර්තු_අප්‍රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්'.split('_'), - monthsShort : 'ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ'.split('_'), - weekdays : 'ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්‍රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා'.split('_'), - weekdaysShort : 'ඉරි_සඳු_අඟ_බදා_බ්‍රහ_සිකු_සෙන'.split('_'), - weekdaysMin : 'ඉ_ස_අ_බ_බ්‍ර_සි_සෙ'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'a h:mm', - LTS : 'a h:mm:ss', - L : 'YYYY/MM/DD', - LL : 'YYYY MMMM D', - LLL : 'YYYY MMMM D, a h:mm', - LLLL : 'YYYY MMMM D [වැනි] dddd, a h:mm:ss' - }, - calendar : { - sameDay : '[අද] LT[ට]', - nextDay : '[හෙට] LT[ට]', - nextWeek : 'dddd LT[ට]', - lastDay : '[ඊයේ] LT[ට]', - lastWeek : '[පසුගිය] dddd LT[ට]', - sameElse : 'L' - }, - relativeTime : { - future : '%sකින්', - past : '%sකට පෙර', - s : 'තත්පර කිහිපය', - ss : 'තත්පර %d', - m : 'මිනිත්තුව', - mm : 'මිනිත්තු %d', - h : 'පැය', - hh : 'පැය %d', - d : 'දිනය', - dd : 'දින %d', - M : 'මාසය', - MM : 'මාස %d', - y : 'වසර', - yy : 'වසර %d' - }, - dayOfMonthOrdinalParse: /\d{1,2} වැනි/, - ordinal : function (number) { - return number + ' වැනි'; - }, - meridiemParse : /පෙර වරු|පස් වරු|පෙ.ව|ප.ව./, - isPM : function (input) { - return input === 'ප.ව.' || input === 'පස් වරු'; - }, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'ප.ව.' : 'පස් වරු'; - } else { - return isLower ? 'පෙ.ව.' : 'පෙර වරු'; - } - } -}); diff --git a/src/locale/sk.js b/src/locale/sk.js deleted file mode 100644 index 3cd3ee15a2..0000000000 --- a/src/locale/sk.js +++ /dev/null @@ -1,149 +0,0 @@ -//! moment.js locale configuration -//! locale : Slovak [sk] -//! author : Martin Minka : https://github.com/k2s -//! based on work of petrbela : https://github.com/petrbela - -import moment from '../moment'; - -var months = 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split('_'), - monthsShort = 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_'); -function plural(n) { - return (n > 1) && (n < 5); -} -function translate(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': // a few seconds / in a few seconds / a few seconds ago - return (withoutSuffix || isFuture) ? 'pár sekúnd' : 'pár sekundami'; - case 'ss': // 9 seconds / in 9 seconds / 9 seconds ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'sekundy' : 'sekúnd'); - } else { - return result + 'sekundami'; - } - break; - case 'm': // a minute / in a minute / a minute ago - return withoutSuffix ? 'minúta' : (isFuture ? 'minútu' : 'minútou'); - case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'minúty' : 'minút'); - } else { - return result + 'minútami'; - } - break; - case 'h': // an hour / in an hour / an hour ago - return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou'); - case 'hh': // 9 hours / in 9 hours / 9 hours ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'hodiny' : 'hodín'); - } else { - return result + 'hodinami'; - } - break; - case 'd': // a day / in a day / a day ago - return (withoutSuffix || isFuture) ? 'deň' : 'dňom'; - case 'dd': // 9 days / in 9 days / 9 days ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'dni' : 'dní'); - } else { - return result + 'dňami'; - } - break; - case 'M': // a month / in a month / a month ago - return (withoutSuffix || isFuture) ? 'mesiac' : 'mesiacom'; - case 'MM': // 9 months / in 9 months / 9 months ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'mesiace' : 'mesiacov'); - } else { - return result + 'mesiacmi'; - } - break; - case 'y': // a year / in a year / a year ago - return (withoutSuffix || isFuture) ? 'rok' : 'rokom'; - case 'yy': // 9 years / in 9 years / 9 years ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'roky' : 'rokov'); - } else { - return result + 'rokmi'; - } - break; - } -} - -export default moment.defineLocale('sk', { - months : months, - monthsShort : monthsShort, - 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('_'), - longDateFormat : { - LT: 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd D. MMMM YYYY H:mm' - }, - calendar : { - sameDay: '[dnes o] LT', - nextDay: '[zajtra o] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[v nedeľu o] LT'; - case 1: - case 2: - return '[v] dddd [o] LT'; - case 3: - return '[v stredu o] LT'; - case 4: - return '[vo štvrtok o] LT'; - case 5: - return '[v piatok o] LT'; - case 6: - return '[v sobotu o] LT'; - } - }, - lastDay: '[včera o] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[minulú nedeľu o] LT'; - case 1: - case 2: - return '[minulý] dddd [o] LT'; - case 3: - return '[minulú stredu o] LT'; - case 4: - case 5: - return '[minulý] dddd [o] LT'; - case 6: - return '[minulú sobotu o] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'za %s', - past : 'pred %s', - s : translate, - ss : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : translate, - dd : translate, - M : translate, - MM : translate, - y : translate, - yy : translate - }, - 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. - } -}); - diff --git a/src/locale/sl.js b/src/locale/sl.js deleted file mode 100644 index 0012e15a57..0000000000 --- a/src/locale/sl.js +++ /dev/null @@ -1,164 +0,0 @@ -//! moment.js locale configuration -//! locale : Slovenian [sl] -//! author : Robert Sedovšek : https://github.com/sedovsek - -import moment from '../moment'; - -function processRelativeTime(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': - return withoutSuffix || isFuture ? 'nekaj sekund' : 'nekaj sekundami'; - case 'ss': - if (number === 1) { - result += withoutSuffix ? 'sekundo' : 'sekundi'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'sekundi' : 'sekundah'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'sekunde' : 'sekundah'; - } else { - result += 'sekund'; - } - return result; - case 'm': - return withoutSuffix ? 'ena minuta' : 'eno minuto'; - case 'mm': - if (number === 1) { - result += withoutSuffix ? 'minuta' : 'minuto'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'minuti' : 'minutama'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'minute' : 'minutami'; - } else { - result += withoutSuffix || isFuture ? 'minut' : 'minutami'; - } - return result; - case 'h': - return withoutSuffix ? 'ena ura' : 'eno uro'; - case 'hh': - if (number === 1) { - result += withoutSuffix ? 'ura' : 'uro'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'uri' : 'urama'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'ure' : 'urami'; - } else { - result += withoutSuffix || isFuture ? 'ur' : 'urami'; - } - return result; - case 'd': - return withoutSuffix || isFuture ? 'en dan' : 'enim dnem'; - case 'dd': - if (number === 1) { - result += withoutSuffix || isFuture ? 'dan' : 'dnem'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'dni' : 'dnevoma'; - } else { - result += withoutSuffix || isFuture ? 'dni' : 'dnevi'; - } - return result; - case 'M': - return withoutSuffix || isFuture ? 'en mesec' : 'enim mesecem'; - case 'MM': - if (number === 1) { - result += withoutSuffix || isFuture ? 'mesec' : 'mesecem'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'meseca' : 'mesecema'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'mesece' : 'meseci'; - } else { - result += withoutSuffix || isFuture ? 'mesecev' : 'meseci'; - } - return result; - case 'y': - return withoutSuffix || isFuture ? 'eno leto' : 'enim letom'; - case 'yy': - if (number === 1) { - result += withoutSuffix || isFuture ? 'leto' : 'letom'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'leti' : 'letoma'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'leta' : 'leti'; - } else { - result += withoutSuffix || isFuture ? 'let' : 'leti'; - } - return result; - } -} - -export default moment.defineLocale('sl', { - months : 'januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december'.split('_'), - monthsShort : 'jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota'.split('_'), - weekdaysShort : 'ned._pon._tor._sre._čet._pet._sob.'.split('_'), - weekdaysMin : 'ne_po_to_sr_če_pe_so'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[danes ob] LT', - nextDay : '[jutri ob] LT', - - nextWeek : function () { - switch (this.day()) { - case 0: - return '[v] [nedeljo] [ob] LT'; - case 3: - return '[v] [sredo] [ob] LT'; - case 6: - return '[v] [soboto] [ob] LT'; - case 1: - case 2: - case 4: - case 5: - return '[v] dddd [ob] LT'; - } - }, - lastDay : '[včeraj ob] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - return '[prejšnjo] [nedeljo] [ob] LT'; - case 3: - return '[prejšnjo] [sredo] [ob] LT'; - case 6: - return '[prejšnjo] [soboto] [ob] LT'; - case 1: - case 2: - case 4: - case 5: - return '[prejšnji] dddd [ob] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'čez %s', - past : 'pred %s', - s : processRelativeTime, - ss : processRelativeTime, - m : processRelativeTime, - mm : processRelativeTime, - h : processRelativeTime, - hh : processRelativeTime, - d : processRelativeTime, - dd : processRelativeTime, - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); diff --git a/src/locale/sq.js b/src/locale/sq.js deleted file mode 100644 index 1280db7f61..0000000000 --- a/src/locale/sq.js +++ /dev/null @@ -1,62 +0,0 @@ -//! moment.js locale configuration -//! locale : Albanian [sq] -//! author : Flakërim Ismani : https://github.com/flakerimi -//! author : Menelion Elensúle : https://github.com/Oire -//! author : Oerd Cukalla : https://github.com/oerd - -import moment from '../moment'; - -export default moment.defineLocale('sq', { - months : 'Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor'.split('_'), - monthsShort : 'Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj'.split('_'), - weekdays : 'E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë'.split('_'), - weekdaysShort : 'Die_Hën_Mar_Mër_Enj_Pre_Sht'.split('_'), - weekdaysMin : 'D_H_Ma_Më_E_P_Sh'.split('_'), - weekdaysParseExact : true, - meridiemParse: /PD|MD/, - isPM: function (input) { - return input.charAt(0) === 'M'; - }, - meridiem : function (hours, minutes, isLower) { - return hours < 12 ? 'PD' : 'MD'; - }, - 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 : '[Sot në] LT', - nextDay : '[Nesër në] LT', - nextWeek : 'dddd [në] LT', - lastDay : '[Dje në] LT', - lastWeek : 'dddd [e kaluar në] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'në %s', - past : '%s më parë', - s : 'disa sekonda', - ss : '%d sekonda', - m : 'një minutë', - mm : '%d minuta', - h : 'një orë', - hh : '%d orë', - d : 'një ditë', - dd : '%d ditë', - M : 'një muaj', - MM : '%d muaj', - y : 'një vit', - yy : '%d vite' - }, - 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. - } -}); - diff --git a/src/locale/sr-cyrl.js b/src/locale/sr-cyrl.js deleted file mode 100644 index 3b9a573454..0000000000 --- a/src/locale/sr-cyrl.js +++ /dev/null @@ -1,102 +0,0 @@ -//! moment.js locale configuration -//! locale : Serbian Cyrillic [sr-cyrl] -//! author : Milan Janačković : https://github.com/milan-j - -import moment from '../moment'; - -var translator = { - words: { //Different grammatical cases - ss: ['секунда', 'секунде', 'секунди'], - m: ['један минут', 'једне минуте'], - mm: ['минут', 'минуте', 'минута'], - h: ['један сат', 'једног сата'], - hh: ['сат', 'сата', 'сати'], - dd: ['дан', 'дана', 'дана'], - MM: ['месец', 'месеца', 'месеци'], - yy: ['година', 'године', 'година'] - }, - correctGrammaticalCase: function (number, wordKey) { - return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]); - }, - translate: function (number, withoutSuffix, key) { - var wordKey = translator.words[key]; - if (key.length === 1) { - return withoutSuffix ? wordKey[0] : wordKey[1]; - } else { - return number + ' ' + translator.correctGrammaticalCase(number, wordKey); - } - } -}; - -export default moment.defineLocale('sr-cyrl', { - months: 'јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар'.split('_'), - monthsShort: 'јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.'.split('_'), - monthsParseExact: true, - weekdays: 'недеља_понедељак_уторак_среда_четвртак_петак_субота'.split('_'), - weekdaysShort: 'нед._пон._уто._сре._чет._пет._суб.'.split('_'), - weekdaysMin: 'не_по_ут_ср_че_пе_су'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm', - LTS : 'H:mm:ss', - L: 'DD.MM.YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm', - LLLL: 'dddd, D. MMMM YYYY H:mm' - }, - calendar: { - sameDay: '[данас у] LT', - nextDay: '[сутра у] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[у] [недељу] [у] LT'; - case 3: - return '[у] [среду] [у] LT'; - case 6: - return '[у] [суботу] [у] LT'; - case 1: - case 2: - case 4: - case 5: - return '[у] dddd [у] LT'; - } - }, - lastDay : '[јуче у] LT', - lastWeek : function () { - var lastWeekDays = [ - '[прошле] [недеље] [у] LT', - '[прошлог] [понедељка] [у] LT', - '[прошлог] [уторка] [у] LT', - '[прошле] [среде] [у] LT', - '[прошлог] [четвртка] [у] LT', - '[прошлог] [петка] [у] LT', - '[прошле] [суботе] [у] LT' - ]; - return lastWeekDays[this.day()]; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'за %s', - past : 'пре %s', - s : 'неколико секунди', - ss : translator.translate, - m : translator.translate, - mm : translator.translate, - h : translator.translate, - hh : translator.translate, - d : 'дан', - dd : translator.translate, - M : 'месец', - MM : translator.translate, - y : 'годину', - yy : translator.translate - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); diff --git a/src/locale/sr.js b/src/locale/sr.js deleted file mode 100644 index 12c3f2467a..0000000000 --- a/src/locale/sr.js +++ /dev/null @@ -1,102 +0,0 @@ -//! moment.js locale configuration -//! locale : Serbian [sr] -//! author : Milan Janačković : https://github.com/milan-j - -import moment from '../moment'; - -var translator = { - words: { //Different grammatical cases - ss: ['sekunda', 'sekunde', 'sekundi'], - m: ['jedan minut', 'jedne minute'], - mm: ['minut', 'minute', 'minuta'], - h: ['jedan sat', 'jednog sata'], - hh: ['sat', 'sata', 'sati'], - dd: ['dan', 'dana', 'dana'], - MM: ['mesec', 'meseca', 'meseci'], - yy: ['godina', 'godine', 'godina'] - }, - correctGrammaticalCase: function (number, wordKey) { - return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]); - }, - translate: function (number, withoutSuffix, key) { - var wordKey = translator.words[key]; - if (key.length === 1) { - return withoutSuffix ? wordKey[0] : wordKey[1]; - } else { - return number + ' ' + translator.correctGrammaticalCase(number, wordKey); - } - } -}; - -export default moment.defineLocale('sr', { - months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split('_'), - monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays: 'nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota'.split('_'), - weekdaysShort: 'ned._pon._uto._sre._čet._pet._sub.'.split('_'), - weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm', - LTS : 'H:mm:ss', - L: 'DD.MM.YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm', - LLLL: 'dddd, D. MMMM YYYY H:mm' - }, - calendar: { - sameDay: '[danas u] LT', - nextDay: '[sutra u] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[u] [nedelju] [u] LT'; - case 3: - return '[u] [sredu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - }, - lastDay : '[juče u] LT', - lastWeek : function () { - var lastWeekDays = [ - '[prošle] [nedelje] [u] LT', - '[prošlog] [ponedeljka] [u] LT', - '[prošlog] [utorka] [u] LT', - '[prošle] [srede] [u] LT', - '[prošlog] [četvrtka] [u] LT', - '[prošlog] [petka] [u] LT', - '[prošle] [subote] [u] LT' - ]; - return lastWeekDays[this.day()]; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'pre %s', - s : 'nekoliko sekundi', - ss : translator.translate, - m : translator.translate, - mm : translator.translate, - h : translator.translate, - hh : translator.translate, - d : 'dan', - dd : translator.translate, - M : 'mesec', - MM : translator.translate, - y : 'godinu', - yy : translator.translate - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); diff --git a/src/locale/ss.js b/src/locale/ss.js deleted file mode 100644 index 7cc5f24a72..0000000000 --- a/src/locale/ss.js +++ /dev/null @@ -1,81 +0,0 @@ -//! moment.js locale configuration -//! locale : siSwati [ss] -//! author : Nicolai Davies : https://github.com/nicolaidavies - - -import moment from '../moment'; - -export default moment.defineLocale('ss', { - months : "Bhimbidvwane_Indlovana_Indlov'lenkhulu_Mabasa_Inkhwekhweti_Inhlaba_Kholwane_Ingci_Inyoni_Imphala_Lweti_Ingongoni".split('_'), - monthsShort : 'Bhi_Ina_Inu_Mab_Ink_Inh_Kho_Igc_Iny_Imp_Lwe_Igo'.split('_'), - weekdays : 'Lisontfo_Umsombuluko_Lesibili_Lesitsatfu_Lesine_Lesihlanu_Umgcibelo'.split('_'), - weekdaysShort : 'Lis_Umb_Lsb_Les_Lsi_Lsh_Umg'.split('_'), - weekdaysMin : 'Li_Us_Lb_Lt_Ls_Lh_Ug'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[Namuhla nga] LT', - nextDay : '[Kusasa nga] LT', - nextWeek : 'dddd [nga] LT', - lastDay : '[Itolo nga] LT', - lastWeek : 'dddd [leliphelile] [nga] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'nga %s', - past : 'wenteka nga %s', - s : 'emizuzwana lomcane', - ss : '%d mzuzwana', - m : 'umzuzu', - mm : '%d emizuzu', - h : 'lihora', - hh : '%d emahora', - d : 'lilanga', - dd : '%d emalanga', - M : 'inyanga', - MM : '%d tinyanga', - y : 'umnyaka', - yy : '%d iminyaka' - }, - meridiemParse: /ekuseni|emini|entsambama|ebusuku/, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'ekuseni'; - } else if (hours < 15) { - return 'emini'; - } else if (hours < 19) { - return 'entsambama'; - } else { - return 'ebusuku'; - } - }, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'ekuseni') { - return hour; - } else if (meridiem === 'emini') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'entsambama' || meridiem === 'ebusuku') { - if (hour === 0) { - return 0; - } - return hour + 12; - } - }, - 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. - } -}); - diff --git a/src/locale/sv.js b/src/locale/sv.js deleted file mode 100644 index 8afce35aaa..0000000000 --- a/src/locale/sv.js +++ /dev/null @@ -1,61 +0,0 @@ -//! moment.js locale configuration -//! locale : Swedish [sv] -//! author : Jens Alm : https://github.com/ulmus - -import moment from '../moment'; - -export default moment.defineLocale('sv', { - months : 'januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december'.split('_'), - monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), - weekdays : 'söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag'.split('_'), - weekdaysShort : 'sön_mån_tis_ons_tor_fre_lör'.split('_'), - weekdaysMin : 'sö_må_ti_on_to_fr_lö'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [kl.] HH:mm', - LLLL : 'dddd D MMMM YYYY [kl.] HH:mm', - lll : 'D MMM YYYY HH:mm', - llll : 'ddd D MMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Idag] LT', - nextDay: '[Imorgon] LT', - lastDay: '[Igår] LT', - nextWeek: '[På] dddd LT', - lastWeek: '[I] dddd[s] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'om %s', - past : 'för %s sedan', - s : 'några sekunder', - ss : '%d sekunder', - m : 'en minut', - mm : '%d minuter', - h : 'en timme', - hh : '%d timmar', - d : 'en dag', - dd : '%d dagar', - M : 'en månad', - MM : '%d månader', - y : 'ett år', - yy : '%d år' - }, - dayOfMonthOrdinalParse: /\d{1,2}(e|a)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'e' : - (b === 1) ? 'a' : - (b === 2) ? 'a' : - (b === 3) ? 'e' : 'e'; - 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. - } -}); - diff --git a/src/locale/sw.js b/src/locale/sw.js deleted file mode 100644 index ec1e54366c..0000000000 --- a/src/locale/sw.js +++ /dev/null @@ -1,51 +0,0 @@ -//! moment.js locale configuration -//! locale : Swahili [sw] -//! author : Fahad Kassim : https://github.com/fadsel - -import moment from '../moment'; - -export default moment.defineLocale('sw', { - months : 'Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba'.split('_'), - monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des'.split('_'), - weekdays : 'Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi'.split('_'), - weekdaysShort : 'Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos'.split('_'), - weekdaysMin : 'J2_J3_J4_J5_Al_Ij_J1'.split('_'), - weekdaysParseExact : true, - 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 : '[leo saa] LT', - nextDay : '[kesho saa] LT', - nextWeek : '[wiki ijayo] dddd [saat] LT', - lastDay : '[jana] LT', - lastWeek : '[wiki iliyopita] dddd [saat] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s baadaye', - past : 'tokea %s', - s : 'hivi punde', - ss : 'sekunde %d', - m : 'dakika moja', - mm : 'dakika %d', - h : 'saa limoja', - hh : 'masaa %d', - d : 'siku moja', - dd : 'masiku %d', - M : 'mwezi mmoja', - MM : 'miezi %d', - y : 'mwaka mmoja', - yy : 'miaka %d' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); - diff --git a/src/locale/ta.js b/src/locale/ta.js deleted file mode 100644 index 5d3d921209..0000000000 --- a/src/locale/ta.js +++ /dev/null @@ -1,121 +0,0 @@ -//! moment.js locale configuration -//! locale : Tamil [ta] -//! author : Arjunkumar Krishnamoorthy : https://github.com/tk120404 - -import moment from '../moment'; - -var symbolMap = { - '1': '௧', - '2': '௨', - '3': '௩', - '4': '௪', - '5': '௫', - '6': '௬', - '7': '௭', - '8': '௮', - '9': '௯', - '0': '௦' -}, numberMap = { - '௧': '1', - '௨': '2', - '௩': '3', - '௪': '4', - '௫': '5', - '௬': '6', - '௭': '7', - '௮': '8', - '௯': '9', - '௦': '0' -}; - -export default moment.defineLocale('ta', { - months : 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'), - monthsShort : 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'), - weekdays : 'ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை'.split('_'), - weekdaysShort : 'ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி'.split('_'), - weekdaysMin : 'ஞா_தி_செ_பு_வி_வெ_ச'.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 : '[இன்று] LT', - nextDay : '[நாளை] LT', - nextWeek : 'dddd, LT', - lastDay : '[நேற்று] LT', - lastWeek : '[கடந்த வாரம்] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s இல்', - past : '%s முன்', - s : 'ஒரு சில விநாடிகள்', - ss : '%d விநாடிகள்', - m : 'ஒரு நிமிடம்', - mm : '%d நிமிடங்கள்', - h : 'ஒரு மணி நேரம்', - hh : '%d மணி நேரம்', - d : 'ஒரு நாள்', - dd : '%d நாட்கள்', - M : 'ஒரு மாதம்', - MM : '%d மாதங்கள்', - y : 'ஒரு வருடம்', - yy : '%d ஆண்டுகள்' - }, - dayOfMonthOrdinalParse: /\d{1,2}வது/, - ordinal : function (number) { - return number + 'வது'; - }, - preparse: function (string) { - return string.replace(/[௧௨௩௪௫௬௭௮௯௦]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - // refer http://ta.wikipedia.org/s/1er1 - meridiemParse: /யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/, - meridiem : function (hour, minute, isLower) { - if (hour < 2) { - return ' யாமம்'; - } else if (hour < 6) { - return ' வைகறை'; // வைகறை - } else if (hour < 10) { - return ' காலை'; // காலை - } else if (hour < 14) { - return ' நண்பகல்'; // நண்பகல் - } else if (hour < 18) { - return ' எற்பாடு'; // எற்பாடு - } else if (hour < 22) { - return ' மாலை'; // மாலை - } else { - return ' யாமம்'; - } - }, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'யாமம்') { - return hour < 2 ? hour : hour + 12; - } else if (meridiem === 'வைகறை' || meridiem === 'காலை') { - return hour; - } else if (meridiem === 'நண்பகல்') { - return hour >= 10 ? hour : hour + 12; - } else { - return hour + 12; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } -}); - diff --git a/src/locale/te.js b/src/locale/te.js deleted file mode 100644 index 87613cc45e..0000000000 --- a/src/locale/te.js +++ /dev/null @@ -1,80 +0,0 @@ -//! moment.js locale configuration -//! locale : Telugu [te] -//! author : Krishna Chaitanya Thota : https://github.com/kcthota - -import moment from '../moment'; - -export default moment.defineLocale('te', { - months : 'జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జులై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్'.split('_'), - monthsShort : 'జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జులై_ఆగ._సెప్._అక్టో._నవ._డిసె.'.split('_'), - monthsParseExact : true, - weekdays : 'ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం'.split('_'), - weekdaysShort : 'ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని'.split('_'), - weekdaysMin : 'ఆ_సో_మం_బు_గు_శు_శ'.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 : '[నేడు] LT', - nextDay : '[రేపు] LT', - nextWeek : 'dddd, LT', - lastDay : '[నిన్న] LT', - lastWeek : '[గత] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s లో', - past : '%s క్రితం', - s : 'కొన్ని క్షణాలు', - ss : '%d సెకన్లు', - m : 'ఒక నిమిషం', - mm : '%d నిమిషాలు', - h : 'ఒక గంట', - hh : '%d గంటలు', - d : 'ఒక రోజు', - dd : '%d రోజులు', - M : 'ఒక నెల', - MM : '%d నెలలు', - y : 'ఒక సంవత్సరం', - yy : '%d సంవత్సరాలు' - }, - dayOfMonthOrdinalParse : /\d{1,2}వ/, - ordinal : '%dవ', - meridiemParse: /రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'రాత్రి') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'ఉదయం') { - return hour; - } else if (meridiem === 'మధ్యాహ్నం') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'సాయంత్రం') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'రాత్రి'; - } else if (hour < 10) { - return 'ఉదయం'; - } else if (hour < 17) { - return 'మధ్యాహ్నం'; - } else if (hour < 20) { - return 'సాయంత్రం'; - } else { - return 'రాత్రి'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 6th is the first week of the year. - } -}); diff --git a/src/locale/tet.js b/src/locale/tet.js deleted file mode 100644 index a4e9e196fe..0000000000 --- a/src/locale/tet.js +++ /dev/null @@ -1,60 +0,0 @@ -//! moment.js locale configuration -//! locale : Tetun Dili (East Timor) [tet] -//! author : Joshua Brooks : https://github.com/joshbrooks -//! author : Onorio De J. Afonso : https://github.com/marobo -//! author : Sonia Simoes : https://github.com/soniasimoes - -import moment from '../moment'; - -export default moment.defineLocale('tet', { - months : 'Janeiru_Fevereiru_Marsu_Abril_Maiu_Juñu_Jullu_Agustu_Setembru_Outubru_Novembru_Dezembru'.split('_'), - monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'), - weekdays : 'Domingu_Segunda_Tersa_Kuarta_Kinta_Sesta_Sabadu'.split('_'), - weekdaysShort : 'Dom_Seg_Ters_Kua_Kint_Sest_Sab'.split('_'), - weekdaysMin : 'Do_Seg_Te_Ku_Ki_Ses_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: '[Ohin iha] LT', - nextDay: '[Aban iha] LT', - nextWeek: 'dddd [iha] LT', - lastDay: '[Horiseik iha] LT', - lastWeek: 'dddd [semana kotuk] [iha] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'iha %s', - past : '%s liuba', - s : 'minutu balun', - ss : 'minutu %d', - m : 'minutu ida', - mm : 'minutu %d', - h : 'oras ida', - hh : 'oras %d', - d : 'loron ida', - dd : 'loron %d', - M : 'fulan ida', - MM : 'fulan %d', - y : 'tinan ida', - yy : 'tinan %d' - }, - 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. - } -}); diff --git a/src/locale/tg.js b/src/locale/tg.js deleted file mode 100644 index 9f15e1ace7..0000000000 --- a/src/locale/tg.js +++ /dev/null @@ -1,107 +0,0 @@ -//! moment.js locale configuration -//! locale : Tajik [tg] -//! author : Orif N. Jr. : https://github.com/orif-jr - -import moment from '../moment'; - -var suffixes = { - 0: '-ум', - 1: '-ум', - 2: '-юм', - 3: '-юм', - 4: '-ум', - 5: '-ум', - 6: '-ум', - 7: '-ум', - 8: '-ум', - 9: '-ум', - 10: '-ум', - 12: '-ум', - 13: '-ум', - 20: '-ум', - 30: '-юм', - 40: '-ум', - 50: '-ум', - 60: '-ум', - 70: '-ум', - 80: '-ум', - 90: '-ум', - 100: '-ум' -}; - -export default moment.defineLocale('tg', { - months : 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split('_'), - monthsShort : 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'), - weekdays : 'якшанбе_душанбе_сешанбе_чоршанбе_панҷшанбе_ҷумъа_шанбе'.split('_'), - weekdaysShort : 'яшб_дшб_сшб_чшб_пшб_ҷум_шнб'.split('_'), - weekdaysMin : 'яш_дш_сш_чш_пш_ҷм_шб'.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 : '[Имрӯз соати] LT', - nextDay : '[Пагоҳ соати] LT', - lastDay : '[Дирӯз соати] LT', - nextWeek : 'dddd[и] [ҳафтаи оянда соати] LT', - lastWeek : 'dddd[и] [ҳафтаи гузашта соати] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'баъди %s', - past : '%s пеш', - s : 'якчанд сония', - m : 'як дақиқа', - mm : '%d дақиқа', - h : 'як соат', - hh : '%d соат', - d : 'як рӯз', - dd : '%d рӯз', - M : 'як моҳ', - MM : '%d моҳ', - y : 'як сол', - yy : '%d сол' - }, - meridiemParse: /шаб|субҳ|рӯз|бегоҳ/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'шаб') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'субҳ') { - return hour; - } else if (meridiem === 'рӯз') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'бегоҳ') { - return hour + 12; - } - }, - meridiem: function (hour, minute, isLower) { - if (hour < 4) { - return 'шаб'; - } else if (hour < 11) { - return 'субҳ'; - } else if (hour < 16) { - return 'рӯз'; - } else if (hour < 19) { - return 'бегоҳ'; - } else { - return 'шаб'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}-(ум|юм)/, - ordinal: function (number) { - var a = number % 10, - b = number >= 100 ? 100 : null; - return number + (suffixes[number] || suffixes[a] || suffixes[b]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1th is the first week of the year. - } -}); diff --git a/src/locale/th.js b/src/locale/th.js deleted file mode 100644 index 9f8771feca..0000000000 --- a/src/locale/th.js +++ /dev/null @@ -1,58 +0,0 @@ -//! moment.js locale configuration -//! locale : Thai [th] -//! author : Kridsada Thanabulpong : https://github.com/sirn - -import moment from '../moment'; - -export default moment.defineLocale('th', { - months : 'มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม'.split('_'), - monthsShort : 'ม.ค._ก.พ._มี.ค._เม.ย._พ.ค._มิ.ย._ก.ค._ส.ค._ก.ย._ต.ค._พ.ย._ธ.ค.'.split('_'), - monthsParseExact: true, - weekdays : 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์'.split('_'), - weekdaysShort : 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์'.split('_'), // yes, three characters difference - weekdaysMin : 'อา._จ._อ._พ._พฤ._ศ._ส.'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY เวลา H:mm', - LLLL : 'วันddddที่ D MMMM YYYY เวลา H:mm' - }, - meridiemParse: /ก่อนเที่ยง|หลังเที่ยง/, - isPM: function (input) { - return input === 'หลังเที่ยง'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ก่อนเที่ยง'; - } else { - return 'หลังเที่ยง'; - } - }, - calendar : { - sameDay : '[วันนี้ เวลา] LT', - nextDay : '[พรุ่งนี้ เวลา] LT', - nextWeek : 'dddd[หน้า เวลา] LT', - lastDay : '[เมื่อวานนี้ เวลา] LT', - lastWeek : '[วัน]dddd[ที่แล้ว เวลา] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'อีก %s', - past : '%sที่แล้ว', - s : 'ไม่กี่วินาที', - ss : '%d วินาที', - m : '1 นาที', - mm : '%d นาที', - h : '1 ชั่วโมง', - hh : '%d ชั่วโมง', - d : '1 วัน', - dd : '%d วัน', - M : '1 เดือน', - MM : '%d เดือน', - y : '1 ปี', - yy : '%d ปี' - } -}); diff --git a/src/locale/tl-ph.js b/src/locale/tl-ph.js deleted file mode 100644 index 26c482496d..0000000000 --- a/src/locale/tl-ph.js +++ /dev/null @@ -1,54 +0,0 @@ -//! moment.js locale configuration -//! locale : Tagalog (Philippines) [tl-ph] -//! author : Dan Hagman : https://github.com/hagmandan - -import moment from '../moment'; - -export default moment.defineLocale('tl-ph', { - months : 'Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre'.split('_'), - monthsShort : 'Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis'.split('_'), - weekdays : 'Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado'.split('_'), - weekdaysShort : 'Lin_Lun_Mar_Miy_Huw_Biy_Sab'.split('_'), - weekdaysMin : 'Li_Lu_Ma_Mi_Hu_Bi_Sab'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'MM/D/YYYY', - LL : 'MMMM D, YYYY', - LLL : 'MMMM D, YYYY HH:mm', - LLLL : 'dddd, MMMM DD, YYYY HH:mm' - }, - calendar : { - sameDay: 'LT [ngayong araw]', - nextDay: '[Bukas ng] LT', - nextWeek: 'LT [sa susunod na] dddd', - lastDay: 'LT [kahapon]', - lastWeek: 'LT [noong nakaraang] dddd', - sameElse: 'L' - }, - relativeTime : { - future : 'sa loob ng %s', - past : '%s ang nakalipas', - s : 'ilang segundo', - ss : '%d segundo', - m : 'isang minuto', - mm : '%d minuto', - h : 'isang oras', - hh : '%d oras', - d : 'isang araw', - dd : '%d araw', - M : 'isang buwan', - MM : '%d buwan', - y : 'isang taon', - yy : '%d taon' - }, - dayOfMonthOrdinalParse: /\d{1,2}/, - ordinal : function (number) { - return number; - }, - 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. - } -}); - diff --git a/src/locale/tlh.js b/src/locale/tlh.js deleted file mode 100644 index 324edc6751..0000000000 --- a/src/locale/tlh.js +++ /dev/null @@ -1,113 +0,0 @@ -//! moment.js locale configuration -//! locale : Klingon [tlh] -//! author : Dominika Kruk : https://github.com/amaranthrose - -import moment from '../moment'; - -var numbersNouns = 'pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut'.split('_'); - -function translateFuture(output) { - var time = output; - time = (output.indexOf('jaj') !== -1) ? - time.slice(0, -3) + 'leS' : - (output.indexOf('jar') !== -1) ? - time.slice(0, -3) + 'waQ' : - (output.indexOf('DIS') !== -1) ? - time.slice(0, -3) + 'nem' : - time + ' pIq'; - return time; -} - -function translatePast(output) { - var time = output; - time = (output.indexOf('jaj') !== -1) ? - time.slice(0, -3) + 'Hu’' : - (output.indexOf('jar') !== -1) ? - time.slice(0, -3) + 'wen' : - (output.indexOf('DIS') !== -1) ? - time.slice(0, -3) + 'ben' : - time + ' ret'; - return time; -} - -function translate(number, withoutSuffix, string, isFuture) { - var numberNoun = numberAsNoun(number); - switch (string) { - case 'ss': - return numberNoun + ' lup'; - case 'mm': - return numberNoun + ' tup'; - case 'hh': - return numberNoun + ' rep'; - case 'dd': - return numberNoun + ' jaj'; - case 'MM': - return numberNoun + ' jar'; - case 'yy': - return numberNoun + ' DIS'; - } -} - -function numberAsNoun(number) { - var hundred = Math.floor((number % 1000) / 100), - ten = Math.floor((number % 100) / 10), - one = number % 10, - word = ''; - if (hundred > 0) { - word += numbersNouns[hundred] + 'vatlh'; - } - if (ten > 0) { - word += ((word !== '') ? ' ' : '') + numbersNouns[ten] + 'maH'; - } - if (one > 0) { - word += ((word !== '') ? ' ' : '') + numbersNouns[one]; - } - return (word === '') ? 'pagh' : word; -} - -export default moment.defineLocale('tlh', { - months : 'tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’'.split('_'), - monthsShort : 'jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’'.split('_'), - monthsParseExact : true, - weekdays : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), - weekdaysShort : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), - weekdaysMin : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.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: '[DaHjaj] LT', - nextDay: '[wa’leS] LT', - nextWeek: 'LLL', - lastDay: '[wa’Hu’] LT', - lastWeek: 'LLL', - sameElse: 'L' - }, - relativeTime : { - future : translateFuture, - past : translatePast, - s : 'puS lup', - ss : translate, - m : 'wa’ tup', - mm : translate, - h : 'wa’ rep', - hh : translate, - d : 'wa’ jaj', - dd : translate, - M : 'wa’ jar', - MM : translate, - y : 'wa’ DIS', - yy : translate - }, - 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. - } -}); diff --git a/src/locale/tr.js b/src/locale/tr.js deleted file mode 100644 index 1eaa700d5e..0000000000 --- a/src/locale/tr.js +++ /dev/null @@ -1,90 +0,0 @@ - -//! moment.js locale configuration -//! locale : Turkish [tr] -//! authors : Erhan Gundogan : https://github.com/erhangundogan, -//! Burak Yiğit Kaya: https://github.com/BYK - -import moment from '../moment'; - -var suffixes = { - 1: '\'inci', - 5: '\'inci', - 8: '\'inci', - 70: '\'inci', - 80: '\'inci', - 2: '\'nci', - 7: '\'nci', - 20: '\'nci', - 50: '\'nci', - 3: '\'üncü', - 4: '\'üncü', - 100: '\'üncü', - 6: '\'ncı', - 9: '\'uncu', - 10: '\'uncu', - 30: '\'uncu', - 60: '\'ıncı', - 90: '\'ıncı' -}; - -export default moment.defineLocale('tr', { - months : 'Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık'.split('_'), - monthsShort : 'Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara'.split('_'), - weekdays : 'Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi'.split('_'), - weekdaysShort : 'Paz_Pts_Sal_Çar_Per_Cum_Cts'.split('_'), - weekdaysMin : 'Pz_Pt_Sa_Ça_Pe_Cu_Ct'.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 : '[bugün saat] LT', - nextDay : '[yarın saat] LT', - nextWeek : '[gelecek] dddd [saat] LT', - lastDay : '[dün] LT', - lastWeek : '[geçen] dddd [saat] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s sonra', - past : '%s önce', - s : 'birkaç saniye', - ss : '%d saniye', - m : 'bir dakika', - mm : '%d dakika', - h : 'bir saat', - hh : '%d saat', - d : 'bir gün', - dd : '%d gün', - M : 'bir ay', - MM : '%d ay', - y : 'bir yıl', - yy : '%d yıl' - }, - ordinal: function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'Do': - case 'DD': - return number; - default: - if (number === 0) { // special case for zero - return number + '\'ıncı'; - } - var a = number % 10, - b = number % 100 - a, - c = number >= 100 ? 100 : null; - return number + (suffixes[a] || suffixes[b] || suffixes[c]); - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); - diff --git a/src/locale/tzl.js b/src/locale/tzl.js deleted file mode 100644 index 2a5945807d..0000000000 --- a/src/locale/tzl.js +++ /dev/null @@ -1,84 +0,0 @@ -//! moment.js locale configuration -//! locale : Talossan [tzl] -//! author : Robin van der Vliet : https://github.com/robin0van0der0v -//! author : Iustì Canun - -import moment from '../moment'; - -// After the year there should be a slash and the amount of years since December 26, 1979 in Roman numerals. -// This is currently too difficult (maybe even impossible) to add. -export default moment.defineLocale('tzl', { - months : 'Januar_Fevraglh_Març_Avrïu_Mai_Gün_Julia_Guscht_Setemvar_Listopäts_Noemvar_Zecemvar'.split('_'), - monthsShort : 'Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec'.split('_'), - weekdays : 'Súladi_Lúneçi_Maitzi_Márcuri_Xhúadi_Viénerçi_Sáturi'.split('_'), - weekdaysShort : 'Súl_Lún_Mai_Már_Xhú_Vié_Sát'.split('_'), - weekdaysMin : 'Sú_Lú_Ma_Má_Xh_Vi_Sá'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM [dallas] YYYY', - LLL : 'D. MMMM [dallas] YYYY HH.mm', - LLLL : 'dddd, [li] D. MMMM [dallas] YYYY HH.mm' - }, - meridiemParse: /d\'o|d\'a/i, - isPM : function (input) { - return 'd\'o' === input.toLowerCase(); - }, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'd\'o' : 'D\'O'; - } else { - return isLower ? 'd\'a' : 'D\'A'; - } - }, - calendar : { - sameDay : '[oxhi à] LT', - nextDay : '[demà à] LT', - nextWeek : 'dddd [à] LT', - lastDay : '[ieiri à] LT', - lastWeek : '[sür el] dddd [lasteu à] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'osprei %s', - past : 'ja%s', - s : processRelativeTime, - ss : processRelativeTime, - m : processRelativeTime, - mm : processRelativeTime, - h : processRelativeTime, - hh : processRelativeTime, - d : processRelativeTime, - dd : processRelativeTime, - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - 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. - } -}); - -function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 's': ['viensas secunds', '\'iensas secunds'], - 'ss': [number + ' secunds', '' + number + ' secunds'], - 'm': ['\'n míut', '\'iens míut'], - 'mm': [number + ' míuts', '' + number + ' míuts'], - 'h': ['\'n þora', '\'iensa þora'], - 'hh': [number + ' þoras', '' + number + ' þoras'], - 'd': ['\'n ziua', '\'iensa ziua'], - 'dd': [number + ' ziuas', '' + number + ' ziuas'], - 'M': ['\'n mes', '\'iens mes'], - 'MM': [number + ' mesen', '' + number + ' mesen'], - 'y': ['\'n ar', '\'iens ar'], - 'yy': [number + ' ars', '' + number + ' ars'] - }; - return isFuture ? format[key][0] : (withoutSuffix ? format[key][0] : format[key][1]); -} - diff --git a/src/locale/tzm-latn.js b/src/locale/tzm-latn.js deleted file mode 100644 index 6adf550485..0000000000 --- a/src/locale/tzm-latn.js +++ /dev/null @@ -1,50 +0,0 @@ -//! moment.js locale configuration -//! locale : Central Atlas Tamazight Latin [tzm-latn] -//! author : Abdel Said : https://github.com/abdelsaid - -import moment from '../moment'; - -export default moment.defineLocale('tzm-latn', { - months : 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split('_'), - monthsShort : 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split('_'), - weekdays : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), - weekdaysShort : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), - weekdaysMin : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.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: '[asdkh g] LT', - nextDay: '[aska g] LT', - nextWeek: 'dddd [g] LT', - lastDay: '[assant g] LT', - lastWeek: 'dddd [g] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'dadkh s yan %s', - past : 'yan %s', - s : 'imik', - ss : '%d imik', - m : 'minuḍ', - mm : '%d minuḍ', - h : 'saɛa', - hh : '%d tassaɛin', - d : 'ass', - dd : '%d ossan', - M : 'ayowr', - MM : '%d iyyirn', - y : 'asgas', - yy : '%d isgasn' - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } -}); - diff --git a/src/locale/tzm.js b/src/locale/tzm.js deleted file mode 100644 index ae7651d785..0000000000 --- a/src/locale/tzm.js +++ /dev/null @@ -1,50 +0,0 @@ -//! moment.js locale configuration -//! locale : Central Atlas Tamazight [tzm] -//! author : Abdel Said : https://github.com/abdelsaid - -import moment from '../moment'; - -export default moment.defineLocale('tzm', { - months : 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split('_'), - monthsShort : 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split('_'), - weekdays : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), - weekdaysShort : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), - weekdaysMin : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.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: '[ⴰⵙⴷⵅ ⴴ] LT', - nextDay: '[ⴰⵙⴽⴰ ⴴ] LT', - nextWeek: 'dddd [ⴴ] LT', - lastDay: '[ⴰⵚⴰⵏⵜ ⴴ] LT', - lastWeek: 'dddd [ⴴ] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s', - past : 'ⵢⴰⵏ %s', - s : 'ⵉⵎⵉⴽ', - ss : '%d ⵉⵎⵉⴽ', - m : 'ⵎⵉⵏⵓⴺ', - mm : '%d ⵎⵉⵏⵓⴺ', - h : 'ⵙⴰⵄⴰ', - hh : '%d ⵜⴰⵙⵙⴰⵄⵉⵏ', - d : 'ⴰⵙⵙ', - dd : '%d oⵙⵙⴰⵏ', - M : 'ⴰⵢoⵓⵔ', - MM : '%d ⵉⵢⵢⵉⵔⵏ', - y : 'ⴰⵙⴳⴰⵙ', - yy : '%d ⵉⵙⴳⴰⵙⵏ' - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 12th is the first week of the year. - } -}); - diff --git a/src/locale/ug-cn.js b/src/locale/ug-cn.js deleted file mode 100644 index 5a9a9fcffa..0000000000 --- a/src/locale/ug-cn.js +++ /dev/null @@ -1,110 +0,0 @@ -//! moment.js language configuration -//! locale : Uyghur (China) [ug-cn] -//! author: boyaq : https://github.com/boyaq - -import moment from '../moment'; - -export default moment.defineLocale('ug-cn', { - months: 'يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر'.split( - '_' - ), - monthsShort: 'يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر'.split( - '_' - ), - weekdays: 'يەكشەنبە_دۈشەنبە_سەيشەنبە_چارشەنبە_پەيشەنبە_جۈمە_شەنبە'.split( - '_' - ), - weekdaysShort: 'يە_دۈ_سە_چا_پە_جۈ_شە'.split('_'), - weekdaysMin: 'يە_دۈ_سە_چا_پە_جۈ_شە'.split('_'), - longDateFormat: { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L: 'YYYY-MM-DD', - LL: 'YYYY-يىلىM-ئاينىڭD-كۈنى', - LLL: 'YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm', - LLLL: 'dddd، YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm' - }, - meridiemParse: /يېرىم كېچە|سەھەر|چۈشتىن بۇرۇن|چۈش|چۈشتىن كېيىن|كەچ/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ( - meridiem === 'يېرىم كېچە' || - meridiem === 'سەھەر' || - meridiem === 'چۈشتىن بۇرۇن' - ) { - return hour; - } else if (meridiem === 'چۈشتىن كېيىن' || meridiem === 'كەچ') { - return hour + 12; - } else { - return hour >= 11 ? hour : hour + 12; - } - }, - meridiem: function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 600) { - return 'يېرىم كېچە'; - } else if (hm < 900) { - return 'سەھەر'; - } else if (hm < 1130) { - return 'چۈشتىن بۇرۇن'; - } else if (hm < 1230) { - return 'چۈش'; - } else if (hm < 1800) { - return 'چۈشتىن كېيىن'; - } else { - return 'كەچ'; - } - }, - calendar: { - sameDay: '[بۈگۈن سائەت] LT', - nextDay: '[ئەتە سائەت] LT', - nextWeek: '[كېلەركى] dddd [سائەت] LT', - lastDay: '[تۆنۈگۈن] LT', - lastWeek: '[ئالدىنقى] dddd [سائەت] LT', - sameElse: 'L' - }, - relativeTime: { - future: '%s كېيىن', - past: '%s بۇرۇن', - s: 'نەچچە سېكونت', - ss: '%d سېكونت', - m: 'بىر مىنۇت', - mm: '%d مىنۇت', - h: 'بىر سائەت', - hh: '%d سائەت', - d: 'بىر كۈن', - dd: '%d كۈن', - M: 'بىر ئاي', - MM: '%d ئاي', - y: 'بىر يىل', - yy: '%d يىل' - }, - - dayOfMonthOrdinalParse: /\d{1,2}(-كۈنى|-ئاي|-ھەپتە)/, - ordinal: function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '-كۈنى'; - case 'w': - case 'W': - return number + '-ھەپتە'; - default: - return number; - } - }, - preparse: function (string) { - return string.replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/,/g, '،'); - }, - week: { - // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效 - dow: 1, // Monday is the first day of the week. - doy: 7 // The week that contains Jan 1st is the first week of the year. - } -}); diff --git a/src/locale/uk.js b/src/locale/uk.js deleted file mode 100644 index 6b18bed83e..0000000000 --- a/src/locale/uk.js +++ /dev/null @@ -1,146 +0,0 @@ -//! moment.js locale configuration -//! locale : Ukrainian [uk] -//! author : zemlanin : https://github.com/zemlanin -//! Author : Menelion Elensúle : https://github.com/Oire - -import moment from '../moment'; - -function plural(word, num) { - var forms = word.split('_'); - return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]); -} -function relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'ss': withoutSuffix ? 'секунда_секунди_секунд' : 'секунду_секунди_секунд', - 'mm': withoutSuffix ? 'хвилина_хвилини_хвилин' : 'хвилину_хвилини_хвилин', - 'hh': withoutSuffix ? 'година_години_годин' : 'годину_години_годин', - 'dd': 'день_дні_днів', - 'MM': 'місяць_місяці_місяців', - 'yy': 'рік_роки_років' - }; - if (key === 'm') { - return withoutSuffix ? 'хвилина' : 'хвилину'; - } - else if (key === 'h') { - return withoutSuffix ? 'година' : 'годину'; - } - else { - return number + ' ' + plural(format[key], +number); - } -} -function weekdaysCaseReplace(m, format) { - var weekdays = { - 'nominative': 'неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота'.split('_'), - 'accusative': 'неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу'.split('_'), - 'genitive': 'неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи'.split('_') - }; - - if (m === true) { - return weekdays['nominative'].slice(1, 7).concat(weekdays['nominative'].slice(0, 1)); - } - if (!m) { - return weekdays['nominative']; - } - - var nounCase = (/(\[[ВвУу]\]) ?dddd/).test(format) ? - 'accusative' : - ((/\[?(?:минулої|наступної)? ?\] ?dddd/).test(format) ? - 'genitive' : - 'nominative'); - return weekdays[nounCase][m.day()]; -} -function processHoursFunction(str) { - return function () { - return str + 'о' + (this.hours() === 11 ? 'б' : '') + '] LT'; - }; -} - -export default moment.defineLocale('uk', { - months : { - 'format': 'січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня'.split('_'), - 'standalone': 'січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень'.split('_') - }, - monthsShort : 'січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд'.split('_'), - weekdays : weekdaysCaseReplace, - weekdaysShort : 'нд_пн_вт_ср_чт_пт_сб'.split('_'), - weekdaysMin : 'нд_пн_вт_ср_чт_пт_сб'.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: processHoursFunction('[Сьогодні '), - nextDay: processHoursFunction('[Завтра '), - lastDay: processHoursFunction('[Вчора '), - nextWeek: processHoursFunction('[У] dddd ['), - lastWeek: function () { - switch (this.day()) { - case 0: - case 3: - case 5: - case 6: - return processHoursFunction('[Минулої] dddd [').call(this); - case 1: - case 2: - case 4: - return processHoursFunction('[Минулого] dddd [').call(this); - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'за %s', - past : '%s тому', - s : 'декілька секунд', - ss : relativeTimeWithPlural, - m : relativeTimeWithPlural, - mm : relativeTimeWithPlural, - h : 'годину', - hh : relativeTimeWithPlural, - d : 'день', - dd : relativeTimeWithPlural, - M : 'місяць', - MM : relativeTimeWithPlural, - y : 'рік', - yy : relativeTimeWithPlural - }, - // M. E.: those two are virtually unused but a user might want to implement them for his/her website for some reason - meridiemParse: /ночі|ранку|дня|вечора/, - isPM: function (input) { - return /^(дня|вечора)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ночі'; - } else if (hour < 12) { - return 'ранку'; - } else if (hour < 17) { - return 'дня'; - } else { - return 'вечора'; - } - }, - dayOfMonthOrdinalParse: /\d{1,2}-(й|го)/, - ordinal: function (number, period) { - switch (period) { - case 'M': - case 'd': - case 'DDD': - case 'w': - case 'W': - return number + '-й'; - case 'D': - return number + '-го'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); diff --git a/src/locale/ur.js b/src/locale/ur.js deleted file mode 100644 index 56f1818431..0000000000 --- a/src/locale/ur.js +++ /dev/null @@ -1,90 +0,0 @@ -//! moment.js locale configuration -//! locale : Urdu [ur] -//! author : Sawood Alam : https://github.com/ibnesayeed -//! author : Zack : https://github.com/ZackVision - -import moment from '../moment'; - -var months = [ - 'جنوری', - 'فروری', - 'مارچ', - 'اپریل', - 'مئی', - 'جون', - 'جولائی', - 'اگست', - 'ستمبر', - 'اکتوبر', - 'نومبر', - 'دسمبر' -]; -var days = [ - 'اتوار', - 'پیر', - 'منگل', - 'بدھ', - 'جمعرات', - 'جمعہ', - 'ہفتہ' -]; - -export default moment.defineLocale('ur', { - months : months, - monthsShort : months, - weekdays : days, - weekdaysShort : days, - weekdaysMin : days, - 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: /صبح|شام/, - isPM : function (input) { - return 'شام' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'صبح'; - } - return 'شام'; - }, - calendar : { - sameDay : '[آج بوقت] LT', - nextDay : '[کل بوقت] LT', - nextWeek : 'dddd [بوقت] LT', - lastDay : '[گذشتہ روز بوقت] LT', - lastWeek : '[گذشتہ] dddd [بوقت] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s بعد', - past : '%s قبل', - s : 'چند سیکنڈ', - ss : '%d سیکنڈ', - m : 'ایک منٹ', - mm : '%d منٹ', - h : 'ایک گھنٹہ', - hh : '%d گھنٹے', - d : 'ایک دن', - dd : '%d دن', - M : 'ایک ماہ', - MM : '%d ماہ', - y : 'ایک سال', - yy : '%d سال' - }, - preparse: function (string) { - return string.replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/,/g, '،'); - }, - 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. - } -}); diff --git a/src/locale/uz-latn.js b/src/locale/uz-latn.js deleted file mode 100644 index 7dda237326..0000000000 --- a/src/locale/uz-latn.js +++ /dev/null @@ -1,50 +0,0 @@ -//! moment.js locale configuration -//! locale : Uzbek Latin [uz-latn] -//! author : Rasulbek Mirzayev : github.com/Rasulbeeek - -import moment from '../moment'; - -export default moment.defineLocale('uz-latn', { - months : 'Yanvar_Fevral_Mart_Aprel_May_Iyun_Iyul_Avgust_Sentabr_Oktabr_Noyabr_Dekabr'.split('_'), - monthsShort : 'Yan_Fev_Mar_Apr_May_Iyun_Iyul_Avg_Sen_Okt_Noy_Dek'.split('_'), - weekdays : 'Yakshanba_Dushanba_Seshanba_Chorshanba_Payshanba_Juma_Shanba'.split('_'), - weekdaysShort : 'Yak_Dush_Sesh_Chor_Pay_Jum_Shan'.split('_'), - weekdaysMin : 'Ya_Du_Se_Cho_Pa_Ju_Sha'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'D MMMM YYYY, dddd HH:mm' - }, - calendar : { - sameDay : '[Bugun soat] LT [da]', - nextDay : '[Ertaga] LT [da]', - nextWeek : 'dddd [kuni soat] LT [da]', - lastDay : '[Kecha soat] LT [da]', - lastWeek : '[O\'tgan] dddd [kuni soat] LT [da]', - sameElse : 'L' - }, - relativeTime : { - future : 'Yaqin %s ichida', - past : 'Bir necha %s oldin', - s : 'soniya', - ss : '%d soniya', - m : 'bir daqiqa', - mm : '%d daqiqa', - h : 'bir soat', - hh : '%d soat', - d : 'bir kun', - dd : '%d kun', - M : 'bir oy', - MM : '%d oy', - y : 'bir yil', - yy : '%d yil' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 7th is the first week of the year. - } -}); - diff --git a/src/locale/uz.js b/src/locale/uz.js deleted file mode 100644 index ff0f7ca2c2..0000000000 --- a/src/locale/uz.js +++ /dev/null @@ -1,50 +0,0 @@ -//! moment.js locale configuration -//! locale : Uzbek [uz] -//! author : Sardor Muminov : https://github.com/muminoff - -import moment from '../moment'; - -export default moment.defineLocale('uz', { - months : 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split('_'), - monthsShort : 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'), - weekdays : 'Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба'.split('_'), - weekdaysShort : 'Якш_Душ_Сеш_Чор_Пай_Жум_Шан'.split('_'), - weekdaysMin : 'Як_Ду_Се_Чо_Па_Жу_Ша'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'D MMMM YYYY, dddd HH:mm' - }, - calendar : { - sameDay : '[Бугун соат] LT [да]', - nextDay : '[Эртага] LT [да]', - nextWeek : 'dddd [куни соат] LT [да]', - lastDay : '[Кеча соат] LT [да]', - lastWeek : '[Утган] dddd [куни соат] LT [да]', - sameElse : 'L' - }, - relativeTime : { - future : 'Якин %s ичида', - past : 'Бир неча %s олдин', - s : 'фурсат', - ss : '%d фурсат', - m : 'бир дакика', - mm : '%d дакика', - h : 'бир соат', - hh : '%d соат', - d : 'бир кун', - dd : '%d кун', - M : 'бир ой', - MM : '%d ой', - y : 'бир йил', - yy : '%d йил' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/locale/vi.js b/src/locale/vi.js deleted file mode 100644 index ad7f4b08ee..0000000000 --- a/src/locale/vi.js +++ /dev/null @@ -1,71 +0,0 @@ -//! moment.js locale configuration -//! locale : Vietnamese [vi] -//! author : Bang Nguyen : https://github.com/bangnk - -import moment from '../moment'; - -export default moment.defineLocale('vi', { - months : 'tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12'.split('_'), - monthsShort : 'Th01_Th02_Th03_Th04_Th05_Th06_Th07_Th08_Th09_Th10_Th11_Th12'.split('_'), - monthsParseExact : true, - weekdays : 'chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy'.split('_'), - weekdaysShort : 'CN_T2_T3_T4_T5_T6_T7'.split('_'), - weekdaysMin : 'CN_T2_T3_T4_T5_T6_T7'.split('_'), - weekdaysParseExact : true, - meridiemParse: /sa|ch/i, - isPM : function (input) { - return /^ch$/i.test(input); - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 12) { - return isLower ? 'sa' : 'SA'; - } else { - return isLower ? 'ch' : 'CH'; - } - }, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM [năm] YYYY', - LLL : 'D MMMM [năm] YYYY HH:mm', - LLLL : 'dddd, D MMMM [năm] YYYY HH:mm', - l : 'DD/M/YYYY', - ll : 'D MMM YYYY', - lll : 'D MMM YYYY HH:mm', - llll : 'ddd, D MMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Hôm nay lúc] LT', - nextDay: '[Ngày mai lúc] LT', - nextWeek: 'dddd [tuần tới lúc] LT', - lastDay: '[Hôm qua lúc] LT', - lastWeek: 'dddd [tuần rồi lúc] LT', - sameElse: 'L' - }, - relativeTime : { - future : '%s tới', - past : '%s trước', - s : 'vài giây', - ss : '%d giây' , - m : 'một phút', - mm : '%d phút', - h : 'một giờ', - hh : '%d giờ', - d : 'một ngày', - dd : '%d ngày', - M : 'một tháng', - MM : '%d tháng', - y : 'một năm', - yy : '%d năm' - }, - dayOfMonthOrdinalParse: /\d{1,2}/, - ordinal : function (number) { - return number; - }, - 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. - } -}); - diff --git a/src/locale/x-pseudo.js b/src/locale/x-pseudo.js deleted file mode 100644 index c50320d636..0000000000 --- a/src/locale/x-pseudo.js +++ /dev/null @@ -1,59 +0,0 @@ -//! moment.js locale configuration -//! locale : Pseudo [x-pseudo] -//! author : Andrew Hood : https://github.com/andrewhood125 - -import moment from '../moment'; - -export default moment.defineLocale('x-pseudo', { - months : 'J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér'.split('_'), - monthsShort : 'J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc'.split('_'), - monthsParseExact : true, - weekdays : 'S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý'.split('_'), - weekdaysShort : 'S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát'.split('_'), - weekdaysMin : 'S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[T~ódá~ý át] LT', - nextDay : '[T~ómó~rró~w át] LT', - nextWeek : 'dddd [át] LT', - lastDay : '[Ý~ést~érdá~ý át] LT', - lastWeek : '[L~ást] dddd [át] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'í~ñ %s', - past : '%s á~gó', - s : 'á ~féw ~sécó~ñds', - ss : '%d s~écóñ~ds', - m : 'á ~míñ~úté', - mm : '%d m~íñú~tés', - h : 'á~ñ hó~úr', - hh : '%d h~óúrs', - d : 'á ~dáý', - dd : '%d d~áýs', - M : 'á ~móñ~th', - MM : '%d m~óñt~hs', - y : 'á ~ýéár', - yy : '%d ý~éárs' - }, - dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, - 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. - } -}); diff --git a/src/locale/yo.js b/src/locale/yo.js deleted file mode 100644 index dcd6cd24a2..0000000000 --- a/src/locale/yo.js +++ /dev/null @@ -1,51 +0,0 @@ -//! moment.js locale configuration -//! locale : Yoruba Nigeria [yo] -//! author : Atolagbe Abisoye : https://github.com/andela-batolagbe - -import moment from '../moment'; - -export default moment.defineLocale('yo', { - months : 'Sẹ́rẹ́_Èrèlè_Ẹrẹ̀nà_Ìgbé_Èbibi_Òkùdu_Agẹmo_Ògún_Owewe_Ọ̀wàrà_Bélú_Ọ̀pẹ̀̀'.split('_'), - monthsShort : 'Sẹ́r_Èrl_Ẹrn_Ìgb_Èbi_Òkù_Agẹ_Ògú_Owe_Ọ̀wà_Bél_Ọ̀pẹ̀̀'.split('_'), - weekdays : 'Àìkú_Ajé_Ìsẹ́gun_Ọjọ́rú_Ọjọ́bọ_Ẹtì_Àbámẹ́ta'.split('_'), - weekdaysShort : 'Àìk_Ajé_Ìsẹ́_Ọjr_Ọjb_Ẹtì_Àbá'.split('_'), - weekdaysMin : 'Àì_Aj_Ìs_Ọr_Ọb_Ẹt_Àb'.split('_'), - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[Ònì ni] LT', - nextDay : '[Ọ̀la ni] LT', - nextWeek : 'dddd [Ọsẹ̀ tón\'bọ] [ni] LT', - lastDay : '[Àna ni] LT', - lastWeek : 'dddd [Ọsẹ̀ tólọ́] [ni] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ní %s', - past : '%s kọjá', - s : 'ìsẹjú aayá die', - ss :'aayá %d', - m : 'ìsẹjú kan', - mm : 'ìsẹjú %d', - h : 'wákati kan', - hh : 'wákati %d', - d : 'ọjọ́ kan', - dd : 'ọjọ́ %d', - M : 'osù kan', - MM : 'osù %d', - y : 'ọdún kan', - yy : 'ọdún %d' - }, - dayOfMonthOrdinalParse : /ọjọ́\s\d{1,2}/, - ordinal : 'ọjọ́ %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. - } -}); diff --git a/src/locale/zh-cn.js b/src/locale/zh-cn.js deleted file mode 100644 index d9e6e7e2a2..0000000000 --- a/src/locale/zh-cn.js +++ /dev/null @@ -1,102 +0,0 @@ -//! moment.js locale configuration -//! locale : Chinese (China) [zh-cn] -//! author : suupic : https://github.com/suupic -//! author : Zeno Zeng : https://github.com/zenozeng - -import moment from '../moment'; - -export default moment.defineLocale('zh-cn', { - months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), - weekdaysShort : '周日_周一_周二_周三_周四_周五_周六'.split('_'), - weekdaysMin : '日_一_二_三_四_五_六'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY/MM/DD', - LL : 'YYYY年M月D日', - LLL : 'YYYY年M月D日Ah点mm分', - LLLL : 'YYYY年M月D日ddddAh点mm分', - l : 'YYYY/M/D', - ll : 'YYYY年M月D日', - lll : 'YYYY年M月D日 HH:mm', - llll : 'YYYY年M月D日dddd HH:mm' - }, - meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === '凌晨' || meridiem === '早上' || - meridiem === '上午') { - return hour; - } else if (meridiem === '下午' || meridiem === '晚上') { - return hour + 12; - } else { - // '中午' - return hour >= 11 ? hour : hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 600) { - return '凌晨'; - } else if (hm < 900) { - return '早上'; - } else if (hm < 1130) { - return '上午'; - } else if (hm < 1230) { - return '中午'; - } else if (hm < 1800) { - return '下午'; - } else { - return '晚上'; - } - }, - calendar : { - sameDay : '[今天]LT', - nextDay : '[明天]LT', - nextWeek : '[下]ddddLT', - lastDay : '[昨天]LT', - lastWeek : '[上]ddddLT', - sameElse : 'L' - }, - dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/, - ordinal : function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '日'; - case 'M': - return number + '月'; - case 'w': - case 'W': - return number + '周'; - default: - return number; - } - }, - relativeTime : { - future : '%s内', - past : '%s前', - s : '几秒', - ss : '%d 秒', - m : '1 分钟', - mm : '%d 分钟', - h : '1 小时', - hh : '%d 小时', - d : '1 天', - dd : '%d 天', - M : '1 个月', - MM : '%d 个月', - y : '1 年', - yy : '%d 年' - }, - week : { - // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效 - 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. - } -}); diff --git a/src/locale/zh-hk.js b/src/locale/zh-hk.js deleted file mode 100644 index 99435414e4..0000000000 --- a/src/locale/zh-hk.js +++ /dev/null @@ -1,96 +0,0 @@ -//! moment.js locale configuration -//! locale : Chinese (Hong Kong) [zh-hk] -//! author : Ben : https://github.com/ben-lin -//! author : Chris Lam : https://github.com/hehachris -//! author : Konstantin : https://github.com/skfd - -import moment from '../moment'; - -export default moment.defineLocale('zh-hk', { - months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), - weekdaysShort : '週日_週一_週二_週三_週四_週五_週六'.split('_'), - weekdaysMin : '日_一_二_三_四_五_六'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY/MM/DD', - LL : 'YYYY年M月D日', - LLL : 'YYYY年M月D日 HH:mm', - LLLL : 'YYYY年M月D日dddd HH:mm', - l : 'YYYY/M/D', - ll : 'YYYY年M月D日', - lll : 'YYYY年M月D日 HH:mm', - llll : 'YYYY年M月D日dddd HH:mm' - }, - meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') { - return hour; - } else if (meridiem === '中午') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === '下午' || meridiem === '晚上') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 600) { - return '凌晨'; - } else if (hm < 900) { - return '早上'; - } else if (hm < 1130) { - return '上午'; - } else if (hm < 1230) { - return '中午'; - } else if (hm < 1800) { - return '下午'; - } else { - return '晚上'; - } - }, - calendar : { - sameDay : '[今天]LT', - nextDay : '[明天]LT', - nextWeek : '[下]ddddLT', - lastDay : '[昨天]LT', - lastWeek : '[上]ddddLT', - sameElse : 'L' - }, - dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/, - ordinal : function (number, period) { - switch (period) { - case 'd' : - case 'D' : - case 'DDD' : - return number + '日'; - case 'M' : - return number + '月'; - case 'w' : - case 'W' : - return number + '週'; - default : - return number; - } - }, - relativeTime : { - future : '%s內', - past : '%s前', - s : '幾秒', - ss : '%d 秒', - m : '1 分鐘', - mm : '%d 分鐘', - h : '1 小時', - hh : '%d 小時', - d : '1 天', - dd : '%d 天', - M : '1 個月', - MM : '%d 個月', - y : '1 年', - yy : '%d 年' - } -}); diff --git a/src/locale/zh-tw.js b/src/locale/zh-tw.js deleted file mode 100644 index 5ad0d9ca04..0000000000 --- a/src/locale/zh-tw.js +++ /dev/null @@ -1,95 +0,0 @@ -//! moment.js locale configuration -//! locale : Chinese (Taiwan) [zh-tw] -//! author : Ben : https://github.com/ben-lin -//! author : Chris Lam : https://github.com/hehachris - -import moment from '../moment'; - -export default moment.defineLocale('zh-tw', { - months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), - weekdaysShort : '週日_週一_週二_週三_週四_週五_週六'.split('_'), - weekdaysMin : '日_一_二_三_四_五_六'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY/MM/DD', - LL : 'YYYY年M月D日', - LLL : 'YYYY年M月D日 HH:mm', - LLLL : 'YYYY年M月D日dddd HH:mm', - l : 'YYYY/M/D', - ll : 'YYYY年M月D日', - lll : 'YYYY年M月D日 HH:mm', - llll : 'YYYY年M月D日dddd HH:mm' - }, - meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') { - return hour; - } else if (meridiem === '中午') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === '下午' || meridiem === '晚上') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 600) { - return '凌晨'; - } else if (hm < 900) { - return '早上'; - } else if (hm < 1130) { - return '上午'; - } else if (hm < 1230) { - return '中午'; - } else if (hm < 1800) { - return '下午'; - } else { - return '晚上'; - } - }, - calendar : { - sameDay : '[今天] LT', - nextDay : '[明天] LT', - nextWeek : '[下]dddd LT', - lastDay : '[昨天] LT', - lastWeek : '[上]dddd LT', - sameElse : 'L' - }, - dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/, - ordinal : function (number, period) { - switch (period) { - case 'd' : - case 'D' : - case 'DDD' : - return number + '日'; - case 'M' : - return number + '月'; - case 'w' : - case 'W' : - return number + '週'; - default : - return number; - } - }, - relativeTime : { - future : '%s內', - past : '%s前', - s : '幾秒', - ss : '%d 秒', - m : '1 分鐘', - mm : '%d 分鐘', - h : '1 小時', - hh : '%d 小時', - d : '1 天', - dd : '%d 天', - M : '1 個月', - MM : '%d 個月', - y : '1 年', - yy : '%d 年' - } -}); diff --git a/src/test/locale/af.js b/src/test/locale/af.js deleted file mode 100644 index f6523e7dd2..0000000000 --- a/src/test/locale/af.js +++ /dev/null @@ -1,211 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('af'); - -test('parse', function (assert) { - var tests = 'Januarie Jan_Februarie Feb_Maart Mrt_April Apr_Mei Mei_Junie Jun_Julie Jul_Augustus 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); - 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', 'Sondag, Februarie 14de 2010, 3:25:50 nm'], - ['ddd, hA', 'Son, 3NM'], - ['M Mo MM MMMM MMM', '2 2de 02 Februarie Feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14de 14'], - ['d do dddd ddd dd', '0 0de Sondag Son So'], - ['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', 'nm NM'], - ['[the] DDDo [day of the year]', 'the 45ste day of the year'], - ['LT', '15:25'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 Februarie 2010'], - ['LLL', '14 Februarie 2010 15:25'], - ['LLLL', 'Sondag, 14 Februarie 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Feb 2010'], - ['lll', '14 Feb 2010 15:25'], - ['llll', 'Son, 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 = 'Januarie Jan_Februarie Feb_Maart Mrt_April Apr_Mei Mei_Junie Jun_Julie Jul_Augustus 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 expected = 'Sondag Son So_Maandag Maa Ma_Dinsdag Din Di_Woensdag Woe Wo_Donderdag Don Do_Vrydag Vry Vr_Saterdag 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]); - } -}); - -test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), '\'n paar sekondes', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), '\'n minuut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '\'n minuut', '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 minute', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), '\'n uur', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '\'n uur', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 ure', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ure', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 ure', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), '\'n dag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '\'n dag', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dae', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), '\'n dag', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dae', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dae', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), '\'n maand', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '\'n maand', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '\'n maand', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 maande', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 maande', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 maande', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), '\'n maand', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 maande', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), '\'n jaar', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 jaar', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), '\'n jaar', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 jaar', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'oor \'n paar sekondes', 'prefix'); - assert.equal(moment(0).from(30000), '\'n paar sekondes gelede', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), '\'n paar sekondes gelede', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'oor \'n paar sekondes', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'oor 5 dae', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Vandag om 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Vandag om 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Vandag om 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Môre om 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Vandag om 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Gister 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('[Laas] dddd [om] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Laas] dddd [om] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Laas] 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('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'); -}); - diff --git a/src/test/locale/ar-dz.js b/src/test/locale/ar-dz.js deleted file mode 100644 index c6b4cb39c9..0000000000 --- a/src/test/locale/ar-dz.js +++ /dev/null @@ -1,211 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('ar-dz'); - -test('parse', function (assert) { - 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); - 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', 'الأحد, فيفري 14 2010, 3:25:50 pm'], - ['ddd, hA', 'احد, 3PM'], - ['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', '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'], - ['LT', '15:25'], - ['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; - 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 = 'جانفي جانفي_فيفري فيفري_مارس مارس_أفريل أفريل_ماي ماي_جوان جوان_جويلية جويلية_أوت أوت_سبتمبر سبتمبر_أكتوبر أكتوبر_نوفمبر نوفمبر_ديسمبر ديسمبر'.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; - 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), 'ثوان', '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), '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: 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), 'في ثوان', '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'); -}); - -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'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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([2016, 1, 4]).format('w ww wo'), '5 05 5', 'Feb 4 2016 should be week 5'); - assert.equal(moment([2016, 0, 6]).format('w ww wo'), '1 01 1', 'Jan 6 2016 should be week 1'); - assert.equal(moment([2016, 0, 7]).format('w ww wo'), '1 01 1', 'Jan 7 2016 should be week 1'); - assert.equal(moment([2016, 0, 13]).format('w ww wo'), '2 02 2', 'Jan 13 2016 should be week 2'); - assert.equal(moment([2016, 0, 14]).format('w ww wo'), '2 02 2', 'Jan 14 2016 should be week 2'); -}); - diff --git a/src/test/locale/ar-kw.js b/src/test/locale/ar-kw.js deleted file mode 100644 index 0de32c4949..0000000000 --- a/src/test/locale/ar-kw.js +++ /dev/null @@ -1,210 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('ar-kw'); - -test('parse', function (assert) { - 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); - 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', 'الأحد, فبراير 14 2010, 3:25:50 pm'], - ['ddd, hA', 'احد, 3PM'], - ['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', '9 9 09'], - ['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'], - ['LT', '15:25'], - ['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; - 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 = 'يناير يناير_فبراير فبراير_مارس مارس_أبريل أبريل_ماي ماي_يونيو يونيو_يوليوز يوليوز_غشت غشت_شتنبر شتنبر_أكتوبر أكتوبر_نونبر نونبر_دجنبر دجنبر'.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; - 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), 'ثوان', '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), '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: 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), 'في ثوان', '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'); -}); - -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'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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([2011, 11, 31]).format('w ww wo'), '1 01 1', 'Dec 31 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '2 02 2', 'Jan 1 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '3 03 3', 'Jan 8 2012 should be week 3'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '3 03 3', 'Jan 14 2012 should be week 3'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '4 04 4', 'Jan 15 2012 should be week 4'); -}); diff --git a/src/test/locale/ar-ly.js b/src/test/locale/ar-ly.js deleted file mode 100644 index ee260f3680..0000000000 --- a/src/test/locale/ar-ly.js +++ /dev/null @@ -1,252 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('ar-ly'); - -var months = [ - 'يناير', - 'فبراير', - 'مارس', - 'أبريل', - 'مايو', - 'يونيو', - 'يوليو', - 'أغسطس', - 'سبتمبر', - 'أكتوبر', - 'نوفمبر', - 'ديسمبر' -]; - -test('parse', function (assert) { - var tests = months, 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()); - } - for (i = 0; i < 12; i++) { - equalTest(tests[i], 'MMM', i); - equalTest(tests[i], 'MMM', i); - equalTest(tests[i], 'MMMM', i); - equalTest(tests[i], 'MMMM', i); - equalTest(tests[i].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i].toLocaleUpperCase(), 'MMMM', i); - } -}); - -test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'الأحد، فبراير 14 2010، 3:25:50 م'], - ['ddd, hA', 'أحد، 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'], - ['LT', '15:25'], - ['LTS', '15:25:50'], - ['L', '14/\u200f2/\u200f2010'], - ['LL', '14 فبراير 2010'], - ['LLL', '14 فبراير 2010 15:25'], - ['LLLL', 'الأحد 14 فبراير 2010 15:25'], - ['l', '14/\u200f2/\u200f2010'], - ['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; - 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 = months, i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM'), expected[i], expected[i]); - assert.equal(moment([2011, i, 1]).format('MMM'), expected[i], expected[i]); - } -}); - -test('format week', function (assert) { - 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]); - } -}); - -test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), '44 ثانية', '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 دقيقة', '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({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), 'بعد 30 ثانية', 'prefix'); - assert.equal(moment(0).from(30000), 'منذ 30 ثانية', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'منذ ثانية واحدة', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'بعد 30 ثانية', 'in a few 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(), 'اليوم عند الساعة 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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 wednesday custom', function (assert) { - assert.equal(moment('2003 1 6', 'gggg w d').format('YYYY-MM-DD'), '2002-12-28', 'Week 1 of 2003 should be Dec 28 2002'); - assert.equal(moment('2003 1 0', 'gggg w e').format('YYYY-MM-DD'), '2002-12-28', 'Week 1 of 2003 should be Dec 28 2002'); - assert.equal(moment('2003 1 6', 'gggg w d').format('gggg w d'), '2003 1 6', 'Saturday of week 1 of 2003 parsed should be formatted as 2003 1 6'); - assert.equal(moment('2003 1 0', 'gggg w e').format('gggg w e'), '2003 1 0', '1st day of week 1 of 2003 parsed should be formatted as 2003 1 0'); -}); - -test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 31]).format('w ww wo'), '1 01 1', 'Dec 31 2011 should be week 1'); - assert.equal(moment([2012, 0, 6]).format('w ww wo'), '1 01 1', 'Jan 6 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '2 02 2', 'Jan 7 2012 should be week 2'); - assert.equal(moment([2012, 0, 13]).format('w ww wo'), '2 02 2', 'Jan 13 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '3 03 3', 'Jan 14 2012 should be week 3'); -}); - -test('no leading zeros in long date formats', function (assert) { - var i, j, longDateStr, shortDateStr; - for (i = 1; i <= 9; ++i) { - for (j = 1; j <= 9; ++j) { - longDateStr = moment([2014, i, j]).format('L'); - shortDateStr = moment([2014, i, j]).format('l'); - assert.equal(longDateStr, shortDateStr, 'should not have leading zeros in month or day'); - } - } -}); - -// locale-specific -test('ar-ly strict mode parsing works', function (assert) { - var m, formattedDate; - m = moment().locale('ar-ly'); - formattedDate = m.format('l'); - assert.equal(moment.utc(formattedDate, 'l', 'ar-ly', false).isValid(), true, 'Non-strict parsing works'); - assert.equal(moment.utc(formattedDate, 'l', 'ar-ly', true).isValid(), true,'Strict parsing must work'); -}); diff --git a/src/test/locale/ar-ma.js b/src/test/locale/ar-ma.js deleted file mode 100644 index d7b924d33c..0000000000 --- a/src/test/locale/ar-ma.js +++ /dev/null @@ -1,211 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('ar-ma'); - -test('parse', function (assert) { - 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); - 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', 'الأحد, فبراير 14 2010, 3:25:50 pm'], - ['ddd, hA', 'احد, 3PM'], - ['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', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45 day of the year'], - ['LT', '15:25'], - ['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; - 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 = 'يناير يناير_فبراير فبراير_مارس مارس_أبريل أبريل_ماي ماي_يونيو يونيو_يوليوز يوليوز_غشت غشت_شتنبر شتنبر_أكتوبر أكتوبر_نونبر نونبر_دجنبر دجنبر'.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; - 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), 'ثوان', '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), '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: 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), 'في ثوان', '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'); -}); - -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'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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([2011, 11, 31]).format('w ww wo'), '1 01 1', 'Dec 31 2011 should be week 1'); - assert.equal(moment([2012, 0, 6]).format('w ww wo'), '1 01 1', 'Jan 6 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '2 02 2', 'Jan 7 2012 should be week 2'); - assert.equal(moment([2012, 0, 13]).format('w ww wo'), '2 02 2', 'Jan 13 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '3 03 3', 'Jan 14 2012 should be week 3'); -}); - diff --git a/src/test/locale/ar-sa.js b/src/test/locale/ar-sa.js deleted file mode 100644 index a17ffe395a..0000000000 --- a/src/test/locale/ar-sa.js +++ /dev/null @@ -1,218 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('ar-sa'); - -test('parse', function (assert) { - var tests = 'يناير:يناير_فبراير:فبراير_مارس:مارس_أبريل:أبريل_مايو:مايو_يونيو:يونيو_يوليو:يوليو_أغسطس:أغسطس_سبتمبر:سبتمبر_أكتوبر:أكتوبر_نوفمبر:نوفمبر_ديسمبر:ديسمبر'.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()); - } - 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', 'الأحد، فبراير ١٤ ٢٠١٠، ٣:٢٥:٥٠ م'], - ['ddd, hA', 'أحد، ٣م'], - ['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', 'م م'], - ['[the] DDDo [day of the year]', 'the ٤٥ day of the year'], - ['LT', '١٥:٢٥'], - ['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'); - 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'); - 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'); - 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'); -}); - -test('format month', function (assert) { - 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; - 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), 'ثوان', '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'); -}); - -test('now from now', function (assert) { - 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(), 'في ٥ أيام', '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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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 wednesday custom', function (assert) { - assert.equal(moment('2003 1 6', 'gggg w d').format('YYYY-MM-DD'), '٢٠٠٣-٠١-٠٤', '2003 1 6 : gggg w d'); - assert.equal(moment('2003 1 0', 'gggg w e').format('YYYY-MM-DD'), '٢٠٠٢-١٢-٢٩', '2003 1 0 : gggg w e'); - assert.equal(moment('2003 1 6', 'gggg w d').format('gggg w d'), '٢٠٠٣ ١ ٦', '2003 1 6 : gggg w d'); - assert.equal(moment('2003 1 0', 'gggg w e').format('gggg w e'), '٢٠٠٣ ١ ٠', '2003 1 0 : gggg w e'); -}); - -test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 31]).format('w ww wo'), '٥٣ ٥٣ ٥٣', '2011 11 31'); - assert.equal(moment([2012, 0, 6]).format('w ww wo'), '١ ٠١ ١', '2012 0 6'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '١ ٠١ ١', '2012 0 7'); - assert.equal(moment([2012, 0, 13]).format('w ww wo'), '٢ ٠٢ ٢', '2012 0 13'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '٢ ٠٢ ٢', '2012 0 14'); -}); - diff --git a/src/test/locale/ar-tn.js b/src/test/locale/ar-tn.js deleted file mode 100644 index 89b49724c7..0000000000 --- a/src/test/locale/ar-tn.js +++ /dev/null @@ -1,287 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('ar-tn'); - -test('parse', function (assert) { - 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); - 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', 'الأحد, فيفري 14 2010, 3:25:50 pm'], - ['ddd, hA', 'أحد, 3PM'], - ['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', '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'], - ['LT', '15:25'], - ['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; - 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 = 'جانفي جانفي_فيفري فيفري_مارس مارس_أفريل أفريل_ماي ماي_جوان جوان_جويلية جويلية_أوت أوت_سبتمبر سبتمبر_أكتوبر أكتوبر_نوفمبر نوفمبر_ديسمبر ديسمبر'.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; - 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), 'ثوان', '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), '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: 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), 'في ثوان', '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'); -}); - -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'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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 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'); -}); - diff --git a/src/test/locale/ar.js b/src/test/locale/ar.js deleted file mode 100644 index 1a67cf1679..0000000000 --- a/src/test/locale/ar.js +++ /dev/null @@ -1,252 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('ar'); - -var months = [ - 'يناير', - 'فبراير', - 'مارس', - 'أبريل', - 'مايو', - 'يونيو', - 'يوليو', - 'أغسطس', - 'سبتمبر', - 'أكتوبر', - 'نوفمبر', - 'ديسمبر' -]; - -test('parse', function (assert) { - var tests = months, 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()); - } - for (i = 0; i < 12; i++) { - equalTest(tests[i], 'MMM', i); - equalTest(tests[i], 'MMM', i); - equalTest(tests[i], 'MMMM', i); - equalTest(tests[i], 'MMMM', i); - equalTest(tests[i].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i].toLocaleUpperCase(), 'MMMM', i); - } -}); - -test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'الأحد، فبراير ١٤ ٢٠١٠، ٣:٢٥:٥٠ م'], - ['ddd, hA', 'أحد، ٣م'], - ['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', 'م م'], - ['[the] DDDo [day of the year]', 'the ٤٥ day of the year'], - ['LT', '١٥:٢٥'], - ['LTS', '١٥:٢٥:٥٠'], - ['L', '١٤/\u200f٢/\u200f٢٠١٠'], - ['LL', '١٤ فبراير ٢٠١٠'], - ['LLL', '١٤ فبراير ٢٠١٠ ١٥:٢٥'], - ['LLLL', 'الأحد ١٤ فبراير ٢٠١٠ ١٥:٢٥'], - ['l', '١٤/\u200f٢/\u200f٢٠١٠'], - ['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'); - 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'); - 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'); - 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'); -}); - -test('format month', function (assert) { - var expected = months, i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM'), expected[i], expected[i]); - assert.equal(moment([2011, i, 1]).format('MMM'), expected[i], expected[i]); - } -}); - -test('format week', function (assert) { - 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]); - } -}); - -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'); -}); - -test('suffix', function (assert) { - 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'); -}); - -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'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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 wednesday custom', function (assert) { - assert.equal(moment('2003 1 6', 'gggg w d').format('YYYY-MM-DD'), '٢٠٠٢-١٢-٢٨', 'Week 1 of 2003 should be Dec 28 2002'); - assert.equal(moment('2003 1 0', 'gggg w e').format('YYYY-MM-DD'), '٢٠٠٢-١٢-٢٨', 'Week 1 of 2003 should be Dec 28 2002'); - assert.equal(moment('2003 1 6', 'gggg w d').format('gggg w d'), '٢٠٠٣ ١ ٦', 'Saturday of week 1 of 2003 parsed should be formatted as 2003 1 6'); - assert.equal(moment('2003 1 0', 'gggg w e').format('gggg w e'), '٢٠٠٣ ١ ٠', '1st day of week 1 of 2003 parsed should be formatted as 2003 1 0'); -}); - -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'); -}); - -test('no leading zeros in long date formats', function (assert) { - var i, j, longDateStr, shortDateStr; - for (i = 1; i <= 9; ++i) { - for (j = 1; j <= 9; ++j) { - longDateStr = moment([2014, i, j]).format('L'); - shortDateStr = moment([2014, i, j]).format('l'); - assert.equal(longDateStr, shortDateStr, 'should not have leading zeros in month or day'); - } - } -}); - -// locale-specific -test('ar strict mode parsing works', function (assert) { - var m, formattedDate; - m = moment().locale('ar'); - formattedDate = m.format('l'); - assert.equal(moment.utc(formattedDate, 'l', 'ar', false).isValid(), true, 'Non-strict parsing works'); - assert.equal(moment.utc(formattedDate, 'l', 'ar', true).isValid(), true,'Strict parsing must work'); -}); diff --git a/src/test/locale/az.js b/src/test/locale/az.js deleted file mode 100644 index f152420769..0000000000 --- a/src/test/locale/az.js +++ /dev/null @@ -1,221 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('az'); - -test('parse', function (assert) { - var tests = 'yanvar yan_fevral fev_mart mar_Aprel apr_may may_iyun iyn_iyul iyl_Avqust avq_sentyabr sen_oktyabr okt_noyabr noy_dekabr dek'.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, D MMMM YYYY, HH:mm:ss', 'Bazar, 14 fevral 2010, 15:25:50'], - ['ddd, A h', 'Baz, gündüz 3'], - ['M Mo MM MMMM MMM', '2 2-nci 02 fevral fev'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14-üncü 14'], - ['d do dddd ddd dd', '0 0-ıncı Bazar Baz Bz'], - ['DDD DDDo DDDD', '45 45-inci 045'], - ['w wo ww', '7 7-nci 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'gündüz gündüz'], - ['[ilin] DDDo [günü]', 'ilin 45-inci günü'], - ['LT', '15:25'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 fevral 2010'], - ['LLL', '14 fevral 2010 15:25'], - ['LLLL', 'Bazar, 14 fevral 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14 fev 2010'], - ['lll', '14 fev 2010 15:25'], - ['llll', 'Baz, 14 fev 2010 15:25'] - ], - DDDo = [ - [359, '360-ıncı'], - [199, '200-üncü'], - [149, '150-nci'] - ], - dt = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - DDDoDt, - i; - - for (i = 0; i < a.length; i++) { - assert.equal(dt.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - for (i = 0; i < DDDo.length; i++) { - DDDoDt = moment([2010]); - assert.equal(DDDoDt.add(DDDo[i][0], 'days').format('DDDo'), DDDo[i][1], DDDo[i][0] + ' ---> ' + DDDo[i][1]); - } -}); - -test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1-inci', '1st'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2-nci', '2nd'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3-üncü', '3rd'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4-üncü', '4th'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5-inci', '5th'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6-ncı', '6th'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7-nci', '7th'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8-inci', '8th'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9-uncu', '9th'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10-uncu', '10th'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11-inci', '11th'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12-nci', '12th'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13-üncü', '13th'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14-üncü', '14th'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15-inci', '15th'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16-ncı', '16th'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17-nci', '17th'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18-inci', '18th'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19-uncu', '19th'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20-nci', '20th'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21-inci', '21th'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22-nci', '22th'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23-üncü', '23th'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24-üncü', '24th'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25-inci', '25th'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26-ncı', '26th'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27-nci', '27th'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28-inci', '28th'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29-uncu', '29th'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30-uncu', '30th'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31-inci', '31st'); -}); - -test('format month', function (assert) { - var expected = 'yanvar yan_fevral fev_mart mar_aprel apr_may may_iyun iyn_iyul iyl_avqust avq_sentyabr sen_oktyabr okt_noyabr noy_dekabr dek'.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 = 'Bazar Baz Bz_Bazar ertəsi BzE BE_Çərşənbə axşamı ÇAx ÇA_Çərşənbə Çər Çə_Cümə axşamı CAx CA_Cümə Cüm Cü_Şənbə Şən Şə'.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), 'birneçə saniyə', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'bir dəqiqə', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'bir dəqiqə', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 dəqiqə', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 dəqiqə', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'bir saat', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'bir saat', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 saat', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 saat', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 saat', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'bir gün', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'bir gün', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 gün', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'bir gün', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 gün', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 gün', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'bir ay', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'bir ay', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 ay', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 ay', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 ay', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'bir ay', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 ay', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'bir il', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 il', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'bir il', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 il', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'birneçə saniyə sonra', 'prefix'); - assert.equal(moment(0).from(30000), 'birneçə saniyə əvvəl', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'birneçə saniyə əvvəl', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'birneçə saniyə sonra', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5 gün sonra', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'bugün saat 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'bugün saat 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'bugün saat 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'sabah saat 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'bugün saat 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'dünən 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('[gələn həftə] dddd [saat] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[gələn həftə] dddd [saat] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[gələn həftə] dddd [saat] 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('[keçən həftə] dddd [saat] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[keçən həftə] dddd [saat] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[keçən həftə] dddd [saat] 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([2011, 11, 26]).format('w ww wo'), '1 01 1-inci', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1-inci', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2-nci', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2-nci', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3-üncü', 'Jan 9 2012 should be week 3'); -}); - diff --git a/src/test/locale/be.js b/src/test/locale/be.js deleted file mode 100644 index 5ba85d6ebd..0000000000 --- a/src/test/locale/be.js +++ /dev/null @@ -1,269 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('be'); - -test('parse', function (assert) { - 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); - 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, 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-ы нядзеля нд нд'], - ['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-ы дзень года'], - ['LT', '15:25'], - ['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; - 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 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; - 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 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 week', function (assert) { - 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]); - } -}); - -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: 31}), true), '31 хвіліна', '31 minutes = 31 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), 'праз некалькі секунд', 'prefix'); - assert.equal(moment(0).from(30000), 'некалькі секунд таму', 'suffix'); -}); - -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({m: 31}).fromNow(), 'праз 31 хвіліну', 'in 31 minutes = in 31 minutes'); - assert.equal(moment().subtract({m: 31}).fromNow(), '31 хвіліну таму', '31 minutes ago = 31 minutes ago'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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(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: - case 5: - case 6: - return '[У мінулую] dddd [ў] LT'; - case 1: - case 2: - case 4: - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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(makeFormat(m)), '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([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'); -}); - -test('calendar should format', function (assert) { - assert.equal(moment('2018-04-13').calendar(moment('2018-04-16')), 'У мінулую пятніцу ў 00:00', 'calendar should handle day of week'); -}); diff --git a/src/test/locale/bg.js b/src/test/locale/bg.js deleted file mode 100644 index 970af6bda7..0000000000 --- a/src/test/locale/bg.js +++ /dev/null @@ -1,226 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('bg'); - -test('parse', function (assert) { - 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); - 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', 'неделя, февруари 14-ти 2010, 15:25:50'], - ['ddd, hA', 'нед, 3PM'], - ['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', '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'], - ['LT', '15:25'], - ['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; - 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 = 'януари янр_февруари фев_март мар_април апр_май май_юни юни_юли юли_август авг_септември сеп_октомври окт_ноември ное_декември дек'.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; - 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), 'няколко секунди', '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), '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: 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), 'след няколко секунди', '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'); -}); - -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'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -test('calendar last week', function (assert) { - var i, m; - - function makeFormat(d) { - switch (d.day()) { - case 0: - case 3: - case 6: - return '[В изминалата] dddd [в] LT'; - case 1: - case 2: - case 4: - case 5: - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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(makeFormat(m)), '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([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'); -}); - diff --git a/src/test/locale/bm.js b/src/test/locale/bm.js deleted file mode 100644 index 326daf0f4d..0000000000 --- a/src/test/locale/bm.js +++ /dev/null @@ -1,181 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('bm'); - -test('parse', function (assert) { - var i, - tests = 'Zanwuyekalo Zan_Fewuruyekalo Few_Marisikalo Mar_Awirilikalo Awi_Mɛkalo Mɛ_Zuwɛnkalo Zuw_Zuluyekalo Zul_Utikalo Uti_Sɛtanburukalo Sɛt_ɔkutɔburukalo ɔku_Nowanburukalo Now_Desanburukalo Des'.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); - 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', 'Kari, Fewuruyekalo 14 2010, 3:25:50 pm'], - ['ddd, hA', 'Kar, 3PM'], - ['M Mo MM MMMM MMM', '2 2 02 Fewuruyekalo Few'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 Kari Kar Ka'], - ['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'], - ['[le] Do [jour du mois]', 'le 14 jour du mois'], - ['[le] DDDo [jour de l’année]', 'le 45 jour de l’année'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', 'Fewuruyekalo tile 14 san 2010'], - ['LLL', 'Fewuruyekalo tile 14 san 2010 lɛrɛ 15:25'], - ['LLLL', 'Kari Fewuruyekalo tile 14 san 2010 lɛrɛ 15:25'], - ['l', '14/2/2010'], - ['ll', 'Few tile 14 san 2010'], - ['lll', 'Few tile 14 san 2010 lɛrɛ 15:25'], - ['llll', 'Kar Few tile 14 san 2010 lɛrɛ 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 month', function (assert) { - var i, - expected = 'Zanwuyekalo Zan_Fewuruyekalo Few_Marisikalo Mar_Awirilikalo Awi_Mɛkalo Mɛ_Zuwɛnkalo Zuw_Zuluyekalo Zul_Utikalo Uti_Sɛtanburukalo Sɛt_ɔkutɔburukalo ɔku_Nowanburukalo Now_Desanburukalo Des'.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 i, - expected = 'Kari Kar Ka_Ntɛnɛn Ntɛ Nt_Tarata Tar Ta_Araba Ara Ar_Alamisa Ala Al_Juma Jum Ju_Sibiri Sib Si'.split('_'); - - 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), 'sanga dama dama', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'miniti kelen', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'miniti kelen', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), 'miniti 2', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), 'miniti 44', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'lɛrɛ kelen', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'lɛrɛ kelen', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), 'lɛrɛ 2', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), 'lɛrɛ 5', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), 'lɛrɛ 21', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'tile kelen', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'tile kelen', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), 'tile 2', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'tile kelen', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), 'tile 5', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), 'tile 25', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'kalo kelen', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'kalo kelen', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'kalo kelen', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), 'kalo 2', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), 'kalo 2', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), 'kalo 3', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'kalo kelen', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), 'kalo 5', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'san kelen', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), 'san 2', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'san kelen', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), 'san 5', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'sanga dama dama kɔnɔ', 'prefix'); - assert.equal(moment(0).from(30000), 'a bɛ sanga dama dama bɔ', 'suffix'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'sanga dama dama kɔnɔ', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'tile 5 kɔnɔ', 'in 5 days'); -}); - -test('same day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Bi lɛrɛ 12:00', 'Today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Bi lɛrɛ 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Bi lɛrɛ 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Sini lɛrɛ 12:00', 'Tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Bi lɛrɛ 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kunu lɛrɛ 12:00', 'Yesterday at the same time'); -}); - -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 [don lɛrɛ] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [don lɛrɛ] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [don lɛrɛ] LT'), 'Today + ' + i + ' days end of day'); - } -}); - -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('dddd [tɛmɛnen lɛrɛ] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [tɛmɛnen lɛrɛ] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [tɛmɛnen lɛrɛ] LT'), 'Today - ' + i + ' days end of day'); - } -}); - -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'); - - 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 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'); -}); - diff --git a/src/test/locale/bn.js b/src/test/locale/bn.js deleted file mode 100644 index 6399b22103..0000000000 --- a/src/test/locale/bn.js +++ /dev/null @@ -1,225 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('bn'); - -test('parse', function (assert) { - 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); - 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, 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', 'দুপুর দুপুর'], - ['LT', 'দুপুর ৩:২৫ সময়'], - ['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'), '১', '১'); - 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; - 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; - 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), 'কয়েক সেকেন্ড', '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: 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'); -}); - -test('now from now', function (assert) { - 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(), '৫ দিন পরে', '৫ দিন পরে'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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('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'); -}); diff --git a/src/test/locale/bo.js b/src/test/locale/bo.js deleted file mode 100644 index c484b6ba73..0000000000 --- a/src/test/locale/bo.js +++ /dev/null @@ -1,227 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('bo'); - -test('parse', function (assert) { - 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); - 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, 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', 'ཉིན་གུང ཉིན་གུང'], - ['LT', 'ཉིན་གུང ༣:༢༥'], - ['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'), '༡', '༡'); - 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; - 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; - 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), 'ལམ་སང', '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'); -}); - -test('now from now', function (assert) { - 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(), '༥ ཉིན་ ལ་', '༥ ཉིན་ ལ་'); -}); - -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'); -}); - -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('[བདུན་ཕྲག་རྗེས་མ][,] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[བདུན་ཕྲག་རྗེས་མ][,] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[བདུན་ཕྲག་རྗེས་མ][,] 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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('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'); -}); - diff --git a/src/test/locale/br.js b/src/test/locale/br.js deleted file mode 100644 index b31d66d2f0..0000000000 --- a/src/test/locale/br.js +++ /dev/null @@ -1,228 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('br'); - -test('parse', function (assert) { - var tests = 'Genver Gen_C\'hwevrer C\'hwe_Meurzh Meu_Ebrel Ebr_Mae Mae_Mezheven Eve_Gouere Gou_Eost Eos_Gwengolo Gwe_Here Her_Du Du_Kerzu Ker'.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) { - moment.locale('br'); - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Sul, C\'hwevrer 14vet 2010, 3:25:50 pm'], - ['ddd, h A', 'Sul, 3 PM'], - ['M Mo MM MMMM MMM', '2 2vet 02 C\'hwevrer C\'hwe'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14vet 14'], - ['d do dddd ddd dd', '0 0vet Sul Sul Su'], - ['DDD DDDo DDDD', '45 45vet 045'], - ['w wo ww', '6 6vet 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['DDDo [devezh] [ar] [vloaz]', '45vet devezh ar vloaz'], - ['L', '14/02/2010'], - ['LL', '14 a viz C\'hwevrer 2010'], - ['LLL', '14 a viz C\'hwevrer 2010 3e25 PM'], - ['LLLL', 'Sul, 14 a viz C\'hwevrer 2010 3e25 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) { - moment.locale('br'); - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1añ', '1añ'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2vet', '2vet'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3vet', '3vet'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4vet', '4vet'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5vet', '5vet'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6vet', '6vet'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7vet', '7vet'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8vet', '8vet'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9vet', '9vet'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10vet', '10vet'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11vet', '11vet'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12vet', '12vet'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13vet', '13vet'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14vet', '14vet'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15vet', '15vet'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16vet', '16vet'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17vet', '17vet'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18vet', '18vet'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19vet', '19vet'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20vet', '20vet'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21vet', '21vet'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22vet', '22vet'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23vet', '23vet'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24vet', '24vet'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25vet', '25vet'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26vet', '26vet'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27vet', '27vet'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28vet', '28vet'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29vet', '29vet'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30vet', '30vet'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31vet', '31vet'); -}); - -test('format month', function (assert) { - moment.locale('br'); - var expected = 'Genver Gen_C\'hwevrer C\'hwe_Meurzh Meu_Ebrel Ebr_Mae Mae_Mezheven Eve_Gouere Gou_Eost Eos_Gwengolo Gwe_Here Her_Du Du_Kerzu Ker'.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) { - moment.locale('br'); - var expected = 'Sul Sul Su_Lun Lun Lu_Meurzh Meu Me_Merc\'her Mer Mer_Yaou Yao Ya_Gwener Gwe Gw_Sadorn Sad 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]); - } -}); - -test('from', function (assert) { - moment.locale('br'); - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'un nebeud segondennoù', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ur vunutenn', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ur vunutenn', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 vunutenn', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 munutenn', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'un eur', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'un eur', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 eur', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 eur', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 eur', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'un devezh', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'un devezh', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 zevezh', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'un devezh', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 devezh', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 devezh', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ur miz', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ur miz', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ur miz', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 viz', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 viz', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 miz', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ur miz', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 miz', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ur bloaz', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 vloaz', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ur bloaz', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 bloaz', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - moment.locale('br'); - assert.equal(moment(30000).from(0), 'a-benn un nebeud segondennoù', 'prefix'); - assert.equal(moment(0).from(30000), 'un nebeud segondennoù \'zo', 'suffix'); -}); - -test('now from now', function (assert) { - moment.locale('br'); - assert.equal(moment().fromNow(), 'un nebeud segondennoù \'zo', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - moment.locale('br'); - assert.equal(moment().add({s: 30}).fromNow(), 'a-benn un nebeud segondennoù', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'a-benn 5 devezh', 'in 5 days'); -}); - -test('calendar day', function (assert) { - moment.locale('br'); - - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Hiziv da 12e00 PM', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Hiziv da 12e25 PM', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Hiziv da 1e00 PM', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Warc\'hoazh da 12e00 PM', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hiziv da 11e00 AM', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Dec\'h da 12e00 PM', 'yesterday at the same time'); -}); - -test('calendar next week', function (assert) { - moment.locale('br'); - - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [da] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [da] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [da] LT'), 'Today + ' + i + ' days end of day'); - } -}); - -test('calendar last week', function (assert) { - moment.locale('br'); - - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [paset da] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [paset da] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [paset da] LT'), 'Today - ' + i + ' days end of day'); - } -}); - -test('calendar all else', function (assert) { - moment.locale('br'); - 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('special mutations for years', function (assert) { - moment.locale('br'); - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ur bloaz', 'mutation 1 year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 2}), true), '2 vloaz', 'mutation 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 3}), true), '3 bloaz', 'mutation 3 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 4}), true), '4 bloaz', 'mutation 4 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 bloaz', 'mutation 5 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 9}), true), '9 bloaz', 'mutation 9 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 10}), true), '10 vloaz', 'mutation 10 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 21}), true), '21 bloaz', 'mutation 21 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 22}), true), '22 vloaz', 'mutation 22 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 133}), true), '133 bloaz', 'mutation 133 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 148}), true), '148 vloaz', 'mutation 148 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 261}), true), '261 bloaz', 'mutation 261 years'); -}); - diff --git a/src/test/locale/bs.js b/src/test/locale/bs.js deleted file mode 100644 index 1a2999a9cf..0000000000 --- a/src/test/locale/bs.js +++ /dev/null @@ -1,242 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('bs'); - -test('parse', function (assert) { - var tests = 'januar jan._februar feb._mart mar._april apr._maj maj._juni jun._juli jul._august aug._septembar sep._oktobar okt._novembar nov._decembar dec.'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1) + ' inp ' + mmm); - } - 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, Do MMMM YYYY, h:mm:ss a', 'nedjelja, 14. februar 2010, 3:25:50 pm'], - ['ddd, hA', 'ned., 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. 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. februar 2010'], - ['LLL', '14. februar 2010 15:25'], - ['LLLL', 'nedjelja, 14. februar 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14. feb. 2010'], - ['lll', '14. feb. 2010 15:25'], - ['llll', 'ned., 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'), '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 = 'januar jan._februar feb._mart mar._april apr._maj maj._juni jun._juli jul._august aug._septembar sep._oktobar okt._novembar nov._decembar 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; - 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), '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), 'za par sekundi', 'prefix'); - assert.equal(moment(0).from(30000), 'prije par sekundi', 'prefix'); -}); - -test('now from now', function (assert) { - 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(), '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(), '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(makeFormat(m)), '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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - 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(makeFormat(m)), '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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), '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([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'); -}); diff --git a/src/test/locale/ca.js b/src/test/locale/ca.js deleted file mode 100644 index 154be7b952..0000000000 --- a/src/test/locale/ca.js +++ /dev/null @@ -1,216 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('ca'); - -test('parse', function (assert) { - var tests = 'gener gen._febrer febr._març març_abril abr._maig maig_juny juny_juliol jul._agost ag._setembre set._octubre oct._novembre nov._desembre 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, Do MMMM YYYY, h:mm:ss a', 'diumenge, 14è de febrer 2010, 3:25:50 pm'], - ['ddd, hA', 'dg., 3PM'], - ['M Mo MM MMMM MMM', '2 2n 02 febrer febr.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14è 14'], - ['d do dddd ddd dd', '0 0è diumenge dg. dg'], - ['DDD DDDo DDDD', '45 45è 045'], - ['w wo ww', '6 6a 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 febrer de 2010'], - ['LLL', '14 de febrer de 2010 a les 15:25'], - ['LLLL', 'diumenge 14 de febrer de 2010 a les 15:25'], - ['l', '14/2/2010'], - ['ll', '14 febr. 2010'], - ['lll', '14 febr. 2010, 15:25'], - ['llll', 'dg. 14 febr. 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'), '1r', '1r'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2n', '2n'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3r', '3r'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4t', '4t'); - 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 = 'gener gen._febrer febr._març març_abril abr._maig maig_juny juny_juliol jul._agost ag._setembre set._octubre oct._novembre nov._desembre 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 = 'diumenge dg. dg_dilluns dl. dl_dimarts dt. dt_dimecres dc. dc_dijous dj. dj_divendres dv. dv_dissabte ds. ds'.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 segons', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'un minut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'un minut', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuts', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuts', '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 hores', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 hores', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 hores', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'un dia', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'un dia', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dies', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'un dia', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dies', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dies', '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 mesos', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mesos', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mesos', '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 mesos', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'un any', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 anys', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'un any', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 anys', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'd\'aquí uns segons', 'prefix'); - assert.equal(moment(0).from(30000), 'fa uns segons', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'fa uns segons', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'd\'aquí uns segons', 'd\'aquí uns segons'); - assert.equal(moment().add({d: 5}).fromNow(), 'd\'aquí 5 dies', 'd\'aquí 5 dies'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'avui a les 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'avui a les 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'avui a les 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'demà a les 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).add({d: 1, h : -1}).calendar(), 'demà a les 11:00', 'tomorrow minus 1 hour'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'avui a les 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'ahir a les 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 [a ' + ((m.hours() !== 1) ? 'les' : 'la') + '] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [a ' + ((m.hours() !== 1) ? 'les' : 'la') + '] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [a ' + ((m.hours() !== 1) ? 'les' : 'la') + '] 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('[el] dddd [passat a ' + ((m.hours() !== 1) ? 'les' : 'la') + '] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[el] dddd [passat a ' + ((m.hours() !== 1) ? 'les' : 'la') + '] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[el] dddd [passat a ' + ((m.hours() !== 1) ? 'les' : 'la') + '] 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 52a', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1a', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1a', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2a', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2a', 'Jan 15 2012 should be week 2'); -}); - -test('day and month', function (assert) { - assert.equal(moment([2012, 1, 15]).format('D MMMM'), '15 de febrer'); - assert.equal(moment([2012, 9, 15]).format('D MMMM'), '15 d\'octubre'); - assert.equal(moment([2012, 9, 15]).format('MMMM, D'), 'octubre, 15'); -}); diff --git a/src/test/locale/cs.js b/src/test/locale/cs.js deleted file mode 100644 index a0100a4391..0000000000 --- a/src/test/locale/cs.js +++ /dev/null @@ -1,315 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('cs'); - -test('parse', function (assert) { - var tests = 'leden led ledna_únor úno února_březen bře března_duben dub dubna_květen kvě května_červen čvn června_červenec čvc července_srpen srp srpna_září zář září_říjen říj října_listopad lis listopadu_prosinec pro prosince'.split('_'), i; - function equalTest(input, mmm, monthIndex) { - assert.equal(moment(input, mmm).month(), monthIndex, input + ' ' + mmm + ' should be month ' + (monthIndex + 1)); - } - function equalTestStrict(input, mmm, monthIndex) { - assert.equal(moment(input, mmm, true).month(), monthIndex, input + ' ' + mmm + ' should be strict month ' + (monthIndex + 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][2], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][2], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][2].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][2].toLocaleUpperCase(), 'MMMM', i); - - equalTestStrict(tests[i][1], 'MMM', i); - equalTestStrict(tests[i][0], 'MMMM', i); - equalTestStrict(tests[i][2], 'MMMM', i); - equalTestStrict(tests[i][1].toLocaleLowerCase(), 'MMM', i); - equalTestStrict(tests[i][1].toLocaleUpperCase(), 'MMM', i); - equalTestStrict(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTestStrict(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTestStrict(tests[i][2].toLocaleLowerCase(), 'MMMM', i); - equalTestStrict(tests[i][2].toLocaleUpperCase(), 'MMMM', i); - } -}); - -test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss', 'neděle, únor 14. 2010, 3:25:50'], - ['ddd, h', 'ne, 3'], - ['M Mo MM MMMM MMM', '2 2. 02 únor úno'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. neděle ne ne'], - ['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'], - ['DDDo [den v roce]', '45. den v roce'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14. únor 2010'], - ['LLL', '14. únor 2010 15:25'], - ['LLLL', 'neděle 14. únor 2010 15:25'], - ['l', '14. 2. 2010'], - ['ll', '14. úno 2010'], - ['lll', '14. úno 2010 15:25'], - ['llll', 'ne 14. úno 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 = 'leden led_únor úno_březen bře_duben dub_květen kvě_červen čvn_červenec čvc_srpen srp_září zář_říjen říj_listopad lis_prosinec 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 = 'neděle ne ne_pondělí po po_úterý út út_středa st st_čtvrtek čt čt_pátek pá pá_sobota 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), 'pár sekund', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minuta', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minuta', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuty', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minut', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'hodina', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'hodina', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 hodiny', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 hodin', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 hodin', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'den', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'den', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dny', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'den', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dní', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dní', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'měsíc', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'měsíc', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'měsíc', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 měsíce', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 měsíce', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 měsíce', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'měsíc', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 měsíců', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'rok', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 roky', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'rok', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 let', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'za pár sekund', 'prefix'); - assert.equal(moment(0).from(30000), 'před pár sekundami', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'před pár sekundami', 'now from now should display as in the past'); -}); - -test('fromNow (future)', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'za pár sekund', 'in a few seconds'); - assert.equal(moment().add({m: 1}).fromNow(), 'za minutu', 'in a minute'); - assert.equal(moment().add({m: 3}).fromNow(), 'za 3 minuty', 'in 3 minutes'); - assert.equal(moment().add({m: 10}).fromNow(), 'za 10 minut', 'in 10 minutes'); - assert.equal(moment().add({h: 1}).fromNow(), 'za hodinu', 'in an hour'); - assert.equal(moment().add({h: 3}).fromNow(), 'za 3 hodiny', 'in 3 hours'); - assert.equal(moment().add({h: 10}).fromNow(), 'za 10 hodin', 'in 10 hours'); - assert.equal(moment().add({d: 1}).fromNow(), 'za den', 'in a day'); - assert.equal(moment().add({d: 3}).fromNow(), 'za 3 dny', 'in 3 days'); - assert.equal(moment().add({d: 10}).fromNow(), 'za 10 dní', 'in 10 days'); - assert.equal(moment().add({M: 1}).fromNow(), 'za měsíc', 'in a month'); - assert.equal(moment().add({M: 3}).fromNow(), 'za 3 měsíce', 'in 3 months'); - assert.equal(moment().add({M: 10}).fromNow(), 'za 10 měsíců', 'in 10 months'); - assert.equal(moment().add({y: 1}).fromNow(), 'za rok', 'in a year'); - assert.equal(moment().add({y: 3}).fromNow(), 'za 3 roky', 'in 3 years'); - assert.equal(moment().add({y: 10}).fromNow(), 'za 10 let', 'in 10 years'); -}); - -test('fromNow (past)', function (assert) { - assert.equal(moment().subtract({s: 30}).fromNow(), 'před pár sekundami', 'a few seconds ago'); - assert.equal(moment().subtract({m: 1}).fromNow(), 'před minutou', 'a minute ago'); - assert.equal(moment().subtract({m: 3}).fromNow(), 'před 3 minutami', '3 minutes ago'); - assert.equal(moment().subtract({m: 10}).fromNow(), 'před 10 minutami', '10 minutes ago'); - assert.equal(moment().subtract({h: 1}).fromNow(), 'před hodinou', 'an hour ago'); - assert.equal(moment().subtract({h: 3}).fromNow(), 'před 3 hodinami', '3 hours ago'); - assert.equal(moment().subtract({h: 10}).fromNow(), 'před 10 hodinami', '10 hours ago'); - assert.equal(moment().subtract({d: 1}).fromNow(), 'před dnem', 'a day ago'); - assert.equal(moment().subtract({d: 3}).fromNow(), 'před 3 dny', '3 days ago'); - assert.equal(moment().subtract({d: 10}).fromNow(), 'před 10 dny', '10 days ago'); - assert.equal(moment().subtract({M: 1}).fromNow(), 'před měsícem', 'a month ago'); - assert.equal(moment().subtract({M: 3}).fromNow(), 'před 3 měsíci', '3 months ago'); - assert.equal(moment().subtract({M: 10}).fromNow(), 'před 10 měsíci', '10 months ago'); - assert.equal(moment().subtract({y: 1}).fromNow(), 'před rokem', 'a year ago'); - assert.equal(moment().subtract({y: 3}).fromNow(), 'před 3 lety', '3 years ago'); - assert.equal(moment().subtract({y: 10}).fromNow(), 'před 10 lety', '10 years ago'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'dnes v 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'dnes v 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'dnes v 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'zítra v 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'dnes v 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'včera v 12:00', 'yesterday at the same time'); -}); - -test('calendar next week', function (assert) { - var i, m, nextDay; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - nextDay = ''; - switch (m.day()) { - case 0: - nextDay = 'v neděli'; - break; - case 1: - nextDay = 'v pondělí'; - break; - case 2: - nextDay = 'v úterý'; - break; - case 3: - nextDay = 've středu'; - break; - case 4: - nextDay = 've čtvrtek'; - break; - case 5: - nextDay = 'v pátek'; - break; - case 6: - nextDay = 'v sobotu'; - break; - } - assert.equal(m.calendar(), m.format('[' + nextDay + '] [v] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[' + nextDay + '] [v] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[' + nextDay + '] [v] LT'), 'Today + ' + i + ' days end of day'); - } -}); - -test('calendar last week', function (assert) { - var i, m, lastDay; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - lastDay = ''; - switch (m.day()) { - case 0: - lastDay = 'minulou neděli'; - break; - case 1: - lastDay = 'minulé pondělí'; - break; - case 2: - lastDay = 'minulé úterý'; - break; - case 3: - lastDay = 'minulou středu'; - break; - case 4: - lastDay = 'minulý čtvrtek'; - break; - case 5: - lastDay = 'minulý pátek'; - break; - case 6: - lastDay = 'minulou sobotu'; - break; - } - assert.equal(m.calendar(), m.format('[' + lastDay + '] [v] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[' + lastDay + '] [v] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[' + lastDay + '] [v] 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('humanize duration', function (assert) { - assert.equal(moment.duration(1, 'minutes').humanize(), 'minuta', 'a minute (future)'); - assert.equal(moment.duration(1, 'minutes').humanize(true), 'za minutu', 'in a minute'); - assert.equal(moment.duration(-1, 'minutes').humanize(), 'minuta', 'a minute (past)'); - assert.equal(moment.duration(-1, 'minutes').humanize(true), 'před minutou', 'a minute ago'); -}); - -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'); -}); - diff --git a/src/test/locale/cv.js b/src/test/locale/cv.js deleted file mode 100644 index 5a4833069a..0000000000 --- a/src/test/locale/cv.js +++ /dev/null @@ -1,216 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('cv'); - -test('parse', function (assert) { - 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); - 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', 'вырсарникун, нарӑс 14-мӗш 2010, 3:25:50 pm'], - ['ddd, hA', 'выр, 3PM'], - ['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', '7 7-мӗш 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['Ҫулӑн DDDo кунӗ', 'Ҫулӑн 45-мӗш кунӗ'], - ['LTS', '15:25:50'], - ['L', '14-02-2010'], - ['LL', '2010 ҫулхи нарӑс уйӑхӗн 14-мӗшӗ'], - ['LLL', '2010 ҫулхи нарӑс уйӑхӗн 14-мӗшӗ, 15:25'], - ['LLLL', 'вырсарникун, 2010 ҫулхи нарӑс уйӑхӗн 14-мӗшӗ, 15:25'], - ['l', '14-2-2010'], - ['ll', '2010 ҫулхи нар уйӑхӗн 14-мӗшӗ'], - ['lll', '2010 ҫулхи нар уйӑхӗн 14-мӗшӗ, 15:25'], - ['llll', 'выр, 2010 ҫулхи нар уйӑхӗн 14-мӗшӗ, 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 = 'кӑрлач кӑр_нарӑс нар_пуш пуш_ака ака_май май_ҫӗртме ҫӗр_утӑ утӑ_ҫурла ҫур_авӑн авн_юпа юпа_чӳк чӳк_раштав раш'.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; - 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), 'пӗр-ик ҫеккунт', '44 sekunder = 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), '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: 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), 'пӗр-ик ҫеккунтран', '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'); -}); - -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({h: 2}).fromNow(), '2 сехетрен', 'in 2 hours, the right suffix!'); - assert.equal(moment().add({y: 3}).fromNow(), '3 ҫултан', 'in 3 years, the right suffix!'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); -}); - -// Monday is the first day of the week. -// The week that contains Jan 1st is the first week of the year. - -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'); -}); - diff --git a/src/test/locale/cy.js b/src/test/locale/cy.js deleted file mode 100644 index d9542a987d..0000000000 --- a/src/test/locale/cy.js +++ /dev/null @@ -1,209 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('cy'); - -test('parse', function (assert) { - var tests = 'Ionawr Ion_Chwefror Chwe_Mawrth Maw_Ebrill Ebr_Mai Mai_Mehefin Meh_Gorffennaf Gor_Awst Aws_Medi Med_Hydref Hyd_Tachwedd Tach_Rhagfyr Rhag'.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', 'Dydd Sul, Chwefror 14eg 2010, 3:25:50 pm'], - ['ddd, hA', 'Sul, 3PM'], - ['M Mo MM MMMM MMM', '2 2il 02 Chwefror Chwe'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14eg 14'], - ['d do dddd ddd dd', '0 0 Dydd Sul Sul Su'], - ['DDD DDDo DDDD', '45 45ain 045'], - ['w wo ww', '6 6ed 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 45ain day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 Chwefror 2010'], - ['LLL', '14 Chwefror 2010 15:25'], - ['LLLL', 'Dydd Sul, 14 Chwefror 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Chwe 2010'], - ['lll', '14 Chwe 2010 15:25'], - ['llll', 'Sul, 14 Chwe 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'), '1af', '1af'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2il', '2il'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3ydd', '3ydd'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4ydd', '4ydd'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5ed', '5ed'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6ed', '6ed'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7ed', '7ed'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8fed', '8fed'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9fed', '9fed'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10fed', '10fed'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11eg', '11eg'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12fed', '12fed'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13eg', '13eg'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14eg', '14eg'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15fed', '15fed'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16eg', '16eg'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17eg', '17eg'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18fed', '18fed'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19eg', '19eg'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20fed', '20fed'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21ain', '21ain'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22ain', '22ain'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23ain', '23ain'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24ain', '24ain'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25ain', '25ain'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26ain', '26ain'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27ain', '27ain'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28ain', '28ain'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29ain', '29ain'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30ain', '30ain'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31ain', '31ain'); -}); - -test('format month', function (assert) { - var expected = 'Ionawr Ion_Chwefror Chwe_Mawrth Maw_Ebrill Ebr_Mai Mai_Mehefin Meh_Gorffennaf Gor_Awst Aws_Medi Med_Hydref Hyd_Tachwedd Tach_Rhagfyr Rhag'.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 = 'Dydd Sul Sul Su_Dydd Llun Llun Ll_Dydd Mawrth Maw Ma_Dydd Mercher Mer Me_Dydd Iau Iau Ia_Dydd Gwener Gwe Gw_Dydd Sadwrn Sad 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]); - } -}); - -test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ychydig eiliadau', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'munud', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'munud', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 munud', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 munud', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'awr', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'awr', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 awr', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 awr', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 awr', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'diwrnod', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'diwrnod', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 diwrnod', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'diwrnod', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 diwrnod', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 diwrnod', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mis', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mis', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mis', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mis', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mis', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mis', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mis', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mis', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'blwyddyn', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 flynedd', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'blwyddyn', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 flynedd', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'mewn ychydig eiliadau', 'prefix'); - assert.equal(moment(0).from(30000), 'ychydig eiliadau yn ôl', 'suffix'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'mewn ychydig eiliadau', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'mewn 5 diwrnod', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Heddiw am 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Heddiw am 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Heddiw am 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Yfory am 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Heddiw am 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ddoe am 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 [am] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [am] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [am] 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 [diwethaf am] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [diwethaf am] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [diwethaf am] 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 52ain', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1af', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1af', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2il', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2il', 'Jan 15 2012 should be week 2'); -}); - diff --git a/src/test/locale/da.js b/src/test/locale/da.js deleted file mode 100644 index 3697426f25..0000000000 --- a/src/test/locale/da.js +++ /dev/null @@ -1,212 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('da'); - -test('parse', function (assert) { - var tests = 'januar jan_februar feb_marts mar_april apr_maj maj_juni jun_juli jul_august aug_september sep_oktober 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)); - } - 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 [den] Do MMMM YYYY, h:mm:ss a', 'søndag den 14. februar 2010, 3:25:50 pm'], - ['ddd hA', 'søn 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. søndag søn sø'], - ['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'], - ['[den] DDDo [dag på året]', 'den 45. dag på året'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14. februar 2010'], - ['LLL', '14. februar 2010 15:25'], - ['LLLL', 'søndag d. 14. februar 2010 kl. 15:25'], - ['l', '14.2.2010'], - ['ll', '14. feb 2010'], - ['lll', '14. feb 2010 15:25'], - ['llll', 'søn d. 14. feb 2010 kl. 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 = 'januar jan_februar feb_marts mar_april apr_maj maj_juni jun_juli jul_august aug_september sep_oktober 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 = 'søndag søn sø_mandag man ma_tirsdag tir ti_onsdag ons on_torsdag tor to_fredag fre fr_lørdag lør 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]); - } -}); - -test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'få sekunder', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'et minut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'et minut', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutter', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutter', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'en time', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'en time', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 timer', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 timer', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 timer', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'en dag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'en dag', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dage', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'en dag', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dage', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dage', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'en måned', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'en måned', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'en måned', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 måneder', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 måneder', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 måneder', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'en måned', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 måneder', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'et å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), 'et å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), 'om få sekunder', 'prefix'); - assert.equal(moment(0).from(30000), 'få sekunder siden', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'få sekunder siden', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'om få sekunder', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'om 5 dage', 'in 5 days'); -}); - - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'i dag kl. 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'i dag kl. 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'i dag kl. 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'i morgen kl. 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'i dag kl. 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'i 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('på dddd [kl.] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('på dddd [kl.] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('på 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('[i] dddd[s kl.] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[i] dddd[s kl.] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[i] dddd[s kl.] 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 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'); -}); diff --git a/src/test/locale/de-at.js b/src/test/locale/de-at.js deleted file mode 100644 index 147b20e298..0000000000 --- a/src/test/locale/de-at.js +++ /dev/null @@ -1,206 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('de-at'); - -test('parse', function (assert) { - var tests = 'Jänner Jän._Februar Feb._März März_April Apr._Mai Mai_Juni Juni_Juli Juli_August Aug._September Sep._Oktober Okt._November Nov._Dezember Dez.'.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, Do MMMM YYYY, h:mm:ss a', 'Sonntag, 14. Februar 2010, 3:25:50 pm'], - ['ddd, hA', 'So., 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. Sonntag So. So'], - ['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. Februar 2010'], - ['LLL', '14. Februar 2010 15:25'], - ['LLLL', 'Sonntag, 14. Februar 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14. Feb. 2010'], - ['lll', '14. Feb. 2010 15:25'], - ['llll', 'So., 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'), '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 = 'Jänner Jän._Februar Feb._März März_April Apr._Mai Mai_Juni Juni_Juli Juli_August Aug._September Sep._Oktober Okt._November Nov._Dezember Dez.'.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 = 'Sonntag So. So_Montag Mo. Mo_Dienstag Di. Di_Mittwoch Mi. Mi_Donnerstag Do. Do_Freitag Fr. Fr_Samstag Sa. 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]); - } -}); - -test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ein paar Sekunden', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'eine Minute', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'eine Minute', '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), 'eine Stunde', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'eine Stunde', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 Stunden', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 Stunden', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 Stunden', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ein Tag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ein Tag', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 Tage', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ein Tag', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 Tage', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 Tage', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ein Monat', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ein Monat', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 Monate', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 Monate', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 Monate', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ein Monat', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 Monate', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ein Jahr', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 Jahre', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ein Jahr', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 Jahre', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'in ein paar Sekunden', 'prefix'); - assert.equal(moment(0).from(30000), 'vor ein paar Sekunden', 'suffix'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'in ein paar Sekunden', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'in 5 Tagen', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'heute um 12:00 Uhr', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'heute um 12:25 Uhr', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'heute um 13:00 Uhr', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'morgen um 12:00 Uhr', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'heute um 11:00 Uhr', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'gestern um 12:00 Uhr', '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 [um] LT [Uhr]'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [um] LT [Uhr]'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [um] LT [Uhr]'), '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('[letzten] dddd [um] LT [Uhr]'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[letzten] dddd [um] LT [Uhr]'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[letzten] dddd [um] LT [Uhr]'), '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 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'); -}); diff --git a/src/test/locale/de-ch.js b/src/test/locale/de-ch.js deleted file mode 100644 index c8fcd43a39..0000000000 --- a/src/test/locale/de-ch.js +++ /dev/null @@ -1,206 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('de-ch'); - -test('parse', function (assert) { - var tests = 'Januar Jan._Februar Feb._März März_April Apr._Mai Mai_Juni Juni_Juli Juli_August Aug._September Sep._Oktober Okt._November Nov._Dezember Dez.'.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, Do MMMM YYYY, h:mm:ss a', 'Sonntag, 14. Februar 2010, 3:25:50 pm'], - ['ddd, hA', 'So, 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. Sonntag So So'], - ['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'], - ['LT', '15:25'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14. Februar 2010'], - ['LLL', '14. Februar 2010 15:25'], - ['LLLL', 'Sonntag, 14. Februar 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14. Feb. 2010'], - ['lll', '14. Feb. 2010 15:25'], - ['llll', 'So, 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'), '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 = 'Januar Jan._Februar Feb._März März_April Apr._Mai Mai_Juni Juni_Juli Juli_August Aug._September Sep._Oktober Okt._November Nov._Dezember Dez.'.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 = 'Sonntag So So_Montag Mo Mo_Dienstag Di Di_Mittwoch Mi Mi_Donnerstag Do Do_Freitag Fr Fr_Samstag Sa 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]); - } -}); - -test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ein paar Sekunden', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'eine Minute', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'eine Minute', '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), 'eine Stunde', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'eine Stunde', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 Stunden', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 Stunden', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 Stunden', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ein Tag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ein Tag', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 Tage', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ein Tag', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 Tage', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 Tage', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ein Monat', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ein Monat', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ein Monat', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 Monate', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 Monate', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 Monate', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ein Monat', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 Monate', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ein Jahr', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 Jahre', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ein Jahr', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 Jahre', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'in ein paar Sekunden', 'prefix'); - assert.equal(moment(0).from(30000), 'vor ein paar Sekunden', 'suffix'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'in ein paar Sekunden', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'in 5 Tagen', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'heute um 12:00 Uhr', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'heute um 12:25 Uhr', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'heute um 13:00 Uhr', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'morgen um 12:00 Uhr', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'heute um 11:00 Uhr', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'gestern um 12:00 Uhr', '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 [um] LT [Uhr]'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [um] LT [Uhr]'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [um] LT [Uhr]'), '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('[letzten] dddd [um] LT [Uhr]'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[letzten] dddd [um] LT [Uhr]'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[letzten] dddd [um] LT [Uhr]'), '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 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'); -}); diff --git a/src/test/locale/de.js b/src/test/locale/de.js deleted file mode 100644 index 640802ccd9..0000000000 --- a/src/test/locale/de.js +++ /dev/null @@ -1,206 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('de'); - -test('parse', function (assert) { - var tests = 'Januar Jan._Februar Feb._März März_April Apr._Mai Mai_Juni Juni_Juli Juli_August Aug._September Sep._Oktober Okt._November Nov._Dezember Dez.'.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, Do MMMM YYYY, h:mm:ss a', 'Sonntag, 14. Februar 2010, 3:25:50 pm'], - ['ddd, hA', 'So., 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. Sonntag So. So'], - ['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. Februar 2010'], - ['LLL', '14. Februar 2010 15:25'], - ['LLLL', 'Sonntag, 14. Februar 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14. Feb. 2010'], - ['lll', '14. Feb. 2010 15:25'], - ['llll', 'So., 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'), '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 = 'Januar Jan._Februar Feb._März März_April Apr._Mai Mai_Juni Juni_Juli Juli_August Aug._September Sep._Oktober Okt._November Nov._Dezember Dez.'.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 = 'Sonntag So. So_Montag Mo. Mo_Dienstag Di. Di_Mittwoch Mi. Mi_Donnerstag Do. Do_Freitag Fr. Fr_Samstag Sa. 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]); - } -}); - -test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ein paar Sekunden', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'eine Minute', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'eine Minute', '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), 'eine Stunde', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'eine Stunde', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 Stunden', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 Stunden', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 Stunden', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ein Tag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ein Tag', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 Tage', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ein Tag', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 Tage', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 Tage', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ein Monat', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ein Monat', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ein Monat', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 Monate', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 Monate', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 Monate', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ein Monat', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 Monate', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ein Jahr', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 Jahre', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ein Jahr', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 Jahre', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'in ein paar Sekunden', 'prefix'); - assert.equal(moment(0).from(30000), 'vor ein paar Sekunden', 'suffix'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'in ein paar Sekunden', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'in 5 Tagen', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'heute um 12:00 Uhr', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'heute um 12:25 Uhr', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'heute um 13:00 Uhr', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'morgen um 12:00 Uhr', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'heute um 11:00 Uhr', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'gestern um 12:00 Uhr', '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 [um] LT [Uhr]'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [um] LT [Uhr]'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [um] LT [Uhr]'), '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('[letzten] dddd [um] LT [Uhr]'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[letzten] dddd [um] LT [Uhr]'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[letzten] dddd [um] LT [Uhr]'), '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 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'); -}); - diff --git a/src/test/locale/dv.js b/src/test/locale/dv.js deleted file mode 100644 index 2cc71d935b..0000000000 --- a/src/test/locale/dv.js +++ /dev/null @@ -1,205 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('dv'); - -test('parse', function (assert) { - var i, - tests = [ - 'ޖެނުއަރީ', - 'ފެބްރުއަރީ', - 'މާރިޗު', - 'އޭޕްރީލު', - 'މޭ', - 'ޖޫން', - 'ޖުލައި', - 'އޯގަސްޓު', - 'ސެޕްޓެމްބަރު', - 'އޮކްޓޯބަރު', - 'ނޮވެމްބަރު', - 'ޑިސެމްބަރު' - ]; - - function equalTest(input, mmm, i) { - 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); - equalTest(tests[i].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i].toLocaleUpperCase(), 'MMMM', i); - } -}); - -test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'އާދިއްތަ، ފެބްރުއަރީ 14 2010، 3:25:50 މފ'], - ['ddd, hA', 'އާދިއްތަ، 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', 'މފ މފ'], - ['LTS', '15:25:50'], - ['L', '14/2/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; - - 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 month', function (assert) { - var i, - expected = [ - 'ޖެނުއަރީ', - 'ފެބްރުއަރީ', - 'މާރިޗު', - 'އޭޕްރީލު', - 'މޭ', - 'ޖޫން', - 'ޖުލައި', - 'އޯގަސްޓު', - 'ސެޕްޓެމްބަރު', - 'އޮކްޓޯބަރު', - 'ނޮވެމްބަރު', - 'ޑިސެމްބަރު' - ]; - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM'), expected[i]); - } -}); - -test('format week', function (assert) { - var i, - expected = [ - 'އާދިއްތަ', - 'ހޯމަ', - 'އަންގާރަ', - 'ބުދަ', - 'ބުރާސްފަތި', - 'ހުކުރު', - 'ހޮނިހިރު' - ]; - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd'), expected[i]); - } -}); - - -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), 'ގަޑިއިރު 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: 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), 'ތެރޭގައި ސިކުންތުކޮޅެއް', 'prefix'); - assert.equal(moment(0).from(30000), 'ކުރިން ސިކުންތުކޮޅެއް', 'suffix'); -}); - -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'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'), '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'), '2 02 2', 'Jan 8 2012 should be week 2'); - 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'), '3 03 3', 'Jan 15 2012 should be week 3'); -}); diff --git a/src/test/locale/el.js b/src/test/locale/el.js deleted file mode 100644 index 73b93f87d3..0000000000 --- a/src/test/locale/el.js +++ /dev/null @@ -1,266 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('el'); - -test('parse', function (assert) { - var i, - tests = 'Ιανουάριος Ιαν_Φεβρουάριος Φεβ_Μάρτιος Μαρ_Απρίλιος Απρ_Μάιος Μαϊ_Ιούνιος Ιουν_Ιούλιος Ιουλ_Αύγουστος Αυγ_Σεπτέμβριος Σεπ_Οκτώβριος Οκτ_Νοέμβριος Νοε_Δεκέμβριος Δεκ'.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); - 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('parse meridiem', function (assert) { - var i, - b = moment(), - meridiemTests = [ - // h a patterns, expected hours, isValid - ['10 πμ', 10, true], - ['10 μμ', 22, true], - ['10 π.μ.', 10, true], - ['10 μ.μ.', 22, true], - ['10 π', 10, true], - ['10 μ', 22, true], - ['10 ΠΜ', 10, true], - ['10 ΜΜ', 22, true], - ['10 Π.Μ.', 10, true], - ['10 Μ.Μ.', 22, true], - ['10 Π', 10, true], - ['10 Μ', 22, true], - ['10 am', 10, false], - ['10 pm', 10, false] - ], - parsed; - - // test that a formatted moment including meridiem string can be parsed back to the same moment - assert.ok(b.isSame(moment(b.format('h:mm:ss a'), 'h:mm:ss a', 'el', true), 'seconds'), b.format('h:mm:ss a') + ' should be equal to ' + moment(b.format('h:mm:ss a'), 'h:mm:ss a', 'el', true).format('h:mm:ss a')); - - // test that a formatted moment having a meridiem string can be parsed with strict flag - assert.ok(moment(b.format('h:mm:ss a'), 'h:mm:ss a', 'el', true).isValid(), b.format('h:mm:ss a') + ' should be parsed as valid'); - - for (i = 0; i < meridiemTests.length; i++) { - parsed = moment(meridiemTests[i][0], 'h a', 'el', true); - assert.equal(parsed.isValid(), meridiemTests[i][2], 'validity for ' + meridiemTests[i][0]); - if (parsed.isValid()) { - assert.equal(parsed.hours(), meridiemTests[i][1], 'hours for ' + meridiemTests[i][0]); - } - } -}); - -test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Κυριακή, Φεβρουάριος 14η 2010, 3:25:50 μμ'], - ['dddd, D MMMM YYYY, h:mm:ss a', 'Κυριακή, 14 Φεβρουαρίου 2010, 3:25:50 μμ'], - ['ddd, hA', 'Κυρ, 3ΜΜ'], - ['dddd, MMMM YYYY', 'Κυριακή, Φεβρουάριος 2010'], - ['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', '6 6η 06'], - ['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', '3:25:50 ΜΜ'], - ['L', '14/02/2010'], - ['LL', '14 Φεβρουαρίου 2010'], - ['LLL', '14 Φεβρουαρίου 2010 3:25 ΜΜ'], - ['LLLL', 'Κυριακή, 14 Φεβρουαρίου 2010 3:25 ΜΜ'], - ['l', '14/2/2010'], - ['ll', '14 Φεβ 2010'], - ['lll', '14 Φεβ 2010 3:25 ΜΜ'], - ['llll', 'Κυρ, 14 Φεβ 2010 3: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 i, - expected = 'Ιανουάριος Ιαν_Φεβρουάριος Φεβ_Μάρτιος Μαρ_Απρίλιος Απρ_Μάιος Μαϊ_Ιούνιος Ιουν_Ιούλιος Ιουλ_Αύγουστος Αυγ_Σεπτέμβριος Σεπ_Οκτώβριος Οκτ_Νοέμβριος Νοε_Δεκέμβριος Δεκ'.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 i, - expected = 'Κυριακή Κυρ Κυ_Δευτέρα Δευ Δε_Τρίτη Τρι Τρ_Τετάρτη Τετ Τε_Πέμπτη Πεμ Πε_Παρασκευή Παρ Πα_Σάββατο Σαβ Σα'.split('_'); - - 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), 'λίγα δευτερόλεπτα', '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), '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: 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), 'σε λίγα δευτερόλεπτα', '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'); -}); - -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'); -}); - -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(), 'Σήμερα στη 1: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 [' + (m.hours() % 12 === 1 ? 'στη' : 'στις') + '] 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [στις] LT'), 'Today + ' + i + ' days end of day'); - } -}); - -test('calendar last week', function (assert) { - var i, m, dayString; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - dayString = m.day() === 6 ? '[το προηγούμενο Σάββατο]' : '[την προηγούμενη] dddd'; - assert.equal(m.calendar(), m.format(dayString + ' [' + (m.hours() % 12 === 1 ? 'στη' : 'στις') + '] LT'), 'Today - ' + i + ' days current time'); - m.hours(1).minutes(30).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(dayString + ' [στη] LT'), 'Today - ' + i + ' days one o clock'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(dayString + ' [στις] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(dayString + ' [στις] 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 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, 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'), '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('localeData months calls', function (assert) { - var jan = moment('2012-01-01'); - assert.equal(moment.localeData().months(jan), 'Ιανουάριος', 'should return the nominative month name'); - assert.equal(moment.localeData().months(jan, 'D MMMM'), 'Ιανουαρίου', 'should return the genitive month name'); -}); diff --git a/src/test/locale/en-SG.js b/src/test/locale/en-sg.js similarity index 99% rename from src/test/locale/en-SG.js rename to src/test/locale/en-sg.js index 92b5cb2fda..a4137450d6 100644 --- a/src/test/locale/en-SG.js +++ b/src/test/locale/en-sg.js @@ -1,7 +1,7 @@ import {test} from '../qunit'; import {localeModule} from '../qunit-locale'; import moment from '../../moment'; -localeModule('en-SG'); +localeModule('en-sg'); 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; diff --git a/src/test/locale/eo.js b/src/test/locale/eo.js deleted file mode 100644 index 799cac3d23..0000000000 --- a/src/test/locale/eo.js +++ /dev/null @@ -1,212 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('eo'); - -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; - 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', '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 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', '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; - 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, 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'), '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'), '31a', '31a'); -}); - -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; - 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; - 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), '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), 'post sekundoj', 'post prefix'); - assert.equal(moment(0).from(30000), 'antaŭ sekundoj', 'antaŭ prefix'); -}); - -test('now from now', function (assert) { - 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(), '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(), '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) { - var i, m; - - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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 [je] 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('[pasinta] dddd [je] 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'); - 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'); - } -}); - -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([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'); -}); - diff --git a/src/test/locale/es.js b/src/test/locale/es.js index ef3e679b9f..02bad1d45e 100644 --- a/src/test/locale/es.js +++ b/src/test/locale/es.js @@ -217,3 +217,6 @@ test('test short months proper', function (assert) { assert.equal(moment(str, 'DD-MMM-YYYY').month(), '7', '02-ago-2016 month should be 7'); }); +test('translated invalid date', function (assert) { + assert.equal(moment('nonsense', 'DD-MMM-YYYY').format(), 'Fecha invalida', 'Invalid date should translate'); +}); diff --git a/src/test/locale/et.js b/src/test/locale/et.js deleted file mode 100644 index a790942058..0000000000 --- a/src/test/locale/et.js +++ /dev/null @@ -1,234 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('et'); - -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; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' peaks olema kuu ' + (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, 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; - 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 = '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 = '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]); - } -}); - -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'); -}); - -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'); -}); - -test('now from now', function (assert) { - 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(), '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(), '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('[Järgmine] dddd 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'); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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('[Eelmine] dddd 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 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 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([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'); -}); - diff --git a/src/test/locale/eu.js b/src/test/locale/eu.js deleted file mode 100644 index a51f2c1015..0000000000 --- a/src/test/locale/eu.js +++ /dev/null @@ -1,210 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('eu'); - -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; - 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', '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; - 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 = '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 = '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]); - } -}); - -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'); -}); - -test('suffix', function (assert) { - 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(), 'duela segundo batzuk', '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'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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[etan]'), '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('[aurreko] dddd LT[etan]'), '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'); - 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'); - } -}); - -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([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'); -}); - diff --git a/src/test/locale/fa.js b/src/test/locale/fa.js deleted file mode 100644 index 2758d5f1ae..0000000000 --- a/src/test/locale/fa.js +++ /dev/null @@ -1,203 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('fa'); - -test('parse', function (assert) { - var tests = 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.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()); - } - for (i = 0; i < 12; 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', 'یک\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; - 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'); - 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'); - 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'); - 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'); -}); - -test('format month', function (assert) { - 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 = 'یک\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]); - } -}); - -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'); -}); - -test('suffix', function (assert) { - 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'); -}); - -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'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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([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'); -}); - diff --git a/src/test/locale/fi.js b/src/test/locale/fi.js deleted file mode 100644 index a8e0cc737a..0000000000 --- a/src/test/locale/fi.js +++ /dev/null @@ -1,211 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('fi'); - -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; - 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', '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'] - ], - 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.', '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.', '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.', '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.', '31st'); -}); - -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; - 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; - 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), '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), '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(), 'muutama sekunti sitten', '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'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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 [klo] 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('[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('[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('[viime] dddd[na] [klo] 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'), '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'), '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'), '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'); -}); - diff --git a/src/test/locale/fo.js b/src/test/locale/fo.js deleted file mode 100644 index 16d7b93e1c..0000000000 --- a/src/test/locale/fo.js +++ /dev/null @@ -1,212 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('fo'); - -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; - 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 [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([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 = '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 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]); - } -}); - -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 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), '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(), 'um fá sekund', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'um 5 dagar', '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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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 [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('[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('[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('[síðstu] dddd [kl] 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'), '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'), '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'), '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'); -}); - diff --git a/src/test/locale/fr-ca.js b/src/test/locale/fr-ca.js deleted file mode 100644 index 62e87b6c52..0000000000 --- a/src/test/locale/fr-ca.js +++ /dev/null @@ -1,233 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('fr-ca'); - -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('_'); - - 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', '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'] - ], - 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, 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 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 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]); - } -}); - -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'); -}); - -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(), 'dans quelques secondes', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'dans 5 jours', 'in 5 days'); -}); - -test('same 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'); -}); - -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 [à] 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [à] LT'), 'Today + ' + i + ' days end of day'); - } -}); - -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('dddd [dernier à] 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [dernier à] LT'), 'Today - ' + i + ' days end of day'); - } -}); - -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'); - - 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'), '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'); -}); - diff --git a/src/test/locale/fr-ch.js b/src/test/locale/fr-ch.js deleted file mode 100644 index b6a671d658..0000000000 --- a/src/test/locale/fr-ch.js +++ /dev/null @@ -1,233 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('fr-ch'); - -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('_'); - - 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', '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', '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 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'], - ['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([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, 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 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 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]); - } -}); - -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'); -}); - -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(), 'dans quelques secondes', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'dans 5 jours', 'in 5 days'); -}); - -test('same 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'); -}); - -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 [à] 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [à] LT'), 'Today + ' + i + ' days end of day'); - } -}); - -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('dddd [dernier à] 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [dernier à] LT'), 'Today - ' + i + ' days end of day'); - } -}); - -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'); - - 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 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'); -}); - diff --git a/src/test/locale/fr.js b/src/test/locale/fr.js deleted file mode 100644 index da98b8686c..0000000000 --- a/src/test/locale/fr.js +++ /dev/null @@ -1,233 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('fr'); - -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('_'); - - 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', '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([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'), '2', '2'); - - 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 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 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]); - } -}); - -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'); -}); - -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(), 'dans quelques secondes', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'dans 5 jours', 'in 5 days'); -}); - -test('same 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'); -}); - -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 [à] 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [à] LT'), 'Today + ' + i + ' days end of day'); - } -}); - -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('dddd [dernier à] 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [dernier à] LT'), 'Today - ' + i + ' days end of day'); - } -}); - -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'); - - 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 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'); -}); - diff --git a/src/test/locale/fy.js b/src/test/locale/fy.js deleted file mode 100644 index b8112b3a3f..0000000000 --- a/src/test/locale/fy.js +++ /dev/null @@ -1,215 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -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'); -}); - diff --git a/src/test/locale/ga.js b/src/test/locale/ga.js deleted file mode 100644 index a26d9930e9..0000000000 --- a/src/test/locale/ga.js +++ /dev/null @@ -1,223 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -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'); -}); - diff --git a/src/test/locale/gd.js b/src/test/locale/gd.js deleted file mode 100644 index b9c4789cdd..0000000000 --- a/src/test/locale/gd.js +++ /dev/null @@ -1,223 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('gd'); - -var months = [ - 'Am Faoilleach,Faoi', - 'An Gearran,Gear', - 'Am Màrt,Màrt', - 'An Giblean,Gibl', - 'An Cèitean,Cèit', - 'An t-Ògmhios,Ògmh', - 'An t-Iuchar,Iuch', - 'An Lùnastal,Lùn', - 'An t-Sultain,Sult', - 'An Dàmhair,Dàmh', - 'An t-Samhain,Samh', - 'An Dùbhlachd,Dùbh' -]; - -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', 'Didòmhnaich, An Gearran 14mh 2010, 3:25:50 pm'], - ['ddd, hA', 'Did, 3PM'], - ['M Mo MM MMMM MMM', '2 2na 02 An Gearran Gear'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14mh 14'], - ['d do dddd ddd dd', '0 0mh Didòmhnaich Did Dò'], - ['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 An Gearran 2010'], - ['LLL', '14 An Gearran 2010 15:25'], - ['LLLL', 'Didòmhnaich, 14 An Gearran 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Gear 2010'], - ['lll', '14 Gear 2010 15:25'], - ['llll', 'Did, 14 Gear 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 = ['Didòmhnaich Did Dò', 'Diluain Dil Lu', 'Dimàirt Dim Mà', 'Diciadain Dic Ci', 'Diardaoin Dia Ar', 'Dihaoine Dih Ha', 'Disathairne Dis 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), 'beagan diogan', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'mionaid', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'mionaid', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 mionaidean', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 mionaidean', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'uair', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'uair', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 uairean', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 uairean', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 uairean', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'latha', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'latha', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 latha', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'latha', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 latha', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 latha', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mìos', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mìos', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mìos', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mìosan', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mìosan', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mìosan', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mìos', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mìosan', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'bliadhna', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 bliadhna', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'bliadhna', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 bliadhna', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'ann an beagan diogan', 'prefix'); - assert.equal(moment(0).from(30000), 'bho chionn beagan diogan', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'bho chionn beagan diogan', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'ann an beagan diogan', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'ann an 5 latha', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'An-diugh aig 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'An-diugh aig 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'An-diugh aig 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'A-màireach aig 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'An-diugh aig 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'An-dè 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 [aig] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [aig] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [aig] 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 chaidh] [aig] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [seo chaidh] [aig] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [seo chaidh] [aig] 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', 'Faoi 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1d', 'Faoi 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1d', 'Faoi 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2na', 'Faoi 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2na', 'Faoi 15 2012 should be week 2'); -}); - diff --git a/src/test/locale/gl.js b/src/test/locale/gl.js deleted file mode 100644 index 0f00774cf1..0000000000 --- a/src/test/locale/gl.js +++ /dev/null @@ -1,219 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -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'); -}); - diff --git a/src/test/locale/gom-latn.js b/src/test/locale/gom-latn.js deleted file mode 100644 index b24e58e9be..0000000000 --- a/src/test/locale/gom-latn.js +++ /dev/null @@ -1,224 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('gom-latn'); - -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('_'); - - 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', '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'] - ], - 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 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 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]); - } -}); - -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 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), 'thodde second', 'prefix'); - assert.equal(moment(0).from(30000), 'thodde second adim', 'suffix'); -}); - -test('now from now', function (assert) { - 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(), '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(), '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) { - 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'); - 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'); - 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'); - } -}); - -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('[Fatlo] 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Fatlo] dddd[,] 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 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'); -}); diff --git a/src/test/locale/gu.js b/src/test/locale/gu.js deleted file mode 100644 index fa4f9b11ce..0000000000 --- a/src/test/locale/gu.js +++ /dev/null @@ -1,226 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('gu'); - -test('parse', function (assert) { - 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); - 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, 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'), '૧', '૧'); - 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; - 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; - 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), 'અમુક પળો', '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'); -}); - -test('now from now', function (assert) { - 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(), '૫ દિવસ મા', '૫ દિવસ મા'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(2).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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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('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'); -}); - diff --git a/src/test/locale/he.js b/src/test/locale/he.js deleted file mode 100644 index 949050b109..0000000000 --- a/src/test/locale/he.js +++ /dev/null @@ -1,175 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('he'); - -test('parse', function (assert) { - 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); - 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', 'ראשון, פברואר 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; - 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 month', function (assert) { - 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; - 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), 'מספר שניות', '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'); -}); - -test('now from now', function (assert) { - 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'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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 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'); -}); - diff --git a/src/test/locale/hi.js b/src/test/locale/hi.js deleted file mode 100644 index e69373ee31..0000000000 --- a/src/test/locale/hi.js +++ /dev/null @@ -1,226 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('hi'); - -test('parse', function (assert) { - 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); - 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, 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'), '१', '१'); - 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; - 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; - 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), 'कुछ ही क्षण', '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'); -}); - -test('now from now', function (assert) { - 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(), '५ दिन में', '५ दिन में'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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('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'); -}); - diff --git a/src/test/locale/hr.js b/src/test/locale/hr.js deleted file mode 100644 index 66823616c7..0000000000 --- a/src/test/locale/hr.js +++ /dev/null @@ -1,242 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('hr'); - -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; - 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, 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; - 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 = '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 = '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]); - } -}); - -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'); -}); - -test('suffix', function (assert) { - 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(), 'prije par sekundi', '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'); -}); - -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'); -}); - -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(makeFormat(m)), '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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - 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(makeFormat(m)), '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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), '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([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'); -}); diff --git a/src/test/locale/hu.js b/src/test/locale/hu.js deleted file mode 100644 index f2b16e021c..0000000000 --- a/src/test/locale/hu.js +++ /dev/null @@ -1,224 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('hu'); - -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; - 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', '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. vasárnap vas v'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '6 6. 06'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['[az év] DDDo [napja]', 'az év 45. napja'], - ['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'] - ], - 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('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.'); - 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 = '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 = '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'), 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'); -}); - -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'); -}); - -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'); -}); - -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'); -}); - -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('_'); - 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'); - 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'); - 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'); - } -}); - -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('_'); - - 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'); - 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'); - 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'); - } -}); - -test('calendar all else', function (assert) { - 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'); - - 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'); -}); - -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'); -}); - diff --git a/src/test/locale/hy-am.js b/src/test/locale/hy-am.js deleted file mode 100644 index b192fbf5fd..0000000000 --- a/src/test/locale/hy-am.js +++ /dev/null @@ -1,280 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('hy-am'); - -test('parse', function (assert) { - 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); - 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('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 փետրվար փտր'], - ['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'], - ['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'] - ], - 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 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; - 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; - 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), 'մի քանի վայրկյան', '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), 'մի քանի վայրկյան հետո', 'prefix'); - assert.equal(moment(0).from(30000), 'մի քանի վայրկյան առաջ', 'suffix'); -}); - -test('fromNow', function (assert) { - 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(), 'այսօր 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; - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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(makeFormat(m)), '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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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(makeFormat(m)), '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([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'); -}); - diff --git a/src/test/locale/id.js b/src/test/locale/id.js deleted file mode 100644 index 63ce9c4a03..0000000000 --- a/src/test/locale/id.js +++ /dev/null @@ -1,172 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('id'); - -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; - 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', '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 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', '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; - 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 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; - 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; - 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), '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), '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(), '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(), '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; - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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('dddd [pukul] 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'); - 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'); - 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'); - } -}); - -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([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'); -}); diff --git a/src/test/locale/is.js b/src/test/locale/is.js deleted file mode 100644 index a3f9c5423d..0000000000 --- a/src/test/locale/is.js +++ /dev/null @@ -1,217 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('is'); - -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; - 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, 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. 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'], - ['[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; - 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 = '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 = '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]); - } -}); - -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'); -}); - -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'); -}); - -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'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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 [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('[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('[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('[síðasta] dddd [kl.] 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 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'); -}); - diff --git a/src/test/locale/it-ch.js b/src/test/locale/it-ch.js deleted file mode 100644 index 9fd72cb7f9..0000000000 --- a/src/test/locale/it-ch.js +++ /dev/null @@ -1,209 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('it-ch'); - -test('parse', function (assert) { - 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)); - } - 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', '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º 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'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['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 15:25'], - ['llll', 'dom 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'), '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 = '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 = '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]); - } -}); - -test('from', function (assert) { - var start = moment([2007, 1, 28]); - 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), '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(), '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(), '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 [alle] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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 [alle] LT'), 'Today + ' + i + ' days end of day'); - } -}); - -test('calendar last week', function (assert) { - var i, m, weekday, datestring; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - // 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(datestring), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(datestring), '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 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'); -}); - diff --git a/src/test/locale/it.js b/src/test/locale/it.js deleted file mode 100644 index 0817a2f756..0000000000 --- a/src/test/locale/it.js +++ /dev/null @@ -1,209 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('it'); - -test('parse', function (assert) { - 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)); - } - 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', '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º 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'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['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 15:25'], - ['llll', 'dom 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'), '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 = '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 = '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]); - } -}); - -test('from', function (assert) { - var start = moment([2007, 1, 28]); - 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), '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(), '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(), '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 [alle] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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 [alle] LT'), 'Today + ' + i + ' days end of day'); - } -}); - -test('calendar last week', function (assert) { - var i, m, weekday, datestring; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - // 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(datestring), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(datestring), '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 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'); -}); - diff --git a/src/test/locale/ja.js b/src/test/locale/ja.js deleted file mode 100644 index c472b0e92a..0000000000 --- a/src/test/locale/ja.js +++ /dev/null @@ -1,194 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('ja'); - -test('parse', function (assert) { - var tests = '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; - 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, a h:mm:ss', '日曜日, 二月 14日 2010, 午後 3:25:50'], - ['ddd, Ah', '日, 午後3'], - ['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日 日曜日 日 日'], - ['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', '2010/02/14'], - ['LL', '2010年2月14日'], - ['LLL', '2010年2月14日 15:25'], - ['LLLL', '2010年2月14日 日曜日 15:25'], - ['l', '2010/02/14'], - ['ll', '2010年2月14日'], - ['lll', '2010年2月14日 15:25'], - ['llll', '2010年2月14日(日) 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 month', function (assert) { - 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]); - } -}); - -test('format week', function (assert) { - 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]); - } -}); - -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), '1分', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '1分', '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), '1時間', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '1時間', '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), '1日', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '1日', '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日', '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), '1ヶ月', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '1ヶ月', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '1ヶ月', '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ヶ月', '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), '1年', '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年', '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'); -}); - -test('now from now', function (assert) { - 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'); -}); - -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'); -}); - -test('calendar next week', function (assert) { - var i, m; - var dow = moment().day(); - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - if (dow + i < 7) { - 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd LT'), 'Today + ' + i + ' days end of day'); - } else { - 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[来週]dddd LT'), 'Today + ' + i + ' days end of day'); - } - } -}); - -test('calendar last week', function (assert) { - var i, m; - var dow = moment().day(); - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - if (dow < i) { - 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[先週]dddd LT'), 'Today - ' + i + ' days end of day'); - } else { - 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd 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 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('parse with japanese parentheses', function (assert) { - assert.ok(moment('2016年5月18日(水)', 'YYYY年M月D日(dd)', true).isValid(), 'parse with japanese parentheses'); -}); diff --git a/src/test/locale/jv.js b/src/test/locale/jv.js deleted file mode 100644 index 76ddc7d10f..0000000000 --- a/src/test/locale/jv.js +++ /dev/null @@ -1,177 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('jv'); - -test('parse', function (assert) { - var tests = 'Januari Jan_Februari Feb_Maret Mar_April Apr_Mei Mei_Juni Jun_Juli Jul_Agustus Ags_September Sep_Oktober Okt_Nopember Nop_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); - 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', 'Minggu, Februari 14 2010, 3:25:50 sonten'], - ['ddd, hA', 'Min, 3sonten'], - ['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 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', 'sonten sonten'], - ['[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; - 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 month', function (assert) { - var expected = 'Januari Jan_Februari Feb_Maret Mar_April Apr_Mei Mei_Juni Jun_Juli Jul_Agustus Ags_September Sep_Oktober Okt_Nopember Nop_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_Senen Sen Sn_Seloso Sel Sl_Rebu Reb Rb_Kemis Kem Km_Jemuwah Jem Jm_Septu Sep Sp'.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), 'sawetawis detik', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'setunggal menit', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'setunggal menit', '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), 'setunggal jam', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'setunggal jam', '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), 'sedinten', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'sedinten', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dinten', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'sedinten', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dinten', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dinten', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'sewulan', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'sewulan', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'sewulan', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 wulan', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 wulan', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 wulan', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'sewulan', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 wulan', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'setaun', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 taun', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'setaun', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 taun', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'wonten ing sawetawis detik', 'prefix'); - assert.equal(moment(0).from(30000), 'sawetawis detik ingkang kepengker', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'sawetawis detik ingkang kepengker', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'wonten ing sawetawis detik', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'wonten ing 5 dinten', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Dinten puniko pukul 12.00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Dinten puniko pukul 12.25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Dinten puniko pukul 13.00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Mbenjang pukul 12.00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Dinten puniko pukul 11.00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kala wingi pukul 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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('dddd [pukul] 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 [kepengker pukul] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [kepengker pukul] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [kepengker pukul] 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'); -}); - -// Monday is the first day of the week. -// The week that contains Jan 1st is the first week of the year. - -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'); -}); - - diff --git a/src/test/locale/ka.js b/src/test/locale/ka.js deleted file mode 100644 index 159224fa42..0000000000 --- a/src/test/locale/ka.js +++ /dev/null @@ -1,224 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('ka'); - -test('parse', function (assert) { - var i, - tests = 'იანვარი იან_თებერვალი თებ_მარტი მარ_აპრილი აპრ_მაისი მაი_ივნისი ივნ_ივლისი ივლ_აგვისტო აგვ_სექტემბერი სექ_ოქტომბერი ოქტ_ნოემბერი ნოე_დეკემბერი დეკ'.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); - 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); - // the last two are broken until https://github.com/nodejs/node/issues/22518 is fixed - // 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', 'კვირა, თებერვალი მე-14 2010, 3:25:50 pm'], - ['ddd, hA', 'კვი, 3PM'], - ['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', '7 მე-7 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['წლის DDDo დღე', 'წლის 45-ე დღე'], - ['LTS', '3:25:50 PM'], - ['L', '14/02/2010'], - ['LL', '14 თებერვალს 2010'], - ['LLL', '14 თებერვალს 2010 3:25 PM'], - ['LLLL', 'კვირა, 14 თებერვალს 2010 3:25 PM'], - ['l', '14/2/2010'], - ['ll', '14 თებ 2010'], - ['lll', '14 თებ 2010 3:25 PM'], - ['llll', 'კვი, 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'), '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 40', 'YYYY DDD').format('DDDo'), 'მე-40', 'მე-40'); - assert.equal(moment('2011 50', 'YYYY DDD').format('DDDo'), '50-ე', '50-ე'); - assert.equal(moment('2011 60', 'YYYY DDD').format('DDDo'), 'მე-60', 'მე-60'); - assert.equal(moment('2011 100', 'YYYY DDD').format('DDDo'), 'მე-100', 'მე-100'); - assert.equal(moment('2011 101', 'YYYY DDD').format('DDDo'), '101-ე', '101-ე'); -}); - -test('format month', function (assert) { - var i, - expected = 'იანვარი იან_თებერვალი თებ_მარტი მარ_აპრილი აპრ_მაისი მაი_ივნისი ივნ_ივლისი ივლ_აგვისტო აგვ_სექტემბერი სექ_ოქტომბერი ოქტ_ნოემბერი ნოე_დეკემბერი დეკ'.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 i, - expected = 'კვირა კვი კვ_ორშაბათი ორშ ორ_სამშაბათი სამ სა_ოთხშაბათი ოთხ ოთ_ხუთშაბათი ხუთ ხუ_პარასკევი პარ პა_შაბათი შაბ შა'.split('_'); - - 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), 'რამდენიმე წამი', '44 წამი = რამდენიმე წამი'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'წუთი', '45 წამი = წუთი'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'წუთი', '89 წამი = წუთი'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 წუთი', '90 წამი = 2 წუთი'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 წუთი', '44 წამი = 44 წუთი'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'საათი', '45 წამი = საათი'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'საათი', '89 წამი = საათი'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 საათი', '90 წამი = 2 საათი'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 საათი', '5 საათი = 5 საათი'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 საათი', '21 საათი = 21 საათი'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'დღე', '22 საათი = დღე'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'დღე', '35 საათი = დღე'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 დღე', '36 საათი = 2 დღე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'დღე', '1 დღე = დღე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 დღე', '5 დღე = 5 დღე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 დღე', '25 დღე = 25 დღე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'თვე', '26 დღე = თვე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'თვე', '30 დღე = თვე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'თვე', '45 დღე = თვე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 თვე', '46 დღე = 2 თვე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 თვე', '75 დღე = 2 თვე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 თვე', '76 დღე = 3 თვე'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'თვე', '1 თვე = თვე'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 თვე', '5 თვე = 5 თვე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'წელი', '345 დღე = წელი'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 წელი', '548 დღე = 2 წელი'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'წელი', '1 წელი = წელი'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 წელი', '5 წელი = 5 წელი'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'რამდენიმე წამში', 'ში სუფიქსი'); - assert.equal(moment(0).from(30000), 'რამდენიმე წამის წინ', 'წინ სუფიქსი'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'რამდენიმე წამის წინ', 'უნდა აჩვენოს როგორც წარსული'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'რამდენიმე წამში', 'რამდენიმე წამში'); - assert.equal(moment().add({d: 5}).fromNow(), '5 დღეში', '5 დღეში'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'დღეს 12:00 PM-ზე', 'დღეს ამავე დროს'); - assert.equal(moment(a).add({m: 25}).calendar(), 'დღეს 12:25 PM-ზე', 'ახლანდელ დროს დამატებული 25 წუთი'); - assert.equal(moment(a).add({h: 1}).calendar(), 'დღეს 1:00 PM-ზე', 'ახლანდელ დროს დამატებული 1 საათი'); - assert.equal(moment(a).add({d: 1}).calendar(), 'ხვალ 12:00 PM-ზე', 'ხვალ ამავე დროს'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'დღეს 11:00 AM-ზე', 'ახლანდელ დროს გამოკლებული 1 საათი'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'გუშინ 12:00 PM-ზე', 'გუშინ ამავე დროს'); -}); - -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[-ზე]'), 'დღეს + ' + i + ' დღე ახლანდელ დროს'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[შემდეგ] dddd LT[-ზე]'), 'დღეს + ' + i + ' დღე დღის დასაწყისში'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[შემდეგ] dddd LT[-ზე]'), 'დღეს + ' + i + ' დღე დღის დასასრულს'); - } -}); - -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[-ზე]'), 'დღეს - ' + i + ' დღე ახლანდელ დროს'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[წინა] dddd LT[-ზე]'), 'დღეს - ' + i + ' დღე დღის დასაწყისში'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[წინა] dddd LT[-ზე]'), 'დღეს - ' + i + ' დღე დღის დასასრულს'); - } -}); - -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 კვირის წინ'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), '1 კვირაში'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 კვირის წინ'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), '2 კვირაში'); -}); - -test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1-ლი', 'დეკ 26 2011 უნდა იყოს კვირა 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1-ლი', 'იან 1 2012 უნდა იყოს კვირა 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 მე-2', 'იან 2 2012 უნდა იყოს კვირა 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 მე-2', 'იან 8 2012 უნდა იყოს კვირა 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 მე-3', 'იან 9 2012 უნდა იყოს კვირა 3'); -}); - diff --git a/src/test/locale/kk.js b/src/test/locale/kk.js deleted file mode 100644 index ff73facd47..0000000000 --- a/src/test/locale/kk.js +++ /dev/null @@ -1,211 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('kk'); - -test('parse', function (assert) { - 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); - 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, Do MMMM YYYY, HH:mm:ss', 'жексенбі, 14-ші ақпан 2010, 15:25:50'], - ['ddd, hA', 'жек, 3PM'], - ['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', '7 7-ші 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[жылдың] 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'] - ], - 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-ші', '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-ші', '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-ші', '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-ші', '31st'); -}); - -test('format month', function (assert) { - 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; - 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), 'бірнеше секунд', '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), '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: 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), 'бірнеше секунд ішінде', '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'); -}); - -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'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'), '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, 15]).format('w ww wo'), '3 03 3-ші', 'Jan 15 2012 should be week 3'); -}); - diff --git a/src/test/locale/km.js b/src/test/locale/km.js deleted file mode 100644 index d2482fe0ca..0000000000 --- a/src/test/locale/km.js +++ /dev/null @@ -1,484 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('km'); - -test('parse', function (assert) { - 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); - 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', - 'អាទិត្យ, កុម្ភៈ ទី១៤ ២០១០, ៣:២៥:៥០ ល្ងាច' - ], - ['ddd, hA', 'អា, ៣ល្ងាច'], - ['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', 'ល្ងាច ល្ងាច'], - ['[the] DDDo [day of the year]', 'the ទី៤៥ day of the year'], - ['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'), 'ទី១', '1st'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), 'ទី២', '2nd'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), 'ទី៣', '3rd'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), 'ទី៤', '4th'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), 'ទី៥', '5th'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), 'ទី៦', '6th'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), 'ទី៧', '7th'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), 'ទី៨', '8th'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), 'ទី៩', '9th'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), 'ទី១០', '10th'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), 'ទី១១', '11st'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), 'ទី១២', '12nd'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), 'ទី១៣', '13rd'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), 'ទី១៤', '14th'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), 'ទី១៥', '15th'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), 'ទី១៦', '16th'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), 'ទី១៧', '17th'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), 'ទី១៨', '18th'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), 'ទី១៩', '19th'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), 'ទី២០', '20th'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), 'ទី២១', '21st'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), 'ទី២២', '22nd'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), 'ទី២៣', '23rd'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), 'ទី២៤', '24th'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), 'ទី២៥', '25th'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), 'ទី២៦', '26th'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), 'ទី២៧', '27th'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), 'ទី២៨', '28th'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), 'ទី២៩', '29th'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), 'ទី៣០', '30th'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), 'ទី៣១', '31st'); -}); - -test('format month', function (assert) { - 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; - 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), - 'ប៉ុន្មានវិនាទី', - '44 seconds = ប៉ុន្មានវិនាទី' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({s: 45}), true), - 'មួយនាទី', - '45 seconds = មួយនាទី' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({s: 89}), true), - 'មួយនាទី', - '89 seconds = មួយនាទី' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({s: 90}), true), - '២ នាទី', - '90 seconds = 2 នាទី' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({m: 44}), true), - '៤៤ នាទី', - '44 minutes = 44 នាទី' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({m: 45}), true), - 'មួយម៉ោង', - '45 minutes = មួយម៉ោង' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({m: 89}), true), - 'មួយម៉ោង', - '89 minutes = មួយម៉ោង' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({m: 90}), true), - '២ ម៉ោង', - '90 minutes = 2 ម៉ោង' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({h: 5}), true), - '៥ ម៉ោង', - '5 hours = 5 ម៉ោង' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({h: 21}), true), - '២១ ម៉ោង', - '21 hours = 21 ម៉ោង' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({h: 22}), true), - 'មួយថ្ងៃ', - '22 hours = មួយថ្ងៃ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({h: 35}), true), - 'មួយថ្ងៃ', - '35 hours = មួយថ្ងៃ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({h: 36}), true), - '២ ថ្ងៃ', - '36 hours = 2 ថ្ងៃ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({d: 1}), true), - 'មួយថ្ងៃ', - '1 day = មួយថ្ងៃ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({d: 5}), true), - '៥ ថ្ងៃ', - '5 days = 5 ថ្ងៃ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({d: 25}), true), - '២៥ ថ្ងៃ', - '25 days = 25 ថ្ងៃ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({d: 26}), true), - 'មួយខែ', - '26 days = មួយខែ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({d: 30}), true), - 'មួយខែ', - '30 days = មួយខែ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({d: 43}), true), - 'មួយខែ', - '43 days = មួយខែ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({d: 46}), true), - '២ ខែ', - '46 days = 2 ខែ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({d: 74}), true), - '២ ខែ', - '75 days = 2 ខែ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({d: 76}), true), - '៣ ខែ', - '76 days = 3 ខែ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({M: 1}), true), - 'មួយខែ', - '1 month = មួយខែ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({M: 5}), true), - '៥ ខែ', - '5 months = 5 ខែ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({d: 345}), true), - 'មួយឆ្នាំ', - '345 days = មួយឆ្នាំ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({d: 548}), true), - '២ ឆ្នាំ', - '548 days = 2 ឆ្នាំ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({y: 1}), true), - 'មួយឆ្នាំ', - '1 year = មួយឆ្នាំ' - ); - assert.equal( - start.from(moment([2007, 1, 28]).add({y: 5}), true), - '៥ ឆ្នាំ', - '5 years = 5 ឆ្នាំ' - ); -}); - -test('suffix', function (assert) { - 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' - ); -}); - -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' - ); -}); - -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' - ); -}); - -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' - ); - m - .hours(0) - .minutes(0) - .seconds(0) - .milliseconds(0); - 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' - ); - } -}); - -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' - ); - m - .hours(0) - .minutes(0) - .seconds(0) - .milliseconds(0); - 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' - ); - } -}); - -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'), - '៥២ ៥២ ទី៥២', - 'Jan 1 2012 should be week 52' - ); - assert.equal( - moment([2012, 0, 2]).format('w ww wo'), - '១ ០១ ទី១', - 'Jan 2 2012 should be week 1' - ); - assert.equal( - moment([2012, 0, 8]).format('w ww wo'), - '១ ០១ ទី១', - 'Jan 8 2012 should be week 1' - ); - assert.equal( - moment([2012, 0, 9]).format('w ww wo'), - '២ ០២ ទី២', - 'Jan 9 2012 should be week 2' - ); - assert.equal( - moment([2012, 0, 15]).format('w ww wo'), - '២ ០២ ទី២', - 'Jan 15 2012 should be week 2' - ); -}); diff --git a/src/test/locale/kn.js b/src/test/locale/kn.js deleted file mode 100644 index 7f932351b3..0000000000 --- a/src/test/locale/kn.js +++ /dev/null @@ -1,225 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('kn'); - -test('parse', function (assert) { - 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); - 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, 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'), '೧ನೇ', '೧ನೇ'); - 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; - 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; - 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), 'ಕೆಲವು ಕ್ಷಣಗಳು', '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'); -}); - -test('now from now', function (assert) { - 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(), '೫ ದಿನ ನಂತರ', '೫ ದಿನ ನಂತರ'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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('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'); -}); diff --git a/src/test/locale/ko.js b/src/test/locale/ko.js deleted file mode 100644 index a44f5ecf55..0000000000 --- a/src/test/locale/ko.js +++ /dev/null @@ -1,245 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('ko'); - -test('parse', function (assert) { - var tests = '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; - 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('parse meridiem', function (assert) { - var elements = [{ - expression : '1981년 9월 8일 오후 2시 30분', - inputFormat : 'YYYY[년] M[월] D[일] A h[시] m[분]', - outputFormat : 'A', - expected : '오후' - }, { - expression : '1981년 9월 8일 오전 2시 30분', - inputFormat : 'YYYY[년] M[월] D[일] A h[시] m[분]', - outputFormat : 'A h시', - expected : '오전 2시' - }, { - expression : '14시 30분', - inputFormat : 'H[시] m[분]', - outputFormat : 'A', - expected : '오후' - }, { - expression : '오후 4시', - inputFormat : 'A h[시]', - outputFormat : 'H', - expected : '16' - }], i, l, it, actual; - - for (i = 0, l = elements.length; i < l; ++i) { - it = elements[i]; - actual = moment(it.expression, it.inputFormat).format(it.outputFormat); - - assert.equal( - actual, - it.expected, - '\'' + it.outputFormat + '\' of \'' + it.expression + '\' must be \'' + it.expected + '\' but was \'' + actual + '\'.' - ); - } -}); - -test('format', function (assert) { - var a = [ - ['YYYY년 MMMM Do dddd a h:mm:ss', '2010년 2월 14일 일요일 오후 3:25:50'], - ['ddd A h', '일 오후 3'], - ['M Mo MM MMMM MMM', '2 2월 02 2월 2월'], - ['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', '오후 오후'], - ['일년 중 DDDo째 되는 날', '일년 중 45일째 되는 날'], - ['LTS', '오후 3:25:50'], - ['L', '2010.02.14.'], - ['LL', '2010년 2월 14일'], - ['LLL', '2010년 2월 14일 오후 3:25'], - ['LLLL', '2010년 2월 14일 일요일 오후 3:25'], - ['l', '2010.02.14.'], - ['ll', '2010년 2월 14일'], - ['lll', '2010년 2월 14일 오후 3:25'], - ['llll', '2010년 2월 14일 일요일 오후 3: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 = '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; - 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; - 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), '몇 초', '44초 = 몇 초'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), '1분', '45초 = 1분'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '1분', '89초 = 1분'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2분', '90초 = 2분'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44분', '44분 = 44분'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), '한 시간', '45분 = 한 시간'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '한 시간', '89분 = 한 시간'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2시간', '90분 = 2시간'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5시간', '5시간 = 5시간'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21시간', '21시간 = 21시간'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), '하루', '22시간 = 하루'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '하루', '35시간 = 하루'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2일', '36시간 = 2일'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), '하루', '하루 = 하루'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5일', '5일 = 5일'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25일', '25일 = 25일'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), '한 달', '26일 = 한 달'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '한 달', '30일 = 한 달'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '한 달', '45일 = 한 달'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2달', '46일 = 2달'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2달', '75일 = 2달'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3달', '76일 = 3달'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), '한 달', '1달 = 한 달'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5달', '5달 = 5달'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), '일 년', '345일 = 일 년'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2년', '548일 = 2년'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), '일 년', '일 년 = 일 년'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5년', '5년 = 5년'); -}); - -test('suffix', function (assert) { - 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'); -}); - -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'); -}); - -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(), '오늘 오후 1: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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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 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'); -}); - diff --git a/src/test/locale/ku.js b/src/test/locale/ku.js deleted file mode 100644 index 9c35bca706..0000000000 --- a/src/test/locale/ku.js +++ /dev/null @@ -1,234 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('ku'); - -var months = [ - 'کانونی دووەم', - 'شوبات', - 'ئازار', - 'نیسان', - 'ئایار', - 'حوزەیران', - 'تەمموز', - 'ئاب', - 'ئەیلوول', - 'تشرینی یەكەم', - 'تشرینی دووەم', - 'كانونی یەکەم' -]; - -test('parse', function (assert) { - var tests = months, 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()); - } - for (i = 0; i < 12; i++) { - equalTest(tests[i], 'MMM', i); - equalTest(tests[i], 'MMM', i); - equalTest(tests[i], 'MMMM', i); - equalTest(tests[i], 'MMMM', i); - equalTest(tests[i].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i].toLocaleUpperCase(), 'MMMM', i); - } -}); - -test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'یه‌كشه‌ممه‌، شوبات ١٤ ٢٠١٠، ٣:٢٥:٥٠ ئێواره‌'], - ['ddd, hA', 'یه‌كشه‌م، ٣ئێواره‌'], - ['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', 'ئێواره‌ ئێواره‌'], - ['[the] DDDo [day of the year]', 'the ٤٥ day of the year'], - ['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'); - 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'); - 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'); - 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'); -}); -//ok -test('format month', function (assert) { - var expected = months, i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM'), expected[i], expected[i]); - assert.equal(moment([2011, i, 1]).format('MMM'), expected[i], expected[i]); - } -}); - -test('format week', function (assert) { - 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]); - } -}); - -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'); -}); - -test('suffix', function (assert) { - 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'); -}); - -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'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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([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'); -}); - - -// locale-specific -test('ku strict mode parsing works', function (assert) { - var m, formattedDate; - m = moment().locale('ku'); - formattedDate = m.format('l'); - assert.equal(moment.utc(formattedDate, 'l', 'ku', false).isValid(), true, 'Non-strict parsing works'); - assert.equal(moment.utc(formattedDate, 'l', 'ku', true).isValid(), true,'Strict parsing must work'); -}); diff --git a/src/test/locale/ky.js b/src/test/locale/ky.js deleted file mode 100644 index 4cc1370944..0000000000 --- a/src/test/locale/ky.js +++ /dev/null @@ -1,210 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('ky'); - -test('parse', function (assert) { - 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); - 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, Do MMMM YYYY, HH:mm:ss', 'Жекшемби, 14-чү февраль 2010, 15:25:50'], - ['ddd, hA', 'Жек, 3PM'], - ['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', '7 7-чи 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[жылдын] 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'] - ], - 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-чи', '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-чи', '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-чи', '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-чи', '31st'); -}); - -test('format month', function (assert) { - 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; - 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), 'бирнече секунд', '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), '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: 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), 'бирнече секунд ичинде', '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'); -}); - -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'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'), '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, 15]).format('w ww wo'), '3 03 3-чү', 'Jan 15 2012 should be week 3'); -}); diff --git a/src/test/locale/lb.js b/src/test/locale/lb.js deleted file mode 100644 index 5c376bb6eb..0000000000 --- a/src/test/locale/lb.js +++ /dev/null @@ -1,187 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('lb'); - -test('parse', function (assert) { - var tests = 'Januar Jan._Februar Febr._Mäerz Mrz._Abrëll Abr._Mee Mee_Juni Jun._Juli Jul._August Aug._September Sept._Oktober Okt._November Nov._Dezember Dez.'.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, Do MMMM YYYY, HH:mm:ss', 'Sonndeg, 14. Februar 2010, 15:25:50'], - ['ddd, HH:mm', 'So., 15:25'], - ['M Mo MM MMMM MMM', '2 2. 02 Februar Febr.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. Sonndeg So. So'], - ['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 Auer'], - ['L', '14.02.2010'], - ['LL', '14. Februar 2010'], - ['LLL', '14. Februar 2010 15:25 Auer'], - ['LLLL', 'Sonndeg, 14. Februar 2010 15:25 Auer'], - ['l', '14.2.2010'], - ['ll', '14. Febr. 2010'], - ['lll', '14. Febr. 2010 15:25 Auer'], - ['llll', 'So., 14. Febr. 2010 15:25 Auer'] - ], - 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 month', function (assert) { - var expected = 'Januar Jan._Februar Febr._Mäerz Mrz._Abrëll Abr._Mee Mee_Juni Jun._Juli Jul._August Aug._September Sept._Oktober Okt._November Nov._Dezember Dez.'.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 = 'Sonndeg So. So_Méindeg Mé. Mé_Dënschdeg Dë. Dë_Mëttwoch Më. Më_Donneschdeg Do. Do_Freideg Fr. Fr_Samschdeg Sa. 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]); - } -}); - -test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'e puer Sekonnen', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'eng Minutt', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'eng Minutt', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 Minutten', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 Minutten', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'eng Stonn', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'eng Stonn', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 Stonnen', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 Stonnen', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 Stonnen', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'een Dag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'een Dag', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 Deeg', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'een Dag', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 Deeg', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 Deeg', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ee Mount', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ee Mount', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ee Mount', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 Méint', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 Méint', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 Méint', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ee Mount', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 Méint', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ee Joer', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 Joer', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ee Joer', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 Joer', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'an e puer Sekonnen', 'prefix'); - assert.equal(moment(0).from(30000), 'virun e puer Sekonnen', 'suffix'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'an e puer Sekonnen', 'in a few seconds'); - assert.equal(moment().add({d: 1}).fromNow(), 'an engem Dag', 'in one day'); - assert.equal(moment().add({d: 2}).fromNow(), 'an 2 Deeg', 'in 2 days'); - assert.equal(moment().add({d: 3}).fromNow(), 'an 3 Deeg', 'in 3 days'); - assert.equal(moment().add({d: 4}).fromNow(), 'a 4 Deeg', 'in 4 days'); - assert.equal(moment().add({d: 5}).fromNow(), 'a 5 Deeg', 'in 5 days'); - assert.equal(moment().add({d: 6}).fromNow(), 'a 6 Deeg', 'in 6 days'); - assert.equal(moment().add({d: 7}).fromNow(), 'a 7 Deeg', 'in 7 days'); - assert.equal(moment().add({d: 8}).fromNow(), 'an 8 Deeg', 'in 8 days'); - assert.equal(moment().add({d: 9}).fromNow(), 'an 9 Deeg', 'in 9 days'); - assert.equal(moment().add({d: 10}).fromNow(), 'an 10 Deeg', 'in 10 days'); - assert.equal(moment().add({y: 100}).fromNow(), 'an 100 Joer', 'in 100 years'); - assert.equal(moment().add({y: 400}).fromNow(), 'a 400 Joer', 'in 400 years'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Haut um 12:00 Auer', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Haut um 12:25 Auer', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Haut um 13:00 Auer', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Muer um 12:00 Auer', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Haut um 11:00 Auer', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Gëschter um 12:00 Auer', '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 [um] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [um] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [um] LT'), 'Today + ' + i + ' days end of day'); - } -}); - -test('calendar last week', function (assert) { - var i, m, weekday, datestring; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - - // Different date string for 'Dënschdeg' (Tuesday) and 'Donneschdeg' (Thursday) - weekday = parseInt(m.format('d'), 10); - datestring = (weekday === 2 || weekday === 4 ? '[Leschten] dddd [um] LT' : '[Leschte] dddd [um] 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(datestring), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(datestring), '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 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, 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'), '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'); -}); diff --git a/src/test/locale/lo.js b/src/test/locale/lo.js deleted file mode 100644 index 977210be9c..0000000000 --- a/src/test/locale/lo.js +++ /dev/null @@ -1,211 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('lo'); - -test('parse', function (assert) { - 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); - 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', 'ອາທິດ, ກຸມພາ ທີ່14 2010, 3:25:50 ຕອນແລງ'], - ['ddd, hA', 'ທິດ, 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', 'ຕອນແລງ ຕອນແລງ'], - ['[ວັນ]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'] - ], - 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 = 'ມັງກອນ ມັງກອນ_ກຸມພາ ກຸມພາ_ມີນາ ມີນາ_ເມສາ ເມສາ_ພຶດສະພາ ພຶດສະພາ_ມິຖຸນາ ມິຖຸນາ_ກໍລະກົດ ກໍລະກົດ_ສິງຫາ ສິງຫາ_ກັນຍາ ກັນຍາ_ຕຸລາ ຕຸລາ_ພະຈິກ ພະຈິກ_ທັນວາ ທັນວາ'.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; - 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), 'ບໍ່ເທົ່າໃດວິນາທີ', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), '1 ນາທີ', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '1 ນາທີ', '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), '1 ຊົ່ວໂມງ', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '1 ຊົ່ວໂມງ', '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), '1 ມື້', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '1 ມື້', '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 ມື້', '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), '1 ເດືອນ', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '1 ເດືອນ', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '1 ເດືອນ', '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 ເດືອນ', '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), '1 ປີ', '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 ປີ', '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'); -}); - -test('now from now', function (assert) { - 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'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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 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'); -}); - diff --git a/src/test/locale/lt.js b/src/test/locale/lt.js deleted file mode 100644 index a1092592c3..0000000000 --- a/src/test/locale/lt.js +++ /dev/null @@ -1,230 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('lt'); - -test('parse', function (assert) { - var tests = 'sausis sau_vasaris vas_kovas kov_balandis bal_gegužė geg_birželis bir_liepa lie_rugpjūtis rgp_rugsėjis rgs_spalis spa_lapkritis lap_gruodis grd'.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, Do MMMM YYYY, h:mm:ss a', 'sekmadienis, 14-oji vasario 2010, 3:25:50 pm'], - ['ddd, hA', 'Sek, 3PM'], - ['M Mo MM MMMM MMM', '2 2-oji 02 vasaris vas'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14-oji 14'], - ['d do dddd ddd dd', '0 0-oji sekmadienis Sek S'], - ['DDD DDDo DDDD', '45 45-oji 045'], - ['w wo ww', '6 6-oji 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['DDDo [metų diena]', '45-oji metų diena'], - ['LTS', '15:25:50'], - ['L', '2010-02-14'], - ['LL', '2010 m. vasario 14 d.'], - ['LLL', '2010 m. vasario 14 d., 15:25 val.'], - ['LLLL', '2010 m. vasario 14 d., sekmadienis, 15:25 val.'], - ['l', '2010-02-14'], - ['ll', '2010 m. vasario 14 d.'], - ['lll', '2010 m. vasario 14 d., 15:25 val.'], - ['llll', '2010 m. vasario 14 d., Sek, 15:25 val.'] - ], - 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-oji', '1-oji'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2-oji', '2-oji'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3-oji', '3-oji'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4-oji', '4-oji'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5-oji', '5-oji'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6-oji', '6-oji'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7-oji', '7-oji'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8-oji', '8-oji'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9-oji', '9-oji'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10-oji', '10-oji'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11-oji', '11-oji'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12-oji', '12-oji'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13-oji', '13-oji'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14-oji', '14-oji'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15-oji', '15-oji'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16-oji', '16-oji'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17-oji', '17-oji'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18-oji', '18-oji'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19-oji', '19-oji'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20-oji', '20-oji'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21-oji', '21-oji'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22-oji', '22-oji'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23-oji', '23-oji'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24-oji', '24-oji'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25-oji', '25-oji'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26-oji', '26-oji'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27-oji', '27-oji'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28-oji', '28-oji'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29-oji', '29-oji'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30-oji', '30-oji'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31-oji', '31-oji'); -}); - -test('format month', function (assert) { - var expected = 'sausis sau_vasaris vas_kovas kov_balandis bal_gegužė geg_birželis bir_liepa lie_rugpjūtis rgp_rugsėjis rgs_spalis spa_lapkritis lap_gruodis grd'.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 = 'sekmadienis Sek S_pirmadienis Pir P_antradienis Ant A_trečiadienis Tre T_ketvirtadienis Ket K_penktadienis Pen Pn_šeštadienis Šeš Š'.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('format week on US calendar', function (assert) { - // Tests, whether the weekday names are correct, even if the week does not start on Monday - moment.updateLocale('lt', {week: {dow: 0, doy: 6}}); - var expected = 'sekmadienis Sek S_pirmadienis Pir P_antradienis Ant A_trečiadienis Tre T_ketvirtadienis Ket K_penktadienis Pen Pn_šeštadienis Šeš Š'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - moment.updateLocale('lt', null); -}); - -test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'kelios sekundės', '44 seconds = seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minutė', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minutė', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutės', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 10}), true), '10 minučių', '10 minutes = 10 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 11}), true), '11 minučių', '11 minutes = 11 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 19}), true), '19 minučių', '19 minutes = 19 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 20}), true), '20 minučių', '20 minutes = 20 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutės', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'valanda', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'valanda', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 valandos', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 valandos', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 10}), true), '10 valandų', '10 hours = 10 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 valandos', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'diena', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'diena', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dienos', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'diena', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dienos', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 10}), true), '10 dienų', '10 days = 10 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dienos', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mėnuo', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mėnuo', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mėnuo', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mėnesiai', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mėnesiai', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mėnesiai', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mėnuo', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mėnesiai', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 10}), true), '10 mėnesių', '10 months = 10 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'metai', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 metai', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'metai', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 metai', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'po kelių sekundžių', 'prefix'); - assert.equal(moment(0).from(30000), 'prieš kelias sekundes', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'prieš kelias sekundes', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'po kelių sekundžių', 'in seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'po 5 dienų', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Šiandien 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Šiandien 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Šiandien 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Rytoj 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Šiandien 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Vakar 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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('[Praėjusį] dddd LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Praėjusį] dddd LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Praėjusį] dddd 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 52-oji', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1-oji', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1-oji', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2-oji', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2-oji', 'Jan 15 2012 should be week 2'); -}); - -test('month cases', function (assert) { - assert.equal(moment([2015, 4, 1]).format('LL'), '2015 m. gegužės 1 d.', 'uses format instead of standalone form'); -}); diff --git a/src/test/locale/lv.js b/src/test/locale/lv.js deleted file mode 100644 index 89e2919f1c..0000000000 --- a/src/test/locale/lv.js +++ /dev/null @@ -1,237 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('lv'); - -test('parse', function (assert) { - var tests = 'janvāris jan_februāris feb_marts mar_aprīlis apr_maijs mai_jūnijs jūn_jūlijs jūl_augusts aug_septembris sep_oktobris okt_novembris nov_decembris 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, Do MMMM YYYY, h:mm:ss a', 'svētdiena, 14. februāris 2010, 3:25:50 pm'], - ['ddd, hA', 'Sv, 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 februāris feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. svētdiena Sv Sv'], - ['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', '2010. gada 14. februāris'], - ['LLL', '2010. gada 14. februāris, 15:25'], - ['LLLL', '2010. gada 14. februāris, svētdiena, 15:25'], - ['l', '14.2.2010.'], - ['ll', '2010. gada 14. feb'], - ['lll', '2010. gada 14. feb, 15:25'], - ['llll', '2010. gada 14. feb, Sv, 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 = 'janvāris jan_februāris feb_marts mar_aprīlis apr_maijs mai_jūnijs jūn_jūlijs jūl_augusts aug_septembris sep_oktobris okt_novembris nov_decembris 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 = 'svētdiena Sv Sv_pirmdiena P P_otrdiena O O_trešdiena T T_ceturtdiena C C_piektdiena Pk Pk_sestdiena S 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]); - } -}); - -// Includes testing the cases of withoutSuffix = true and false. -test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'dažas sekundes', '44 seconds = seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), false), 'pirms dažām sekundēm', '44 seconds with suffix = seconds ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minūte', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), false), 'pirms minūtes', '45 seconds with suffix = a minute ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minūte', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: -89}), false), 'pēc minūtes', '89 seconds with suffix/prefix = in a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minūtes', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), false), 'pirms 2 minūtēm', '90 seconds with suffix = 2 minutes ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minūtes', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), false), 'pirms 44 minūtēm', '44 minutes with suffix = 44 minutes ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'stunda', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), false), 'pirms stundas', '45 minutes with suffix = an hour ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'stunda', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 stundas', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: -90}), false), 'pēc 2 stundām', '90 minutes with suffix = in 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 stundas', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), false), 'pirms 5 stundām', '5 hours with suffix = 5 hours ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 stunda', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), false), 'pirms 21 stundas', '21 hours with suffix = 21 hours ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'diena', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), false), 'pirms dienas', '22 hours with suffix = a day ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'diena', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dienas', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), false), 'pirms 2 dienām', '36 hours with suffix = 2 days ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'diena', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dienas', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), false), 'pirms 5 dienām', '5 days with suffix = 5 days ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dienas', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), false), 'pirms 25 dienām', '25 days with suffix = 25 days ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mēnesis', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), false), 'pirms mēneša', '26 days with suffix = a month ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mēnesis', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mēnesis', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mēneši', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), false), 'pirms 2 mēnešiem', '46 days with suffix = 2 months ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mēneši', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mēneši', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), false), 'pirms 3 mēnešiem', '76 days with suffix = 3 months ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mēnesis', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mēneši', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), false), 'pirms 5 mēnešiem', '5 months with suffix = 5 months ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'gads', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), false), 'pirms gada', '345 days with suffix = a year ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 gadi', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), false), 'pirms 2 gadiem', '548 days with suffix = 2 years ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'gads', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 gadi', '5 years = 5 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), false), 'pirms 5 gadiem', '5 years with suffix = 5 years ago'); - - // test that numbers ending with 1 are singular except for when they end with 11 in which case they are plural - assert.equal(start.from(moment([2007, 1, 28]).add({y: 11}), true), '11 gadi', '11 years = 11 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 21}), true), '21 gads', '21 year = 21 year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 211}), true), '211 gadi', '211 years = 211 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 221}), false), 'pirms 221 gada', '221 year with suffix = 221 years ago'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'pēc dažām sekundēm', 'prefix'); - assert.equal(moment(0).from(30000), 'pirms dažām sekundēm', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'pirms dažām sekundēm', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'pēc dažām sekundēm', 'in seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'pēc 5 dienām', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Šodien pulksten 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Šodien pulksten 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Šodien pulksten 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Rīt pulksten 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Šodien pulksten 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Vakar pulksten 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 [pulksten] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [pulksten] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [pulksten] 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('[Pagājušā] dddd [pulksten] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Pagājušā] dddd [pulksten] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Pagājušā] dddd [pulksten] 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 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'); -}); - diff --git a/src/test/locale/me.js b/src/test/locale/me.js deleted file mode 100644 index 5d2bb54aeb..0000000000 --- a/src/test/locale/me.js +++ /dev/null @@ -1,247 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('me'); - -test('parse', function (assert) { - var tests = 'januar jan._februar feb._mart mar._april apr._maj maj_jun jun_jul jul_avgust avg._septembar sep._oktobar okt._novembar nov._decembar 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, Do MMMM YYYY, h:mm:ss a', 'nedjelja, 14. februar 2010, 3:25:50 pm'], - ['ddd, hA', 'ned., 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. 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. februar 2010'], - ['LLL', '14. februar 2010 15:25'], - ['LLLL', 'nedjelja, 14. februar 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14. feb. 2010'], - ['lll', '14. feb. 2010 15:25'], - ['llll', 'ned., 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'), '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 = 'januar jan._februar feb._mart mar._april apr._maj maj_jun jun_jul jul_avgust avg._septembar sep._oktobar okt._novembar nov._decembar 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; - 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), 'nekoliko sekundi', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'jedan minut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'jedan minut', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuta', '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), 'za nekoliko sekundi', 'prefix'); - assert.equal(moment(0).from(30000), 'prije nekoliko sekundi', 'prefix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'prije nekoliko sekundi', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'za nekoliko 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(), '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(), 'sjutra 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če 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(makeFormat(m)), '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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - 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) { - var lastWeekDay = [ - '[prošle] [nedjelje] [u] LT', - '[prošlog] [ponedjeljka] [u] LT', - '[prošlog] [utorka] [u] LT', - '[prošle] [srijede] [u] LT', - '[prošlog] [četvrtka] [u] LT', - '[prošlog] [petka] [u] LT', - '[prošle] [subote] [u] LT' - ]; - - return lastWeekDay[d.day()]; - } - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - 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(makeFormat(m)), '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'); - } -}); - -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'); -}); - -// Monday is the first day of the week. -// The week that contains Jan 1st is the first week of the year. - -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'); -}); diff --git a/src/test/locale/mi.js b/src/test/locale/mi.js deleted file mode 100644 index f5bca36f46..0000000000 --- a/src/test/locale/mi.js +++ /dev/null @@ -1,211 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('mi'); - -test('parse', function (assert) { - var tests = 'Kohi-tāte Kohi_Hui-tanguru Hui_Poutū-te-rangi Pou_Paenga-whāwhā Pae_Haratua Hara_Pipiri Pipi_Hōngoingoi Hōngoi_Here-turi-kōkā Here_Mahuru Mahu_Whiringa-ā-nuku Whi-nu_Whiringa-ā-rangi Whi-ra_Hakihea Haki'.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', 'Rātapu, Hui-tanguru 14º 2010, 3:25:50 pm'], - ['ddd, hA', 'Ta, 3PM'], - ['M Mo MM MMMM MMM', '2 2º 02 Hui-tanguru Hui'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14º 14'], - ['d do dddd ddd dd', '0 0º Rātapu Ta Ta'], - ['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 Hui-tanguru 2010'], - ['LLL', '14 Hui-tanguru 2010 i 15:25'], - ['LLLL', 'Rātapu, 14 Hui-tanguru 2010 i 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Hui 2010'], - ['lll', '14 Hui 2010 i 15:25'], - ['llll', 'Ta, 14 Hui 2010 i 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 = 'Kohi-tāte Kohi_Hui-tanguru Hui_Poutū-te-rangi Pou_Paenga-whāwhā Pae_Haratua Hara_Pipiri Pipi_Hōngoingoi Hōngoi_Here-turi-kōkā Here_Mahuru Mahu_Whiringa-ā-nuku Whi-nu_Whiringa-ā-rangi Whi-ra_Hakihea Haki'.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 = 'Rātapu Ta Ta_Mane Ma Ma_Tūrei Tū Tū_Wenerei We We_Tāite Tāi Tāi_Paraire Pa Pa_Hātarei Hā Hā'.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), 'te hēkona ruarua', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'he meneti', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'he meneti', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 meneti', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 meneti', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'te haora', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'te haora', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 haora', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 haora', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 haora', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'he ra', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'he ra', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 ra', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'he ra', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 ra', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 ra', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'he marama', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'he marama', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'he marama', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 marama', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 marama', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 marama', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'he marama', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 marama', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'he tau', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 tau', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'he tau', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 tau', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'i roto i te hēkona ruarua', 'prefix'); - assert.equal(moment(0).from(30000), 'te hēkona ruarua i mua', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'te hēkona ruarua i mua', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'i roto i te hēkona ruarua', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'i roto i 5 ra', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'i teie mahana, i 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'i teie mahana, i 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'i teie mahana, i 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'apopo i 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'i teie mahana, i 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'inanahi i 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 [i] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [i] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [i] 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 [whakamutunga i] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [whakamutunga i] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [whakamutunga i] 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 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'); -}); - diff --git a/src/test/locale/mk.js b/src/test/locale/mk.js deleted file mode 100644 index f56b053d69..0000000000 --- a/src/test/locale/mk.js +++ /dev/null @@ -1,225 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('mk'); - -test('parse', function (assert) { - 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); - 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', 'недела, февруари 14-ти 2010, 15:25:50'], - ['ddd, hA', 'нед, 3PM'], - ['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-ев недела нед нe'], - ['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 февруари 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; - 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 = 'јануари јан_февруари фев_март мар_април апр_мај мај_јуни јун_јули јул_август авг_септември сеп_октомври окт_ноември ное_декември дек'.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 = 'недела нед нe_понеделник пон пo_вторник вто вт_среда сре ср_четврток чет че_петок пет пе_сабота саб сa'.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), 'неколку секунди', '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), '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: 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), 'после неколку секунди', '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'); -}); - -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'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -test('calendar last week', function (assert) { - var i, m; - - function makeFormat(d) { - switch (d.day()) { - case 0: - case 3: - case 6: - return '[Изминатата] dddd [во] LT'; - case 1: - case 2: - case 4: - case 5: - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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(makeFormat(m)), '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([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'); -}); - diff --git a/src/test/locale/ml.js b/src/test/locale/ml.js deleted file mode 100644 index 3178c70e0f..0000000000 --- a/src/test/locale/ml.js +++ /dev/null @@ -1,226 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('ml'); - -test('parse', function (assert) { - 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); - 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, Do MMMM YYYY, a h:mm:ss -നു', 'ഞായറാഴ്ച, 14 ഫെബ്രുവരി 2010, ഉച്ച കഴിഞ്ഞ് 3:25:50 -നു'], - ['ddd, a h -നു', 'ഞായർ, ഉച്ച കഴിഞ്ഞ് 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', 'ഉച്ച കഴിഞ്ഞ് ഉച്ച കഴിഞ്ഞ്'], - ['LTS', 'ഉച്ച കഴിഞ്ഞ് 3:25:50 -നു'], - ['L', '14/02/2010'], - ['LL', '14 ഫെബ്രുവരി 2010'], - ['LLL', '14 ഫെബ്രുവരി 2010, ഉച്ച കഴിഞ്ഞ് 3:25 -നു'], - ['LLLL', 'ഞായറാഴ്ച, 14 ഫെബ്രുവരി 2010, ഉച്ച കഴിഞ്ഞ് 3:25 -നു'], - ['l', '14/2/2010'], - ['ll', '14 ഫെബ്രു. 2010'], - ['lll', '14 ഫെബ്രു. 2010, ഉച്ച കഴിഞ്ഞ് 3:25 -നു'], - ['llll', 'ഞായർ, 14 ഫെബ്രു. 2010, ഉച്ച കഴിഞ്ഞ് 3: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 = 'ജനുവരി ജനു._ഫെബ്രുവരി ഫെബ്രു._മാർച്ച് മാർ._ഏപ്രിൽ ഏപ്രി._മേയ് മേയ്_ജൂൺ ജൂൺ_ജൂലൈ ജൂലൈ._ഓഗസ്റ്റ് ഓഗ._സെപ്റ്റംബർ സെപ്റ്റ._ഒക്ടോബർ ഒക്ടോ._നവംബർ നവം._ഡിസംബർ ഡിസം.'.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; - 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), 'അൽപ നിമിഷങ്ങൾ', '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), '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: 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), 'അൽപ നിമിഷങ്ങൾ കഴിഞ്ഞ്', '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'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'അൽപ നിമിഷങ്ങൾ കഴിഞ്ഞ്', 'അൽപ നിമിഷങ്ങൾ കഴിഞ്ഞ്'); - assert.equal(moment().add({d: 5}).fromNow(), '5 ദിവസം കഴിഞ്ഞ്', '5 ദിവസം കഴിഞ്ഞ്'); -}); - -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: 3}).calendar(), 'ഇന്ന് ഉച്ച കഴിഞ്ഞ് 3:00 -നു', 'Now plus 3 hours'); - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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('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'), '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'); -}); - diff --git a/src/test/locale/mn.js b/src/test/locale/mn.js deleted file mode 100644 index 2e0f5d8276..0000000000 --- a/src/test/locale/mn.js +++ /dev/null @@ -1,220 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('mn'); - -test('parse', function (assert) { - var i, - tests = 'Нэгдүгээр сар-1 сар_Хоёрдугаар сар-2 сар_Гуравдугаар сар-3 сар_Дөрөвдүгээр сар-4 сар_Тавдугаар сар-5 сар_Зургадугаар сар-6 сар_Долдугаар сар-7 сар_Наймдугаар сар-8 сар_Есдүгээр сар-9 сар_Аравдугаар сар-10 сар_Арван нэгдүгээр сар-11 сар_Арван хоёрдугаар сар-12 сар'.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); - 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); - } - - assert.equal(moment('5 сар 11 1989', ['MMM DD YYYY']).format('YYYY-MM-DD'), '1989-05-11'); - assert.equal(moment('1989 он, Арван хоёрдугаар сар 11', ['YYYY [он], MMMM DD']).format('YYYY-MM-DD'), '1989-12-11'); - assert.equal(moment('1989 оны 11 сарын 2', ['YYYY [оны] MMMM[ын] DD']).format('YYYY-MM-D'), '1989-11-2'); - assert.equal(moment('1989 оны 5 сарын 11 өдөр', ['YYYY [оны] MMMM[ын] Do']).format('YYYY-MM-DD'), '1989-05-11'); - assert.equal(moment('1989 оны 5 сарын 11 өдөр 11:25 ҮӨ', ['YYYY [оны] MMM[ын] Do h:mm a']).format('YYYY-MM-DD h:mm a'), '1989-05-11 11:25 ҮӨ'); - assert.equal(moment('2003 оны Дөрөвдүгээр сарын 11 өдөр 17:25 ҮХ', ['YYYY [оны] MMMM[ын] Do HH:mm a']).format('YYYY-MM-DD HH:mm a'), '2003-04-11 17:25 ҮХ'); -}); - -test('format', function (assert) { - var a = [ - ['dddd, MMMM[ын] Do YYYY, h:mm:ss a', 'Ням, Хоёрдугаар сарын 14 өдөр 2010, 3:25:50 ҮХ'], - ['ddd, hA', 'Ням, 3ҮХ'], - ['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 өдөр Ням Ням Ня'], - ['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', '2010-02-14'], - ['LL', '2010 оны Хоёрдугаар сарын 14'], - ['LLL', '2010 оны Хоёрдугаар сарын 14 15:25'], - ['LLLL', 'Ням, 2010 оны Хоёрдугаар сарын 14 15:25'], - ['l', '2010-2-14'], - ['ll', '2010 оны 2 сарын 14'], - ['lll', '2010 оны 2 сарын 14 15:25'], - ['llll', 'Ням, 2010 оны 2 сарын 14 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 meridiem', function (assert) { - assert.equal(moment([2012, 11, 28, 0, 0]).format('A'), 'ҮӨ', 'AM'); - assert.equal(moment([2012, 11, 28, 11, 59]).format('A'), 'ҮӨ', 'AM'); - assert.equal(moment([2012, 11, 28, 12, 0]).format('A'), 'ҮХ', 'PM'); - assert.equal(moment([2012, 11, 28, 23, 59]).format('A'), 'ҮХ', 'PM'); -}); - -test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1 өдөр', '1st'); -}); - -test('format month', function (assert) { - var i, - expected = 'Нэгдүгээр сар 1 сар_Хоёрдугаар сар 2 сар_Гуравдугаар сар 3 сар_Дөрөвдүгээр сар 4 сар_Тавдугаар сар 5 сар_Зургадугаар сар 6 сар_Долдугаар сар 7 сар_Наймдугаар сар 8 сар_Есдүгээр сар 9 сар_Аравдугаар сар 10 сар_Арван нэгдүгээр сар 11 сар_Арван хоёрдугаар сар 12 сар'.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 i, - expected = 'Ням Ням Ня_Даваа Дав Да_Мягмар Мяг Мя_Лхагва Лха Лх_Пүрэв Пүр Пү_Баасан Баа Ба_Бямба Бям Бя'.split('_'); - - 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), 'хэдхэн секунд', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), '1 минут', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '1 минут', '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), '1 цаг', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '1 цаг', '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), '1 өдөр', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '1 өдөр', '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 өдөр', '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), '1 сар', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '1 сар', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '1 сар', '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 сар', '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), '1 жил', '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 жил', '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'); -}); - -test('now from now', function (assert) { - 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({s: 50}).fromNow(), '1 минутын дараа', 'in a minute'); - assert.equal(moment().add({m: 5}).fromNow(), '5 минутын дараа', 'in 5 minutes'); - assert.equal(moment().add({h: 2}).fromNow(), '2 цагийн дараа', 'in 2 hours'); - assert.equal(moment().add({d: 5}).fromNow(), '5 өдрийн дараа', 'in 5 days'); - assert.equal(moment().add({M: 2}).fromNow(), '2 сарын дараа', 'in 2 months'); - assert.equal(moment().add({M: 15}).fromNow(), '1 жилийн дараа', 'in a year'); - assert.equal(moment().add({M: 16}).fromNow(), '1 жилийн дараа', 'in a year'); - assert.equal(moment().add({M: 23}).fromNow(), '2 жилийн дараа', 'in 2 years'); - assert.equal(moment().add({y: 7}).fromNow(), '7 жилийн дараа', 'in 7 years'); - - assert.equal(moment().subtract({s: 30}).fromNow(), 'хэдхэн секундын өмнө', 'a few seconds ago'); - assert.equal(moment().subtract({s: 50}).fromNow(), '1 минутын өмнө', 'a minute ago'); - assert.equal(moment().subtract({m: 5}).fromNow(), '5 минутын өмнө', '5 minutes ago'); - assert.equal(moment().subtract({h: 2}).fromNow(), '2 цагийн өмнө', '2 hours ago'); - assert.equal(moment().subtract({d: 5}).fromNow(), '5 өдрийн өмнө', '5 days ago'); - assert.equal(moment().subtract({M: 2}).fromNow(), '2 сарын өмнө', '2 months ago'); - assert.equal(moment().subtract({M: 15}).fromNow(), '1 жилийн өмнө', 'a year ago'); - assert.equal(moment().subtract({M: 16}).fromNow(), '1 жилийн өмнө', 'a year ago'); - assert.equal(moment().subtract({M: 23}).fromNow(), '2 жилийн өмнө', '2 years ago'); - assert.equal(moment().subtract({y: 7}).fromNow(), '7 жилийн өмнө', '7 years ago'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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 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'); -}); - diff --git a/src/test/locale/mr.js b/src/test/locale/mr.js deleted file mode 100644 index c505ae43be..0000000000 --- a/src/test/locale/mr.js +++ /dev/null @@ -1,227 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('mr'); - -test('parse', function (assert) { - 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); - 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, 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'), '१', '१'); - 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; - 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; - 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), 'काही सेकंद', '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'); -}); - -test('now from now', function (assert) { - 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(), '५ दिवसांमध्ये', '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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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('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'); -}); - - diff --git a/src/test/locale/ms-my.js b/src/test/locale/ms-my.js deleted file mode 100644 index 51f99a2e1c..0000000000 --- a/src/test/locale/ms-my.js +++ /dev/null @@ -1,220 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('ms-my'); - -test('parse', function (assert) { - var i, - tests = 'Januari Jan_Februari Feb_Mac Mac_April Apr_Mei Mei_Jun Jun_Julai Jul_Ogos Ogs_September Sep_Oktober Okt_November Nov_Disember Dis'.split('_'); - - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' sepatutnya bulan ' + (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', 'Ahad, Februari 14 2010, 3:25:50 petang'], - ['ddd, hA', 'Ahd, 3petang'], - ['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 Ahad Ahd Ah'], - ['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', 'petang petang'], - ['[hari] [ke] DDDo [tahun] ini', 'hari ke 45 tahun ini'], - ['LTS', '15.25.50'], - ['L', '14/02/2010'], - ['LL', '14 Februari 2010'], - ['LLL', '14 Februari 2010 pukul 15.25'], - ['LLLL', 'Ahad, 14 Februari 2010 pukul 15.25'], - ['l', '14/2/2010'], - ['ll', '14 Feb 2010'], - ['lll', '14 Feb 2010 pukul 15.25'], - ['llll', 'Ahd, 14 Feb 2010 pukul 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 i, - expected = 'Januari Jan_Februari Feb_Mac Mac_April Apr_Mei Mei_Jun Jun_Julai Jul_Ogos Ogs_September Sep_Oktober Okt_November Nov_Disember Dis'.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 i, - expected = 'Ahad Ahd Ah_Isnin Isn Is_Selasa Sel Sl_Rabu Rab Rb_Khamis Kha Km_Jumaat Jum Jm_Sabtu Sab Sb'.split('_'); - - 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), 'beberapa saat', '44 saat = beberapa saat'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'seminit', '45 saat = seminit'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'seminit', '89 saat = seminit'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minit', '90 saat = 2 minit'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minit', '44 minit = 44 minit'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'sejam', '45 minit = sejam'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'sejam', '89 minit = sejam'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 jam', '90 minit = 2 jam'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 jam', '5 jam = 5 jam'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 jam', '21 jam = 21 jam'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'sehari', '22 jam = sehari'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'sehari', '35 jam = sehari'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 hari', '36 jam = 2 hari'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'sehari', '1 hari = sehari'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 hari', '5 hari = 5 hari'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 hari', '25 hari = 25 hari'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'sebulan', '26 hari = sebulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'sebulan', '30 hari = sebulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'sebulan', '45 hari = sebulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 bulan', '46 hari = 2 bulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 bulan', '75 hari = 2 bulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 bulan', '76 hari = 3 bulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'sebulan', '1 bulan = sebulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 bulan', '5 bulan = 5 bulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'setahun', '345 hari = setahun'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 tahun', '548 hari = 2 tahun'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'setahun', '1 tahun = setahun'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 tahun', '5 tahun = 5 tahun'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'dalam beberapa saat', 'prefix'); - assert.equal(moment(0).from(30000), 'beberapa saat yang lepas', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'beberapa saat yang lepas', 'waktu sekarang dari sekarang sepatutnya menunjukkan sebagai telah lepas'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'dalam beberapa saat', 'dalam beberapa saat'); - assert.equal(moment().add({d: 5}).fromNow(), 'dalam 5 hari', 'dalam 5 hari'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Hari ini pukul 12.00', 'hari ini pada waktu yang sama'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Hari ini pukul 12.25', 'Sekarang tambah 25 minit'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Hari ini pukul 13.00', 'Sekarang tambah 1 jam'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Esok pukul 12.00', 'esok pada waktu yang sama'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hari ini pukul 11.00', 'Sekarang tolak 1 jam'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kelmarin pukul 12.00', 'kelmarin pada waktu yang sama'); -}); - -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'), 'Hari ini + ' + i + ' hari waktu sekarang'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Hari ini + ' + i + ' hari permulaan hari'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Hari ini + ' + i + ' hari tamat hari'); - } -}); - -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 [lepas] [pukul] LT'), 'Hari ini - ' + i + ' hari waktu sekarang'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [lepas] [pukul] LT'), 'Hari ini - ' + i + ' hari permulaan hari'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [lepas] [pukul] LT'), 'Hari ini - ' + i + ' hari tamat hari'); - } -}); - -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 minggu lepas'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'dalam 1 minggu'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 minggu lepas'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'dalam 2 minggu'); -}); - -test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', 'Jan 1 2012 sepatutnya minggu 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '2 02 2', 'Jan 7 2012 sepatutnya minggu 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 sepatutnya minggu 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '3 03 3', 'Jan 14 2012 sepatutnya minggu 3'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 sepatutnya minggu 3'); -}); - - diff --git a/src/test/locale/ms.js b/src/test/locale/ms.js deleted file mode 100644 index 36a0e9989f..0000000000 --- a/src/test/locale/ms.js +++ /dev/null @@ -1,220 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('ms'); - -test('parse', function (assert) { - var i, - tests = 'Januari Jan_Februari Feb_Mac Mac_April Apr_Mei Mei_Jun Jun_Julai Jul_Ogos Ogs_September Sep_Oktober Okt_November Nov_Disember Dis'.split('_'); - - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' sepatutnya bulan ' + (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', 'Ahad, Februari 14 2010, 3:25:50 petang'], - ['ddd, hA', 'Ahd, 3petang'], - ['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 Ahad Ahd Ah'], - ['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', 'petang petang'], - ['[hari] [ke] DDDo [tahun] ini', 'hari ke 45 tahun ini'], - ['LTS', '15.25.50'], - ['L', '14/02/2010'], - ['LL', '14 Februari 2010'], - ['LLL', '14 Februari 2010 pukul 15.25'], - ['LLLL', 'Ahad, 14 Februari 2010 pukul 15.25'], - ['l', '14/2/2010'], - ['ll', '14 Feb 2010'], - ['lll', '14 Feb 2010 pukul 15.25'], - ['llll', 'Ahd, 14 Feb 2010 pukul 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 i, - expected = 'Januari Jan_Februari Feb_Mac Mac_April Apr_Mei Mei_Jun Jun_Julai Jul_Ogos Ogs_September Sep_Oktober Okt_November Nov_Disember Dis'.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 i, - expected = 'Ahad Ahd Ah_Isnin Isn Is_Selasa Sel Sl_Rabu Rab Rb_Khamis Kha Km_Jumaat Jum Jm_Sabtu Sab Sb'.split('_'); - - 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), 'beberapa saat', '44 saat = beberapa saat'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'seminit', '45 saat = seminit'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'seminit', '89 saat = seminit'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minit', '90 saat = 2 minit'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minit', '44 minit = 44 minit'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'sejam', '45 minit = sejam'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'sejam', '89 minit = sejam'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 jam', '90 minit = 2 jam'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 jam', '5 jam = 5 jam'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 jam', '21 jam = 21 jam'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'sehari', '22 jam = sehari'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'sehari', '35 jam = sehari'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 hari', '36 jam = 2 hari'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'sehari', '1 hari = sehari'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 hari', '5 hari = 5 hari'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 hari', '25 hari = 25 hari'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'sebulan', '26 hari = sebulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'sebulan', '30 hari = sebulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'sebulan', '45 hari = sebulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 bulan', '46 hari = 2 bulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 bulan', '75 hari = 2 bulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 bulan', '76 hari = 3 bulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'sebulan', '1 bulan = sebulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 bulan', '5 bulan = 5 bulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'setahun', '345 hari = setahun'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 tahun', '548 hari = 2 tahun'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'setahun', '1 tahun = setahun'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 tahun', '5 tahun = 5 tahun'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'dalam beberapa saat', 'prefix'); - assert.equal(moment(0).from(30000), 'beberapa saat yang lepas', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'beberapa saat yang lepas', 'waktu sekarang dari sekarang sepatutnya menunjukkan sebagai telah lepas'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'dalam beberapa saat', 'dalam beberapa saat'); - assert.equal(moment().add({d: 5}).fromNow(), 'dalam 5 hari', 'dalam 5 hari'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Hari ini pukul 12.00', 'hari ini pada waktu yang sama'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Hari ini pukul 12.25', 'Sekarang tambah 25 minit'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Hari ini pukul 13.00', 'Sekarang tambah 1 jam'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Esok pukul 12.00', 'esok pada waktu yang sama'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hari ini pukul 11.00', 'Sekarang tolak 1 jam'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kelmarin pukul 12.00', 'kelmarin pada waktu yang sama'); -}); - -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'), 'Hari ini + ' + i + ' hari waktu sekarang'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Hari ini + ' + i + ' hari permulaan hari'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Hari ini + ' + i + ' hari tamat hari'); - } -}); - -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 [lepas] [pukul] LT'), 'Hari ini - ' + i + ' hari waktu sekarang'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [lepas] [pukul] LT'), 'Hari ini - ' + i + ' hari permulaan hari'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [lepas] [pukul] LT'), 'Hari ini - ' + i + ' hari tamat hari'); - } -}); - -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 minggu lepas'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'dalam 1 minggu'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 minggu lepas'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'dalam 2 minggu'); -}); - -test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', 'Jan 1 2012 sepatutnya minggu 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '2 02 2', 'Jan 7 2012 sepatutnya minggu 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 sepatutnya minggu 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '3 03 3', 'Jan 14 2012 sepatutnya minggu 3'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 sepatutnya minggu 3'); -}); - - diff --git a/src/test/locale/mt.js b/src/test/locale/mt.js deleted file mode 100644 index 242a0de7e5..0000000000 --- a/src/test/locale/mt.js +++ /dev/null @@ -1,211 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('mt'); - -test('parse', function (assert) { - var tests = 'Jannar Jan_Frar Fra_Marzu Mar_April Apr_Mejju Mej_Ġunju Ġun_Lulju Lul_Awwissu Aww_Settembru Set_Ottubru Ott_Novembru Nov_Diċembru Diċ'.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', 'Il-Ħadd, Frar 14º 2010, 3:25:50 pm'], - ['ddd, hA', 'Ħad, 3PM'], - ['M Mo MM MMMM MMM', '2 2º 02 Frar Fra'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14º 14'], - ['d do dddd ddd dd', '0 0º Il-Ħadd Ħad Ħa'], - ['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 Frar 2010'], - ['LLL', '14 Frar 2010 15:25'], - ['LLLL', 'Il-Ħadd, 14 Frar 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Fra 2010'], - ['lll', '14 Fra 2010 15:25'], - ['llll', 'Ħad, 14 Fra 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 = 'Jannar Jan_Frar Fra_Marzu Mar_April Apr_Mejju Mej_Ġunju Ġun_Lulju Lul_Awwissu Aww_Settembru Set_Ottubru Ott_Novembru Nov_Diċembru Diċ'.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 = 'Il-Ħadd Ħad Ħa_It-Tnejn Tne Tn_It-Tlieta Tli Tl_L-Erbgħa Erb Er_Il-Ħamis Ħam Ħa_Il-Ġimgħa Ġim Ġi_Is-Sibt Sib Si'.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), 'ftit sekondi', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minuta', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minuta', '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), 'siegħa', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'siegħa', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 siegħat', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 siegħat', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 siegħat', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ġurnata', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ġurnata', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 ġranet', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ġurnata', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 ġranet', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 ġranet', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'xahar', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'xahar', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'xahar', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 xhur', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 xhur', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 xhur', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'xahar', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 xhur', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'sena', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 sni', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'sena', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 sni', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'f’ ftit sekondi', 'prefix'); - assert.equal(moment(0).from(30000), 'ftit sekondi ilu', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'ftit sekondi ilu', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'f’ ftit sekondi', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'f’ 5 ġranet', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Illum fil-12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Illum fil-12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Illum fil-13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Għada fil-12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Illum fil-11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Il-bieraħ fil-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 [fil-]LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [fil-]LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [fil-]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 [li għadda] [fil-]LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [li għadda] [fil-]LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [li għadda] [fil-]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 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'); -}); - diff --git a/src/test/locale/my.js b/src/test/locale/my.js deleted file mode 100644 index bdead58a89..0000000000 --- a/src/test/locale/my.js +++ /dev/null @@ -1,288 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('my'); - -test('parse', function (assert) { - 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); - 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', 'တနင်္ဂနွေ, ဖေဖော်ဝါရီ ၁၄ ၂၀၁၀, ၃:၂၅:၅၀ pm'], - ['ddd, hA', 'နွေ, ၃PM'], - ['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', 'pm PM'], - ['[နှစ်၏] DDDo [ရက်မြောက်]', 'နှစ်၏ ၄၅ ရက်မြောက်'], - ['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'), '၁', '၁'); - 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; - 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; - - 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), 'စက္ကန်.အနည်းငယ်', '၄၄ စက္ကန်. = စက္ကန်.အနည်းငယ်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - s: 45 - }), true), 'တစ်မိနစ်', '၄၅ စက္ကန်. = တစ်မိနစ်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - s: 89 - }), true), 'တစ်မိနစ်', '၈၉ စက္ကန်. = တစ်မိနစ်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - s: 90 - }), true), '၂ မိနစ်', '၉၀ စက္ကန်. = ၂ မိနစ်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - m: 44 - }), true), '၄၄ မိနစ်', '၄၄ မိနစ် = ၄၄ မိနစ်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - m: 45 - }), true), 'တစ်နာရီ', '၄၅ မိနစ် = ၁ နာရီ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - m: 89 - }), true), 'တစ်နာရီ', '၈၉ မိနစ် = တစ်နာရီ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - m: 90 - }), true), '၂ နာရီ', 'မိနစ် ၉၀= ၂ နာရီ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - h: 5 - }), true), '၅ နာရီ', '၅ နာရီ= ၅ နာရီ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - h: 21 - }), true), '၂၁ နာရီ', '၂၁ နာရီ =၂၁ နာရီ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - h: 22 - }), true), 'တစ်ရက်', '၂၂ နာရီ =တစ်ရက်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - h: 35 - }), true), 'တစ်ရက်', '၃၅ နာရီ =တစ်ရက်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - h: 36 - }), true), '၂ ရက်', '၃၆ နာရီ = ၂ ရက်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 1 - }), true), 'တစ်ရက်', '၁ ရက်= တစ်ရက်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 5 - }), true), '၅ ရက်', '၅ ရက် = ၅ ရက်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 25 - }), true), '၂၅ ရက်', '၂၅ ရက်= ၂၅ ရက်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 26 - }), true), 'တစ်လ', '၂၆ ရက် = တစ်လ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 30 - }), true), 'တစ်လ', 'ရက် ၃၀ = တစ်လ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 43 - }), true), 'တစ်လ', '၄၃ ရက် = တစ်လ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 46 - }), true), '၂ လ', '၄၆ ရက် = ၂ လ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 74 - }), true), '၂ လ', '၇၅ ရက်= ၂ လ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 76 - }), true), '၃ လ', '၇၆ ရက် = ၃ လ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - M: 1 - }), true), 'တစ်လ', '၁ လ = တစ်လ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - M: 5 - }), true), '၅ လ', '၅ လ = ၅ လ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 345 - }), true), 'တစ်နှစ်', '၃၄၅ ရက် = တစ်နှစ်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 548 - }), true), '၂ နှစ်', '၅၄၈ ရက် = ၂ နှစ်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - y: 1 - }), true), 'တစ်နှစ်', '၁ နှစ် = တစ်နှစ်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - y: 5 - }), true), '၅ နှစ်', '၅ နှစ် = ၅ နှစ်'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'လာမည့် စက္ကန်.အနည်းငယ် မှာ', 'prefix'); - assert.equal(moment(0).from(30000), 'လွန်ခဲ့သော စက္ကန်.အနည်းငယ် က', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'လွန်ခဲ့သော စက္ကန်.အနည်းငယ် က', 'ယခုမှစပြီး အတိတ်တွင်ဖော်ပြသလိုဖော်ပြမည်'); -}); - -test('fromNow', function (assert) { - 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(), 'ယနေ. ၁၂:၀၀ မှာ', 'ယနေ. ဒီအချိန်'); - assert.equal(moment(a).add({m: 25}).calendar(), 'ယနေ. ၁၂:၂၅ မှာ', 'ယခုမှ ၂၅ မိနစ်ပေါင်းထည့်'); - assert.equal(moment(a).add({h: 1}).calendar(), 'ယနေ. ၁၃:၀၀ မှာ', 'ယခုမှ ၁ နာရီပေါင်းထည့်'); - assert.equal(moment(a).add({d: 1}).calendar(), 'မနက်ဖြန် ၁၂:၀၀ မှာ', 'မနက်ဖြန် ဒီအချိန်'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'ယနေ. ၁၁:၀၀ မှာ', 'ယခုမှ ၁ နာရီနှုတ်'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'မနေ.က ၁၂:၀၀ မှာ', 'မနေ.က ဒီအချိန်'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({ - w: 1 - }), - weeksFromNow = moment().add({ - w: 1 - }); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), 'လွန်ခဲ့သော ၁ ပတ်က'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), '၁ ပတ်အတွင်း'); - - weeksAgo = moment().subtract({ - w: 2 - }); - weeksFromNow = moment().add({ - w: 2 - }); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '၂ ပတ် အရင်က'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), '၂ ပတ် အတွင်း'); -}); - -test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '၅၂ ၅၂ ၅၂', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '၁ ၀၁ ၁', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '၁ ၀၁ ၁', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '၂ ၀၂ ၂', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '၂ ၀၂ ၂', 'Jan 15 2012 should be week 2'); -}); - diff --git a/src/test/locale/nb.js b/src/test/locale/nb.js deleted file mode 100644 index 64acc5bf63..0000000000 --- a/src/test/locale/nb.js +++ /dev/null @@ -1,211 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('nb'); - -test('parse', function (assert) { - var tests = 'januar jan._februar feb._mars mars_april april_mai mai_juni juni_juli juli_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); - 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', 'søndag, februar 14. 2010, 3:25:50 pm'], - ['ddd, hA', 'sø., 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. søndag sø. sø'], - ['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'], - ['[den] DDDo [dagen i året]', 'den 45. dagen i året'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14. februar 2010'], - ['LLL', '14. februar 2010 kl. 15:25'], - ['LLLL', 'søndag 14. februar 2010 kl. 15:25'], - ['l', '14.2.2010'], - ['ll', '14. feb. 2010'], - ['lll', '14. feb. 2010 kl. 15:25'], - ['llll', 'sø. 14. feb. 2010 kl. 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 = 'januar jan._februar feb._mars mars_april april_mai mai_juni juni_juli juli_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 expected = 'søndag sø. sø_mandag ma. ma_tirsdag ti. ti_onsdag on. on_torsdag to. to_fredag fr. fr_lørdag 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]); - } -}); - -test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'noen sekunder', '44 sekunder = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ett minutt', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ett minutt', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutter', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutter', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'en time', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'en time', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 timer', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 timer', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 timer', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'en dag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'en dag', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dager', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'en dag', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dager', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dager', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'en måned', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'en måned', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'en måned', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 måneder', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 måneder', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 måneder', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'en måned', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 måneder', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ett å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), 'ett å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), 'om noen sekunder', 'prefix'); - assert.equal(moment(0).from(30000), 'noen sekunder siden', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'noen sekunder siden', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'om noen sekunder', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'om 5 dager', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'i dag kl. 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'i dag kl. 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'i dag kl. 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'i morgen kl. 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'i dag kl. 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'i 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 [kl.] 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - 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('[forrige] dddd [kl.] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[forrige] dddd [kl.] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[forrige] dddd [kl.] 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 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'); -}); - diff --git a/src/test/locale/ne.js b/src/test/locale/ne.js deleted file mode 100644 index 7828cd4c6a..0000000000 --- a/src/test/locale/ne.js +++ /dev/null @@ -1,226 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('ne'); - -test('parse', function (assert) { - 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); - 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, 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'), '१', '१'); - 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; - 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; - 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), 'केही क्षण', '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'); -}); - -test('now from now', function (assert) { - 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(), '५ दिनमा', '५ दिनमा'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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('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([2011, 11, 26]).format('w ww wo'), '५३ ५३ ५३', 'Dec 26 2011 should be week 53'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '१ ०१ १', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '१ ०१ १', 'Jan 2 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, 9]).format('w ww wo'), '२ ०२ २', 'Jan 9 2012 should be week 2'); -}); - - diff --git a/src/test/locale/nl-be.js b/src/test/locale/nl-be.js deleted file mode 100644 index ae276531b6..0000000000 --- a/src/test/locale/nl-be.js +++ /dev/null @@ -1,217 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('nl-be'); - -test('parse', function (assert) { - var tests = 'januari jan._februari feb._maart mrt._april apr._mei mei._juni jun._juli jul._augustus aug._september sep._oktober 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)); - } - 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', 'zondag, februari 14de 2010, 15:25:50'], - ['ddd, HH', 'zo., 15'], - ['M Mo MM MMMM MMM', '2 2de 02 februari feb.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14de 14'], - ['d do dddd ddd dd', '0 0de zondag zo. zo'], - ['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 februari 2010'], - ['LLL', '14 februari 2010 15:25'], - ['LLLL', 'zondag 14 februari 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 feb. 2010'], - ['lll', '14 feb. 2010 15:25'], - ['llll', 'zo. 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 = 'januari jan._februari feb._maart mrt._april apr._mei mei_juni jun._juli jul._augustus aug._september sep._oktober 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 = 'zondag zo. zo_maandag ma. ma_dinsdag di. di_woensdag wo. wo_donderdag do. do_vrijdag vr. vr_zaterdag za. za'.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), 'een paar seconden', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'één minuut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'één minuut', '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), 'één uur', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'één uur', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 uur', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 uur', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 uur', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'één dag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'één dag', '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), 'één dag', '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), 'één maand', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'één maand', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'één maand', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 maanden', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 maanden', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 maanden', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'één maand', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 maanden', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'één jaar', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 jaar', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'één jaar', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 jaar', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'over een paar seconden', 'prefix'); - assert.equal(moment(0).from(30000), 'een paar seconden geleden', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'een paar seconden geleden', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'over een paar seconden', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'over 5 dagen', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'vandaag om 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'vandaag om 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'vandaag om 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'morgen om 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'vandaag om 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'gisteren 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('[afgelopen] dddd [om] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[afgelopen] dddd [om] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[afgelopen] 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]).unix(), moment('23-jun-2012', 'D-MMM-YYYY').unix(), 'parse month abbreviation surrounded by dashes without 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(moment([2012, 5, 23]).unix(), moment('23 jun. 2012', 'D MMM YYYY').unix(), 'parse month abbreviation not surrounded by dashes with 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'); -}); - diff --git a/src/test/locale/nl.js b/src/test/locale/nl.js deleted file mode 100644 index 035fecebe9..0000000000 --- a/src/test/locale/nl.js +++ /dev/null @@ -1,217 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('nl'); - -test('parse', function (assert) { - var tests = 'januari jan._februari feb._maart mrt._april apr._mei mei._juni jun._juli jul._augustus aug._september sep._oktober 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)); - } - 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', 'zondag, februari 14de 2010, 15:25:50'], - ['ddd, HH', 'zo., 15'], - ['M Mo MM MMMM MMM', '2 2de 02 februari feb.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14de 14'], - ['d do dddd ddd dd', '0 0de zondag zo. zo'], - ['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 februari 2010'], - ['LLL', '14 februari 2010 15:25'], - ['LLLL', 'zondag 14 februari 2010 15:25'], - ['l', '14-2-2010'], - ['ll', '14 feb. 2010'], - ['lll', '14 feb. 2010 15:25'], - ['llll', 'zo. 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 = 'januari jan._februari feb._maart mrt._april apr._mei mei_juni jun._juli jul._augustus aug._september sep._oktober 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 = 'zondag zo. zo_maandag ma. ma_dinsdag di. di_woensdag wo. wo_donderdag do. do_vrijdag vr. vr_zaterdag za. za'.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), 'een paar seconden', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'één minuut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'één minuut', '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), 'één uur', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'één uur', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 uur', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 uur', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 uur', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'één dag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'één dag', '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), 'één dag', '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), 'één maand', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'één maand', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'één maand', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 maanden', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 maanden', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 maanden', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'één maand', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 maanden', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'één jaar', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 jaar', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'één jaar', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 jaar', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'over een paar seconden', 'prefix'); - assert.equal(moment(0).from(30000), 'een paar seconden geleden', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'een paar seconden geleden', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'over een paar seconden', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'over 5 dagen', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'vandaag om 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'vandaag om 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'vandaag om 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'morgen om 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'vandaag om 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'gisteren 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('[afgelopen] dddd [om] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[afgelopen] dddd [om] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[afgelopen] 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]).unix(), moment('23-jun-2012', 'D-MMM-YYYY').unix(), 'parse month abbreviation surrounded by dashes without 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(moment([2012, 5, 23]).unix(), moment('23 jun. 2012', 'D MMM YYYY').unix(), 'parse month abbreviation not surrounded by dashes with 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'); -}); - diff --git a/src/test/locale/nn.js b/src/test/locale/nn.js deleted file mode 100644 index 7befb05ed7..0000000000 --- a/src/test/locale/nn.js +++ /dev/null @@ -1,210 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('nn'); - -test('parse', function (assert) { - var tests = 'januar jan_februar feb_mars mar_april 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); - 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', 'sundag, februar 14. 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. sundag 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'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14. februar 2010'], - ['LLL', '14. februar 2010 kl. 15:25'], - ['LLLL', 'sundag 14. februar 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; - 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 = 'januar jan_februar feb_mars mar_april 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 expected = 'sundag sun su_måndag mån må_tysdag tys ty_onsdag ons on_torsdag tor to_fredag fre fr_laurdag lau 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]); - } -}); - -test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'nokre sekund', '44 sekunder = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'eit minutt', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'eit minutt', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutt', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutt', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ein time', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ein time', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 timar', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 timar', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 timar', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ein dag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ein dag', '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 dag', '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ånad', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ein månad', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ein månad', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 månader', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 månader', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 månader', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ein månad', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 månader', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'eit å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), 'eit å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), 'om nokre sekund', 'prefix'); - assert.equal(moment(0).from(30000), 'nokre sekund sidan', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'nokre sekund sidan', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'om nokre sekund', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'om 5 dagar', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'I dag klokka 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'I dag klokka 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'I dag klokka 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'I morgon klokka 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'I dag klokka 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'I går klokka 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 [klokka] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [klokka] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [klokka] 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('[Føregåande] dddd [klokka] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Føregåande] dddd [klokka] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Føregåande] dddd [klokka] 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 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'); -}); - diff --git a/src/test/locale/pa-in.js b/src/test/locale/pa-in.js deleted file mode 100644 index 594553a886..0000000000 --- a/src/test/locale/pa-in.js +++ /dev/null @@ -1,322 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('pa-in'); - -test('parse', function (assert) { - 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); - 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, 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'), '੧', '੧'); - 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; - 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; - 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), 'ਕੁਝ ਸਕਿੰਟ', '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'); -}); - -test('now from now', function (assert) { - 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(), '੫ ਦਿਨ ਵਿੱਚ', '੫ ਦਿਨ ਵਿੱਚ'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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('meridiem invariant', 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', function (assert) { - assert.equal(moment([2012, 0, 1]).week(), 1, 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).week(), 1, 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).week(), 2, 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).week(), 2, 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).week(), 3, 'Jan 15 2012 should be week 3'); -}); - -test('weeks year starting monday', function (assert) { - assert.equal(moment([2006, 11, 31]).week(), 1, 'Dec 31 2006 should be week 1'); - assert.equal(moment([2007, 0, 1]).week(), 1, 'Jan 1 2007 should be week 1'); - assert.equal(moment([2007, 0, 6]).week(), 1, 'Jan 6 2007 should be week 1'); - assert.equal(moment([2007, 0, 7]).week(), 2, 'Jan 7 2007 should be week 2'); - assert.equal(moment([2007, 0, 13]).week(), 2, 'Jan 13 2007 should be week 2'); - assert.equal(moment([2007, 0, 14]).week(), 3, 'Jan 14 2007 should be week 3'); -}); - -test('weeks year starting tuesday', function (assert) { - assert.equal(moment([2007, 11, 29]).week(), 52, 'Dec 29 2007 should be week 52'); - assert.equal(moment([2008, 0, 1]).week(), 1, 'Jan 1 2008 should be week 1'); - assert.equal(moment([2008, 0, 5]).week(), 1, 'Jan 5 2008 should be week 1'); - assert.equal(moment([2008, 0, 6]).week(), 2, 'Jan 6 2008 should be week 2'); - assert.equal(moment([2008, 0, 12]).week(), 2, 'Jan 12 2008 should be week 2'); - assert.equal(moment([2008, 0, 13]).week(), 3, 'Jan 13 2008 should be week 3'); -}); - -test('weeks year starting wednesday', function (assert) { - assert.equal(moment([2002, 11, 29]).week(), 1, 'Dec 29 2002 should be week 1'); - assert.equal(moment([2003, 0, 1]).week(), 1, 'Jan 1 2003 should be week 1'); - assert.equal(moment([2003, 0, 4]).week(), 1, 'Jan 4 2003 should be week 1'); - assert.equal(moment([2003, 0, 5]).week(), 2, 'Jan 5 2003 should be week 2'); - assert.equal(moment([2003, 0, 11]).week(), 2, 'Jan 11 2003 should be week 2'); - assert.equal(moment([2003, 0, 12]).week(), 3, 'Jan 12 2003 should be week 3'); -}); - -test('weeks year starting thursday', function (assert) { - assert.equal(moment([2008, 11, 28]).week(), 1, 'Dec 28 2008 should be week 1'); - assert.equal(moment([2009, 0, 1]).week(), 1, 'Jan 1 2009 should be week 1'); - assert.equal(moment([2009, 0, 3]).week(), 1, 'Jan 3 2009 should be week 1'); - assert.equal(moment([2009, 0, 4]).week(), 2, 'Jan 4 2009 should be week 2'); - assert.equal(moment([2009, 0, 10]).week(), 2, 'Jan 10 2009 should be week 2'); - assert.equal(moment([2009, 0, 11]).week(), 3, 'Jan 11 2009 should be week 3'); -}); - -test('weeks year starting friday', function (assert) { - assert.equal(moment([2009, 11, 27]).week(), 1, 'Dec 27 2009 should be week 1'); - assert.equal(moment([2010, 0, 1]).week(), 1, 'Jan 1 2010 should be week 1'); - assert.equal(moment([2010, 0, 2]).week(), 1, 'Jan 2 2010 should be week 1'); - assert.equal(moment([2010, 0, 3]).week(), 2, 'Jan 3 2010 should be week 2'); - assert.equal(moment([2010, 0, 9]).week(), 2, 'Jan 9 2010 should be week 2'); - assert.equal(moment([2010, 0, 10]).week(), 3, 'Jan 10 2010 should be week 3'); -}); - -test('weeks year starting saturday', function (assert) { - assert.equal(moment([2010, 11, 26]).week(), 1, 'Dec 26 2010 should be week 1'); - assert.equal(moment([2011, 0, 1]).week(), 1, 'Jan 1 2011 should be week 1'); - assert.equal(moment([2011, 0, 2]).week(), 2, 'Jan 2 2011 should be week 2'); - assert.equal(moment([2011, 0, 8]).week(), 2, 'Jan 8 2011 should be week 2'); - assert.equal(moment([2011, 0, 9]).week(), 3, 'Jan 9 2011 should be week 3'); -}); - -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('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); - } -}); diff --git a/src/test/locale/pl.js b/src/test/locale/pl.js deleted file mode 100755 index b0b334895d..0000000000 --- a/src/test/locale/pl.js +++ /dev/null @@ -1,276 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('pl'); - -test('parse', function (assert) { - var tests = 'styczeń stycznia sty_luty lutego lut_marzec marca mar_kwiecień kwietnia kwi_maj maja maj_czerwiec czerwca cze_lipiec lipca lip_sierpień sierpnia sie_wrzesień września wrz_październik października paź_listopad listopada lis_grudzień grudnia gru'.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][2], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][2], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][2].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][2].toLocaleUpperCase(), 'MMMM', i); - } -}); - -test('parse strict', function (assert) { - var tests = 'styczeń stycznia sty_luty lutego lut_marzec marca mar_kwiecień kwietnia kwi_maj maja maj_czerwiec czerwca cze_lipiec lipca lip_sierpień sierpnia sie_wrzesień września wrz_październik października paź_listopad listopada lis_grudzień grudnia gru'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm, true).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][2], 'MMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][2].toLocaleLowerCase(), 'MMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][2].toLocaleUpperCase(), 'MMM', i); - } -}); - -test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'niedziela, luty 14. 2010, 3:25:50 pm'], - ['ddd, hA', 'ndz, 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 luty lut'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. niedziela ndz Nd'], - ['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 lutego 2010'], - ['LLL', '14 lutego 2010 15:25'], - ['LLLL', 'niedziela, 14 lutego 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14 lut 2010'], - ['lll', '14 lut 2010 15:25'], - ['llll', 'ndz, 14 lut 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 = 'styczeń sty_luty lut_marzec mar_kwiecień kwi_maj maj_czerwiec cze_lipiec lip_sierpień sie_wrzesień wrz_październik paź_listopad lis_grudzień gru'.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 = 'niedziela ndz Nd_poniedziałek pon Pn_wtorek wt Wt_środa śr Śr_czwartek czw Cz_piątek pt Pt_sobota sob 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), 'kilka sekund', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minuta', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minuta', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuty', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuty', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'godzina', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'godzina', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 godziny', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 godzin', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 godzin', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), '1 dzień', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '1 dzień', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dni', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), '1 dzień', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dni', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dni', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'miesiąc', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'miesiąc', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'miesiąc', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 miesiące', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 miesiące', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 miesiące', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'miesiąc', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 miesięcy', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'rok', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 lata', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'rok', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 lat', '5 years = 5 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 112}), true), '112 lat', '112 years = 112 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 122}), true), '122 lata', '122 years = 122 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 213}), true), '213 lat', '213 years = 213 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 223}), true), '223 lata', '223 years = 223 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'za kilka sekund', 'prefix'); - assert.equal(moment(0).from(30000), 'kilka sekund temu', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'kilka sekund temu', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'za kilka sekund', 'in a few seconds'); - assert.equal(moment().add({h: 1}).fromNow(), 'za godzinę', 'in an hour'); - assert.equal(moment().add({d: 5}).fromNow(), 'za 5 dni', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Dziś o 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Dziś o 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Dziś o 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Jutro o 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Dziś o 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Wczoraj o 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 '[W niedzielę o] LT'; - - case 2: - return '[We wtorek o] LT'; - - case 3: - return '[W środę o] LT'; - - case 6: - return '[W sobotę o] LT'; - - default: - return '[W] dddd [o] 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'); - - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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(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: - return '[W zeszłą niedzielę o] LT'; - case 3: - return '[W zeszłą środę o] LT'; - case 6: - return '[W zeszłą sobotę o] LT'; - default: - return '[W zeszły] dddd [o] 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'); - - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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(makeFormat(m)), '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 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'); -}); - diff --git a/src/test/locale/ro.js b/src/test/locale/ro.js deleted file mode 100644 index 8e84662e0c..0000000000 --- a/src/test/locale/ro.js +++ /dev/null @@ -1,218 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('ro'); - -test('parse', function (assert) { - var tests = 'ianuarie ian._februarie febr._martie mart._aprilie apr._mai mai_iunie iun._iulie iul._august aug._septembrie sept._octombrie oct._noiembrie nov._decembrie 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', 'duminică, februarie 14 2010, 3:25:50 PM'], - ['ddd, hA', 'Dum, 3PM'], - ['M Mo MM MMMM MMM', '2 2 02 februarie febr.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 duminică Dum Du'], - ['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'], - ['[a] DDDo[a zi a anului]', 'a 45a zi a anului'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 februarie 2010'], - ['LLL', '14 februarie 2010 15:25'], - ['LLLL', 'duminică, 14 februarie 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14 febr. 2010'], - ['lll', '14 febr. 2010 15:25'], - ['llll', 'Dum, 14 febr. 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 = 'ianuarie ian._februarie febr._martie mart._aprilie apr._mai mai_iunie iun._iulie iul._august aug._septembrie sept._octombrie oct._noiembrie nov._decembrie 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 = 'duminică Dum Du_luni Lun Lu_marți Mar Ma_miercuri Mie Mi_joi Joi Jo_vineri Vin Vi_sâmbătă Sâm 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), 'câteva secunde', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'un minut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'un minut', '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 de minute', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'o oră', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'o oră', '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 de ore', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'o zi', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'o zi', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 zile', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'o zi', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 zile', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 de zile', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'o lună', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'o lună', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'o lună', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 luni', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 luni', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 luni', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'o lună', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 luni', '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 ani', '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 ani', '5 years = 5 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 19}), true), '19 ani', '19 years = 19 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 20}), true), '20 de ani', '20 years = 20 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 100}), true), '100 de ani', '100 years = 100 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 101}), true), '101 ani', '101 years = 101 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 119}), true), '119 ani', '119 years = 119 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 120}), true), '120 de ani', '120 years = 120 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 219}), true), '219 ani', '219 years = 219 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 220}), true), '220 de ani', '220 years = 220 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'peste câteva secunde', 'prefix'); - assert.equal(moment(0).from(30000), 'câteva secunde în urmă', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'câteva secunde în urmă', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'peste câteva secunde', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'peste 5 zile', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'azi la 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'azi la 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'azi la 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'mâine la 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'azi la 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'ieri la 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 [la] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [la] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [la] 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('[fosta] dddd [la] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[fosta] dddd [la] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[fosta] dddd [la] 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([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'); -}); - diff --git a/src/test/locale/ru.js b/src/test/locale/ru.js deleted file mode 100644 index ce083fda57..0000000000 --- a/src/test/locale/ru.js +++ /dev/null @@ -1,357 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('ru'); - -test('parse', function (assert) { - var tests = 'январь янв._февраль февр._март март_апрель апр._май май_июнь июнь_июль июль_август авг._сентябрь сент._октябрь окт._ноябрь нояб._декабрь дек.'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - function equalTestStrict(input, mmm, monthIndex) { - assert.equal(moment(input, mmm, true).month(), monthIndex, input + ' ' + mmm + ' should be strict month ' + (monthIndex + 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); - - equalTestStrict(tests[i][1], 'MMM', i); - equalTestStrict(tests[i][0], 'MMMM', i); - equalTestStrict(tests[i][1].toLocaleLowerCase(), 'MMM', i); - equalTestStrict(tests[i][1].toLocaleUpperCase(), 'MMM', i); - equalTestStrict(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTestStrict(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - } -}); - -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 февраль февр.'], - ['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', '6 6-я 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'дня дня'], - ['DDDo [день года]', '45-й день года'], - ['LT', '15:25'], - ['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; - 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 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; - 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; - 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), 'несколько секунд', '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: 31}), true), '31 минута', '31 minutes = 31 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), 'через несколько секунд', 'prefix'); - assert.equal(moment(0).from(30000), 'несколько секунд назад', 'suffix'); -}); - -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({m: 31}).fromNow(), 'через 31 минуту', 'in 31 minutes = in 31 minutes'); - assert.equal(moment().subtract({m: 31}).fromNow(), '31 минуту назад', '31 minutes ago = 31 minutes ago'); -}); - -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({h: 4}).calendar(), 'Сегодня, в 8:00', 'Now minus 4 hours'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Вчера, в 12:00', 'yesterday at the same time'); -}); - -test('calendar next week', function (assert) { - var i, m, now; - - function makeFormatNext(d) { - switch (d.day()) { - case 0: - return '[В следующее] dddd, [в] LT'; - case 1: - case 2: - case 4: - return '[В следующий] dddd, [в] LT'; - case 3: - case 5: - case 6: - return '[В следующую] dddd, [в] LT'; - } - } - - function makeFormatThis(d) { - if (d.day() === 2) { - return '[Во] dddd, [в] LT'; - } - else { - return '[В] dddd, [в] LT'; - } - } - - now = moment().startOf('week'); - for (i = 2; i < 7; i++) { - m = moment(now).add({d: i}); - assert.equal(m.calendar(now), m.format(makeFormatThis(m)), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(now), m.format(makeFormatThis(m)), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(now), m.format(makeFormatThis(m)), 'Today + ' + i + ' days end of day'); - } - - now = moment().endOf('week'); - for (i = 2; i < 7; i++) { - m = moment(now).add({d: i}); - assert.equal(m.calendar(now), m.format(makeFormatNext(m)), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(now), m.format(makeFormatNext(m)), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(now), m.format(makeFormatNext(m)), 'Today + ' + i + ' days end of day'); - } -}); - -test('calendar last week', function (assert) { - var i, m, now; - - function makeFormatLast(d) { - switch (d.day()) { - case 0: - return '[В прошлое] dddd, [в] LT'; - case 1: - case 2: - case 4: - return '[В прошлый] dddd, [в] LT'; - case 3: - case 5: - case 6: - return '[В прошлую] dddd, [в] LT'; - } - } - - function makeFormatThis(d) { - if (d.day() === 2) { - return '[Во] dddd, [в] LT'; - } - else { - return '[В] dddd, [в] LT'; - } - } - - now = moment().startOf('week'); - for (i = 2; i < 7; i++) { - m = moment(now).subtract({d: i}); - assert.equal(m.calendar(now), m.format(makeFormatLast(m)), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(now), m.format(makeFormatLast(m)), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(now), m.format(makeFormatLast(m)), 'Today - ' + i + ' days end of day'); - } - - now = moment().endOf('week'); - for (i = 2; i < 7; i++) { - m = moment(now).subtract({d: i}); - assert.equal(m.calendar(now), m.format(makeFormatThis(m)), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(now), m.format(makeFormatThis(m)), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(now), m.format(makeFormatThis(m)), '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 monday 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'); -}); diff --git a/src/test/locale/sd.js b/src/test/locale/sd.js deleted file mode 100644 index 4f3b3a9cae..0000000000 --- a/src/test/locale/sd.js +++ /dev/null @@ -1,223 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('sd'); - -var months = [ - 'جنوري', - 'فيبروري', - 'مارچ', - 'اپريل', - 'مئي', - 'جون', - 'جولاءِ', - 'آگسٽ', - 'سيپٽمبر', - 'آڪٽوبر', - 'نومبر', - 'ڊسمبر' -]; -var days = [ - 'آچر', - 'سومر', - 'اڱارو', - 'اربع', - 'خميس', - 'جمع', - 'ڇنڇر' -]; - -test('parse', function (assert) { - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (var i = 0; i < 12; i++) { - equalTest(months[i], 'MMM', i); - equalTest(months[i], 'MMMM', i); - } -}); - -test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'آچر، فيبروري 14 2010، 3:25:50 شام'], - ['ddd, hA', 'آچر، 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', '6 6 06'], - ['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'] - ], - 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) { - for (var i = 0; i < months.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), months[i] + ' ' + months[i], months[i] + ' ' + months[i]); - } -}); - -test('format week', function (assert) { - for (var i = 0; i < days.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), days[i] + ' ' + days[i] + ' ' + days[i], days[i] + ' ' + days[i] + ' ' + days[i]); - } -}); - -test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'چند سيڪنڊ', '44 seconds = چند سيڪنڊ'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'هڪ منٽ', '45 seconds = هڪ منٽ'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'هڪ منٽ', '89 seconds = هڪ منٽ'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 منٽ', '90 seconds = 2 منٽ'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 منٽ', '44 minutes = 44 منٽ'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'هڪ ڪلاڪ', '45 minutes = هڪ ڪلاڪ'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'هڪ ڪلاڪ', '89 minutes = هڪ ڪلاڪ'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 ڪلاڪ', '90 minutes = 2 ڪلاڪ'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ڪلاڪ', '5 hours = 5 ڪلاڪ'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 ڪلاڪ', '21 hours = 21 ڪلاڪ'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'هڪ ڏينهن', '22 hours = هڪ ڏينهن'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'هڪ ڏينهن', '35 hours = هڪ ڏينهن'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 ڏينهن', '36 hours = 2 ڏينهن'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'هڪ ڏينهن', '1 day = هڪ ڏينهن'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 ڏينهن', '5 days = 5 ڏينهن'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 ڏينهن', '25 days = 25 ڏينهن'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'هڪ مهينو', '26 days = هڪ مهينو'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'هڪ مهينو', '30 days = هڪ مهينو'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'هڪ مهينو', '43 days = هڪ مهينو'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 مهينا', '46 days = 2 مهينا'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 مهينا', '75 days = 2 مهينا'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 مهينا', '76 days = 3 مهينا'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'هڪ مهينو', '1 month = هڪ مهينو'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 مهينا', '5 months = 5 مهينا'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'هڪ سال', '345 days = هڪ سال'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 سال', '548 days = 2 سال'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'هڪ سال', '1 year = هڪ سال'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 سال', '5 years = 5 سال'); -}); - -test('suffix', function (assert) { - 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'); -}); - -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'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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 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'); -}); diff --git a/src/test/locale/se.js b/src/test/locale/se.js deleted file mode 100644 index 0f28ec1523..0000000000 --- a/src/test/locale/se.js +++ /dev/null @@ -1,221 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('se'); - -test('parse', function (assert) { - var i, - tests = 'ođđajagemánnu ođđj_guovvamánnu guov_njukčamánnu njuk_cuoŋománnu cuo_miessemánnu mies_geassemánnu geas_suoidnemánnu suoi_borgemánnu borg_čakčamánnu čakč_golggotmánnu golg_skábmamánnu skáb_juovlamánnu juov'.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); - 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', 'sotnabeaivi, guovvamánnu 14. 2010, 3:25:50 pm'], - ['ddd, hA', 'sotn, 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 guovvamánnu guov'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. sotnabeaivi sotn s'], - ['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'], - ['[jagi] DDDo [beaivi]', 'jagi 45. beaivi'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', 'guovvamánnu 14. b. 2010'], - ['LLL', 'guovvamánnu 14. b. 2010 ti. 15:25'], - ['LLLL', 'sotnabeaivi, guovvamánnu 14. b. 2010 ti. 15:25'], - ['l', '14.2.2010'], - ['ll', 'guov 14. b. 2010'], - ['lll', 'guov 14. b. 2010 ti. 15:25'], - ['llll', 'sotn, guov 14. b. 2010 ti. 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 i, - expected = 'ođđajagemánnu ođđj_guovvamánnu guov_njukčamánnu njuk_cuoŋománnu cuo_miessemánnu mies_geassemánnu geas_suoidnemánnu suoi_borgemánnu borg_čakčamánnu čakč_golggotmánnu golg_skábmamánnu skáb_juovlamánnu juov'.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 i, - expected = 'sotnabeaivi sotn s_vuossárga vuos v_maŋŋebárga maŋ m_gaskavahkku gask g_duorastat duor d_bearjadat bear b_lávvardat láv L'.split('_'); - - 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), 'moadde sekunddat', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'okta minuhta', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'okta minuhta', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuhtat', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuhtat', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'okta diimmu', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'okta diimmu', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 diimmut', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 diimmut', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 diimmut', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'okta beaivi', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'okta beaivi', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 beaivvit', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'okta beaivi', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 beaivvit', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 beaivvit', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'okta mánnu', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'okta mánnu', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'okta mánnu', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mánut', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mánut', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mánut', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'okta mánnu', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mánut', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'okta jahki', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 jagit', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'okta jahki', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 jagit', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'moadde sekunddat geažes', 'prefix'); - assert.equal(moment(0).from(30000), 'maŋit moadde sekunddat', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'maŋit moadde sekunddat', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'moadde sekunddat geažes', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5 beaivvit geažes', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'otne ti 12:00', 'Today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'otne ti 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'otne ti 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'ihttin ti 12:00', 'Tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'otne ti 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'ikte ti 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 [ti] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [ti] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [ti] 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('[ovddit] dddd [ti] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[ovddit] dddd [ti] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[ovddit] dddd [ti] 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 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'); -}); - diff --git a/src/test/locale/si.js b/src/test/locale/si.js deleted file mode 100644 index da20502cba..0000000000 --- a/src/test/locale/si.js +++ /dev/null @@ -1,205 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('si'); - -/*jshint -W100*/ -test('parse', function (assert) { - 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); - 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 = [ - ['YYYY MMMM Do dddd, a h:mm:ss', '2010 පෙබරවාරි 14 වැනි ඉරිදා, ප.ව. 3:25:50'], - ['YYYY MMMM Do dddd, a h:mm:ss', '2010 පෙබරවාරි 14 වැනි ඉරිදා, ප.ව. 3:25:50'], - ['ddd, A h', 'ඉරි, පස් වරු 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'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'ප.ව. පස් වරු'], - ['[වසරේ] DDDo [දිනය]', 'වසරේ 45 වැනි දිනය'], - ['LTS', 'ප.ව. 3:25:50'], - ['LT', 'ප.ව. 3:25'], - ['L', '2010/02/14'], - ['LL', '2010 පෙබරවාරි 14'], - ['LLL', '2010 පෙබරවාරි 14, ප.ව. 3:25'], - ['LLLL', '2010 පෙබරවාරි 14 වැනි ඉරිදා, ප.ව. 3:25:50'], - ['l', '2010/2/14'], - ['ll', '2010 පෙබ 14'], - ['lll', '2010 පෙබ 14, ප.ව. 3:25'], - ['llll', '2010 පෙබ 14 වැනි ඉරි, ප.ව. 3:25:50'] - ], - 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 = 'ජනවාරි ජන_පෙබරවාරි පෙබ_මාර්තු මාර්_අප්‍රේල් අප්_මැයි මැයි_ජූනි ජූනි_ජූලි ජූලි_අගෝස්තු අගෝ_සැප්තැම්බර් සැප්_ඔක්තෝබර් ඔක්_නොවැම්බර් නොවැ_දෙසැම්බර් දෙසැ'.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; - 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), 'තත්පර කිහිපය', '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), 'පැය 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: 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), 'තත්පර කිහිපයකින්', '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'); -}); - -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'); -}); - -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(), 'අද ප.ව. 1: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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); -}); - diff --git a/src/test/locale/sk.js b/src/test/locale/sk.js deleted file mode 100644 index 83da20d5e8..0000000000 --- a/src/test/locale/sk.js +++ /dev/null @@ -1,298 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('sk'); - -test('parse', function (assert) { - var tests = 'január jan._február feb._marec mar._apríl apr._máj máj_jún jún._júl júl._august aug._september sep._október okt._november nov._december dec.'.split('_'), i; - function equalTest(input, mmm, monthIndex) { - assert.equal(moment(input, mmm).month(), monthIndex, input + ' should be month ' + (monthIndex + 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', 'nedeľa, február 14. 2010, 3:25:50'], - ['ddd, h', 'ne, 3'], - ['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. nedeľa ne ne'], - ['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'], - ['DDDo [deň v roku]', '45. deň v roku'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14. február 2010'], - ['LLL', '14. február 2010 15:25'], - ['LLLL', 'nedeľa 14. február 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14. feb 2010'], - ['lll', '14. feb 2010 15:25'], - ['llll', 'ne 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'), '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 = 'január jan_február feb_marec mar_apríl apr_máj máj_jún jún_júl júl_august aug_september sep_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 = 'nedeľa ne ne_pondelok po po_utorok ut ut_streda st st_štvrtok št št_piatok pi pi_sobota 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), 'pár sekúnd', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minúta', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minúta', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minúty', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minút', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'hodina', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'hodina', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 hodiny', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 hodín', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 hodín', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'deň', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'deň', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dni', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'deň', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dní', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dní', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mesiac', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mesiac', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mesiac', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mesiace', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mesiace', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mesiace', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mesiac', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mesiacov', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'rok', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 roky', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'rok', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 rokov', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'za pár sekúnd', 'prefix'); - assert.equal(moment(0).from(30000), 'pred pár sekundami', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'pred pár sekundami', 'now from now should display as in the past'); -}); - -test('fromNow (future)', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'za pár sekúnd', 'in a few seconds'); - assert.equal(moment().add({m: 1}).fromNow(), 'za minútu', 'in a minute'); - assert.equal(moment().add({m: 3}).fromNow(), 'za 3 minúty', 'in 3 minutes'); - assert.equal(moment().add({m: 10}).fromNow(), 'za 10 minút', 'in 10 minutes'); - assert.equal(moment().add({h: 1}).fromNow(), 'za hodinu', 'in an hour'); - assert.equal(moment().add({h: 3}).fromNow(), 'za 3 hodiny', 'in 3 hours'); - assert.equal(moment().add({h: 10}).fromNow(), 'za 10 hodín', 'in 10 hours'); - assert.equal(moment().add({d: 1}).fromNow(), 'za deň', 'in a day'); - assert.equal(moment().add({d: 3}).fromNow(), 'za 3 dni', 'in 3 days'); - assert.equal(moment().add({d: 10}).fromNow(), 'za 10 dní', 'in 10 days'); - assert.equal(moment().add({M: 1}).fromNow(), 'za mesiac', 'in a month'); - assert.equal(moment().add({M: 3}).fromNow(), 'za 3 mesiace', 'in 3 months'); - assert.equal(moment().add({M: 10}).fromNow(), 'za 10 mesiacov', 'in 10 months'); - assert.equal(moment().add({y: 1}).fromNow(), 'za rok', 'in a year'); - assert.equal(moment().add({y: 3}).fromNow(), 'za 3 roky', 'in 3 years'); - assert.equal(moment().add({y: 10}).fromNow(), 'za 10 rokov', 'in 10 years'); -}); - -test('fromNow (past)', function (assert) { - assert.equal(moment().subtract({s: 30}).fromNow(), 'pred pár sekundami', 'a few seconds ago'); - assert.equal(moment().subtract({m: 1}).fromNow(), 'pred minútou', 'a minute ago'); - assert.equal(moment().subtract({m: 3}).fromNow(), 'pred 3 minútami', '3 minutes ago'); - assert.equal(moment().subtract({m: 10}).fromNow(), 'pred 10 minútami', '10 minutes ago'); - assert.equal(moment().subtract({h: 1}).fromNow(), 'pred hodinou', 'an hour ago'); - assert.equal(moment().subtract({h: 3}).fromNow(), 'pred 3 hodinami', '3 hours ago'); - assert.equal(moment().subtract({h: 10}).fromNow(), 'pred 10 hodinami', '10 hours ago'); - assert.equal(moment().subtract({d: 1}).fromNow(), 'pred dňom', 'a day ago'); - assert.equal(moment().subtract({d: 3}).fromNow(), 'pred 3 dňami', '3 days ago'); - assert.equal(moment().subtract({d: 10}).fromNow(), 'pred 10 dňami', '10 days ago'); - assert.equal(moment().subtract({M: 1}).fromNow(), 'pred mesiacom', 'a month ago'); - assert.equal(moment().subtract({M: 3}).fromNow(), 'pred 3 mesiacmi', '3 months ago'); - assert.equal(moment().subtract({M: 10}).fromNow(), 'pred 10 mesiacmi', '10 months ago'); - assert.equal(moment().subtract({y: 1}).fromNow(), 'pred rokom', 'a year ago'); - assert.equal(moment().subtract({y: 3}).fromNow(), 'pred 3 rokmi', '3 years ago'); - assert.equal(moment().subtract({y: 10}).fromNow(), 'pred 10 rokmi', '10 years ago'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'dnes o 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'dnes o 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'dnes o 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'zajtra o 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'dnes o 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'včera o 12:00', 'yesterday at the same time'); -}); - -test('calendar next week', function (assert) { - var i, m, nextDay; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - nextDay = ''; - switch (m.day()) { - case 0: - nextDay = 'v nedeľu'; - break; - case 1: - nextDay = 'v pondelok'; - break; - case 2: - nextDay = 'v utorok'; - break; - case 3: - nextDay = 'v stredu'; - break; - case 4: - nextDay = 'vo štvrtok'; - break; - case 5: - nextDay = 'v piatok'; - break; - case 6: - nextDay = 'v sobotu'; - break; - } - assert.equal(m.calendar(), m.format('[' + nextDay + '] [o] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[' + nextDay + '] [o] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[' + nextDay + '] [o] LT'), 'Today + ' + i + ' days end of day'); - } -}); - -test('calendar last week', function (assert) { - var i, m, lastDay; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - lastDay = ''; - switch (m.day()) { - case 0: - lastDay = 'minulú nedeľu'; - break; - case 1: - lastDay = 'minulý pondelok'; - break; - case 2: - lastDay = 'minulý utorok'; - break; - case 3: - lastDay = 'minulú stredu'; - break; - case 4: - lastDay = 'minulý štvrtok'; - break; - case 5: - lastDay = 'minulý piatok'; - break; - case 6: - lastDay = 'minulú sobotu'; - break; - } - assert.equal(m.calendar(), m.format('[' + lastDay + '] [o] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[' + lastDay + '] [o] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[' + lastDay + '] [o] 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('humanize duration', function (assert) { - assert.equal(moment.duration(1, 'minutes').humanize(), 'minúta', 'a minute (future)'); - assert.equal(moment.duration(1, 'minutes').humanize(true), 'za minútu', 'in a minute'); - assert.equal(moment.duration(-1, 'minutes').humanize(), 'minúta', 'a minute (past)'); - assert.equal(moment.duration(-1, 'minutes').humanize(true), 'pred minútou', 'a minute ago'); -}); - -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'); -}); - diff --git a/src/test/locale/sl.js b/src/test/locale/sl.js deleted file mode 100644 index c38a53fdf8..0000000000 --- a/src/test/locale/sl.js +++ /dev/null @@ -1,333 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('sl'); - -test('parse', function (assert) { - var tests = 'januar jan._februar feb._marec mar._april apr._maj maj_junij jun._julij jul._avgust avg._september sep._oktober 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)); - } - 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, Do MMMM YYYY, h:mm:ss a', 'nedelja, 14. februar 2010, 3:25:50 pm'], - ['ddd, hA', 'ned., 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. nedelja 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. februar 2010'], - ['LLL', '14. februar 2010 15:25'], - ['LLLL', 'nedelja, 14. februar 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14. feb. 2010'], - ['lll', '14. feb. 2010 15:25'], - ['llll', 'ned., 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'), '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 = 'januar jan._februar feb._marec mar._april apr._maj maj._junij jun._julij jul._avgust avg._september sep._oktober 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 = 'nedelja ned. ne_ponedeljek pon. po_torek tor. to_sreda sre. sr_četrtek čet. če_petek pet. pe_sobota sob. 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), 'nekaj sekund', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ena minuta', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ena minuta', '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 minut', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ena ura', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ena ura', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 uri', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ur', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 ur', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'en dan', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'en dan', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dni', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'en dan', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dni', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dni', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'en mesec', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'en mesec', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'en mesec', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 meseca', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 meseca', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mesece', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'en mesec', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mesecev', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'eno leto', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 leti', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'eno leto', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 let', '5 years = 5 years'); - - assert.equal(start.from(moment([2007, 1, 28]).add({m: 1}), true), 'ena minuta', 'a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 2}), true), '2 minuti', '2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 3}), true), '3 minute', '3 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 4}), true), '4 minute', '4 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 5}), true), '5 minut', '5 minutes'); - - assert.equal(start.from(moment([2007, 1, 28]).add({h: 1}), true), 'ena ura', 'an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 2}), true), '2 uri', '2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 3}), true), '3 ure', '3 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 4}), true), '4 ure', '4 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ur', '5 hours'); - - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'en dan', 'a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 2}), true), '2 dni', '2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 3}), true), '3 dni', '3 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 4}), true), '4 dni', '4 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dni', '5 days'); - - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'en mesec', 'a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 2}), true), '2 meseca', '2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 3}), true), '3 mesece', '3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 4}), true), '4 mesece', '4 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mesecev', '5 months'); - - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'eno leto', 'a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 2}), true), '2 leti', '2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 3}), true), '3 leta', '3 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 4}), true), '4 leta', '4 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 let', '5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'čez nekaj sekund', 'prefix'); - assert.equal(moment(0).from(30000), 'pred nekaj sekundami', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'pred nekaj sekundami', 'now from now should display as in the past'); -}); - -test('fromNow (future)', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'čez nekaj sekund', 'in a few seconds'); - assert.equal(moment().add({m: 1}).fromNow(), 'čez eno minuto', 'in a minute'); - assert.equal(moment().add({m: 2}).fromNow(), 'čez 2 minuti', 'in 2 minutes'); - assert.equal(moment().add({m: 3}).fromNow(), 'čez 3 minute', 'in 3 minutes'); - assert.equal(moment().add({m: 4}).fromNow(), 'čez 4 minute', 'in 4 minutes'); - assert.equal(moment().add({m: 5}).fromNow(), 'čez 5 minut', 'in 5 minutes'); - - assert.equal(moment().add({h: 1}).fromNow(), 'čez eno uro', 'in an hour'); - assert.equal(moment().add({h: 2}).fromNow(), 'čez 2 uri', 'in 2 hours'); - assert.equal(moment().add({h: 3}).fromNow(), 'čez 3 ure', 'in 3 hours'); - assert.equal(moment().add({h: 4}).fromNow(), 'čez 4 ure', 'in 4 hours'); - assert.equal(moment().add({h: 5}).fromNow(), 'čez 5 ur', 'in 5 hours'); - - assert.equal(moment().add({d: 1}).fromNow(), 'čez en dan', 'in a day'); - assert.equal(moment().add({d: 2}).fromNow(), 'čez 2 dni', 'in 2 days'); - assert.equal(moment().add({d: 3}).fromNow(), 'čez 3 dni', 'in 3 days'); - assert.equal(moment().add({d: 4}).fromNow(), 'čez 4 dni', 'in 4 days'); - assert.equal(moment().add({d: 5}).fromNow(), 'čez 5 dni', 'in 5 days'); - - assert.equal(moment().add({M: 1}).fromNow(), 'čez en mesec', 'in a month'); - assert.equal(moment().add({M: 2}).fromNow(), 'čez 2 meseca', 'in 2 months'); - assert.equal(moment().add({M: 3}).fromNow(), 'čez 3 mesece', 'in 3 months'); - assert.equal(moment().add({M: 4}).fromNow(), 'čez 4 mesece', 'in 4 months'); - assert.equal(moment().add({M: 5}).fromNow(), 'čez 5 mesecev', 'in 5 months'); - - assert.equal(moment().add({y: 1}).fromNow(), 'čez eno leto', 'in a year'); - assert.equal(moment().add({y: 2}).fromNow(), 'čez 2 leti', 'in 2 years'); - assert.equal(moment().add({y: 3}).fromNow(), 'čez 3 leta', 'in 3 years'); - assert.equal(moment().add({y: 4}).fromNow(), 'čez 4 leta', 'in 4 years'); - assert.equal(moment().add({y: 5}).fromNow(), 'čez 5 let', 'in 5 years'); - - assert.equal(moment().subtract({s: 30}).fromNow(), 'pred nekaj sekundami', 'a few seconds ago'); - - assert.equal(moment().subtract({m: 1}).fromNow(), 'pred eno minuto', 'a minute ago'); - assert.equal(moment().subtract({m: 2}).fromNow(), 'pred 2 minutama', '2 minutes ago'); - assert.equal(moment().subtract({m: 3}).fromNow(), 'pred 3 minutami', '3 minutes ago'); - assert.equal(moment().subtract({m: 4}).fromNow(), 'pred 4 minutami', '4 minutes ago'); - assert.equal(moment().subtract({m: 5}).fromNow(), 'pred 5 minutami', '5 minutes ago'); - - assert.equal(moment().subtract({h: 1}).fromNow(), 'pred eno uro', 'an hour ago'); - assert.equal(moment().subtract({h: 2}).fromNow(), 'pred 2 urama', '2 hours ago'); - assert.equal(moment().subtract({h: 3}).fromNow(), 'pred 3 urami', '3 hours ago'); - assert.equal(moment().subtract({h: 4}).fromNow(), 'pred 4 urami', '4 hours ago'); - assert.equal(moment().subtract({h: 5}).fromNow(), 'pred 5 urami', '5 hours ago'); - - assert.equal(moment().subtract({d: 1}).fromNow(), 'pred enim dnem', 'a day ago'); - assert.equal(moment().subtract({d: 2}).fromNow(), 'pred 2 dnevoma', '2 days ago'); - assert.equal(moment().subtract({d: 3}).fromNow(), 'pred 3 dnevi', '3 days ago'); - assert.equal(moment().subtract({d: 4}).fromNow(), 'pred 4 dnevi', '4 days ago'); - assert.equal(moment().subtract({d: 5}).fromNow(), 'pred 5 dnevi', '5 days ago'); - - assert.equal(moment().subtract({M: 1}).fromNow(), 'pred enim mesecem', 'a month ago'); - assert.equal(moment().subtract({M: 2}).fromNow(), 'pred 2 mesecema', '2 months ago'); - assert.equal(moment().subtract({M: 3}).fromNow(), 'pred 3 meseci', '3 months ago'); - assert.equal(moment().subtract({M: 4}).fromNow(), 'pred 4 meseci', '4 months ago'); - assert.equal(moment().subtract({M: 5}).fromNow(), 'pred 5 meseci', '5 months ago'); - - assert.equal(moment().subtract({y: 1}).fromNow(), 'pred enim letom', 'a year ago'); - assert.equal(moment().subtract({y: 2}).fromNow(), 'pred 2 letoma', '2 years ago'); - assert.equal(moment().subtract({y: 3}).fromNow(), 'pred 3 leti', '3 years ago'); - assert.equal(moment().subtract({y: 4}).fromNow(), 'pred 4 leti', '4 years ago'); - assert.equal(moment().subtract({y: 5}).fromNow(), 'pred 5 leti', '5 years ago'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'danes ob 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'danes ob 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'danes ob 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'jutri ob 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'danes ob 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'včeraj ob 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 '[v] [nedeljo] [ob] LT'; - case 3: - return '[v] [sredo] [ob] LT'; - case 6: - return '[v] [soboto] [ob] LT'; - case 1: - case 2: - case 4: - case 5: - return '[v] dddd [ob] 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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(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: - return '[prejšnjo] [nedeljo] [ob] LT'; - case 3: - return '[prejšnjo] [sredo] [ob] LT'; - case 6: - return '[prejšnjo] [soboto] [ob] LT'; - case 1: - case 2: - case 4: - case 5: - return '[prejšnji] dddd [ob] 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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(makeFormat(m)), '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([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'); -}); diff --git a/src/test/locale/sq.js b/src/test/locale/sq.js deleted file mode 100644 index 836bc45426..0000000000 --- a/src/test/locale/sq.js +++ /dev/null @@ -1,226 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('sq'); - -test('parse', function (assert) { - var i, - tests = 'Janar Jan_Shkurt Shk_Mars Mar_Prill Pri_Maj Maj_Qershor Qer_Korrik Kor_Gusht Gus_Shtator Sht_Tetor Tet_Nëntor Nën_Dhjetor Dhj'.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); - 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', 'E Diel, Shkurt 14. 2010, 15:25:50'], - ['ddd, HH', 'Die, 15'], - ['M Mo MM MMMM MMM', '2 2. 02 Shkurt Shk'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. E Diel Die D'], - ['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', 'MD MD'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 Shkurt 2010'], - ['LLL', '14 Shkurt 2010 15:25'], - ['LLLL', 'E Diel, 14 Shkurt 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Shk 2010'], - ['lll', '14 Shk 2010 15:25'], - ['llll', 'Die, 14 Shk 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('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 0, 0]).format('A'), 'PD', 'before dawn'); - assert.equal(moment([2011, 2, 23, 12, 0]).format('A'), 'MD', 'noon'); -}); - -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 i, - expected = 'Janar Jan_Shkurt Shk_Mars Mar_Prill Pri_Maj Maj_Qershor Qer_Korrik Kor_Gusht Gus_Shtator Sht_Tetor Tet_Nëntor Nën_Dhjetor Dhj'.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 i, - expected = 'E Diel Die D_E Hënë Hën H_E Martë Mar Ma_E Mërkurë Mër Më_E Enjte Enj E_E Premte Pre P_E Shtunë Sht Sh'.split('_'); - - 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), 'disa sekonda', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'një minutë', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'një minutë', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuta', '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), 'një orë', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'një orë', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 orë', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 orë', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 orë', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'një ditë', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'një ditë', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 ditë', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'një ditë', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 ditë', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 ditë', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'një muaj', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'një muaj', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'një muaj', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 muaj', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 muaj', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 muaj', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'një muaj', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 muaj', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'një vit', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 vite', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'një vit', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 vite', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'në disa sekonda', 'prefix'); - assert.equal(moment(0).from(30000), 'disa sekonda më parë', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'disa sekonda më parë', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'në disa sekonda', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'në 5 ditë', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Sot në 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Sot në 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Sot në 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Nesër në 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Sot në 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Dje në 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 [në] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [në] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [në] 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 [e kaluar në] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [e kaluar në] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [e kaluar në] 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 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'); -}); - diff --git a/src/test/locale/sr-cyrl.js b/src/test/locale/sr-cyrl.js deleted file mode 100644 index 10f96973b2..0000000000 --- a/src/test/locale/sr-cyrl.js +++ /dev/null @@ -1,244 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('sr-cyrl'); - -test('parse', function (assert) { - 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); - 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, Do MMMM YYYY, h:mm:ss a', 'недеља, 14. фебруар 2010, 3:25:50 pm'], - ['ddd, hA', 'нед., 3PM'], - ['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', '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. фебруар 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; - 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 = 'јануар јан._фебруар феб._март мар._април апр._мај мај_јун јун_јул јул_август авг._септембар сеп._октобар окт._новембар нов._децембар дец.'.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; - 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), 'неколико секунди', '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), '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: 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), 'за неколико секунди', 'prefix'); - assert.equal(moment(0).from(30000), 'пре неколико секунди', 'prefix'); -}); - -test('now from now', function (assert) { - 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'); -}); - -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'); -}); - -test('calendar next week', function (assert) { - var i, m; - - function makeFormat(d) { - switch (d.day()) { - case 0: - return '[у] [недељу] [у] LT'; - case 3: - return '[у] [среду] [у] LT'; - case 6: - return '[у] [суботу] [у] LT'; - case 1: - case 2: - case 4: - case 5: - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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(makeFormat(m)), 'Today + ' + i + ' days end of day'); - } -}); - -test('calendar last week', function (assert) { - var i, m; - - function makeFormat(d) { - var lastWeekDay = [ - '[прошле] [недеље] [у] LT', - '[прошлог] [понедељка] [у] LT', - '[прошлог] [уторка] [у] LT', - '[прошле] [среде] [у] LT', - '[прошлог] [четвртка] [у] LT', - '[прошлог] [петка] [у] LT', - '[прошле] [суботе] [у] LT' - ]; - - return lastWeekDay[d.day()]; - } - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - 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(makeFormat(m)), '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'); - } -}); - -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([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'); -}); diff --git a/src/test/locale/sr.js b/src/test/locale/sr.js deleted file mode 100644 index 878882e253..0000000000 --- a/src/test/locale/sr.js +++ /dev/null @@ -1,244 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('sr'); - -test('parse', function (assert) { - var tests = 'januar jan._februar feb._mart mar._april apr._maj maj_jun jun_jul jul_avgust avg._septembar sep._oktobar okt._novembar nov._decembar 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, Do MMMM YYYY, h:mm:ss a', 'nedelja, 14. februar 2010, 3:25:50 pm'], - ['ddd, hA', 'ned., 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. nedelja 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. februar 2010'], - ['LLL', '14. februar 2010 15:25'], - ['LLLL', 'nedelja, 14. februar 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14. feb. 2010'], - ['lll', '14. feb. 2010 15:25'], - ['llll', 'ned., 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'), '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 = 'januar jan._februar feb._mart mar._april apr._maj maj_jun jun_jul jul_avgust avg._septembar sep._oktobar okt._novembar nov._decembar 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 = 'nedelja ned. ne_ponedeljak pon. po_utorak uto. ut_sreda sre. 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]); - } -}); - -test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'nekoliko sekundi', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'jedan minut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'jedan minut', '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), 'mesec', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mesec', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mesec', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 meseca', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 meseca', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 meseca', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mesec', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 meseci', '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), 'za nekoliko sekundi', 'prefix'); - assert.equal(moment(0).from(30000), 'pre nekoliko sekundi', 'prefix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'pre nekoliko sekundi', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'za nekoliko 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(), '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če 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] [nedelju] [u] LT'; - case 3: - return '[u] [sredu] [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(makeFormat(m)), '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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - 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) { - var lastWeekDay = [ - '[prošle] [nedelje] [u] LT', - '[prošlog] [ponedeljka] [u] LT', - '[prošlog] [utorka] [u] LT', - '[prošle] [srede] [u] LT', - '[prošlog] [četvrtka] [u] LT', - '[prošlog] [petka] [u] LT', - '[prošle] [subote] [u] LT' - ]; - - return lastWeekDay[d.day()]; - } - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - 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(makeFormat(m)), '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'); - } -}); - -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([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'); -}); diff --git a/src/test/locale/ss.js b/src/test/locale/ss.js deleted file mode 100644 index 5a949ec9b1..0000000000 --- a/src/test/locale/ss.js +++ /dev/null @@ -1,243 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('ss'); - -test('parse', function (assert) { - var tests = "Bhimbidvwane Bhi_Indlovana Ina_Indlov'lenkhulu Inu_Mabasa Mab_Inkhwekhweti Ink_Inhlaba Inh_Kholwane Kho_Ingci Igc_Inyoni Iny_Imphala Imp_Lweti lwe_Ingongoni Igo".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('parse meridiem', function (assert) { - var i, - b = moment(), - meridiemTests = [ - // h a patterns, expected hours, isValid - ['10 ekuseni', 10, true], - ['11 emini', 11, true], - ['3 entsambama', 15, true], - ['4 entsambama', 16, true], - ['6 entsambama', 18, true], - ['7 ebusuku', 19, true], - ['12 ebusuku', 0, true], - ['10 am', 10, false], - ['10 pm', 10, false] - ], - parsed; - - // test that a formatted moment including meridiem string can be parsed back to the same moment - assert.ok(b.isSame(moment(b.format('h:mm:ss a'), 'h:mm:ss a', 'ss', true), 'seconds'), b.format('h:mm:ss a') + ' should be equal to ' + moment(b.format('h:mm:ss a'), 'h:mm:ss a', 'ss', true).format('h:mm:ss a')); - - // test that a formatted moment having a meridiem string can be parsed with strict flag - assert.ok(moment(b.format('h:mm:ss a'), 'h:mm:ss a', 'ss', true).isValid(), b.format('h:mm:ss a') + ' should be parsed as valid'); - - for (i = 0; i < meridiemTests.length; i++) { - parsed = moment(meridiemTests[i][0], 'h a', 'ss', true); - assert.equal(parsed.isValid(), meridiemTests[i][2], 'validity for ' + meridiemTests[i][0]); - if (parsed.isValid()) { - assert.equal(parsed.hours(), meridiemTests[i][1], 'hours for ' + meridiemTests[i][0]); - } - } -}); - -test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Lisontfo, Indlovana 14 2010, 3:25:50 entsambama'], - ['ddd, h A', 'Lis, 3 entsambama'], - ['M Mo MM MMMM MMM', '2 2 02 Indlovana Ina'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 Lisontfo Lis Li'], - ['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', 'entsambama entsambama'], - ['[Lilanga] DDDo [lilanga lelinyaka]', 'Lilanga 45 lilanga lelinyaka'], - ['LTS', '3:25:50 entsambama'], - ['L', '14/02/2010'], - ['LL', '14 Indlovana 2010'], - ['LLL', '14 Indlovana 2010 3:25 entsambama'], - ['LLLL', 'Lisontfo, 14 Indlovana 2010 3:25 entsambama'], - ['l', '14/2/2010'], - ['ll', '14 Ina 2010'], - ['lll', '14 Ina 2010 3:25 entsambama'], - ['llll', 'Lis, 14 Ina 2010 3:25 entsambama'] - ], - 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 = "Bhimbidvwane Bhi_Indlovana Ina_Indlov'lenkhulu Inu_Mabasa Mab_Inkhwekhweti Ink_Inhlaba Inh_Kholwane Kho_Ingci Igc_Inyoni Iny_Imphala Imp_Lweti Lwe_Ingongoni Igo".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 = 'Lisontfo Lis Li_Umsombuluko Umb Us_Lesibili Lsb Lb_Lesitsatfu Les Lt_Lesine Lsi Ls_Lesihlanu Lsh Lh_Umgcibelo Umg Ug'.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), 'emizuzwana lomcane', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'umzuzu', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'umzuzu', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 emizuzu', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 emizuzu', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'lihora', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'lihora', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 emahora', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 emahora', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 emahora', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'lilanga', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'lilanga', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 emalanga', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'lilanga', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 emalanga', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 emalanga', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'inyanga', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'inyanga', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'inyanga', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 tinyanga', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 tinyanga', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 tinyanga', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'inyanga', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 tinyanga', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'umnyaka', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 iminyaka', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'umnyaka', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 iminyaka', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'nga emizuzwana lomcane', 'prefix'); - assert.equal(moment(0).from(30000), 'wenteka nga emizuzwana lomcane', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'wenteka nga emizuzwana lomcane', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'nga emizuzwana lomcane', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'nga 5 emalanga', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Namuhla nga 12:00 emini', 'Today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Namuhla nga 12:25 emini', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Namuhla nga 1:00 emini', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Kusasa nga 12:00 emini', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Namuhla nga 11:00 emini', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Itolo nga 12:00 emini', '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 [nga] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [nga] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [nga] 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 [leliphelile] [nga] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [leliphelile] [nga] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [leliphelile] [nga] 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 52', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1', 'Jan 4 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'); -}); - diff --git a/src/test/locale/sv.js b/src/test/locale/sv.js deleted file mode 100644 index 7c5fd5b8f1..0000000000 --- a/src/test/locale/sv.js +++ /dev/null @@ -1,210 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('sv'); - -test('parse', function (assert) { - var tests = 'januari jan_februari feb_mars mar_april apr_maj maj_juni jun_juli jul_augusti aug_september sep_oktober 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)); - } - 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', 'söndag, februari 14e 2010, 3:25:50 pm'], - ['ddd, hA', 'sön, 3PM'], - ['M Mo MM MMMM MMM', '2 2a 02 februari feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14e 14'], - ['d do dddd ddd dd', '0 0e söndag sön sö'], - ['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'], - ['[the] DDDo [day of the year]', 'the 45e day of the year'], - ['LTS', '15:25:50'], - ['L', '2010-02-14'], - ['LL', '14 februari 2010'], - ['LLL', '14 februari 2010 kl. 15:25'], - ['LLLL', 'söndag 14 februari 2010 kl. 15:25'], - ['l', '2010-2-14'], - ['ll', '14 feb 2010'], - ['lll', '14 feb 2010 15:25'], - ['llll', 'sön 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'), '1a', '1a'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2a', '2a'); - 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'), '21a', '21a'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22a', '22a'); - 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'), '31a', '31a'); -}); - -test('format month', function (assert) { - var expected = 'januari jan_februari feb_mars mar_april apr_maj maj_juni jun_juli jul_augusti aug_september sep_oktober 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 = 'söndag sön sö_måndag mån må_tisdag tis ti_onsdag ons on_torsdag tor to_fredag fre fr_lördag lör 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]); - } -}); - -test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'några sekunder', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'en minut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'en minut', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuter', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuter', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'en timme', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'en timme', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 timmar', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 timmar', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 timmar', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'en dag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'en dag', '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), 'en dag', '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), 'en månad', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'en månad', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'en månad', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 månader', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 månader', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 månader', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'en månad', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 månader', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ett å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), 'ett å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), 'om några sekunder', 'prefix'); - assert.equal(moment(0).from(30000), 'för några sekunder sedan', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'för några sekunder sedan', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'om några sekunder', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'om 5 dagar', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Idag 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Idag 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Idag 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Imorgon 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Idag 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Igår 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('[På] dddd LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[På] dddd LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[På] 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('[I] dddd[s] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[I] dddd[s] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[I] dddd[s] 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 52a', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1a', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1a', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2a', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2a', 'Jan 15 2012 should be week 2'); -}); - diff --git a/src/test/locale/sw.js b/src/test/locale/sw.js deleted file mode 100644 index 5c5afbab05..0000000000 --- a/src/test/locale/sw.js +++ /dev/null @@ -1,210 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('sw'); - -test('parse', function (assert) { - var tests = 'Januari Jan_Februari Feb_Machi Mac_Aprili Apr_Mei Mei_Juni Jun_Julai Jul_Agosti Ago_Septemba Sep_Oktoba Okt_Novemba Nov_Desemba 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, h:mm:ss a', 'Jumapili, Februari 14 2010, 3:25:50 pm'], - ['ddd, hA', 'Jpl, 3PM'], - ['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 Jumapili Jpl J2'], - ['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'], - ['[siku] DDDo [ya mwaka]', 'siku 45 ya mwaka'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 Februari 2010'], - ['LLL', '14 Februari 2010 15:25'], - ['LLLL', 'Jumapili, 14 Februari 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14 Feb 2010'], - ['lll', '14 Feb 2010 15:25'], - ['llll', 'Jpl, 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'), '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_Machi Mac_Aprili Apr_Mei Mei_Juni Jun_Julai Jul_Agosti Ago_Septemba Sep_Oktoba Okt_Novemba Nov_Desemba 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 = 'Jumapili Jpl J2_Jumatatu Jtat J3_Jumanne Jnne J4_Jumatano Jtan J5_Alhamisi Alh Al_Ijumaa Ijm Ij_Jumamosi Jmos J1'.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), 'hivi punde', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'dakika moja', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'dakika moja', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), 'dakika 2', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), 'dakika 44', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'saa limoja', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'saa limoja', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), 'masaa 2', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), 'masaa 5', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), 'masaa 21', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'siku moja', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'siku moja', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), 'masiku 2', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'siku moja', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), 'masiku 5', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), 'masiku 25', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mwezi mmoja', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mwezi mmoja', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mwezi mmoja', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), 'miezi 2', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), 'miezi 2', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), 'miezi 3', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mwezi mmoja', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), 'miezi 5', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'mwaka mmoja', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), 'miaka 2', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'mwaka mmoja', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), 'miaka 5', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'hivi punde baadaye', 'prefix'); - assert.equal(moment(0).from(30000), 'tokea hivi punde', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'tokea hivi punde', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'hivi punde baadaye', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'masiku 5 baadaye', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'leo saa 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'leo saa 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'leo saa 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'kesho saa 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'leo saa 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'jana 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('[wiki ijayo] dddd [saat] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[wiki ijayo] dddd [saat] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[wiki ijayo] dddd [saat] 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('[wiki iliyopita] dddd [saat] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[wiki iliyopita] dddd [saat] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[wiki iliyopita] dddd [saat] 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 format', 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'); -}); - diff --git a/src/test/locale/ta.js b/src/test/locale/ta.js deleted file mode 100644 index 0baead51da..0000000000 --- a/src/test/locale/ta.js +++ /dev/null @@ -1,214 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('ta'); - -test('parse', function (assert) { - 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); - 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', 'ஞாயிற்றுக்கிழமை, பிப்ரவரி ௧௪வது ௨௦௧௦, ௩:௨௫:௫௦ எற்பாடு'], - ['ddd, hA', 'ஞாயிறு, ௩ எற்பாடு'], - ['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', ' எற்பாடு எற்பாடு'], - ['[ஆண்டின்] DDDo [நாள்]', 'ஆண்டின் ௪௫வது நாள்'], - ['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'), '௧வது', '௧வது'); - 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; - 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; - 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), 'ஒரு சில விநாடிகள்', '44 விநாடிகள் = ஒரு சில விநாடிகள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ஒரு நிமிடம்', '45 விநாடிகள் = ஒரு நிமிடம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ஒரு நிமிடம்', '89 விநாடிகள் = ஒரு நிமிடம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '௨ நிமிடங்கள்', '90 விநாடிகள் = ௨ நிமிடங்கள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '௪௪ நிமிடங்கள்', '44 நிமிடங்கள் = 44 நிமிடங்கள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ஒரு மணி நேரம்', '45 நிமிடங்கள் = ஒரு மணி நேரம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ஒரு மணி நேரம்', '89 நிமிடங்கள் = ஒரு மணி நேரம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '௨ மணி நேரம்', '90 நிமிடங்கள் = ௨ மணி நேரம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '௫ மணி நேரம்', '5 மணி நேரம் = 5 மணி நேரம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '௨௧ மணி நேரம்', '௨௧ மணி நேரம் = ௨௧ மணி நேரம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ஒரு நாள்', '௨௨ மணி நேரம் = ஒரு நாள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ஒரு நாள்', '௩5 மணி நேரம் = ஒரு நாள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '௨ நாட்கள்', '௩6 மணி நேரம் = ௨ days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ஒரு நாள்', '௧ நாள் = ஒரு நாள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '௫ நாட்கள்', '5 நாட்கள் = 5 நாட்கள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '௨௫ நாட்கள்', '௨5 நாட்கள் = ௨5 நாட்கள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ஒரு மாதம்', '௨6 நாட்கள் = ஒரு மாதம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ஒரு மாதம்', '௩0 நாட்கள் = ஒரு மாதம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ஒரு மாதம்', '45 நாட்கள் = ஒரு மாதம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '௨ மாதங்கள்', '46 நாட்கள் = ௨ மாதங்கள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '௨ மாதங்கள்', '75 நாட்கள் = ௨ மாதங்கள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '௩ மாதங்கள்', '76 நாட்கள் = ௩ மாதங்கள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ஒரு மாதம்', '௧ மாதம் = ஒரு மாதம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '௫ மாதங்கள்', '5 மாதங்கள் = 5 மாதங்கள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ஒரு வருடம்', '௩45 நாட்கள் = ஒரு வருடம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '௨ ஆண்டுகள்', '548 நாட்கள் = ௨ ஆண்டுகள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ஒரு வருடம்', '௧ வருடம் = ஒரு வருடம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '௫ ஆண்டுகள்', '5 ஆண்டுகள் = 5 ஆண்டுகள்'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'ஒரு சில விநாடிகள் இல்', 'prefix'); - assert.equal(moment(0).from(30000), 'ஒரு சில விநாடிகள் முன்', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'ஒரு சில விநாடிகள் முன்', 'இப்போது இருந்து கடந்த காலத்தில் காட்ட வேண்டும்'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'ஒரு சில விநாடிகள் இல்', 'ஒரு சில விநாடிகள் இல்'); - assert.equal(moment().add({d: 5}).fromNow(), '௫ நாட்கள் இல்', '5 நாட்கள் இல்'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'இன்று ௧௨:௦௦', 'இன்று 12:00'); - assert.equal(moment(a).add({m: 25}).calendar(), 'இன்று ௧௨:௨௫', 'இன்று 12:25'); - assert.equal(moment(a).add({h: 1}).calendar(), 'இன்று ௧௩:௦௦', 'இன்று 13:00'); - assert.equal(moment(a).add({d: 1}).calendar(), 'நாளை ௧௨:௦௦', 'நாளை 12:00'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'இன்று ௧௧:௦௦', 'இன்று 11:00'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'நேற்று ௧௨:௦௦', 'நேற்று 12:00'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 0, 30]).format('a'), ' யாமம்', '(after) midnight'); - 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, 23, 30]).format('a'), ' யாமம்', '(before) midnight'); -}); - - diff --git a/src/test/locale/te.js b/src/test/locale/te.js deleted file mode 100644 index 210f0bc672..0000000000 --- a/src/test/locale/te.js +++ /dev/null @@ -1,225 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('te'); - -test('parse', function (assert) { - 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); - 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, Do తేదీ MMMM YYYY, a h:mm:ss', 'ఆదివారం, 14వ తేదీ ఫిబ్రవరి 2010, మధ్యాహ్నం 3:25:50'], - ['ddd, a h గంటలు', 'ఆది, మధ్యాహ్నం 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', 'మధ్యాహ్నం మధ్యాహ్నం'], - ['LTS', 'మధ్యాహ్నం 3:25:50'], - ['L', '14/02/2010'], - ['LL', '14 ఫిబ్రవరి 2010'], - ['LLL', '14 ఫిబ్రవరి 2010, మధ్యాహ్నం 3:25'], - ['LLLL', 'ఆదివారం, 14 ఫిబ్రవరి 2010, మధ్యాహ్నం 3:25'], - ['l', '14/2/2010'], - ['ll', '14 ఫిబ్ర. 2010'], - ['lll', '14 ఫిబ్ర. 2010, మధ్యాహ్నం 3:25'], - ['llll', 'ఆది, 14 ఫిబ్ర. 2010, మధ్యాహ్నం 3: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 = 'జనవరి జన._ఫిబ్రవరి ఫిబ్ర._మార్చి మార్చి_ఏప్రిల్ ఏప్రి._మే మే_జూన్ జూన్_జులై జులై_ఆగస్టు ఆగ._సెప్టెంబర్ సెప్._అక్టోబర్ అక్టో._నవంబర్ నవ._డిసెంబర్ డిసె.'.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; - 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), 'కొన్ని క్షణాలు', '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), '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: 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), 'కొన్ని క్షణాలు లో', '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'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'కొన్ని క్షణాలు లో', 'కొన్ని క్షణాలు లో'); - assert.equal(moment().add({d: 5}).fromNow(), '5 రోజులు లో', '5 రోజులు లో'); -}); - -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: 3}).calendar(), 'నేడు మధ్యాహ్నం 3:00', 'Now plus 3 hours'); - 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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('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'), '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'); -}); diff --git a/src/test/locale/tet.js b/src/test/locale/tet.js deleted file mode 100644 index 20d0868061..0000000000 --- a/src/test/locale/tet.js +++ /dev/null @@ -1,211 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('tet'); - -test('parse', function (assert) { - var tests = 'Janeiru Jan_Fevereiru Fev_Marsu Mar_Abril Abr_Maiu Mai_Juñu Jun_Jullu Jul_Agustu Ago_Setembru Set_Outubru Out_Novembru Nov_Dezembru Dez'.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', 'Domingu, Fevereiru 14th 2010, 3:25:50 pm'], - ['ddd, hA', 'Dom, 3PM'], - ['M Mo MM MMMM MMM', '2 2nd 02 Fevereiru Fev'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14th 14'], - ['d do dddd ddd dd', '0 0th Domingu Dom Do'], - ['DDD DDDo DDDD', '45 45th 045'], - ['w wo ww', '6 6th 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 45th day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 Fevereiru 2010'], - ['LLL', '14 Fevereiru 2010 15:25'], - ['LLLL', 'Domingu, 14 Fevereiru 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Fev 2010'], - ['lll', '14 Fev 2010 15:25'], - ['llll', 'Dom, 14 Fev 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'), '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'), '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'), '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'), '31st', '31st'); -}); - -test('format month', function (assert) { - var expected = 'Janeiru Jan_Fevereiru Fev_Marsu Mar_Abril Abr_Maiu Mai_Juñu Jun_Jullu Jul_Agustu Ago_Setembru Set_Outubru Out_Novembru Nov_Dezembru Dez'.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 = 'Domingu Dom Do_Segunda Seg Seg_Tersa Ters Te_Kuarta Kua Ku_Kinta Kint Ki_Sesta Sest Ses_Sabadu 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]); - } -}); - -test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'minutu balun', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minutu ida', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minutu ida', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), 'minutu 2', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), 'minutu 44', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'oras ida', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'oras ida', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), 'oras 2', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), 'oras 5', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), 'oras 21', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'loron ida', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'loron ida', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), 'loron 2', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'loron ida', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), 'loron 5', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), 'loron 25', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'fulan ida', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'fulan ida', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'fulan ida', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), 'fulan 2', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), 'fulan 2', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), 'fulan 3', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'fulan ida', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), 'fulan 5', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'tinan ida', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), 'tinan 2', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'tinan ida', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), 'tinan 5', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'iha minutu balun', 'prefix'); - assert.equal(moment(0).from(30000), 'minutu balun liuba', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'minutu balun liuba', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'iha minutu balun', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'iha loron 5', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Ohin iha 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Ohin iha 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Ohin iha 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Aban iha 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Ohin iha 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Horiseik iha 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 [iha] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [iha] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [iha] 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 [semana kotuk] [iha] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [semana kotuk] [iha] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [semana kotuk] [iha] 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 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'); -}); - diff --git a/src/test/locale/tg.js b/src/test/locale/tg.js deleted file mode 100644 index a173e11c00..0000000000 --- a/src/test/locale/tg.js +++ /dev/null @@ -1,221 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('tg'); - -test('parse', function (assert) { - 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); - 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, Do MMMM YYYY, h:mm:ss', 'якшанбе, 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', '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'] - ], - 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 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, 10, 59]).format('A'), 'субҳ', 'morning'); - assert.equal(moment([2012, 11, 28, 12, 0]).format('A'), 'рӯз', 'afternoon'); - assert.equal(moment([2012, 11, 28, 15, 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-ум', '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-ум', '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-ум', '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-ум', '31st'); -}); - -test('format month', function (assert) { - 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; - 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), 'якчанд сония', '44 сония = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'як дақиқа', '45 сония = як дақиқа'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'як дақиқа', '89 сония = як дақиқа'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 дақиқа', '90 сония = 2 дақиқа'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 дақиқа', '44 дақиқа = 44 дақиқа'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'як соат', '45 дақиқа = як соат'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'як соат', '89 дақиқа = як соат'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 соат', '90 дақиқа = 2 соат'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 соат', '5 соат = 5 соат'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 соат', '21 соат = 21 соат'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'як рӯз', '22 соат = як рӯз'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'як рӯз', '35 соат = як рӯз'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 рӯз', '36 соат = 2 рӯз'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'як рӯз', '1 рӯз = як рӯз'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 рӯз', '5 рӯз = 5 рӯз'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 рӯз', '25 рӯз = 25 рӯз'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'як моҳ', '26 рӯз = як моҳ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'як моҳ', '30 рӯз = як моҳ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'як моҳ', '43 рӯз = як моҳ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 моҳ', '46 рӯз = 2 моҳ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 моҳ', '74 рӯз = 2 моҳ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 моҳ', '76 рӯз = 3 моҳ'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'як моҳ', 'як моҳ = як моҳ'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 моҳ', '5 моҳ = 5 моҳ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'як сол', '345 рӯз = як сол'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 сол', '548 рӯз = 2 сол'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'як сол', '1 сол = як сол'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 сол', '5 сол = 5 сол'); -}); - -test('suffix', function (assert) { - 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'); -}); - -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'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'), '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, 15]).format('w ww wo'), '3 03 3-юм', 'Jan 15 2012 should be week 3'); -}); diff --git a/src/test/locale/th.js b/src/test/locale/th.js deleted file mode 100644 index 859a948dec..0000000000 --- a/src/test/locale/th.js +++ /dev/null @@ -1,172 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('th'); - -test('parse', function (assert) { - 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); - 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, Do MMMM 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; - 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 month', function (assert) { - 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; - 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), 'ไม่กี่วินาที', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), '1 นาที', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '1 นาที', '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), '1 ชั่วโมง', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '1 ชั่วโมง', '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), '1 วัน', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '1 วัน', '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 วัน', '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), '1 เดือน', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '1 เดือน', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '1 เดือน', '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 เดือน', '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), '1 ปี', '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 ปี', '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'); -}); - -test('now from now', function (assert) { - 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'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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 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'); -}); diff --git a/src/test/locale/tl-ph.js b/src/test/locale/tl-ph.js deleted file mode 100644 index 10a1edc037..0000000000 --- a/src/test/locale/tl-ph.js +++ /dev/null @@ -1,209 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('tl-ph'); - -test('parse', function (assert) { - var tests = 'Enero Ene_Pebrero Peb_Marso Mar_Abril Abr_Mayo May_Hunyo Hun_Hulyo Hul_Agosto Ago_Setyembre Set_Oktubre Okt_Nobyembre Nob_Disyembre Dis'.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', 'Linggo, Pebrero 14 2010, 3:25:50 pm'], - ['ddd, hA', 'Lin, 3PM'], - ['M Mo MM MMMM MMM', '2 2 02 Pebrero Peb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 Linggo Lin Li'], - ['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', '02/14/2010'], - ['LL', 'Pebrero 14, 2010'], - ['LLL', 'Pebrero 14, 2010 15:25'], - ['LLLL', 'Linggo, Pebrero 14, 2010 15:25'], - ['l', '2/14/2010'], - ['ll', 'Peb 14, 2010'], - ['lll', 'Peb 14, 2010 15:25'], - ['llll', 'Lin, Peb 14, 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 = 'Enero Ene_Pebrero Peb_Marso Mar_Abril Abr_Mayo May_Hunyo Hun_Hulyo Hul_Agosto Ago_Setyembre Set_Oktubre Okt_Nobyembre Nob_Disyembre Dis'.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 = 'Linggo Lin Li_Lunes Lun Lu_Martes Mar Ma_Miyerkules Miy Mi_Huwebes Huw Hu_Biyernes Biy Bi_Sabado Sab Sab'.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), 'ilang segundo', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'isang minuto', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'isang minuto', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuto', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuto', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'isang oras', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'isang oras', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 oras', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 oras', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 oras', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'isang araw', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'isang araw', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 araw', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'isang araw', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 araw', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 araw', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'isang buwan', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'isang buwan', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'isang buwan', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 buwan', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 buwan', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 buwan', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'isang buwan', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 buwan', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'isang taon', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 taon', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'isang taon', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 taon', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'sa loob ng ilang segundo', 'prefix'); - assert.equal(moment(0).from(30000), 'ilang segundo ang nakalipas', 'suffix'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'sa loob ng ilang segundo', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'sa loob ng 5 araw', 'in 5 days'); -}); - -test('same day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), '12:00 ngayong araw', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), '12:25 ngayong araw', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), '13:00 ngayong araw', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Bukas ng 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), '11:00 ngayong araw', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), '12:00 kahapon', 'yesterday at the same time'); -}); - -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('LT [sa susunod na] dddd'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('LT [sa susunod na] dddd'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('LT [sa susunod na] dddd'), 'Today + ' + i + ' days end of day'); - } -}); - -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('LT [noong nakaraang] dddd'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('LT [noong nakaraang] dddd'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('LT [noong nakaraang] dddd'), 'Today - ' + i + ' days end of day'); - } -}); - -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'); - - 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 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'); -}); - diff --git a/src/test/locale/tlh.js b/src/test/locale/tlh.js deleted file mode 100644 index 21a036624f..0000000000 --- a/src/test/locale/tlh.js +++ /dev/null @@ -1,226 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('tlh'); - -//Current parsing method doesn't allow parsing correctly months 10, 11 and 12. -/* - * test('parse', function (assert) { - var tests = 'tera’ jar wa’.jar wa’_tera’ jar cha’.jar cha’_tera’ jar wej.jar wej_tera’ jar loS.jar loS_tera’ jar vagh.jar vagh_tera’ jar jav.jar jav_tera’ jar Soch.jar Soch_tera’ jar chorgh.jar chorgh_tera’ jar Hut.jar Hut_tera’ jar wa’maH.jar wa’maH_tera’ jar wa’maH wa’.jar wa’maH wa’_tera’ jar wa’maH cha’.jar wa’maH cha’'.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', 'lojmItjaj, tera’ jar cha’ 14. 2010, 3:25:50 pm'], - ['ddd, hA', 'lojmItjaj, 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 tera’ jar cha’ jar cha’'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. lojmItjaj lojmItjaj lojmItjaj'], - ['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'], - ['[DIS jaj] DDDo', 'DIS jaj 45.'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 tera’ jar cha’ 2010'], - ['LLL', '14 tera’ jar cha’ 2010 15:25'], - ['LLLL', 'lojmItjaj, 14 tera’ jar cha’ 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14 jar cha’ 2010'], - ['lll', '14 jar cha’ 2010 15:25'], - ['llll', 'lojmItjaj, 14 jar cha’ 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 = 'tera’ jar wa’ jar wa’_tera’ jar cha’ jar cha’_tera’ jar wej jar wej_tera’ jar loS jar loS_tera’ jar vagh jar vagh_tera’ jar jav jar jav_tera’ jar Soch jar Soch_tera’ jar chorgh jar chorgh_tera’ jar Hut jar Hut_tera’ jar wa’maH jar wa’maH_tera’ jar wa’maH wa’ jar wa’maH wa’_tera’ jar wa’maH cha’ jar wa’maH cha’'.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 = 'lojmItjaj lojmItjaj lojmItjaj_DaSjaj DaSjaj DaSjaj_povjaj povjaj povjaj_ghItlhjaj ghItlhjaj ghItlhjaj_loghjaj loghjaj loghjaj_buqjaj buqjaj buqjaj_ghInjaj ghInjaj ghInjaj'.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), 'puS lup', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'wa’ tup', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'wa’ tup', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), 'cha’ tup', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), 'loSmaH loS tup', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'wa’ rep', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'wa’ rep', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), 'cha’ rep', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), 'vagh rep', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), 'cha’maH wa’ rep', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'wa’ jaj', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'wa’ jaj', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), 'cha’ jaj', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'wa’ jaj', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), 'vagh jaj', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), 'cha’maH vagh jaj', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'wa’ jar', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'wa’ jar', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'wa’ jar', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), 'cha’ jar', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), 'cha’ jar', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), 'wej jar', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'wa’ jar', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), 'vagh jar', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'wa’ DIS', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), 'cha’ DIS', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'wa’ DIS', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), 'vagh DIS', '5 years = 5 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 112}), true), 'wa’vatlh wa’maH cha’ DIS', '112 years = 112 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 122}), true), 'wa’vatlh cha’maH cha’ DIS', '122 years = 122 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 213}), true), 'cha’vatlh wa’maH wej DIS', '213 years = 213 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 223}), true), 'cha’vatlh cha’maH wej DIS', '223 years = 223 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'puS lup pIq', 'suffix'); - assert.equal(moment(0).from(30000), 'puS lup ret', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'puS lup ret', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'puS lup pIq', 'in a few seconds'); - assert.equal(moment().add({h: 1}).fromNow(), 'wa’ rep pIq', 'in an hour'); - assert.equal(moment().add({d: 5}).fromNow(), 'vagh leS', 'in 5 days'); - assert.equal(moment().add({M: 2}).fromNow(), 'cha’ waQ', 'in 2 months'); - assert.equal(moment().add({y: 1}).fromNow(), 'wa’ nem', 'in a year'); - assert.equal(moment().add({s: -30}).fromNow(), 'puS lup ret', 'a few seconds ago'); - assert.equal(moment().add({h: -1}).fromNow(), 'wa’ rep ret', 'an hour ago'); - assert.equal(moment().add({d: -5}).fromNow(), 'vagh Hu’', '5 days ago'); - assert.equal(moment().add({M: -2}).fromNow(), 'cha’ wen', '2 months ago'); - assert.equal(moment().add({y: -1}).fromNow(), 'wa’ ben', 'a year ago'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'DaHjaj 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'DaHjaj 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'DaHjaj 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'wa’leS 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'DaHjaj 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'wa’Hu’ 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('LLL'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('LLL'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('LLL'), '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('LLL'), 'Today - ' + i + ' days current time'); - - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('LLL'), 'Today - ' + i + ' days beginning of day'); - - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('LLL'), '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 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'); -}); - diff --git a/src/test/locale/tr.js b/src/test/locale/tr.js deleted file mode 100644 index 9c0f5e8cde..0000000000 --- a/src/test/locale/tr.js +++ /dev/null @@ -1,220 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('tr'); - -test('parse', function (assert) { - var tests = 'Ocak Oca_Şubat Şub_Mart Mar_Nisan Nis_Mayıs May_Haziran Haz_Temmuz Tem_Ağustos Ağu_Eylül Eyl_Ekim Eki_Kasım Kas_Aralık Ara'.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', 'Pazar, Şubat 14 2010, 3:25:50 pm'], - ['ddd, hA', 'Paz, 3PM'], - ['M Mo MM MMMM MMM', '2 2\'nci 02 Şubat Şub'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 Pazar Paz Pz'], - ['DDD DDDo DDDD', '45 45\'inci 045'], - ['w wo ww', '7 7\'nci 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[yılın] DDDo [günü]', 'yılın 45\'inci günü'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 Şubat 2010'], - ['LLL', '14 Şubat 2010 15:25'], - ['LLLL', 'Pazar, 14 Şubat 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14 Şub 2010'], - ['lll', '14 Şub 2010 15:25'], - ['llll', 'Paz, 14 Şub 2010 15:25'] - ], - DDDo = [ - [359, '360\'ıncı'], - [199, '200\'üncü'], - [149, '150\'nci'] - ], - dt = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - DDDoDt, - i; - - for (i = 0; i < a.length; i++) { - assert.equal(dt.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - for (i = 0; i < DDDo.length; i++) { - DDDoDt = moment([2010]); - assert.equal(DDDoDt.add(DDDo[i][0], 'days').format('DDDo'), DDDo[i][1], DDDo[i][0] + ' ---> ' + DDDo[i][1]); - } -}); - -test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1\'inci', '1st'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2\'nci', '2nd'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3\'üncü', '3rd'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4\'üncü', '4th'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5\'inci', '5th'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6\'ncı', '6th'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7\'nci', '7th'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8\'inci', '8th'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9\'uncu', '9th'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10\'uncu', '10th'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11\'inci', '11th'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12\'nci', '12th'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13\'üncü', '13th'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14\'üncü', '14th'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15\'inci', '15th'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16\'ncı', '16th'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17\'nci', '17th'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18\'inci', '18th'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19\'uncu', '19th'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20\'nci', '20th'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21\'inci', '21th'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22\'nci', '22th'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23\'üncü', '23th'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24\'üncü', '24th'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25\'inci', '25th'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26\'ncı', '26th'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27\'nci', '27th'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28\'inci', '28th'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29\'uncu', '29th'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30\'uncu', '30th'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31\'inci', '31st'); -}); - -test('format month', function (assert) { - var expected = 'Ocak Oca_Şubat Şub_Mart Mar_Nisan Nis_Mayıs May_Haziran Haz_Temmuz Tem_Ağustos Ağu_Eylül Eyl_Ekim Eki_Kasım Kas_Aralık Ara'.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 = 'Pazar Paz Pz_Pazartesi Pts Pt_Salı Sal Sa_Çarşamba Çar Ça_Perşembe Per Pe_Cuma Cum Cu_Cumartesi Cts Ct'.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), 'birkaç saniye', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'bir dakika', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'bir dakika', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 dakika', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 dakika', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'bir saat', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'bir saat', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 saat', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 saat', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 saat', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'bir gün', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'bir gün', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 gün', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'bir gün', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 gün', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 gün', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'bir ay', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'bir ay', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'bir ay', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 ay', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 ay', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 ay', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'bir ay', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 ay', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'bir yıl', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 yıl', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'bir yıl', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 yıl', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'birkaç saniye sonra', 'prefix'); - assert.equal(moment(0).from(30000), 'birkaç saniye önce', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'birkaç saniye önce', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'birkaç saniye sonra', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5 gün sonra', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'bugün saat 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'bugün saat 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'bugün saat 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'yarın saat 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'bugün saat 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'dün 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('[gelecek] dddd [saat] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[gelecek] dddd [saat] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[gelecek] dddd [saat] 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('[geçen] dddd [saat] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[geçen] dddd [saat] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[geçen] dddd [saat] 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([2011, 11, 26]).format('w ww wo'), '1 01 1\'inci', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1\'inci', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2\'nci', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2\'nci', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3\'üncü', 'Jan 9 2012 should be week 3'); -}); diff --git a/src/test/locale/tzl.js b/src/test/locale/tzl.js deleted file mode 100644 index 2e3f4e11cf..0000000000 --- a/src/test/locale/tzl.js +++ /dev/null @@ -1,214 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('tzl'); - -test('parse', function (assert) { - var tests = 'Januar Jan_Fevraglh Fev_Març Mar_Avrïu Avr_Mai Mai_Gün Gün_Julia Jul_Guscht Gus_Setemvar Set_Listopäts Lis_Noemvar Noe_Zecemvar Zec'.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', 'Súladi, Fevraglh 14. 2010, 3.25.50 d\'o'], - ['ddd, hA', 'Súl, 3D\'O'], - ['M Mo MM MMMM MMM', '2 2. 02 Fevraglh Fev'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. Súladi Súl Sú'], - ['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', 'd\'o D\'O'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], - ['LTS', '15.25.50'], - ['L', '14.02.2010'], - ['LL', '14. Fevraglh dallas 2010'], - ['LLL', '14. Fevraglh dallas 2010 15.25'], - ['LLLL', 'Súladi, li 14. Fevraglh dallas 2010 15.25'], - ['l', '14.2.2010'], - ['ll', '14. Fev dallas 2010'], - ['lll', '14. Fev dallas 2010 15.25'], - ['llll', 'Súl, li 14. Fev dallas 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 = 'Januar Jan_Fevraglh Fev_Març Mar_Avrïu Avr_Mai Mai_Gün Gün_Julia Jul_Guscht Gus_Setemvar Set_Listopäts Lis_Noemvar Noe_Zecemvar Zec'.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 = 'Súladi Súl Sú_Lúneçi Lún Lú_Maitzi Mai Ma_Márcuri Már Má_Xhúadi Xhú Xh_Viénerçi Vié Vi_Sáturi Sát 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), 'viensas secunds', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), '\'n míut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '\'n míut', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 míuts', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 míuts', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), '\'n þora', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '\'n þora', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 þoras', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 þoras', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 þoras', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), '\'n ziua', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '\'n ziua', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 ziuas', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), '\'n ziua', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 ziuas', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 ziuas', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), '\'n mes', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '\'n mes', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '\'n mes', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mesen', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mesen', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mesen', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), '\'n mes', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mesen', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), '\'n ar', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 ars', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), '\'n ar', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 ars', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'osprei viensas secunds', 'prefix'); - assert.equal(moment(0).from(30000), 'ja\'iensas secunds', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'ja\'iensas secunds', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'osprei viensas secunds', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'osprei 5 ziuas', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'oxhi à 12.00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'oxhi à 12.25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'oxhi à 13.00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'demà à 12.00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'oxhi à 11.00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'ieiri à 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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('[sür el] dddd [lasteu à] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[sür el] dddd [lasteu à] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[sür el] dddd [lasteu à] 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'); -}); - -// Monday is the first day of the week. -// The week that contains Jan 4th is the first week of the year. - -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'); -}); - diff --git a/src/test/locale/tzm-latn.js b/src/test/locale/tzm-latn.js deleted file mode 100644 index 38bd759a36..0000000000 --- a/src/test/locale/tzm-latn.js +++ /dev/null @@ -1,210 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('tzm-latn'); - -test('parse', function (assert) { - var tests = 'innayr innayr_brˤayrˤ brˤayrˤ_marˤsˤ marˤsˤ_ibrir ibrir_mayyw mayyw_ywnyw ywnyw_ywlywz ywlywz_ɣwšt ɣwšt_šwtanbir šwtanbir_ktˤwbrˤ ktˤwbrˤ_nwwanbir nwwanbir_dwjnbir dwjnbir'.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', 'asamas, brˤayrˤ 14 2010, 3:25:50 pm'], - ['ddd, hA', 'asamas, 3PM'], - ['M Mo MM MMMM MMM', '2 2 02 brˤayrˤ brˤayrˤ'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 asamas asamas asamas'], - ['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', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45 day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 brˤayrˤ 2010'], - ['LLL', '14 brˤayrˤ 2010 15:25'], - ['LLLL', 'asamas 14 brˤayrˤ 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 brˤayrˤ 2010'], - ['lll', '14 brˤayrˤ 2010 15:25'], - ['llll', 'asamas 14 brˤayrˤ 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 = 'innayr innayr_brˤayrˤ brˤayrˤ_marˤsˤ marˤsˤ_ibrir ibrir_mayyw mayyw_ywnyw ywnyw_ywlywz ywlywz_ɣwšt ɣwšt_šwtanbir šwtanbir_ktˤwbrˤ ktˤwbrˤ_nwwanbir nwwanbir_dwjnbir dwjnbir'.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 = 'asamas asamas asamas_aynas aynas aynas_asinas asinas asinas_akras akras akras_akwas akwas akwas_asimwas asimwas asimwas_asiḍyas asiḍyas asiḍyas'.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), 'imik', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minuḍ', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minuḍ', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuḍ', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuḍ', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'saɛa', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'saɛa', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 tassaɛin', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 tassaɛin', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 tassaɛin', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ass', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ass', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 ossan', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ass', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 ossan', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 ossan', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ayowr', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ayowr', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ayowr', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 iyyirn', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 iyyirn', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 iyyirn', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ayowr', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 iyyirn', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'asgas', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 isgasn', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'asgas', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 isgasn', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'dadkh s yan imik', 'prefix'); - assert.equal(moment(0).from(30000), 'yan imik', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'yan imik', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'dadkh s yan imik', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'dadkh s yan 5 ossan', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'asdkh g 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'asdkh g 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'asdkh g 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'aska g 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'asdkh g 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'assant g 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 [g] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [g] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [g] 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 [g] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [g] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [g] 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([2011, 11, 31]).format('w ww wo'), '1 01 1', 'Dec 31 2011 should be week 1'); - assert.equal(moment([2012, 0, 6]).format('w ww wo'), '1 01 1', 'Jan 6 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '2 02 2', 'Jan 7 2012 should be week 2'); - assert.equal(moment([2012, 0, 13]).format('w ww wo'), '2 02 2', 'Jan 13 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '3 03 3', 'Jan 14 2012 should be week 3'); -}); - diff --git a/src/test/locale/tzm.js b/src/test/locale/tzm.js deleted file mode 100644 index 5737957b76..0000000000 --- a/src/test/locale/tzm.js +++ /dev/null @@ -1,210 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('tzm'); - -test('parse', function (assert) { - 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); - 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', 'ⴰⵙⴰⵎⴰⵙ, ⴱⵕⴰⵢⵕ 14 2010, 3:25:50 pm'], - ['ddd, hA', 'ⴰⵙⴰⵎⴰⵙ, 3PM'], - ['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', 'pm PM'], - ['[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; - 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 = 'ⵉⵏⵏⴰⵢⵔ ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ ⴷⵓⵊⵏⴱⵉⵔ'.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; - 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), 'ⵉⵎⵉⴽ', '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), '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 oⵙⵙⴰⵏ', '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 oⵙⵙⴰⵏ', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 oⵙⵙⴰⵏ', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ⴰⵢoⵓⵔ', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ⴰⵢoⵓⵔ', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ⴰⵢoⵓⵔ', '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), 'ⴰⵢoⵓⵔ', '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), 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ ⵉⵎⵉⴽ', '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'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ ⵉⵎⵉⴽ', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ 5 oⵙⵙⴰⵏ', '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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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([2011, 11, 31]).format('w ww wo'), '1 01 1', 'Dec 31 2011 should be week 1'); - assert.equal(moment([2012, 0, 6]).format('w ww wo'), '1 01 1', 'Jan 6 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '2 02 2', 'Jan 7 2012 should be week 2'); - assert.equal(moment([2012, 0, 13]).format('w ww wo'), '2 02 2', 'Jan 13 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '3 03 3', 'Jan 14 2012 should be week 3'); -}); - diff --git a/src/test/locale/ug-cn.js b/src/test/locale/ug-cn.js deleted file mode 100644 index c5e1f4016d..0000000000 --- a/src/test/locale/ug-cn.js +++ /dev/null @@ -1,182 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('ug-cn'); - -test('parse', function (assert) { - 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); - 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, YYYY MMMM Do, a h:mm:ss', 'يەكشەنبە، 2010 فېۋرال 14-كۈنى، چۈشتىن كېيىن 3:25:50'], - ['dddd, A h', 'يەكشەنبە، چۈشتىن كېيىن 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', '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', '2010-02-14'], - ['LL', '2010-يىلى2-ئاينىڭ14-كۈنى'], - ['LLL', '2010-يىلى2-ئاينىڭ14-كۈنى، 15:25'], - ['LLLL', 'يەكشەنبە، 2010-يىلى2-ئاينىڭ14-كۈنى، 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 month', function (assert) { - 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; - - 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), 'نەچچە سېكونت', '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), '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: 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), 'نەچچە سېكونت كېيىن', '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'); -}); - -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'); -}); - -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'); -}); - - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 0, 0]).format('A'), 'يېرىم كېچە', 'before dawn'); - assert.equal(moment([2011, 2, 23, 6, 0]).format('A'), 'سەھەر', 'morning'); - assert.equal(moment([2011, 2, 23, 9, 0]).format('A'), 'چۈشتىن بۇرۇن', 'before noon'); - assert.equal(moment([2011, 2, 23, 12, 0]).format('A'), 'چۈش', 'noon'); - assert.equal(moment([2011, 2, 23, 13, 0]).format('A'), 'چۈشتىن كېيىن', 'afternoon'); - assert.equal(moment([2011, 2, 23, 18, 0]).format('A'), 'كەچ', 'night'); -}); - -test('weeks year starting sunday format', 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'); -}); diff --git a/src/test/locale/uk.js b/src/test/locale/uk.js deleted file mode 100644 index 8e136999d5..0000000000 --- a/src/test/locale/uk.js +++ /dev/null @@ -1,243 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('uk'); - -test('parse', function (assert) { - 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); - 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, 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-й неділя нд нд'], - ['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'] - ], - 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 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; - 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 week', function (assert) { - 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]); - } -}); - -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'); -}); - -test('suffix', function (assert) { - 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(), 'за декілька секунд', '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(), 'Сьогодні о 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: 2}).calendar(), 'Сьогодні о 10:00', 'Now minus 2 hours'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Вчора о 12:00', 'yesterday at the same time'); - // A special case for Ukrainian since 11 hours have different preposition - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Сьогодні об 11:00', 'same day at 11 o\'clock'); -}); - -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() === 11 ? 'б' : '') + '] 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'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[У] dddd [о] LT'), '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: - case 5: - case 6: - return '[Минулої] dddd [о' + (d.hours() === 11 ? 'б' : '') + '] LT'; - case 1: - case 2: - case 4: - return '[Минулого] dddd [о' + (d.hours() === 11 ? 'б' : '') + '] 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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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(makeFormat(m)), '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([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'); -}); - diff --git a/src/test/locale/ur.js b/src/test/locale/ur.js deleted file mode 100644 index a27e73a0f3..0000000000 --- a/src/test/locale/ur.js +++ /dev/null @@ -1,224 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('ur'); - -var months = [ - 'جنوری', - 'فروری', - 'مارچ', - 'اپریل', - 'مئی', - 'جون', - 'جولائی', - 'اگست', - 'ستمبر', - 'اکتوبر', - 'نومبر', - 'دسمبر' -]; -var days = [ - 'اتوار', - 'پیر', - 'منگل', - 'بدھ', - 'جمعرات', - 'جمعہ', - 'ہفتہ' -]; - -test('parse', function (assert) { - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (var i = 0; i < 12; i++) { - equalTest(months[i], 'MMM', i); - equalTest(months[i], 'MMMM', i); - } -}); - -test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'اتوار، فروری 14 2010، 3:25:50 شام'], - ['ddd, hA', 'اتوار، 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', '6 6 06'], - ['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'] - ], - 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) { - for (var i = 0; i < months.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), months[i] + ' ' + months[i], months[i] + ' ' + months[i]); - } -}); - -test('format week', function (assert) { - for (var i = 0; i < days.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), days[i] + ' ' + days[i] + ' ' + days[i], days[i] + ' ' + days[i] + ' ' + days[i]); - } -}); - -test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'چند سیکنڈ', '44 seconds = چند سیکنڈ'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ایک منٹ', '45 seconds = ایک منٹ'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ایک منٹ', '89 seconds = ایک منٹ'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 منٹ', '90 seconds = 2 منٹ'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 منٹ', '44 minutes = 44 منٹ'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ایک گھنٹہ', '45 minutes = ایک گھنٹہ'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ایک گھنٹہ', '89 minutes = ایک گھنٹہ'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 گھنٹے', '90 minutes = 2 گھنٹے'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 گھنٹے', '5 hours = 5 گھنٹے'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 گھنٹے', '21 hours = 21 گھنٹے'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ایک دن', '22 hours = ایک دن'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ایک دن', '35 hours = ایک دن'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 دن', '36 hours = 2 دن'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ایک دن', '1 day = ایک دن'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 دن', '5 days = 5 دن'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 دن', '25 days = 25 دن'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ایک ماہ', '26 days = ایک ماہ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ایک ماہ', '30 days = ایک ماہ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ایک ماہ', '43 days = ایک ماہ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 ماہ', '46 days = 2 ماہ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 ماہ', '75 days = 2 ماہ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 ماہ', '76 days = 3 ماہ'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ایک ماہ', '1 month = ایک ماہ'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 ماہ', '5 months = 5 ماہ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ایک سال', '345 days = ایک سال'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 سال', '548 days = 2 سال'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ایک سال', '1 year = ایک سال'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 سال', '5 years = 5 سال'); -}); - -test('suffix', function (assert) { - 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'); -}); - -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'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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 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'); -}); diff --git a/src/test/locale/uz-latn.js b/src/test/locale/uz-latn.js deleted file mode 100644 index 0046709bd0..0000000000 --- a/src/test/locale/uz-latn.js +++ /dev/null @@ -1,211 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('uz-latn'); - -test('parse', function (assert) { - var tests = 'Yanvar Yan_Fevral Fev_Mart Mar_Aprel Apr_May May_Iyun Iyun_Iyul Iyul_Avgust Avg_Sentabr Sen_Oktabr Okt_Noyabr Noy_Dekabr Dek'.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, Do-MMMM YYYY, h:mm:ss', 'Yakshanba, 14-Fevral 2010, 3:25:50'], - ['ddd, h:mm', 'Yak, 3:25'], - ['M Mo MM MMMM MMM', '2 2 02 Fevral Fev'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 Yakshanba Yak Ya'], - ['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'], - ['[yilning] DDDo-[kuni]', 'yilning 45-kuni'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 Fevral 2010'], - ['LLL', '14 Fevral 2010 15:25'], - ['LLLL', '14 Fevral 2010, Yakshanba 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Fev 2010'], - ['lll', '14 Fev 2010 15:25'], - ['llll', '14 Fev 2010, Yak 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([2016, 0, 1]).format('DDDo'), '1', '1'); - assert.equal(moment([2016, 0, 2]).format('DDDo'), '2', '2'); - assert.equal(moment([2016, 0, 3]).format('DDDo'), '3', '3'); - assert.equal(moment([2016, 0, 4]).format('DDDo'), '4', '4'); - assert.equal(moment([2016, 0, 5]).format('DDDo'), '5', '5'); - assert.equal(moment([2016, 0, 6]).format('DDDo'), '6', '6'); - assert.equal(moment([2016, 0, 7]).format('DDDo'), '7', '7'); - assert.equal(moment([2016, 0, 8]).format('DDDo'), '8', '8'); - assert.equal(moment([2016, 0, 9]).format('DDDo'), '9', '9'); - assert.equal(moment([2016, 0, 10]).format('DDDo'), '10', '10'); - - assert.equal(moment([2016, 0, 11]).format('DDDo'), '11', '11'); - assert.equal(moment([2016, 0, 12]).format('DDDo'), '12', '12'); - assert.equal(moment([2016, 0, 13]).format('DDDo'), '13', '13'); - assert.equal(moment([2016, 0, 14]).format('DDDo'), '14', '14'); - assert.equal(moment([2016, 0, 15]).format('DDDo'), '15', '15'); - assert.equal(moment([2016, 0, 16]).format('DDDo'), '16', '16'); - assert.equal(moment([2016, 0, 17]).format('DDDo'), '17', '17'); - assert.equal(moment([2016, 0, 18]).format('DDDo'), '18', '18'); - assert.equal(moment([2016, 0, 19]).format('DDDo'), '19', '19'); - assert.equal(moment([2016, 0, 20]).format('DDDo'), '20', '20'); - - assert.equal(moment([2016, 0, 21]).format('DDDo'), '21', '21'); - assert.equal(moment([2016, 0, 22]).format('DDDo'), '22', '22'); - assert.equal(moment([2016, 0, 23]).format('DDDo'), '23', '23'); - assert.equal(moment([2016, 0, 24]).format('DDDo'), '24', '24'); - assert.equal(moment([2016, 0, 25]).format('DDDo'), '25', '25'); - assert.equal(moment([2016, 0, 26]).format('DDDo'), '26', '26'); - assert.equal(moment([2016, 0, 27]).format('DDDo'), '27', '27'); - assert.equal(moment([2016, 0, 28]).format('DDDo'), '28', '28'); - assert.equal(moment([2016, 0, 29]).format('DDDo'), '29', '29'); - assert.equal(moment([2016, 0, 30]).format('DDDo'), '30', '30'); - - assert.equal(moment([2016, 0, 31]).format('DDDo'), '31', '31'); -}); - -test('format month', function (assert) { - var expected = 'Yanvar Yan_Fevral Fev_Mart Mar_Aprel Apr_May May_Iyun Iyun_Iyul Iyul_Avgust Avg_Sentabr Sen_Oktabr Okt_Noyabr Noy_Dekabr Dek'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2016, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } -}); - -test('format week', function (assert) { - var expected = 'Yakshanba Yak Ya_Dushanba Dush Du_Seshanba Sesh Se_Chorshanba Chor Cho_Payshanba Pay Pa_Juma Jum Ju_Shanba Shan Sha'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2016, 0, 3 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } -}); - -test('from', function (assert) { - var start = moment([2017, 1, 28]); - assert.equal(start.from(moment([2017, 1, 28]).add({s: 44}), true), 'soniya', '44 soniya = soniya'); - assert.equal(start.from(moment([2017, 1, 28]).add({s: 45}), true), 'bir daqiqa', '45 soniya = bir daqiqa'); - assert.equal(start.from(moment([2017, 1, 28]).add({s: 89}), true), 'bir daqiqa', '89 soniya = bir daqiqa'); - assert.equal(start.from(moment([2017, 1, 28]).add({s: 90}), true), '2 daqiqa', '90 soniya = 2 daqiqa'); - assert.equal(start.from(moment([2017, 1, 28]).add({m: 44}), true), '44 daqiqa', '44 daqiqa = 44 daqiqa'); - assert.equal(start.from(moment([2017, 1, 28]).add({m: 45}), true), 'bir soat', '45 minut = bir soat'); - assert.equal(start.from(moment([2017, 1, 28]).add({m: 89}), true), 'bir soat', '89 minut = bir soat'); - assert.equal(start.from(moment([2017, 1, 28]).add({m: 90}), true), '2 soat', '90 minut = 2 soat'); - assert.equal(start.from(moment([2017, 1, 28]).add({h: 5}), true), '5 soat', '5 soat = 5 soat'); - assert.equal(start.from(moment([2017, 1, 28]).add({h: 21}), true), '21 soat', '21 soat = 21 soat'); - assert.equal(start.from(moment([2017, 1, 28]).add({h: 22}), true), 'bir kun', '22 soat = bir kun'); - assert.equal(start.from(moment([2017, 1, 28]).add({h: 35}), true), 'bir kun', '35 soat = bir kun'); - assert.equal(start.from(moment([2017, 1, 28]).add({h: 36}), true), '2 kun', '36 soat = 2 kun'); - assert.equal(start.from(moment([2017, 1, 28]).add({d: 1}), true), 'bir kun', '1 kun = 1 kun'); - assert.equal(start.from(moment([2017, 1, 28]).add({d: 5}), true), '5 kun', '5 kun = 5 kun'); - assert.equal(start.from(moment([2017, 1, 28]).add({d: 25}), true), '25 kun', '25 kun = 25 kun'); - assert.equal(start.from(moment([2017, 1, 28]).add({d: 26}), true), 'bir oy', '26 kun = bir oy'); - assert.equal(start.from(moment([2017, 1, 28]).add({d: 30}), true), 'bir oy', '30 kun = bir oy'); - assert.equal(start.from(moment([2017, 1, 28]).add({d: 43}), true), 'bir oy', '45 kun = bir oy'); - assert.equal(start.from(moment([2017, 1, 28]).add({d: 46}), true), '2 oy', '46 kun = 2 oy'); - assert.equal(start.from(moment([2017, 1, 28]).add({d: 74}), true), '2 oy', '75 kun = 2 oy'); - assert.equal(start.from(moment([2017, 1, 28]).add({d: 76}), true), '3 oy', '76 kun = 3 oy'); - assert.equal(start.from(moment([2017, 1, 28]).add({M: 1}), true), 'bir oy', 'bir oy = bir oy'); - assert.equal(start.from(moment([2017, 1, 28]).add({M: 5}), true), '5 oy', '5 oy = 5 oy'); - assert.equal(start.from(moment([2017, 1, 28]).add({d: 345}), true), 'bir yil', '345 kun = bir yil'); - assert.equal(start.from(moment([2017, 1, 28]).add({d: 548}), true), '2 yil', '548 kun = 2 yil'); - assert.equal(start.from(moment([2017, 1, 28]).add({y: 1}), true), 'bir yil', '1 yil = bir yil'); - assert.equal(start.from(moment([2017, 1, 28]).add({y: 5}), true), '5 yil', '5 yil = 5 yil'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'Yaqin soniya ichida', 'prefix'); - assert.equal(moment(0).from(30000), 'Bir necha soniya oldin', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'Bir necha soniya oldin', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'Yaqin soniya ichida', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'Yaqin 5 kun ichida', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Bugun soat 12:00 da', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Bugun soat 12:25 da', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Bugun soat 13:00 da', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Ertaga 12:00 da', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Bugun soat 11:00 da', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kecha soat 12:00 da', '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 [kuni soat] LT [da]'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [kuni soat] LT [da]'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [kuni soat] LT [da]'), '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\'tgan] dddd [kuni soat] LT [da]'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[O\'tgan] dddd [kuni soat] LT [da]'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[O\'tgan] dddd [kuni soat] LT [da]'), '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'), '1 01 1', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 should be week 2'); -}); - diff --git a/src/test/locale/uz.js b/src/test/locale/uz.js deleted file mode 100644 index 9d93d4aaef..0000000000 --- a/src/test/locale/uz.js +++ /dev/null @@ -1,211 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('uz'); - -test('parse', function (assert) { - 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); - 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, Do-MMMM YYYY, h:mm:ss', 'Якшанба, 14-феврал 2010, 3:25:50'], - ['ddd, h:mm', 'Якш, 3:25'], - ['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', '7 7 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[йилнинг] 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'] - ], - 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 = 'январ янв_феврал фев_март мар_апрел апр_май май_июн июн_июл июл_август авг_сентябр сен_октябр окт_ноябр ноя_декабр дек'.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; - 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), 'фурсат', '44 секунд = фурсат'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'бир дакика', '45 секунд = бир дакика'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'бир дакика', '89 секунд = бир дакика'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 дакика', '90 секунд = 2 дакика'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 дакика', '44 дакика = 44 дакика'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'бир соат', '45 минут = бир соат'); - 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 минут = 2 соат'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 соат', '5 соат = 5 соат'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 соат', '21 соат = 21 соат'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'бир кун', '22 соат = бир кун'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'бир кун', '35 соат = бир кун'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 кун', '36 соат = 2 кун'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'бир кун', '1 кун = 1 кун'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 кун', '5 кун = 5 кун'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 кун', '25 кун = 25 кун'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'бир ой', '26 кун = бир ой'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'бир ой', '30 кун = бир ой'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'бир ой', '45 кун = бир ой'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 ой', '46 кун = 2 ой'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 ой', '75 кун = 2 ой'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 ой', '76 кун = 3 ой'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'бир ой', 'бир ой = бир ой'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 ой', '5 ой = 5 ой'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'бир йил', '345 кун = бир йил'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 йил', '548 кун = 2 йил'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'бир йил', '1 йил = бир йил'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 йил', '5 йил = 5 йил'); -}); - -test('suffix', function (assert) { - 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'); -}); - -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'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'), '1 01 1', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 should be week 2'); -}); - diff --git a/src/test/locale/vi.js b/src/test/locale/vi.js deleted file mode 100644 index 0c530cf830..0000000000 --- a/src/test/locale/vi.js +++ /dev/null @@ -1,221 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('vi'); - -test('parse', function (assert) { - var i, - tests = 'tháng 1,Th01_tháng 2,Th02_tháng 3,Th03_tháng 4,Th04_tháng 5,Th05_tháng 6,Th06_tháng 7,Th07_tháng 8,Th08_tháng 9,Th09_tháng 10,Th10_tháng 11,Th11_tháng 12,Th12'.split('_'); - - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + i); - } - - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(','); - equalTest(tests[i][0], '[tháng] M', i); - equalTest(tests[i][1], '[Th]M', i); - equalTest(tests[i][0], '[tháng] MM', i); - equalTest(tests[i][1], '[Th]MM', i); - equalTest(tests[i][0].toLocaleLowerCase(), '[THÁNG] M', i); - equalTest(tests[i][1].toLocaleLowerCase(), '[TH]M', i); - equalTest(tests[i][0].toLocaleUpperCase(), '[THÁNG] MM', i); - equalTest(tests[i][1].toLocaleUpperCase(), '[TH]MM', i); - } -}); - -test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'chủ nhật, tháng 2 14 2010, 3:25:50 ch'], - ['ddd, hA', 'CN, 3CH'], - ['M Mo MM MMMM MMM', '2 2 02 tháng 2 Th02'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 chủ nhật CN CN'], - ['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', 'ch CH'], - ['[ngày thứ] DDDo [của năm]', 'ngày thứ 45 của năm'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 tháng 2 năm 2010'], - ['LLL', '14 tháng 2 năm 2010 15:25'], - ['LLLL', 'chủ nhật, 14 tháng 2 năm 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Th02 2010'], - ['lll', '14 Th02 2010 15:25'], - ['llll', 'CN, 14 Th02 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 i, - expected = 'tháng 1,Th01_tháng 2,Th02_tháng 3,Th03_tháng 4,Th04_tháng 5,Th05_tháng 6,Th06_tháng 7,Th07_tháng 8,Th08_tháng 9,Th09_tháng 10,Th10_tháng 11,Th11_tháng 12,Th12'.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 i, - expected = 'chủ nhật CN CN_thứ hai T2 T2_thứ ba T3 T3_thứ tư T4 T4_thứ năm T5 T5_thứ sáu T6 T6_thứ bảy T7 T7'.split('_'); - - 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), 'vài giây', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'một phút', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'một phút', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 phút', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 phút', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'một giờ', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'một giờ', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 giờ', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 giờ', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 giờ', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'một ngày', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'một ngày', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 ngày', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'một ngày', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 ngày', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 ngày', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'một tháng', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'một tháng', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'một tháng', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 tháng', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 tháng', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 tháng', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'một tháng', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 tháng', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'một năm', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 năm', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'một năm', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 năm', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'vài giây tới', 'prefix'); - assert.equal(moment(0).from(30000), 'vài giây trước', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'vài giây trước', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'vài giây tới', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5 ngày tới', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Hôm nay lúc 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Hôm nay lúc 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Hôm nay lúc 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Ngày mai lúc 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hôm nay lúc 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Hôm qua lúc 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 [tuần tới lúc] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [tuần tới lúc] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [tuần tới lúc] 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 [tuần rồi lúc] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [tuần rồi lúc] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [tuần rồi lúc] 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 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'); -}); - diff --git a/src/test/locale/x-pseudo.js b/src/test/locale/x-pseudo.js deleted file mode 100644 index b3409b1c78..0000000000 --- a/src/test/locale/x-pseudo.js +++ /dev/null @@ -1,210 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('x-pseudo'); - -test('parse', function (assert) { - var tests = 'J~áñúá~rý J~áñ_F~ébrú~árý ~Féb_~Márc~h ~Már_Áp~ríl ~Ápr_~Máý ~Máý_~Júñé~ ~Júñ_Júl~ý ~Júl_Áú~gúst~ ~Áúg_Sép~témb~ér ~Sép_Ó~ctób~ér ~Óct_Ñ~óvém~bér ~Ñóv_~Décé~mbér ~Déc'.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', 'S~úñdá~ý, F~ébrú~árý 14th 2010, 3:25:50 pm'], - ['ddd, hA', 'S~úñ, 3PM'], - ['M Mo MM MMMM MMM', '2 2nd 02 F~ébrú~árý ~Féb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14th 14'], - ['d do dddd ddd dd', '0 0th S~úñdá~ý S~úñ S~ú'], - ['DDD DDDo DDDD', '45 45th 045'], - ['w wo ww', '6 6th 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 45th day of the year'], - ['LT', '15:25'], - ['L', '14/02/2010'], - ['LL', '14 F~ébrú~árý 2010'], - ['LLL', '14 F~ébrú~árý 2010 15:25'], - ['LLLL', 'S~úñdá~ý, 14 F~ébrú~árý 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 ~Féb 2010'], - ['lll', '14 ~Féb 2010 15:25'], - ['llll', 'S~úñ, 14 ~Féb 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'), '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'), '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'), '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'), '31st', '31st'); -}); - -test('format month', function (assert) { - var expected = 'J~áñúá~rý J~áñ_F~ébrú~árý ~Féb_~Márc~h ~Már_Áp~ríl ~Ápr_~Máý ~Máý_~Júñé~ ~Júñ_Júl~ý ~Júl_Áú~gúst~ ~Áúg_Sép~témb~ér ~Sép_Ó~ctób~ér ~Óct_Ñ~óvém~bér ~Ñóv_~Décé~mbér ~Déc'.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 = 'S~úñdá~ý S~úñ S~ú_Mó~ñdáý~ ~Móñ Mó~_Túé~sdáý~ ~Túé Tú_Wéd~ñésd~áý ~Wéd ~Wé_T~húrs~dáý ~Thú T~h_~Fríd~áý ~Frí Fr~_S~átúr~dáý ~Sát 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), 'á ~féw ~sécó~ñds', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'á ~míñ~úté', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'á ~míñ~úté', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 m~íñú~tés', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 m~íñú~tés', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'á~ñ hó~úr', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'á~ñ hó~úr', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 h~óúrs', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 h~óúrs', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 h~óúrs', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'á ~dáý', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'á ~dáý', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 d~áýs', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'á ~dáý', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 d~áýs', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 d~áýs', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'á ~móñ~th', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'á ~móñ~th', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'á ~móñ~th', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 m~óñt~hs', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 m~óñt~hs', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 m~óñt~hs', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'á ~móñ~th', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 m~óñt~hs', '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 ý~éárs', '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 ý~éárs', '5 years = 5 years'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'í~ñ á ~féw ~sécó~ñds', 'prefix'); - assert.equal(moment(0).from(30000), 'á ~féw ~sécó~ñds á~gó', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'á ~féw ~sécó~ñds á~gó', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'í~ñ á ~féw ~sécó~ñds', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'í~ñ 5 d~áýs', 'in 5 days'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(2).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'T~ódá~ý át 02:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'T~ódá~ý át 02:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'T~ódá~ý át 03:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'T~ómó~rró~w át 02:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'T~ódá~ý át 01:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ý~ést~érdá~ý át 02: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 [át] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [át] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [át] 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('[L~ást] dddd [át] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[L~ást] dddd [át] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[L~ást] dddd [át] 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 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'); -}); diff --git a/src/test/locale/yo.js b/src/test/locale/yo.js deleted file mode 100644 index 00c07fc333..0000000000 --- a/src/test/locale/yo.js +++ /dev/null @@ -1,213 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('yo'); - -test('parse', function (assert) { - var tests = 'Sẹ́rẹ́ Sẹ́r_Èrèlè Èrl_Ẹrẹ̀nà Ẹrn_Ìgbé Ìgb_Èbibi Èbi_Òkùdu Òkù_Agẹmo Agẹ_Ògún Ògú_Owewe Owe_Ọ̀wàrà Ọ̀wà_Bélú Bél_Ọ̀pẹ̀̀ Ọ̀pẹ̀̀'.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', 'Àìkú, Èrèlè ọjọ́ 14 2010, 3:25:50 pm'], - ['ddd, hA', 'Àìk, 3PM'], - ['M Mo MM MMMM MMM', '2 ọjọ́ 2 02 Èrèlè Èrl'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 ọjọ́ 14 14'], - ['d do dddd ddd dd', '0 ọjọ́ 0 Àìkú Àìk Àì'], - ['DDD DDDo DDDD', '45 ọjọ́ 45 045'], - ['w wo ww', '6 ọjọ́ 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 ọjọ́ 45 day of the year'], - ['LTS', '3:25:50 PM'], - ['L', '14/02/2010'], - ['LL', '14 Èrèlè 2010'], - ['LLL', '14 Èrèlè 2010 3:25 PM'], - ['LLLL', 'Àìkú, 14 Èrèlè 2010 3:25 PM'], - ['l', '14/2/2010'], - ['ll', '14 Èrl 2010'], - ['lll', '14 Èrl 2010 3:25 PM'], - ['llll', 'Àìk, 14 Èrl 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'), 'ọjọ́ 1', 'ọjọ́ 1'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), 'ọjọ́ 2', 'ọjọ́ 2'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), 'ọjọ́ 3', 'ọjọ́ 3'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), 'ọjọ́ 4', 'ọjọ́ 4'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), 'ọjọ́ 5', 'ọjọ́ 5'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), 'ọjọ́ 6', 'ọjọ́ 6'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), 'ọjọ́ 7', 'ọjọ́ 7'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), 'ọjọ́ 8', 'ọjọ́ 8'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), 'ọjọ́ 9', 'ọjọ́ 9'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), 'ọjọ́ 10', 'ọjọ́ 10'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), 'ọjọ́ 11', 'ọjọ́ 11'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), 'ọjọ́ 12', 'ọjọ́ 12'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), 'ọjọ́ 13', 'ọjọ́ 13'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), 'ọjọ́ 14', 'ọjọ́ 14'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), 'ọjọ́ 15', 'ọjọ́ 15'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), 'ọjọ́ 16', 'ọjọ́ 16'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), 'ọjọ́ 17', 'ọjọ́ 17'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), 'ọjọ́ 18', 'ọjọ́ 18'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), 'ọjọ́ 19', 'ọjọ́ 19'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), 'ọjọ́ 20', 'ọjọ́ 20'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), 'ọjọ́ 21', 'ọjọ́ 21'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), 'ọjọ́ 22', 'ọjọ́ 22'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), 'ọjọ́ 23', 'ọjọ́ 23'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), 'ọjọ́ 24', 'ọjọ́ 24'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), 'ọjọ́ 25', 'ọjọ́ 25'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), 'ọjọ́ 26', 'ọjọ́ 26'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), 'ọjọ́ 27', 'ọjọ́ 27'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), 'ọjọ́ 28', 'ọjọ́ 28'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), 'ọjọ́ 29', 'ọjọ́ 29'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), 'ọjọ́ 30', 'ọjọ́ 30'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), 'ọjọ́ 31', 'ọjọ́ 31'); -}); - -test('format month', function (assert) { - var expected = 'Sẹ́rẹ́ Sẹ́r_Èrèlè Èrl_Ẹrẹ̀nà Ẹrn_Ìgbé Ìgb_Èbibi Èbi_Òkùdu Òkù_Agẹmo Agẹ_Ògún Ògú_Owewe Owe_Ọ̀wàrà Ọ̀wà_Bélú Bél_Ọ̀pẹ̀̀ Ọ̀pẹ̀̀'.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 = 'Àìkú Àìk Àì_Ajé Ajé Aj_Ìsẹ́gun Ìsẹ́ Ìs_Ọjọ́rú Ọjr Ọr_Ọjọ́bọ Ọjb Ọb_Ẹtì Ẹtì Ẹt_Àbámẹ́ta Àbá Àb'.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), 'ìsẹjú aayá die', '44 seconds = ìsẹjú aayá die'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ìsẹjú kan', '45 seconds = ìsẹjú kan'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ìsẹjú kan', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), 'ìsẹjú 2', '90 seconds = ìsẹjú 2'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), 'ìsẹjú 44', 'ìsẹjú 44 = ìsẹjú 44'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'wákati kan', 'ìsẹjú 45 = wákati kan'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'wákati kan', 'ìsẹjú 89 = wákati kan'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), 'wákati 2', 'ìsẹjú 90 = wákati 2'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), 'wákati 5', 'wákati 5 = wákati 5'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), 'wákati 21', 'wákati 21 = wákati 21'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ọjọ́ kan', '22 wákati = ọjọ́ kan'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ọjọ́ kan', '35 wákati = ọjọ́ kan'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), 'ọjọ́ 2', 'wákati 36 = ọjọ́ 2'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ọjọ́ kan', '1 = ọjọ́ kan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), 'ọjọ́ 5', 'ọjọ́ 5 = ọjọ́ 5'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), 'ọjọ́ 25', 'ọjọ́ 25 = ọjọ́ 25'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'osù kan', 'ọjọ́ 26 = osù kan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'osù kan', 'ọjọ́ 30 = osù kan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'osù kan', 'ọjọ́ 43 = osù kan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), 'osù 2', 'ọjọ́ 46 = osù 2'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), 'osù 2', 'ọjọ́ 75 = osù 2'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), 'osù 3', 'ọjọ́ 76 = osù 3'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'osù kan', 'osù 1 = osù kan'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), 'osù 5', 'osù 5 = osù 5'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ọdún kan', 'ọjọ 345 = ọdún kan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), 'ọdún 2', 'ọjọ 548 = ọdún 2'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ọdún kan', 'ọdún 1 = ọdún kan'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), 'ọdún 5', 'ọdún 5 = ọdún 5'); -}); - -test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'ní ìsẹjú aayá die', 'prefix'); - assert.equal(moment(0).from(30000), 'ìsẹjú aayá die kọjá', 'suffix'); -}); - -test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'ìsẹjú aayá die kọjá', 'now from now should display as in the past'); -}); - -test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'ní ìsẹjú aayá die', 'ní ìsẹjú aayá die'); - assert.equal(moment().add({d: 5}).fromNow(), 'ní ọjọ́ 5', 'ní ọjọ́ 5'); -}); - -test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Ònì ni 12:00 PM', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Ònì ni 12:25 PM', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Ònì ni 1:00 PM', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Ọ̀la ni 12:00 PM', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Ònì ni 11:00 AM', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Àna ni 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 [Ọsẹ̀ tón\'bọ] [ni] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [Ọsẹ̀ tón\'bọ] [ni] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [Ọsẹ̀ tón\'bọ] [ni] 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 [Ọsẹ̀ tólọ́] [ni] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [Ọsẹ̀ tólọ́] [ni] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [Ọsẹ̀ tólọ́] [ni] 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 format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 ọjọ́ 52', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 ọjọ́ 1', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 ọjọ́ 1', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 ọjọ́ 2', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 ọjọ́ 2', 'Jan 15 2012 should be week 2'); -}); diff --git a/src/test/locale/zh-cn.js b/src/test/locale/zh-cn.js deleted file mode 100644 index 009c179969..0000000000 --- a/src/test/locale/zh-cn.js +++ /dev/null @@ -1,184 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('zh-cn'); - -test('parse', function (assert) { - var tests = '一月 1月_二月 2月_三月 3月_四月 4月_五月 5月_六月 6月_七月 7月_八月 8月_九月 9月_十月 10月_十一月 11月_十二月 12月'.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, a h:mm:ss', '星期日, 二月 14日 2010, 下午 3:25:50'], - ['ddd, Ah', '周日, 下午3'], - ['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日 星期日 周日 日'], - ['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', '下午 下午'], - ['[这年的第] DDDo', '这年的第 45日'], - ['LTS', '15:25:50'], - ['L', '2010/02/14'], - ['LL', '2010年2月14日'], - ['LLL', '2010年2月14日下午3点25分'], - ['LLLL', '2010年2月14日星期日下午3点25分'], - ['l', '2010/2/14'], - ['ll', '2010年2月14日'], - ['lll', '2010年2月14日 15:25'], - ['llll', '2010年2月14日星期日 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 month', function (assert) { - 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]); - } -}); - -test('format week', function (assert) { - 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]); - } -}); - -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), '1 分钟', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '1 分钟', '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), '1 小时', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '1 小时', '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), '1 天', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '1 天', '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 天', '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), '1 个月', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '1 个月', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '1 个月', '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 个月', '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), '1 年', '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 年', '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'); -}); - -test('now from now', function (assert) { - 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'); -}); - -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'); -}); - -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('[下]ddddLT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[下]ddddLT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[下]ddddLT'), '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('[上]ddddLT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[上]ddddLT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[上]ddddLT'), '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('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 0, 0]).format('A'), '凌晨', 'before dawn'); - assert.equal(moment([2011, 2, 23, 6, 0]).format('A'), '早上', 'morning'); - assert.equal(moment([2011, 2, 23, 9, 0]).format('A'), '上午', 'before noon'); - assert.equal(moment([2011, 2, 23, 12, 0]).format('A'), '中午', 'noon'); - assert.equal(moment([2011, 2, 23, 13, 0]).format('A'), '下午', 'afternoon'); - assert.equal(moment([2011, 2, 23, 18, 0]).format('A'), '晚上', 'night'); -}); - -test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52周', 'Jan 1 2012 应该是第52周'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1周', 'Jan 7 2012 应该是第 1周'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2周', 'Jan 14 2012 应该是第 2周'); -}); diff --git a/src/test/locale/zh-hk.js b/src/test/locale/zh-hk.js deleted file mode 100644 index 05947cfe53..0000000000 --- a/src/test/locale/zh-hk.js +++ /dev/null @@ -1,191 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('zh-hk'); - -test('parse', function (assert) { - var tests = '一月 1月_二月 2月_三月 3月_四月 4月_五月 5月_六月 6月_七月 7月_八月 8月_九月 9月_十月 10月_十一月 11月_十二月 12月'.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, a h:mm:ss', '星期日, 二月 14日 2010, 下午 3:25:50'], - ['ddd, Ah', '週日, 下午3'], - ['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日 星期日 週日 日'], - ['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', '下午 下午'], - ['[這年的第] DDDo', '這年的第 45日'], - ['LTS', '15:25:50'], - ['L', '2010/02/14'], - ['LL', '2010年2月14日'], - ['LLL', '2010年2月14日 15:25'], - ['LLLL', '2010年2月14日星期日 15:25'], - ['l', '2010/2/14'], - ['ll', '2010年2月14日'], - ['lll', '2010年2月14日 15:25'], - ['llll', '2010年2月14日星期日 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 month', function (assert) { - 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]); - } -}); - -test('format week', function (assert) { - 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]); - } -}); - -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), '1 分鐘', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '1 分鐘', '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), '1 小時', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '1 小時', '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), '1 天', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '1 天', '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 天', '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), '1 個月', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '1 個月', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '1 個月', '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 個月', '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), '1 年', '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 年', '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'); -}); - -test('now from now', function (assert) { - 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'); -}); - -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'); -}); - -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('[下]ddddLT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[下]ddddLT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[下]ddddLT'), '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('[上]ddddLT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[上]ddddLT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[上]ddddLT'), '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('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 0, 0]).format('a'), '凌晨', 'before dawn'); - assert.equal(moment([2011, 2, 23, 6, 0]).format('a'), '早上', 'morning'); - assert.equal(moment([2011, 2, 23, 9, 0]).format('a'), '上午', 'before noon'); - assert.equal(moment([2011, 2, 23, 12, 0]).format('a'), '中午', 'noon'); - assert.equal(moment([2011, 2, 23, 13, 0]).format('a'), '下午', 'after noon'); - assert.equal(moment([2011, 2, 23, 18, 0]).format('a'), '晚上', 'night'); - - assert.equal(moment([2011, 2, 23, 0, 0]).format('A'), '凌晨', 'before dawn'); - assert.equal(moment([2011, 2, 23, 6, 0]).format('A'), '早上', 'morning'); - assert.equal(moment([2011, 2, 23, 9, 0]).format('A'), '上午', 'before noon'); - assert.equal(moment([2011, 2, 23, 12, 0]).format('A'), '中午', 'noon'); - assert.equal(moment([2011, 2, 23, 13, 0]).format('A'), '下午', 'afternoon'); - assert.equal(moment([2011, 2, 23, 18, 0]).format('A'), '晚上', 'night'); -}); - -test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1週', 'Jan 1 2012 應該是第 1週'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1週', 'Jan 7 2012 應該是第 1週'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2週', 'Jan 8 2012 應該是第 2週'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2週', 'Jan 14 2012 應該是第 2週'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3週', 'Jan 15 2012 應該是第 3週'); -}); diff --git a/src/test/locale/zh-tw.js b/src/test/locale/zh-tw.js deleted file mode 100644 index 07e96a6390..0000000000 --- a/src/test/locale/zh-tw.js +++ /dev/null @@ -1,191 +0,0 @@ -import {test} from '../qunit'; -import {localeModule} from '../qunit-locale'; -import moment from '../../moment'; -localeModule('zh-tw'); - -test('parse', function (assert) { - var tests = '一月 1月_二月 2月_三月 3月_四月 4月_五月 5月_六月 6月_七月 7月_八月 8月_九月 9月_十月 10月_十一月 11月_十二月 12月'.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, a h:mm:ss', '星期日, 二月 14日 2010, 下午 3:25:50'], - ['ddd, Ah', '週日, 下午3'], - ['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日 星期日 週日 日'], - ['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', '下午 下午'], - ['[這年的第] DDDo', '這年的第 45日'], - ['LTS', '15:25:50'], - ['L', '2010/02/14'], - ['LL', '2010年2月14日'], - ['LLL', '2010年2月14日 15:25'], - ['LLLL', '2010年2月14日星期日 15:25'], - ['l', '2010/2/14'], - ['ll', '2010年2月14日'], - ['lll', '2010年2月14日 15:25'], - ['llll', '2010年2月14日星期日 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 month', function (assert) { - 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]); - } -}); - -test('format week', function (assert) { - 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]); - } -}); - -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), '1 分鐘', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '1 分鐘', '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), '1 小時', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '1 小時', '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), '1 天', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '1 天', '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 天', '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), '1 個月', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '1 個月', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '1 個月', '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 個月', '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), '1 年', '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 年', '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'); -}); - -test('now from now', function (assert) { - 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'); -}); - -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'); -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - 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'); - } -}); - -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('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 0, 0]).format('a'), '凌晨', 'before dawn'); - assert.equal(moment([2011, 2, 23, 6, 0]).format('a'), '早上', 'morning'); - assert.equal(moment([2011, 2, 23, 9, 0]).format('a'), '上午', 'before noon'); - assert.equal(moment([2011, 2, 23, 12, 0]).format('a'), '中午', 'noon'); - assert.equal(moment([2011, 2, 23, 13, 0]).format('a'), '下午', 'after noon'); - assert.equal(moment([2011, 2, 23, 18, 0]).format('a'), '晚上', 'night'); - - assert.equal(moment([2011, 2, 23, 0, 0]).format('A'), '凌晨', 'before dawn'); - assert.equal(moment([2011, 2, 23, 6, 0]).format('A'), '早上', 'morning'); - assert.equal(moment([2011, 2, 23, 9, 0]).format('A'), '上午', 'before noon'); - assert.equal(moment([2011, 2, 23, 12, 0]).format('A'), '中午', 'noon'); - assert.equal(moment([2011, 2, 23, 13, 0]).format('A'), '下午', 'afternoon'); - assert.equal(moment([2011, 2, 23, 18, 0]).format('A'), '晚上', 'night'); -}); - -test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1週', 'Jan 1 2012 應該是第 1週'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1週', 'Jan 7 2012 應該是第 1週'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2週', 'Jan 8 2012 應該是第 2週'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2週', 'Jan 14 2012 應該是第 2週'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3週', 'Jan 15 2012 應該是第 3週'); -}); diff --git a/src/test/moment/calendar.js b/src/test/moment/calendar.js index 36af6848fa..c9a5d007c8 100644 --- a/src/test/moment/calendar.js +++ b/src/test/moment/calendar.js @@ -49,7 +49,6 @@ test('extending calendar options', function (assert) { try { assert.equal(a.calendar('2016-01-01'), 'This month on the 29th', 'Ad hoc calendar format for this month'); assert.equal(b.calendar('2016-01-01'), 'Next month on the 1st', 'Ad hoc calendar format for next month'); - assert.equal(a.locale('fr').calendar('2016-01-01'), a.locale('fr').format('L'), 'French falls back to default because thisMonth is not defined in that locale'); } finally { moment.calendarFormat = calendarFormat; moment.updateLocale('en', null); diff --git a/src/test/moment/create.js b/src/test/moment/create.js index 159dcf90b1..da5e3c6049 100644 --- a/src/test/moment/create.js +++ b/src/test/moment/create.js @@ -756,21 +756,21 @@ test('parsing weekdays verifies the day', function (assert) { assert.ok(moment('Thu 08-10-2017', 'ddd MM-DD-YYYY').isValid(), 'because day of week is correct for the date'); }); -test('parsing weekday on utc dates verifies day acccording to utc time', function (assert) { +test('parsing weekday on utc dates verifies day according to utc time', function (assert) { assert.ok(moment.utc('Mon 03:59', 'ddd HH:mm').isValid(), 'Monday 03:59'); }); -test('parsing weekday on local dates verifies day acccording to local time', function (assert) { +test('parsing weekday on local dates verifies day according to local time', function (assert) { // this doesn't do much useful if you're not in the US or at least close to it assert.ok(moment('Mon 03:59', 'ddd HH:mm').isValid(), 'Monday 03:59'); }); -test('parsing weekday on utc dates with specified offsets verifies day acccording to that offset', function (assert) { +test('parsing weekday on utc dates with specified offsets verifies day according to that offset', function (assert) { assert.ok(moment.utc('Mon 03:59 +12:00', 'ddd HH:mm Z', true).isValid(), 'Monday 03:59'); }); -test('parsing weekday on local dates with specified offsets verifies day acccording to that offset', function (assert) { - // if you're in the US, these times will all be sometime Sunday, but they shoud parse as Monday +test('parsing weekday on local dates with specified offsets verifies day according to that offset', function (assert) { + // if you're in the US, these times will all be sometime Sunday, but they should parse as Monday assert.ok(moment('Mon 03:59 +12:00', 'ddd HH:mm Z', true).isValid(), 'Monday 03:59'); }); diff --git a/src/test/moment/creation-data.js b/src/test/moment/creation-data.js index 15391462ec..48a3e35be4 100644 --- a/src/test/moment/creation-data.js +++ b/src/test/moment/creation-data.js @@ -14,13 +14,6 @@ test('valid date', function (assert) { assert.equal(orig.isUTC, false, 'not a UTC date'); }); -test('valid date at fr locale', function (assert) { - var dat = moment('1992-10-22', 'YYYY-MM-DD', 'fr'); - var orig = dat.creationData(); - - assert.equal(orig.locale._abbr, 'fr', 'locale is fr'); -}); - test('valid date with formats', function (assert) { var dat = moment('29-06-1995', ['MM-DD-YYYY', 'DD-MM', 'DD-MM-YYYY']); var orig = dat.creationData(); diff --git a/src/test/moment/duration.js b/src/test/moment/duration.js index a067eca5e4..3a6e9e161c 100644 --- a/src/test/moment/duration.js +++ b/src/test/moment/duration.js @@ -182,7 +182,7 @@ test('instantiation from 24-hour time >24 hours', function (assert) { assert.equal(moment.duration('26:45').milliseconds(), 0, '0 milliseconds'); }); -test('instatiation from serialized C# TimeSpan zero', function (assert) { +test('instantiation from serialized C# TimeSpan zero', function (assert) { assert.equal(moment.duration('00:00:00').years(), 0, '0 years'); assert.equal(moment.duration('00:00:00').days(), 0, '0 days'); assert.equal(moment.duration('00:00:00').hours(), 0, '0 hours'); @@ -191,7 +191,7 @@ test('instatiation from serialized C# TimeSpan zero', function (assert) { assert.equal(moment.duration('00:00:00').milliseconds(), 0, '0 milliseconds'); }); -test('instatiation from serialized C# TimeSpan with days', function (assert) { +test('instantiation from serialized C# TimeSpan with days', function (assert) { assert.equal(moment.duration('1.02:03:04.9999999').years(), 0, '0 years'); assert.equal(moment.duration('1.02:03:04.9999999').days(), 1, '1 day'); assert.equal(moment.duration('1.02:03:04.9999999').hours(), 2, '2 hours'); @@ -207,7 +207,7 @@ test('instatiation from serialized C# TimeSpan with days', function (assert) { assert.equal(moment.duration('1 02:03:04.9999999').milliseconds(), 0, '0 milliseconds'); }); -test('instatiation from serialized C# TimeSpan without days', function (assert) { +test('instantiation from serialized C# TimeSpan without days', function (assert) { assert.equal(moment.duration('01:02:03.9999999').years(), 0, '0 years'); assert.equal(moment.duration('01:02:03.9999999').days(), 0, '0 days'); assert.equal(moment.duration('01:02:03.9999999').hours(), 1, '1 hour'); @@ -225,7 +225,7 @@ test('instatiation from serialized C# TimeSpan without days', function (assert) assert.equal(moment.duration('500:59:59.8888888').hours(), 20, '500 hours overflows to 20 hours'); }); -test('instatiation from serialized C# TimeSpan without days or milliseconds', function (assert) { +test('instantiation from serialized C# TimeSpan without days or milliseconds', function (assert) { assert.equal(moment.duration('01:02:03').years(), 0, '0 years'); assert.equal(moment.duration('01:02:03').days(), 0, '0 days'); assert.equal(moment.duration('01:02:03').hours(), 1, '1 hour'); @@ -234,7 +234,7 @@ test('instatiation from serialized C# TimeSpan without days or milliseconds', fu assert.equal(moment.duration('01:02:03').milliseconds(), 0, '0 milliseconds'); }); -test('instatiation from serialized C# TimeSpan without milliseconds', function (assert) { +test('instantiation from serialized C# TimeSpan without milliseconds', function (assert) { assert.equal(moment.duration('1.02:03:04').years(), 0, '0 years'); assert.equal(moment.duration('1.02:03:04').days(), 1, '1 day'); assert.equal(moment.duration('1.02:03:04').hours(), 2, '2 hours'); @@ -273,7 +273,7 @@ test('instantiation from serialized C# TimeSpan with high millisecond precision' assert.equal(moment.duration('+00:00:15.7205000').milliseconds(), 721, '721 milliseconds'); }); -test('instatiation from serialized C# TimeSpan maxValue', function (assert) { +test('instantiation from serialized C# TimeSpan maxValue', function (assert) { var d = moment.duration('10675199.02:48:05.4775807'); assert.equal(d.years(), 29227, '29227 years'); @@ -286,7 +286,7 @@ test('instatiation from serialized C# TimeSpan maxValue', function (assert) { assert.equal(d.milliseconds(), 478, '478 milliseconds'); }); -test('instatiation from serialized C# TimeSpan minValue', function (assert) { +test('instantiation from serialized C# TimeSpan minValue', function (assert) { var d = moment.duration('-10675199.02:48:05.4775808'); assert.equal(d.years(), -29227, '29653 years'); @@ -299,7 +299,7 @@ test('instatiation from serialized C# TimeSpan minValue', function (assert) { assert.equal(d.milliseconds(), -478, '478 milliseconds'); }); -test('instatiation from serialized C# TimeSpan maxValue with + sign', function (assert) { +test('instantiation from serialized C# TimeSpan maxValue with + sign', function (assert) { var d = moment.duration('+10675199.02:48:05.4775808'); assert.equal(d.years(), 29227, '29653 years'); diff --git a/src/test/moment/is_after.js b/src/test/moment/is_after.js index 1050acb33b..53e4857aa5 100644 --- a/src/test/moment/is_after.js +++ b/src/test/moment/is_after.js @@ -106,7 +106,7 @@ test('is after minute', function (assert) { assert.equal(m.isAfter(moment(new Date(2011, 3, 3, 3, 4, 9, 10)), 'minute'), false, 'day is later'); assert.equal(m.isAfter(moment(new Date(2011, 3, 1, 3, 4, 9, 10)), 'minute'), true, 'day is earlier'); assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 4, 4, 9, 10)), 'minute'), false, 'hour is later'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 2, 4, 9, 10)), 'minute'), true, 'hour is earler'); + assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 2, 4, 9, 10)), 'minute'), true, 'hour is earlier'); assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 5, 9, 10)), 'minute'), false, 'minute is later'); assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 3, 9, 10)), 'minute'), true, 'minute is earlier'); assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 4, 0, 0)), 'minute'), false, 'exact start of minute'); diff --git a/src/test/moment/is_before.js b/src/test/moment/is_before.js index 90d415f462..d193ad2a44 100644 --- a/src/test/moment/is_before.js +++ b/src/test/moment/is_before.js @@ -106,7 +106,7 @@ test('is before minute', function (assert) { assert.equal(m.isBefore(moment(new Date(2011, 3, 3, 3, 4, 9, 10)), 'minute'), true, 'day is later'); assert.equal(m.isBefore(moment(new Date(2011, 3, 1, 3, 4, 9, 10)), 'minute'), false, 'day is earlier'); assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 4, 4, 9, 10)), 'minute'), true, 'hour is later'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 2, 4, 9, 10)), 'minute'), false, 'hour is earler'); + assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 2, 4, 9, 10)), 'minute'), false, 'hour is earlier'); assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 5, 9, 10)), 'minute'), true, 'minute is later'); assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 3, 9, 10)), 'minute'), false, 'minute is earlier'); assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 4, 0, 0)), 'minute'), false, 'exact start of minute'); diff --git a/src/test/moment/locale_inheritance.js b/src/test/moment/locale_inheritance.js index a1e4a4613a..5f3bc3016d 100644 --- a/src/test/moment/locale_inheritance.js +++ b/src/test/moment/locale_inheritance.js @@ -159,7 +159,7 @@ test('months', function (assert) { }); moment.defineLocale('child-months', { parentLocale: 'base-months', - months : 'First_Second_Third_Fourth_Fifth_Sixth_Seventh_Eighth_Ninth_Tenth_Eleventh_Twelveth '.split('_') + months : 'First_Second_Third_Fourth_Fifth_Sixth_Seventh_Eighth_Ninth_Tenth_Eleventh_Twelfth '.split('_') }); assert.ok(moment.utc('2015-01-01', 'YYYY-MM-DD').format('MMMM'), 'First', 'months uses child'); }); @@ -170,7 +170,7 @@ test('define child locale before parent', function (assert) { moment.defineLocale('months-x', { parentLocale: 'base-months-x', - months : 'First_Second_Third_Fourth_Fifth_Sixth_Seventh_Eighth_Ninth_Tenth_Eleventh_Twelveth '.split('_') + months : 'First_Second_Third_Fourth_Fifth_Sixth_Seventh_Eighth_Ninth_Tenth_Eleventh_Twelfth '.split('_') }); assert.equal(moment.locale(), 'en', 'failed to set a locale requiring missing parent'); @@ -185,9 +185,9 @@ test('define child locale before parent', function (assert) { }); test('lazy load parentLocale', function (assert) { - moment.defineLocale('de_test', { - parentLocale: 'de', + moment.defineLocale('en_test', { + parentLocale: 'en', monthsShort: ['M1', 'M2', 'M3', 'M4', 'M5', 'M6', 'M7', 'M8', 'M9', 'M10', 'M11', 'M12'] }); - assert.equal(moment.locale(), 'de_test', 'failed to lazy load parentLocale'); + assert.equal(moment.locale(), 'en_test', 'failed to lazy load parentLocale'); }); diff --git a/src/test/moment/locale_update.js b/src/test/moment/locale_update.js index 3a525e2796..19bcbf6488 100644 --- a/src/test/moment/locale_update.js +++ b/src/test/moment/locale_update.js @@ -160,15 +160,25 @@ test('months', function (assert) { }); moment.updateLocale('months', { parentLocale: 'base-months', - months : 'First_Second_Third_Fourth_Fifth_Sixth_Seventh_Eighth_Ninth_Tenth_Eleventh_Twelveth '.split('_') + months : 'First_Second_Third_Fourth_Fifth_Sixth_Seventh_Eighth_Ninth_Tenth_Eleventh_Twelfth '.split('_') }); assert.ok(moment.utc('2015-01-01', 'YYYY-MM-DD').format('MMMM'), 'First', 'months uses child'); }); test('update existing locale', function (assert) { - moment.updateLocale('de', { + moment.updateLocale('es', { monthsShort: ['JAN', 'FEB', 'MÄR', 'APR', 'MAI', 'JUN', 'JUL', 'AUG', 'SEP', 'OKT', 'NOV', 'DEZ'] }); - assert.equal(moment('2017-02-01').format('YYYY MMM MMMM'), '2017 FEB Februar'); - moment.updateLocale('de', null); + assert.equal(moment('2017-02-01').format('YYYY MMM MMMM'), '2017 FEB febrero'); + moment.updateLocale('es', null); +}); + +test('reset locale', function (assert) { + moment.locale('es'); + var resultBeforeUpdate = moment('2017-02-01').format('YYYY MMM MMMM'); + moment.updateLocale('es', { + monthsShort: ['JAN', 'FEB', 'MÄR', 'APR', 'MAI', 'JUN', 'JUL', 'AUG', 'SEP', 'OKT', 'NOV', 'DEZ'] + }); + moment.updateLocale('es', null); + assert.equal(moment('2017-02-01').format('YYYY MMM MMMM'), resultBeforeUpdate); }); diff --git a/src/test/moment/weekday.js b/src/test/moment/weekday.js index db62405998..a1a8d85b34 100644 --- a/src/test/moment/weekday.js +++ b/src/test/moment/weekday.js @@ -100,7 +100,7 @@ test('weekday first day of week Tuesday (dow 2)', function (assert) { assert.equal(moment([2029, 8, 19]).weekday(), 1, 'Sep 19 2029 is Wednesday -- 1st day'); assert.equal(moment([2013, 3, 25]).weekday(), 2, 'Apr 25 2013 is Thursday -- 2nd day'); assert.equal(moment([2015, 2, 6]).weekday(), 3, 'Mar 6 2015 is Friday -- 3nd day'); - assert.equal(moment([1970, 0, 3]).weekday(), 4, 'Jan 3 1970 is Staturday -- 4th day'); + assert.equal(moment([1970, 0, 3]).weekday(), 4, 'Jan 3 1970 is Saturday -- 4th day'); assert.equal(moment([2001, 4, 13]).weekday(), 5, 'May 13 2001 is Sunday -- 5th day'); assert.equal(moment([2000, 0, 3]).weekday(), 6, 'Jan 3 2000 is Monday -- 6th day'); }); @@ -131,7 +131,7 @@ test('weekday first day of week Thursday (dow 4)', function (assert) { test('weekday first day of week Friday (dow 5)', function (assert) { moment.locale('dow: 5,doy: 6', {week: {dow: 5, doy: 6}}); assert.equal(moment([1985, 1, 8]).weekday(), 0, 'Feb 8 1985 is Friday -- 0th day'); - assert.equal(moment([2029, 8, 22]).weekday(), 1, 'Sep 22 2029 is Staturday -- 1st day'); + assert.equal(moment([2029, 8, 22]).weekday(), 1, 'Sep 22 2029 is Saturday -- 1st day'); assert.equal(moment([2013, 3, 28]).weekday(), 2, 'Apr 28 2013 is Sunday -- 2nd day'); assert.equal(moment([2015, 2, 9]).weekday(), 3, 'Mar 9 2015 is Monday -- 3nd day'); assert.equal(moment([1970, 0, 6]).weekday(), 4, 'Jan 6 1970 is Tuesday -- 4th day'); @@ -141,7 +141,7 @@ test('weekday first day of week Friday (dow 5)', function (assert) { test('weekday first day of week Saturday (dow 6)', function (assert) { moment.locale('dow: 6,doy: 6', {week: {dow: 6, doy: 6}}); - assert.equal(moment([1985, 1, 9]).weekday(), 0, 'Feb 9 1985 is Staturday -- 0th day'); + assert.equal(moment([1985, 1, 9]).weekday(), 0, 'Feb 9 1985 is Saturday -- 0th day'); assert.equal(moment([2029, 8, 23]).weekday(), 1, 'Sep 23 2029 is Sunday -- 1st day'); assert.equal(moment([2013, 3, 29]).weekday(), 2, 'Apr 29 2013 is Monday -- 2nd day'); assert.equal(moment([2015, 2, 10]).weekday(), 3, 'Mar 10 2015 is Tuesday -- 3nd day'); diff --git a/src/test/moment/zones.js b/src/test/moment/zones.js index a7e4f6ce94..f2647024b7 100644 --- a/src/test/moment/zones.js +++ b/src/test/moment/zones.js @@ -500,7 +500,7 @@ test('parse zone with a minutes unit abs less than 16 should retain minutes', fu assert.equal(o.hour(), 0); }); -test('parse zone with weekday on verifies day acccording to the offset', function (assert) { +test('parse zone with weekday on verifies day according to the offset', function (assert) { test.expectedDeprecations(); assert.ok(moment.parseZone('Mon 03:59 +12:00', 'ddd HH:mm Z', true).isValid(), 'Monday 03:59'); });