-!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){"use strict";function a(){return Wd.apply(null,arguments)}function b(a){Wd=a}function c(a){return a instanceof Array||"[object Array]"===Object.prototype.toString.call(a)}function d(a){return a instanceof Date||"[object Date]"===Object.prototype.toString.call(a)}function e(a,b){var c,d=[];for(c=0;c<a.length;++c)d.push(b(a[c],c));return d}function f(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function g(a,b){for(var c in b)f(b,c)&&(a[c]=b[c]);return f(b,"toString")&&(a.toString=b.toString),f(b,"valueOf")&&(a.valueOf=b.valueOf),a}function h(a,b,c,d){return Ia(a,b,c,d,!0).utc()}function i(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function j(a){return null==a._pf&&(a._pf=i()),a._pf}function k(a){if(null==a._isValid){var b=j(a);a._isValid=!(isNaN(a._d.getTime())||!(b.overflow<0)||b.empty||b.invalidMonth||b.invalidWeekday||b.nullInput||b.invalidFormat||b.userInvalidated),a._strict&&(a._isValid=a._isValid&&0===b.charsLeftOver&&0===b.unusedTokens.length&&void 0===b.bigHour)}return a._isValid}function l(a){var b=h(NaN);return null!=a?g(j(b),a):j(b).userInvalidated=!0,b}function m(a){return void 0===a}function n(a,b){var c,d,e;if(m(b._isAMomentObject)||(a._isAMomentObject=b._isAMomentObject),m(b._i)||(a._i=b._i),m(b._f)||(a._f=b._f),m(b._l)||(a._l=b._l),m(b._strict)||(a._strict=b._strict),m(b._tzm)||(a._tzm=b._tzm),m(b._isUTC)||(a._isUTC=b._isUTC),m(b._offset)||(a._offset=b._offset),m(b._pf)||(a._pf=j(b)),m(b._locale)||(a._locale=b._locale),Xd.length>0)for(c in Xd)d=Xd[c],e=b[d],m(e)||(a[d]=e);return a}function o(b){n(this,b),this._d=new Date(null!=b._d?b._d.getTime():NaN),Yd===!1&&(Yd=!0,a.updateOffset(this),Yd=!1)}function p(a){return a instanceof o||null!=a&&null!=a._isAMomentObject}function q(a){return 0>a?Math.ceil(a):Math.floor(a)}function r(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=q(b)),c}function s(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&r(a[d])!==r(b[d]))&&g++;return g+f}function t(b){a.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+b)}function u(a,b){var c=!0;return g(function(){return c&&(t(a+"\nArguments: "+Array.prototype.slice.call(arguments).join(", ")+"\n"+(new Error).stack),c=!1),b.apply(this,arguments)},b)}function v(a,b){Zd[a]||(t(b),Zd[a]=!0)}function w(a){return a instanceof Function||"[object Function]"===Object.prototype.toString.call(a)}function x(a){return"[object Object]"===Object.prototype.toString.call(a)}function y(a){var b,c;for(c in a)b=a[c],w(b)?this[c]=b:this["_"+c]=b;this._config=a,this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function z(a,b){var c,d=g({},a);for(c in b)f(b,c)&&(x(a[c])&&x(b[c])?(d[c]={},g(d[c],a[c]),g(d[c],b[c])):null!=b[c]?d[c]=b[c]:delete d[c]);return d}function A(a){null!=a&&this.set(a)}function B(a){return a?a.toLowerCase().replace("_","-"):a}function C(a){for(var b,c,d,e,f=0;f<a.length;){for(e=B(a[f]).split("-"),b=e.length,c=B(a[f+1]),c=c?c.split("-"):null;b>0;){if(d=D(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&s(e,c,!0)>=b-1)break;b--}f++}return null}function D(a){var b=null;if(!_d[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=$d._abbr,require("./locale/"+a),E(b)}catch(c){}return _d[a]}function E(a,b){var c;return a&&(c=m(b)?H(a):F(a,b),c&&($d=c)),$d._abbr}function F(a,b){return null!==b?(b.abbr=a,null!=_d[a]?(v("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale"),b=z(_d[a]._config,b)):null!=b.parentLocale&&(null!=_d[b.parentLocale]?b=z(_d[b.parentLocale]._config,b):v("parentLocaleUndefined","specified parentLocale is not defined yet")),_d[a]=new A(b),E(a),_d[a]):(delete _d[a],null)}function G(a,b){if(null!=b){var c;null!=_d[a]&&(b=z(_d[a]._config,b)),c=new A(b),c.parentLocale=_d[a],_d[a]=c,E(a)}else null!=_d[a]&&(null!=_d[a].parentLocale?_d[a]=_d[a].parentLocale:null!=_d[a]&&delete _d[a]);return _d[a]}function H(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return $d;if(!c(a)){if(b=D(a))return b;a=[a]}return C(a)}function I(){return Object.keys(_d)}function J(a,b){var c=a.toLowerCase();ae[c]=ae[c+"s"]=ae[b]=a}function K(a){return"string"==typeof a?ae[a]||ae[a.toLowerCase()]:void 0}function L(a){var b,c,d={};for(c in a)f(a,c)&&(b=K(c),b&&(d[b]=a[c]));return d}function M(b,c){return function(d){return null!=d?(O(this,b,d),a.updateOffset(this,c),this):N(this,b)}}function N(a,b){return a.isValid()?a._d["get"+(a._isUTC?"UTC":"")+b]():NaN}function O(a,b,c){a.isValid()&&a._d["set"+(a._isUTC?"UTC":"")+b](c)}function P(a,b){var c;if("object"==typeof a)for(c in a)this.set(c,a[c]);else if(a=K(a),w(this[a]))return this[a](b);return this}function Q(a,b,c){var d=""+Math.abs(a),e=b-d.length,f=a>=0;return(f?c?"+":"":"-")+Math.pow(10,Math.max(0,e)).toString().substr(1)+d}function R(a,b,c,d){var e=d;"string"==typeof d&&(e=function(){return this[d]()}),a&&(ee[a]=e),b&&(ee[b[0]]=function(){return Q(e.apply(this,arguments),b[1],b[2])}),c&&(ee[c]=function(){return this.localeData().ordinal(e.apply(this,arguments),a)})}function S(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function T(a){var b,c,d=a.match(be);for(b=0,c=d.length;c>b;b++)ee[d[b]]?d[b]=ee[d[b]]:d[b]=S(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function U(a,b){return a.isValid()?(b=V(b,a.localeData()),de[b]=de[b]||T(b),de[b](a)):a.localeData().invalidDate()}function V(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(ce.lastIndex=0;d>=0&&ce.test(a);)a=a.replace(ce,c),ce.lastIndex=0,d-=1;return a}function W(a,b,c){we[a]=w(b)?b:function(a,d){return a&&c?c:b}}function X(a,b){return f(we,a)?we[a](b._strict,b._locale):new RegExp(Y(a))}function Y(a){return Z(a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}))}function Z(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function $(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),"number"==typeof b&&(d=function(a,c){c[b]=r(a)}),c=0;c<a.length;c++)xe[a[c]]=d}function _(a,b){$(a,function(a,c,d,e){d._w=d._w||{},b(a,d._w,d,e)})}function aa(a,b,c){null!=b&&f(xe,a)&&xe[a](b,c._a,c,a)}function ba(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function ca(a,b){return c(this._months)?this._months[a.month()]:this._months[He.test(b)?"format":"standalone"][a.month()]}function da(a,b){return c(this._monthsShort)?this._monthsShort[a.month()]:this._monthsShort[He.test(b)?"format":"standalone"][a.month()]}function ea(a,b,c){var d,e,f;for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),d=0;12>d;d++){if(e=h([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}}function fa(a,b){var c;if(!a.isValid())return a;if("string"==typeof b)if(/^\d+$/.test(b))b=r(b);else if(b=a.localeData().monthsParse(b),"number"!=typeof b)return a;return c=Math.min(a.date(),ba(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a}function ga(b){return null!=b?(fa(this,b),a.updateOffset(this,!0),this):N(this,"Month")}function ha(){return ba(this.year(),this.month())}function ia(a){return this._monthsParseExact?(f(this,"_monthsRegex")||ka.call(this),a?this._monthsShortStrictRegex:this._monthsShortRegex):this._monthsShortStrictRegex&&a?this._monthsShortStrictRegex:this._monthsShortRegex}function ja(a){return this._monthsParseExact?(f(this,"_monthsRegex")||ka.call(this),a?this._monthsStrictRegex:this._monthsRegex):this._monthsStrictRegex&&a?this._monthsStrictRegex:this._monthsRegex}function ka(){function a(a,b){return b.length-a.length}var b,c,d=[],e=[],f=[];for(b=0;12>b;b++)c=h([2e3,b]),d.push(this.monthsShort(c,"")),e.push(this.months(c,"")),f.push(this.months(c,"")),f.push(this.monthsShort(c,""));for(d.sort(a),e.sort(a),f.sort(a),b=0;12>b;b++)d[b]=Z(d[b]),e[b]=Z(e[b]),f[b]=Z(f[b]);this._monthsRegex=new RegExp("^("+f.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+e.join("|")+")$","i"),this._monthsShortStrictRegex=new RegExp("^("+d.join("|")+")$","i")}function la(a){var b,c=a._a;return c&&-2===j(a).overflow&&(b=c[ze]<0||c[ze]>11?ze:c[Ae]<1||c[Ae]>ba(c[ye],c[ze])?Ae:c[Be]<0||c[Be]>24||24===c[Be]&&(0!==c[Ce]||0!==c[De]||0!==c[Ee])?Be:c[Ce]<0||c[Ce]>59?Ce:c[De]<0||c[De]>59?De:c[Ee]<0||c[Ee]>999?Ee:-1,j(a)._overflowDayOfYear&&(ye>b||b>Ae)&&(b=Ae),j(a)._overflowWeeks&&-1===b&&(b=Fe),j(a)._overflowWeekday&&-1===b&&(b=Ge),j(a).overflow=b),a}function ma(a){var b,c,d,e,f,g,h=a._i,i=Me.exec(h)||Ne.exec(h);if(i){for(j(a).iso=!0,b=0,c=Pe.length;c>b;b++)if(Pe[b][1].exec(i[1])){e=Pe[b][0],d=Pe[b][2]!==!1;break}if(null==e)return void(a._isValid=!1);if(i[3]){for(b=0,c=Qe.length;c>b;b++)if(Qe[b][1].exec(i[3])){f=(i[2]||" ")+Qe[b][0];break}if(null==f)return void(a._isValid=!1)}if(!d&&null!=f)return void(a._isValid=!1);if(i[4]){if(!Oe.exec(i[4]))return void(a._isValid=!1);g="Z"}a._f=e+(f||"")+(g||""),Ba(a)}else a._isValid=!1}function na(b){var c=Re.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(ma(b),void(b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b))))}function oa(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 100>a&&a>=0&&isFinite(h.getFullYear())&&h.setFullYear(a),h}function pa(a){var b=new Date(Date.UTC.apply(null,arguments));return 100>a&&a>=0&&isFinite(b.getUTCFullYear())&&b.setUTCFullYear(a),b}function qa(a){return ra(a)?366:365}function ra(a){return a%4===0&&a%100!==0||a%400===0}function sa(){return ra(this.year())}function ta(a,b,c){var d=7+b-c,e=(7+pa(a,0,d).getUTCDay()-b)%7;return-e+d-1}function ua(a,b,c,d,e){var f,g,h=(7+c-d)%7,i=ta(a,d,e),j=1+7*(b-1)+h+i;return 0>=j?(f=a-1,g=qa(f)+j):j>qa(a)?(f=a+1,g=j-qa(a)):(f=a,g=j),{year:f,dayOfYear:g}}function va(a,b,c){var d,e,f=ta(a.year(),b,c),g=Math.floor((a.dayOfYear()-f-1)/7)+1;return 1>g?(e=a.year()-1,d=g+wa(e,b,c)):g>wa(a.year(),b,c)?(d=g-wa(a.year(),b,c),e=a.year()+1):(e=a.year(),d=g),{week:d,year:e}}function wa(a,b,c){var d=ta(a,b,c),e=ta(a+1,b,c);return(qa(a)-d+e)/7}function xa(a,b,c){return null!=a?a:null!=b?b:c}function ya(b){var c=new Date(a.now());return b._useUTC?[c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()]:[c.getFullYear(),c.getMonth(),c.getDate()]}function za(a){var b,c,d,e,f=[];if(!a._d){for(d=ya(a),a._w&&null==a._a[Ae]&&null==a._a[ze]&&Aa(a),a._dayOfYear&&(e=xa(a._a[ye],d[ye]),a._dayOfYear>qa(e)&&(j(a)._overflowDayOfYear=!0),c=pa(e,0,a._dayOfYear),a._a[ze]=c.getUTCMonth(),a._a[Ae]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=f[b]=d[b];for(;7>b;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];24===a._a[Be]&&0===a._a[Ce]&&0===a._a[De]&&0===a._a[Ee]&&(a._nextDay=!0,a._a[Be]=0),a._d=(a._useUTC?pa:oa).apply(null,f),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[Be]=24)}}function Aa(a){var b,c,d,e,f,g,h,i;b=a._w,null!=b.GG||null!=b.W||null!=b.E?(f=1,g=4,c=xa(b.GG,a._a[ye],va(Ja(),1,4).year),d=xa(b.W,1),e=xa(b.E,1),(1>e||e>7)&&(i=!0)):(f=a._locale._week.dow,g=a._locale._week.doy,c=xa(b.gg,a._a[ye],va(Ja(),f,g).year),d=xa(b.w,1),null!=b.d?(e=b.d,(0>e||e>6)&&(i=!0)):null!=b.e?(e=b.e+f,(b.e<0||b.e>6)&&(i=!0)):e=f),1>d||d>wa(c,f,g)?j(a)._overflowWeeks=!0:null!=i?j(a)._overflowWeekday=!0:(h=ua(c,d,e,f,g),a._a[ye]=h.year,a._dayOfYear=h.dayOfYear)}function Ba(b){if(b._f===a.ISO_8601)return void ma(b);b._a=[],j(b).empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,k=0;for(e=V(b._f,b._locale).match(be)||[],c=0;c<e.length;c++)f=e[c],d=(h.match(X(f,b))||[])[0],d&&(g=h.substr(0,h.indexOf(d)),g.length>0&&j(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),k+=d.length),ee[f]?(d?j(b).empty=!1:j(b).unusedTokens.push(f),aa(f,d,b)):b._strict&&!d&&j(b).unusedTokens.push(f);j(b).charsLeftOver=i-k,h.length>0&&j(b).unusedInput.push(h),j(b).bigHour===!0&&b._a[Be]<=12&&b._a[Be]>0&&(j(b).bigHour=void 0),b._a[Be]=Ca(b._locale,b._a[Be],b._meridiem),za(b),la(b)}function Ca(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&12>b&&(b+=12),d||12!==b||(b=0),b):b}function Da(a){var b,c,d,e,f;if(0===a._f.length)return j(a).invalidFormat=!0,void(a._d=new Date(NaN));for(e=0;e<a._f.length;e++)f=0,b=n({},a),null!=a._useUTC&&(b._useUTC=a._useUTC),b._f=a._f[e],Ba(b),k(b)&&(f+=j(b).charsLeftOver,f+=10*j(b).unusedTokens.length,j(b).score=f,(null==d||d>f)&&(d=f,c=b));g(a,c||b)}function Ea(a){if(!a._d){var b=L(a._i);a._a=e([b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],function(a){return a&&parseInt(a,10)}),za(a)}}function Fa(a){var b=new o(la(Ga(a)));return b._nextDay&&(b.add(1,"d"),b._nextDay=void 0),b}function Ga(a){var b=a._i,e=a._f;return a._locale=a._locale||H(a._l),null===b||void 0===e&&""===b?l({nullInput:!0}):("string"==typeof b&&(a._i=b=a._locale.preparse(b)),p(b)?new o(la(b)):(c(e)?Da(a):e?Ba(a):d(b)?a._d=b:Ha(a),k(a)||(a._d=null),a))}function Ha(b){var f=b._i;void 0===f?b._d=new Date(a.now()):d(f)?b._d=new Date(+f):"string"==typeof f?na(b):c(f)?(b._a=e(f.slice(0),function(a){return parseInt(a,10)}),za(b)):"object"==typeof f?Ea(b):"number"==typeof f?b._d=new Date(f):a.createFromInputFallback(b)}function Ia(a,b,c,d,e){var f={};return"boolean"==typeof c&&(d=c,c=void 0),f._isAMomentObject=!0,f._useUTC=f._isUTC=e,f._l=c,f._i=a,f._f=b,f._strict=d,Fa(f)}function Ja(a,b,c,d){return Ia(a,b,c,d,!1)}function Ka(a,b){var d,e;if(1===b.length&&c(b[0])&&(b=b[0]),!b.length)return Ja();for(d=b[0],e=1;e<b.length;++e)(!b[e].isValid()||b[e][a](d))&&(d=b[e]);return d}function La(){var a=[].slice.call(arguments,0);return Ka("isBefore",a)}function Ma(){var a=[].slice.call(arguments,0);return Ka("isAfter",a)}function Na(a){var b=L(a),c=b.year||0,d=b.quarter||0,e=b.month||0,f=b.week||0,g=b.day||0,h=b.hour||0,i=b.minute||0,j=b.second||0,k=b.millisecond||0;this._milliseconds=+k+1e3*j+6e4*i+36e5*h,this._days=+g+7*f,this._months=+e+3*d+12*c,this._data={},this._locale=H(),this._bubble()}function Oa(a){return a instanceof Na}function Pa(a,b){R(a,0,0,function(){var a=this.utcOffset(),c="+";return 0>a&&(a=-a,c="-"),c+Q(~~(a/60),2)+b+Q(~~a%60,2)})}function Qa(a,b){var c=(b||"").match(a)||[],d=c[c.length-1]||[],e=(d+"").match(We)||["-",0,0],f=+(60*e[1])+r(e[2]);return"+"===e[0]?f:-f}function Ra(b,c){var e,f;return c._isUTC?(e=c.clone(),f=(p(b)||d(b)?+b:+Ja(b))-+e,e._d.setTime(+e._d+f),a.updateOffset(e,!1),e):Ja(b).local()}function Sa(a){return 15*-Math.round(a._d.getTimezoneOffset()/15)}function Ta(b,c){var d,e=this._offset||0;return this.isValid()?null!=b?("string"==typeof b?b=Qa(te,b):Math.abs(b)<16&&(b=60*b),!this._isUTC&&c&&(d=Sa(this)),this._offset=b,this._isUTC=!0,null!=d&&this.add(d,"m"),e!==b&&(!c||this._changeInProgress?ib(this,cb(b-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,a.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?e:Sa(this):null!=b?this:NaN}function Ua(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function Va(a){return this.utcOffset(0,a)}function Wa(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(Sa(this),"m")),this}function Xa(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Qa(se,this._i)),this}function Ya(a){return this.isValid()?(a=a?Ja(a).utcOffset():0,(this.utcOffset()-a)%60===0):!1}function Za(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function $a(){if(!m(this._isDSTShifted))return this._isDSTShifted;var a={};if(n(a,this),a=Ga(a),a._a){var b=a._isUTC?h(a._a):Ja(a._a);this._isDSTShifted=this.isValid()&&s(a._a,b.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function _a(){return this.isValid()?!this._isUTC:!1}function ab(){return this.isValid()?this._isUTC:!1}function bb(){return this.isValid()?this._isUTC&&0===this._offset:!1}function cb(a,b){var c,d,e,g=a,h=null;return Oa(a)?g={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(g={},b?g[b]=a:g.milliseconds=a):(h=Xe.exec(a))?(c="-"===h[1]?-1:1,g={y:0,d:r(h[Ae])*c,h:r(h[Be])*c,m:r(h[Ce])*c,s:r(h[De])*c,ms:r(h[Ee])*c}):(h=Ye.exec(a))?(c="-"===h[1]?-1:1,g={y:db(h[2],c),M:db(h[3],c),w:db(h[4],c),d:db(h[5],c),h:db(h[6],c),m:db(h[7],c),s:db(h[8],c)}):null==g?g={}:"object"==typeof g&&("from"in g||"to"in g)&&(e=fb(Ja(g.from),Ja(g.to)),g={},g.ms=e.milliseconds,g.M=e.months),d=new Na(g),Oa(a)&&f(a,"_locale")&&(d._locale=a._locale),d}function db(a,b){var c=a&&parseFloat(a.replace(",","."));return(isNaN(c)?0:c)*b}function eb(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function fb(a,b){var c;return a.isValid()&&b.isValid()?(b=Ra(b,a),a.isBefore(b)?c=eb(a,b):(c=eb(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c):{milliseconds:0,months:0}}function gb(a){return 0>a?-1*Math.round(-1*a):Math.round(a)}function hb(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||(v(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period)."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=cb(c,d),ib(this,e,a),this}}function ib(b,c,d,e){var f=c._milliseconds,g=gb(c._days),h=gb(c._months);b.isValid()&&(e=null==e?!0:e,f&&b._d.setTime(+b._d+f*d),g&&O(b,"Date",N(b,"Date")+g*d),h&&fa(b,N(b,"Month")+h*d),e&&a.updateOffset(b,g||h))}function jb(a,b){var c=a||Ja(),d=Ra(c,this).startOf("day"),e=this.diff(d,"days",!0),f=-6>e?"sameElse":-1>e?"lastWeek":0>e?"lastDay":1>e?"sameDay":2>e?"nextDay":7>e?"nextWeek":"sameElse",g=b&&(w(b[f])?b[f]():b[f]);return this.format(g||this.localeData().calendar(f,this,Ja(c)))}function kb(){return new o(this)}function lb(a,b){var c=p(a)?a:Ja(a);return this.isValid()&&c.isValid()?(b=K(m(b)?"millisecond":b),"millisecond"===b?+this>+c:+c<+this.clone().startOf(b)):!1}function mb(a,b){var c=p(a)?a:Ja(a);return this.isValid()&&c.isValid()?(b=K(m(b)?"millisecond":b),"millisecond"===b?+c>+this:+this.clone().endOf(b)<+c):!1}function nb(a,b,c){return this.isAfter(a,c)&&this.isBefore(b,c)}function ob(a,b){var c,d=p(a)?a:Ja(a);return this.isValid()&&d.isValid()?(b=K(b||"millisecond"),"millisecond"===b?+this===+d:(c=+d,+this.clone().startOf(b)<=c&&c<=+this.clone().endOf(b))):!1}function pb(a,b){return this.isSame(a,b)||this.isAfter(a,b)}function qb(a,b){return this.isSame(a,b)||this.isBefore(a,b)}function rb(a,b,c){var d,e,f,g;return this.isValid()?(d=Ra(a,this),d.isValid()?(e=6e4*(d.utcOffset()-this.utcOffset()),b=K(b),"year"===b||"month"===b||"quarter"===b?(g=sb(this,d),"quarter"===b?g/=3:"year"===b&&(g/=12)):(f=this-d,g="second"===b?f/1e3:"minute"===b?f/6e4:"hour"===b?f/36e5:"day"===b?(f-e)/864e5:"week"===b?(f-e)/6048e5:f),c?g:q(g)):NaN):NaN}function sb(a,b){var c,d,e=12*(b.year()-a.year())+(b.month()-a.month()),f=a.clone().add(e,"months");return 0>b-f?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)}function tb(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function ub(){var a=this.clone().utc();return 0<a.year()&&a.year()<=9999?w(Date.prototype.toISOString)?this.toDate().toISOString():U(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):U(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function vb(b){var c=U(this,b||a.defaultFormat);return this.localeData().postformat(c)}function wb(a,b){return this.isValid()&&(p(a)&&a.isValid()||Ja(a).isValid())?cb({to:this,from:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function xb(a){return this.from(Ja(),a)}function yb(a,b){return this.isValid()&&(p(a)&&a.isValid()||Ja(a).isValid())?cb({from:this,to:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function zb(a){return this.to(Ja(),a)}function Ab(a){var b;return void 0===a?this._locale._abbr:(b=H(a),null!=b&&(this._locale=b),this)}function Bb(){return this._locale}function Cb(a){switch(a=K(a)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===a&&this.weekday(0),"isoWeek"===a&&this.isoWeekday(1),"quarter"===a&&this.month(3*Math.floor(this.month()/3)),this}function Db(a){return a=K(a),void 0===a||"millisecond"===a?this:this.startOf(a).add(1,"isoWeek"===a?"week":a).subtract(1,"ms")}function Eb(){return+this._d-6e4*(this._offset||0)}function Fb(){return Math.floor(+this/1e3)}function Gb(){return this._offset?new Date(+this):this._d}function Hb(){var a=this;return[a.year(),a.month(),a.date(),a.hour(),a.minute(),a.second(),a.millisecond()]}function Ib(){var a=this;return{years:a.year(),months:a.month(),date:a.date(),hours:a.hours(),minutes:a.minutes(),seconds:a.seconds(),milliseconds:a.milliseconds()}}function Jb(){return this.isValid()?this.toISOString():null}function Kb(){return k(this)}function Lb(){return g({},j(this))}function Mb(){return j(this).overflow}function Nb(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function Ob(a,b){R(0,[a,a.length],0,b)}function Pb(a){return Tb.call(this,a,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Qb(a){return Tb.call(this,a,this.isoWeek(),this.isoWeekday(),1,4)}function Rb(){return wa(this.year(),1,4)}function Sb(){var a=this.localeData()._week;return wa(this.year(),a.dow,a.doy)}function Tb(a,b,c,d,e){var f;return null==a?va(this,d,e).year:(f=wa(a,d,e),b>f&&(b=f),Ub.call(this,a,b,c,d,e))}function Ub(a,b,c,d,e){var f=ua(a,b,c,d,e),g=pa(f.year,0,f.dayOfYear);return this.year(g.getUTCFullYear()),this.month(g.getUTCMonth()),this.date(g.getUTCDate()),this}function Vb(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)}function Wb(a){return va(a,this._week.dow,this._week.doy).week}function Xb(){return this._week.dow}function Yb(){return this._week.doy}function Zb(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function $b(a){var b=va(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}function _b(a,b){return"string"!=typeof a?a:isNaN(a)?(a=b.weekdaysParse(a),"number"==typeof a?a:null):parseInt(a,10)}function ac(a,b){return c(this._weekdays)?this._weekdays[a.day()]:this._weekdays[this._weekdays.isFormat.test(b)?"format":"standalone"][a.day()]}function bc(a){return this._weekdaysShort[a.day()]}function cc(a){return this._weekdaysMin[a.day()]}function dc(a,b,c){var d,e,f;for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),d=0;7>d;d++){if(e=Ja([2e3,1]).day(d),c&&!this._fullWeekdaysParse[d]&&(this._fullWeekdaysParse[d]=new RegExp("^"+this.weekdays(e,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[d]=new RegExp("^"+this.weekdaysShort(e,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[d]=new RegExp("^"+this.weekdaysMin(e,"").replace(".",".?")+"$","i")),this._weekdaysParse[d]||(f="^"+this.weekdays(e,"")+"|^"+this.weekdaysShort(e,"")+"|^"+this.weekdaysMin(e,""),this._weekdaysParse[d]=new RegExp(f.replace(".",""),"i")),c&&"dddd"===b&&this._fullWeekdaysParse[d].test(a))return d;if(c&&"ddd"===b&&this._shortWeekdaysParse[d].test(a))return d;if(c&&"dd"===b&&this._minWeekdaysParse[d].test(a))return d;if(!c&&this._weekdaysParse[d].test(a))return d}}function ec(a){if(!this.isValid())return null!=a?this:NaN;var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=_b(a,this.localeData()),this.add(a-b,"d")):b}function fc(a){if(!this.isValid())return null!=a?this:NaN;var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function gc(a){return this.isValid()?null==a?this.day()||7:this.day(this.day()%7?a:a-7):null!=a?this:NaN}function hc(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function ic(){return this.hours()%12||12}function jc(a,b){R(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}function kc(a,b){return b._meridiemParse}function lc(a){return"p"===(a+"").toLowerCase().charAt(0)}function mc(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function nc(a,b){b[Ee]=r(1e3*("0."+a))}function oc(){return this._isUTC?"UTC":""}function pc(){return this._isUTC?"Coordinated Universal Time":""}function qc(a){return Ja(1e3*a)}function rc(){return Ja.apply(null,arguments).parseZone()}function sc(a,b,c){var d=this._calendar[a];return w(d)?d.call(b,c):d}function tc(a){var b=this._longDateFormat[a],c=this._longDateFormat[a.toUpperCase()];return b||!c?b:(this._longDateFormat[a]=c.replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a])}function uc(){return this._invalidDate}function vc(a){return this._ordinal.replace("%d",a)}function wc(a){return a}function xc(a,b,c,d){var e=this._relativeTime[c];return w(e)?e(a,b,c,d):e.replace(/%d/i,a)}function yc(a,b){var c=this._relativeTime[a>0?"future":"past"];return w(c)?c(b):c.replace(/%s/i,b)}function zc(a,b,c,d){var e=H(),f=h().set(d,b);return e[c](f,a)}function Ac(a,b,c,d,e){if("number"==typeof a&&(b=a,a=void 0),a=a||"",null!=b)return zc(a,b,c,e);var f,g=[];for(f=0;d>f;f++)g[f]=zc(a,f,c,e);return g}function Bc(a,b){return Ac(a,b,"months",12,"month")}function Cc(a,b){return Ac(a,b,"monthsShort",12,"month")}function Dc(a,b){return Ac(a,b,"weekdays",7,"day")}function Ec(a,b){return Ac(a,b,"weekdaysShort",7,"day")}function Fc(a,b){return Ac(a,b,"weekdaysMin",7,"day")}function Gc(){var a=this._data;return this._milliseconds=vf(this._milliseconds),this._days=vf(this._days),this._months=vf(this._months),a.milliseconds=vf(a.milliseconds),a.seconds=vf(a.seconds),a.minutes=vf(a.minutes),a.hours=vf(a.hours),a.months=vf(a.months),a.years=vf(a.years),this}function Hc(a,b,c,d){var e=cb(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}function Ic(a,b){return Hc(this,a,b,1)}function Jc(a,b){return Hc(this,a,b,-1)}function Kc(a){return 0>a?Math.floor(a):Math.ceil(a)}function Lc(){var a,b,c,d,e,f=this._milliseconds,g=this._days,h=this._months,i=this._data;return f>=0&&g>=0&&h>=0||0>=f&&0>=g&&0>=h||(f+=864e5*Kc(Nc(h)+g),g=0,h=0),i.milliseconds=f%1e3,a=q(f/1e3),i.seconds=a%60,b=q(a/60),i.minutes=b%60,c=q(b/60),i.hours=c%24,g+=q(c/24),e=q(Mc(g)),h+=e,g-=Kc(Nc(e)),d=q(h/12),h%=12,i.days=g,i.months=h,i.years=d,this}function Mc(a){return 4800*a/146097}function Nc(a){return 146097*a/4800}function Oc(a){var b,c,d=this._milliseconds;if(a=K(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+Mc(b),"month"===a?c:c/12;switch(b=this._days+Math.round(Nc(this._months)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 1440*b+d/6e4;case"second":return 86400*b+d/1e3;case"millisecond":return Math.floor(864e5*b)+d;default:throw new Error("Unknown unit "+a)}}function Pc(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*r(this._months/12)}function Qc(a){return function(){return this.as(a)}}function Rc(a){return a=K(a),this[a+"s"]()}function Sc(a){return function(){return this._data[a]}}function Tc(){return q(this.days()/7)}function Uc(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function Vc(a,b,c){var d=cb(a).abs(),e=Lf(d.as("s")),f=Lf(d.as("m")),g=Lf(d.as("h")),h=Lf(d.as("d")),i=Lf(d.as("M")),j=Lf(d.as("y")),k=e<Mf.s&&["s",e]||1>=f&&["m"]||f<Mf.m&&["mm",f]||1>=g&&["h"]||g<Mf.h&&["hh",g]||1>=h&&["d"]||h<Mf.d&&["dd",h]||1>=i&&["M"]||i<Mf.M&&["MM",i]||1>=j&&["y"]||["yy",j];return k[2]=b,k[3]=+a>0,k[4]=c,Uc.apply(null,k)}function Wc(a,b){return void 0===Mf[a]?!1:void 0===b?Mf[a]:(Mf[a]=b,!0)}function Xc(a){var b=this.localeData(),c=Vc(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function Yc(){var a,b,c,d=Nf(this._milliseconds)/1e3,e=Nf(this._days),f=Nf(this._months);a=q(d/60),b=q(a/60),d%=60,a%=60,c=q(f/12),f%=12;var g=c,h=f,i=e,j=b,k=a,l=d,m=this.asSeconds();return m?(0>m?"-":"")+"P"+(g?g+"Y":"")+(h?h+"M":"")+(i?i+"D":"")+(j||k||l?"T":"")+(j?j+"H":"")+(k?k+"M":"")+(l?l+"S":""):"P0D"}
+!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){"use strict";function a(){return ce.apply(null,arguments)}function b(a){ce=a}function c(a){return a instanceof Array||"[object Array]"===Object.prototype.toString.call(a)}function d(a){return a instanceof Date||"[object Date]"===Object.prototype.toString.call(a)}function e(a,b){var c,d=[];for(c=0;c<a.length;++c)d.push(b(a[c],c));return d}function f(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function g(a,b){for(var c in b)f(b,c)&&(a[c]=b[c]);return f(b,"toString")&&(a.toString=b.toString),f(b,"valueOf")&&(a.valueOf=b.valueOf),a}function h(a,b,c,d){return Ja(a,b,c,d,!0).utc()}function i(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null}}function j(a){return null==a._pf&&(a._pf=i()),a._pf}function k(a){if(null==a._isValid){var b=j(a),c=de.call(b.parsedDateParts,function(a){return null!=a});a._isValid=!isNaN(a._d.getTime())&&b.overflow<0&&!b.empty&&!b.invalidMonth&&!b.invalidWeekday&&!b.nullInput&&!b.invalidFormat&&!b.userInvalidated&&(!b.meridiem||b.meridiem&&c),a._strict&&(a._isValid=a._isValid&&0===b.charsLeftOver&&0===b.unusedTokens.length&&void 0===b.bigHour)}return a._isValid}function l(a){var b=h(NaN);return null!=a?g(j(b),a):j(b).userInvalidated=!0,b}function m(a){return void 0===a}function n(a,b){var c,d,e;if(m(b._isAMomentObject)||(a._isAMomentObject=b._isAMomentObject),m(b._i)||(a._i=b._i),m(b._f)||(a._f=b._f),m(b._l)||(a._l=b._l),m(b._strict)||(a._strict=b._strict),m(b._tzm)||(a._tzm=b._tzm),m(b._isUTC)||(a._isUTC=b._isUTC),m(b._offset)||(a._offset=b._offset),m(b._pf)||(a._pf=j(b)),m(b._locale)||(a._locale=b._locale),ee.length>0)for(c in ee)d=ee[c],e=b[d],m(e)||(a[d]=e);return a}function o(b){n(this,b),this._d=new Date(null!=b._d?b._d.getTime():NaN),fe===!1&&(fe=!0,a.updateOffset(this),fe=!1)}function p(a){return a instanceof o||null!=a&&null!=a._isAMomentObject}function q(a){return 0>a?Math.ceil(a):Math.floor(a)}function r(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=q(b)),c}function s(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&r(a[d])!==r(b[d]))&&g++;return g+f}function t(b){a.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+b)}function u(b,c){var d=!0;return g(function(){return null!=a.deprecationHandler&&a.deprecationHandler(null,b),d&&(t(b+"\nArguments: "+Array.prototype.slice.call(arguments).join(", ")+"\n"+(new Error).stack),d=!1),c.apply(this,arguments)},c)}function v(b,c){null!=a.deprecationHandler&&a.deprecationHandler(b,c),ge[b]||(t(c),ge[b]=!0)}function w(a){return a instanceof Function||"[object Function]"===Object.prototype.toString.call(a)}function x(a){return"[object Object]"===Object.prototype.toString.call(a)}function y(a){var b,c;for(c in a)b=a[c],w(b)?this[c]=b:this["_"+c]=b;this._config=a,this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function z(a,b){var c,d=g({},a);for(c in b)f(b,c)&&(x(a[c])&&x(b[c])?(d[c]={},g(d[c],a[c]),g(d[c],b[c])):null!=b[c]?d[c]=b[c]:delete d[c]);return d}function A(a){null!=a&&this.set(a)}function B(a){return a?a.toLowerCase().replace("_","-"):a}function C(a){for(var b,c,d,e,f=0;f<a.length;){for(e=B(a[f]).split("-"),b=e.length,c=B(a[f+1]),c=c?c.split("-"):null;b>0;){if(d=D(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&s(e,c,!0)>=b-1)break;b--}f++}return null}function D(a){var b=null;if(!ke[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=ie._abbr,require("./locale/"+a),E(b)}catch(c){}return ke[a]}function E(a,b){var c;return a&&(c=m(b)?H(a):F(a,b),c&&(ie=c)),ie._abbr}function F(a,b){return null!==b?(b.abbr=a,null!=ke[a]?(v("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale"),b=z(ke[a]._config,b)):null!=b.parentLocale&&(null!=ke[b.parentLocale]?b=z(ke[b.parentLocale]._config,b):v("parentLocaleUndefined","specified parentLocale is not defined yet")),ke[a]=new A(b),E(a),ke[a]):(delete ke[a],null)}function G(a,b){if(null!=b){var c;null!=ke[a]&&(b=z(ke[a]._config,b)),c=new A(b),c.parentLocale=ke[a],ke[a]=c,E(a)}else null!=ke[a]&&(null!=ke[a].parentLocale?ke[a]=ke[a].parentLocale:null!=ke[a]&&delete ke[a]);return ke[a]}function H(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return ie;if(!c(a)){if(b=D(a))return b;a=[a]}return C(a)}function I(){return he(ke)}function J(a,b){var c=a.toLowerCase();le[c]=le[c+"s"]=le[b]=a}function K(a){return"string"==typeof a?le[a]||le[a.toLowerCase()]:void 0}function L(a){var b,c,d={};for(c in a)f(a,c)&&(b=K(c),b&&(d[b]=a[c]));return d}function M(b,c){return function(d){return null!=d?(O(this,b,d),a.updateOffset(this,c),this):N(this,b)}}function N(a,b){return a.isValid()?a._d["get"+(a._isUTC?"UTC":"")+b]():NaN}function O(a,b,c){a.isValid()&&a._d["set"+(a._isUTC?"UTC":"")+b](c)}function P(a,b){var c;if("object"==typeof a)for(c in a)this.set(c,a[c]);else if(a=K(a),w(this[a]))return this[a](b);return this}function Q(a,b,c){var d=""+Math.abs(a),e=b-d.length,f=a>=0;return(f?c?"+":"":"-")+Math.pow(10,Math.max(0,e)).toString().substr(1)+d}function R(a,b,c,d){var e=d;"string"==typeof d&&(e=function(){return this[d]()}),a&&(pe[a]=e),b&&(pe[b[0]]=function(){return Q(e.apply(this,arguments),b[1],b[2])}),c&&(pe[c]=function(){return this.localeData().ordinal(e.apply(this,arguments),a)})}function S(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function T(a){var b,c,d=a.match(me);for(b=0,c=d.length;c>b;b++)pe[d[b]]?d[b]=pe[d[b]]:d[b]=S(d[b]);return function(b){var e,f="";for(e=0;c>e;e++)f+=d[e]instanceof Function?d[e].call(b,a):d[e];return f}}function U(a,b){return a.isValid()?(b=V(b,a.localeData()),oe[b]=oe[b]||T(b),oe[b](a)):a.localeData().invalidDate()}function V(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(ne.lastIndex=0;d>=0&&ne.test(a);)a=a.replace(ne,c),ne.lastIndex=0,d-=1;return a}function W(a,b,c){He[a]=w(b)?b:function(a,d){return a&&c?c:b}}function X(a,b){return f(He,a)?He[a](b._strict,b._locale):new RegExp(Y(a))}function Y(a){return Z(a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}))}function Z(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function $(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),"number"==typeof b&&(d=function(a,c){c[b]=r(a)}),c=0;c<a.length;c++)Ie[a[c]]=d}function _(a,b){$(a,function(a,c,d,e){d._w=d._w||{},b(a,d._w,d,e)})}function aa(a,b,c){null!=b&&f(Ie,a)&&Ie[a](b,c._a,c,a)}function ba(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function ca(a,b){return c(this._months)?this._months[a.month()]:this._months[Se.test(b)?"format":"standalone"][a.month()]}function da(a,b){return c(this._monthsShort)?this._monthsShort[a.month()]:this._monthsShort[Se.test(b)?"format":"standalone"][a.month()]}function ea(a,b,c){var d,e,f,g=a.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],d=0;12>d;++d)f=h([2e3,d]),this._shortMonthsParse[d]=this.monthsShort(f,"").toLocaleLowerCase(),this._longMonthsParse[d]=this.months(f,"").toLocaleLowerCase();return c?"MMM"===b?(e=je.call(this._shortMonthsParse,g),-1!==e?e:null):(e=je.call(this._longMonthsParse,g),-1!==e?e:null):"MMM"===b?(e=je.call(this._shortMonthsParse,g),-1!==e?e:(e=je.call(this._longMonthsParse,g),-1!==e?e:null)):(e=je.call(this._longMonthsParse,g),-1!==e?e:(e=je.call(this._shortMonthsParse,g),-1!==e?e:null))}function fa(a,b,c){var d,e,f;if(this._monthsParseExact)return ea.call(this,a,b,c);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),d=0;12>d;d++){if(e=h([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}}function ga(a,b){var c;if(!a.isValid())return a;if("string"==typeof b)if(/^\d+$/.test(b))b=r(b);else if(b=a.localeData().monthsParse(b),"number"!=typeof b)return a;return c=Math.min(a.date(),ba(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a}function ha(b){return null!=b?(ga(this,b),a.updateOffset(this,!0),this):N(this,"Month")}function ia(){return ba(this.year(),this.month())}function ja(a){return this._monthsParseExact?(f(this,"_monthsRegex")||la.call(this),a?this._monthsShortStrictRegex:this._monthsShortRegex):this._monthsShortStrictRegex&&a?this._monthsShortStrictRegex:this._monthsShortRegex}function ka(a){return this._monthsParseExact?(f(this,"_monthsRegex")||la.call(this),a?this._monthsStrictRegex:this._monthsRegex):this._monthsStrictRegex&&a?this._monthsStrictRegex:this._monthsRegex}function la(){function a(a,b){return b.length-a.length}var b,c,d=[],e=[],f=[];for(b=0;12>b;b++)c=h([2e3,b]),d.push(this.monthsShort(c,"")),e.push(this.months(c,"")),f.push(this.months(c,"")),f.push(this.monthsShort(c,""));for(d.sort(a),e.sort(a),f.sort(a),b=0;12>b;b++)d[b]=Z(d[b]),e[b]=Z(e[b]),f[b]=Z(f[b]);this._monthsRegex=new RegExp("^("+f.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+e.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+d.join("|")+")","i")}function ma(a){var b,c=a._a;return c&&-2===j(a).overflow&&(b=c[Ke]<0||c[Ke]>11?Ke:c[Le]<1||c[Le]>ba(c[Je],c[Ke])?Le:c[Me]<0||c[Me]>24||24===c[Me]&&(0!==c[Ne]||0!==c[Oe]||0!==c[Pe])?Me:c[Ne]<0||c[Ne]>59?Ne:c[Oe]<0||c[Oe]>59?Oe:c[Pe]<0||c[Pe]>999?Pe:-1,j(a)._overflowDayOfYear&&(Je>b||b>Le)&&(b=Le),j(a)._overflowWeeks&&-1===b&&(b=Qe),j(a)._overflowWeekday&&-1===b&&(b=Re),j(a).overflow=b),a}function na(a){var b,c,d,e,f,g,h=a._i,i=Xe.exec(h)||Ye.exec(h);if(i){for(j(a).iso=!0,b=0,c=$e.length;c>b;b++)if($e[b][1].exec(i[1])){e=$e[b][0],d=$e[b][2]!==!1;break}if(null==e)return void(a._isValid=!1);if(i[3]){for(b=0,c=_e.length;c>b;b++)if(_e[b][1].exec(i[3])){f=(i[2]||" ")+_e[b][0];break}if(null==f)return void(a._isValid=!1)}if(!d&&null!=f)return void(a._isValid=!1);if(i[4]){if(!Ze.exec(i[4]))return void(a._isValid=!1);g="Z"}a._f=e+(f||"")+(g||""),Ca(a)}else a._isValid=!1}function oa(b){var c=af.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(na(b),void(b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b))))}function pa(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 100>a&&a>=0&&isFinite(h.getFullYear())&&h.setFullYear(a),h}function qa(a){var b=new Date(Date.UTC.apply(null,arguments));return 100>a&&a>=0&&isFinite(b.getUTCFullYear())&&b.setUTCFullYear(a),b}function ra(a){return sa(a)?366:365}function sa(a){return a%4===0&&a%100!==0||a%400===0}function ta(){return sa(this.year())}function ua(a,b,c){var d=7+b-c,e=(7+qa(a,0,d).getUTCDay()-b)%7;return-e+d-1}function va(a,b,c,d,e){var f,g,h=(7+c-d)%7,i=ua(a,d,e),j=1+7*(b-1)+h+i;return 0>=j?(f=a-1,g=ra(f)+j):j>ra(a)?(f=a+1,g=j-ra(a)):(f=a,g=j),{year:f,dayOfYear:g}}function wa(a,b,c){var d,e,f=ua(a.year(),b,c),g=Math.floor((a.dayOfYear()-f-1)/7)+1;return 1>g?(e=a.year()-1,d=g+xa(e,b,c)):g>xa(a.year(),b,c)?(d=g-xa(a.year(),b,c),e=a.year()+1):(e=a.year(),d=g),{week:d,year:e}}function xa(a,b,c){var d=ua(a,b,c),e=ua(a+1,b,c);return(ra(a)-d+e)/7}function ya(a,b,c){return null!=a?a:null!=b?b:c}function za(b){var c=new Date(a.now());return b._useUTC?[c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()]:[c.getFullYear(),c.getMonth(),c.getDate()]}function Aa(a){var b,c,d,e,f=[];if(!a._d){for(d=za(a),a._w&&null==a._a[Le]&&null==a._a[Ke]&&Ba(a),a._dayOfYear&&(e=ya(a._a[Je],d[Je]),a._dayOfYear>ra(e)&&(j(a)._overflowDayOfYear=!0),c=qa(e,0,a._dayOfYear),a._a[Ke]=c.getUTCMonth(),a._a[Le]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=f[b]=d[b];for(;7>b;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];24===a._a[Me]&&0===a._a[Ne]&&0===a._a[Oe]&&0===a._a[Pe]&&(a._nextDay=!0,a._a[Me]=0),a._d=(a._useUTC?qa:pa).apply(null,f),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[Me]=24)}}function Ba(a){var b,c,d,e,f,g,h,i;b=a._w,null!=b.GG||null!=b.W||null!=b.E?(f=1,g=4,c=ya(b.GG,a._a[Je],wa(Ka(),1,4).year),d=ya(b.W,1),e=ya(b.E,1),(1>e||e>7)&&(i=!0)):(f=a._locale._week.dow,g=a._locale._week.doy,c=ya(b.gg,a._a[Je],wa(Ka(),f,g).year),d=ya(b.w,1),null!=b.d?(e=b.d,(0>e||e>6)&&(i=!0)):null!=b.e?(e=b.e+f,(b.e<0||b.e>6)&&(i=!0)):e=f),1>d||d>xa(c,f,g)?j(a)._overflowWeeks=!0:null!=i?j(a)._overflowWeekday=!0:(h=va(c,d,e,f,g),a._a[Je]=h.year,a._dayOfYear=h.dayOfYear)}function Ca(b){if(b._f===a.ISO_8601)return void na(b);b._a=[],j(b).empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,k=0;for(e=V(b._f,b._locale).match(me)||[],c=0;c<e.length;c++)f=e[c],d=(h.match(X(f,b))||[])[0],d&&(g=h.substr(0,h.indexOf(d)),g.length>0&&j(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),k+=d.length),pe[f]?(d?j(b).empty=!1:j(b).unusedTokens.push(f),aa(f,d,b)):b._strict&&!d&&j(b).unusedTokens.push(f);j(b).charsLeftOver=i-k,h.length>0&&j(b).unusedInput.push(h),j(b).bigHour===!0&&b._a[Me]<=12&&b._a[Me]>0&&(j(b).bigHour=void 0),j(b).parsedDateParts=b._a.slice(0),j(b).meridiem=b._meridiem,b._a[Me]=Da(b._locale,b._a[Me],b._meridiem),Aa(b),ma(b)}function Da(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&12>b&&(b+=12),d||12!==b||(b=0),b):b}function Ea(a){var b,c,d,e,f;if(0===a._f.length)return j(a).invalidFormat=!0,void(a._d=new Date(NaN));for(e=0;e<a._f.length;e++)f=0,b=n({},a),null!=a._useUTC&&(b._useUTC=a._useUTC),b._f=a._f[e],Ca(b),k(b)&&(f+=j(b).charsLeftOver,f+=10*j(b).unusedTokens.length,j(b).score=f,(null==d||d>f)&&(d=f,c=b));g(a,c||b)}function Fa(a){if(!a._d){var b=L(a._i);a._a=e([b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],function(a){return a&&parseInt(a,10)}),Aa(a)}}function Ga(a){var b=new o(ma(Ha(a)));return b._nextDay&&(b.add(1,"d"),b._nextDay=void 0),b}function Ha(a){var b=a._i,e=a._f;return a._locale=a._locale||H(a._l),null===b||void 0===e&&""===b?l({nullInput:!0}):("string"==typeof b&&(a._i=b=a._locale.preparse(b)),p(b)?new o(ma(b)):(c(e)?Ea(a):e?Ca(a):d(b)?a._d=b:Ia(a),k(a)||(a._d=null),a))}function Ia(b){var f=b._i;void 0===f?b._d=new Date(a.now()):d(f)?b._d=new Date(f.valueOf()):"string"==typeof f?oa(b):c(f)?(b._a=e(f.slice(0),function(a){return parseInt(a,10)}),Aa(b)):"object"==typeof f?Fa(b):"number"==typeof f?b._d=new Date(f):a.createFromInputFallback(b)}function Ja(a,b,c,d,e){var f={};return"boolean"==typeof c&&(d=c,c=void 0),f._isAMomentObject=!0,f._useUTC=f._isUTC=e,f._l=c,f._i=a,f._f=b,f._strict=d,Ga(f)}function Ka(a,b,c,d){return Ja(a,b,c,d,!1)}function La(a,b){var d,e;if(1===b.length&&c(b[0])&&(b=b[0]),!b.length)return Ka();for(d=b[0],e=1;e<b.length;++e)(!b[e].isValid()||b[e][a](d))&&(d=b[e]);return d}function Ma(){var a=[].slice.call(arguments,0);return La("isBefore",a)}function Na(){var a=[].slice.call(arguments,0);return La("isAfter",a)}function Oa(a){var b=L(a),c=b.year||0,d=b.quarter||0,e=b.month||0,f=b.week||0,g=b.day||0,h=b.hour||0,i=b.minute||0,j=b.second||0,k=b.millisecond||0;this._milliseconds=+k+1e3*j+6e4*i+1e3*h*60*60,this._days=+g+7*f,this._months=+e+3*d+12*c,this._data={},this._locale=H(),this._bubble()}function Pa(a){return a instanceof Oa}function Qa(a,b){R(a,0,0,function(){var a=this.utcOffset(),c="+";return 0>a&&(a=-a,c="-"),c+Q(~~(a/60),2)+b+Q(~~a%60,2)})}function Ra(a,b){var c=(b||"").match(a)||[],d=c[c.length-1]||[],e=(d+"").match(ff)||["-",0,0],f=+(60*e[1])+r(e[2]);return"+"===e[0]?f:-f}function Sa(b,c){var e,f;return c._isUTC?(e=c.clone(),f=(p(b)||d(b)?b.valueOf():Ka(b).valueOf())-e.valueOf(),e._d.setTime(e._d.valueOf()+f),a.updateOffset(e,!1),e):Ka(b).local()}function Ta(a){return 15*-Math.round(a._d.getTimezoneOffset()/15)}function Ua(b,c){var d,e=this._offset||0;return this.isValid()?null!=b?("string"==typeof b?b=Ra(Ee,b):Math.abs(b)<16&&(b=60*b),!this._isUTC&&c&&(d=Ta(this)),this._offset=b,this._isUTC=!0,null!=d&&this.add(d,"m"),e!==b&&(!c||this._changeInProgress?jb(this,db(b-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,a.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?e:Ta(this):null!=b?this:NaN}function Va(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function Wa(a){return this.utcOffset(0,a)}function Xa(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(Ta(this),"m")),this}function Ya(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Ra(De,this._i)),this}function Za(a){return this.isValid()?(a=a?Ka(a).utcOffset():0,(this.utcOffset()-a)%60===0):!1}function $a(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function _a(){if(!m(this._isDSTShifted))return this._isDSTShifted;var a={};if(n(a,this),a=Ha(a),a._a){var b=a._isUTC?h(a._a):Ka(a._a);this._isDSTShifted=this.isValid()&&s(a._a,b.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function ab(){return this.isValid()?!this._isUTC:!1}function bb(){return this.isValid()?this._isUTC:!1}function cb(){return this.isValid()?this._isUTC&&0===this._offset:!1}function db(a,b){var c,d,e,g=a,h=null;return Pa(a)?g={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(g={},b?g[b]=a:g.milliseconds=a):(h=gf.exec(a))?(c="-"===h[1]?-1:1,g={y:0,d:r(h[Le])*c,h:r(h[Me])*c,m:r(h[Ne])*c,s:r(h[Oe])*c,ms:r(h[Pe])*c}):(h=hf.exec(a))?(c="-"===h[1]?-1:1,g={y:eb(h[2],c),M:eb(h[3],c),w:eb(h[4],c),d:eb(h[5],c),h:eb(h[6],c),m:eb(h[7],c),s:eb(h[8],c)}):null==g?g={}:"object"==typeof g&&("from"in g||"to"in g)&&(e=gb(Ka(g.from),Ka(g.to)),g={},g.ms=e.milliseconds,g.M=e.months),d=new Oa(g),Pa(a)&&f(a,"_locale")&&(d._locale=a._locale),d}function eb(a,b){var c=a&&parseFloat(a.replace(",","."));return(isNaN(c)?0:c)*b}function fb(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function gb(a,b){var c;return a.isValid()&&b.isValid()?(b=Sa(b,a),a.isBefore(b)?c=fb(a,b):(c=fb(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c):{milliseconds:0,months:0}}function hb(a){return 0>a?-1*Math.round(-1*a):Math.round(a)}function ib(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||(v(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period)."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=db(c,d),jb(this,e,a),this}}function jb(b,c,d,e){var f=c._milliseconds,g=hb(c._days),h=hb(c._months);b.isValid()&&(e=null==e?!0:e,f&&b._d.setTime(b._d.valueOf()+f*d),g&&O(b,"Date",N(b,"Date")+g*d),h&&ga(b,N(b,"Month")+h*d),e&&a.updateOffset(b,g||h))}function kb(a,b){var c=a||Ka(),d=Sa(c,this).startOf("day"),e=this.diff(d,"days",!0),f=-6>e?"sameElse":-1>e?"lastWeek":0>e?"lastDay":1>e?"sameDay":2>e?"nextDay":7>e?"nextWeek":"sameElse",g=b&&(w(b[f])?b[f]():b[f]);return this.format(g||this.localeData().calendar(f,this,Ka(c)))}function lb(){return new o(this)}function mb(a,b){var c=p(a)?a:Ka(a);return this.isValid()&&c.isValid()?(b=K(m(b)?"millisecond":b),"millisecond"===b?this.valueOf()>c.valueOf():c.valueOf()<this.clone().startOf(b).valueOf()):!1}function nb(a,b){var c=p(a)?a:Ka(a);return this.isValid()&&c.isValid()?(b=K(m(b)?"millisecond":b),"millisecond"===b?this.valueOf()<c.valueOf():this.clone().endOf(b).valueOf()<c.valueOf()):!1}function ob(a,b,c,d){return d=d||"()",("("===d[0]?this.isAfter(a,c):!this.isBefore(a,c))&&(")"===d[1]?this.isBefore(b,c):!this.isAfter(b,c))}function pb(a,b){var c,d=p(a)?a:Ka(a);return this.isValid()&&d.isValid()?(b=K(b||"millisecond"),"millisecond"===b?this.valueOf()===d.valueOf():(c=d.valueOf(),this.clone().startOf(b).valueOf()<=c&&c<=this.clone().endOf(b).valueOf())):!1}function qb(a,b){return this.isSame(a,b)||this.isAfter(a,b)}function rb(a,b){return this.isSame(a,b)||this.isBefore(a,b)}function sb(a,b,c){var d,e,f,g;return this.isValid()?(d=Sa(a,this),d.isValid()?(e=6e4*(d.utcOffset()-this.utcOffset()),b=K(b),"year"===b||"month"===b||"quarter"===b?(g=tb(this,d),"quarter"===b?g/=3:"year"===b&&(g/=12)):(f=this-d,g="second"===b?f/1e3:"minute"===b?f/6e4:"hour"===b?f/36e5:"day"===b?(f-e)/864e5:"week"===b?(f-e)/6048e5:f),c?g:q(g)):NaN):NaN}function tb(a,b){var c,d,e=12*(b.year()-a.year())+(b.month()-a.month()),f=a.clone().add(e,"months");return 0>b-f?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)||0}function ub(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function vb(){var a=this.clone().utc();return 0<a.year()&&a.year()<=9999?w(Date.prototype.toISOString)?this.toDate().toISOString():U(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):U(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function wb(b){b||(b=this.isUtc()?a.defaultFormatUtc:a.defaultFormat);var c=U(this,b);return this.localeData().postformat(c)}function xb(a,b){return this.isValid()&&(p(a)&&a.isValid()||Ka(a).isValid())?db({to:this,from:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function yb(a){return this.from(Ka(),a)}function zb(a,b){return this.isValid()&&(p(a)&&a.isValid()||Ka(a).isValid())?db({from:this,to:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function Ab(a){return this.to(Ka(),a)}function Bb(a){var b;return void 0===a?this._locale._abbr:(b=H(a),null!=b&&(this._locale=b),this)}function Cb(){return this._locale}function Db(a){switch(a=K(a)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===a&&this.weekday(0),"isoWeek"===a&&this.isoWeekday(1),"quarter"===a&&this.month(3*Math.floor(this.month()/3)),this}function Eb(a){return a=K(a),void 0===a||"millisecond"===a?this:("date"===a&&(a="day"),this.startOf(a).add(1,"isoWeek"===a?"week":a).subtract(1,"ms"))}function Fb(){return this._d.valueOf()-6e4*(this._offset||0)}function Gb(){return Math.floor(this.valueOf()/1e3)}function Hb(){return this._offset?new Date(this.valueOf()):this._d}function Ib(){var a=this;return[a.year(),a.month(),a.date(),a.hour(),a.minute(),a.second(),a.millisecond()]}function Jb(){var a=this;return{years:a.year(),months:a.month(),date:a.date(),hours:a.hours(),minutes:a.minutes(),seconds:a.seconds(),milliseconds:a.milliseconds()}}function Kb(){return this.isValid()?this.toISOString():null}function Lb(){return k(this)}function Mb(){return g({},j(this))}function Nb(){return j(this).overflow}function Ob(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function Pb(a,b){R(0,[a,a.length],0,b)}function Qb(a){return Ub.call(this,a,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Rb(a){return Ub.call(this,a,this.isoWeek(),this.isoWeekday(),1,4)}function Sb(){return xa(this.year(),1,4)}function Tb(){var a=this.localeData()._week;return xa(this.year(),a.dow,a.doy)}function Ub(a,b,c,d,e){var f;return null==a?wa(this,d,e).year:(f=xa(a,d,e),b>f&&(b=f),Vb.call(this,a,b,c,d,e))}function Vb(a,b,c,d,e){var f=va(a,b,c,d,e),g=qa(f.year,0,f.dayOfYear);return this.year(g.getUTCFullYear()),this.month(g.getUTCMonth()),this.date(g.getUTCDate()),this}function Wb(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)}function Xb(a){return wa(a,this._week.dow,this._week.doy).week}function Yb(){return this._week.dow}function Zb(){return this._week.doy}function $b(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function _b(a){var b=wa(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}function ac(a,b){return"string"!=typeof a?a:isNaN(a)?(a=b.weekdaysParse(a),"number"==typeof a?a:null):parseInt(a,10)}function bc(a,b){return c(this._weekdays)?this._weekdays[a.day()]:this._weekdays[this._weekdays.isFormat.test(b)?"format":"standalone"][a.day()]}function cc(a){return this._weekdaysShort[a.day()]}function dc(a){return this._weekdaysMin[a.day()]}function ec(a,b,c){var d,e,f,g=a.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],d=0;7>d;++d)f=h([2e3,1]).day(d),this._minWeekdaysParse[d]=this.weekdaysMin(f,"").toLocaleLowerCase(),this._shortWeekdaysParse[d]=this.weekdaysShort(f,"").toLocaleLowerCase(),this._weekdaysParse[d]=this.weekdays(f,"").toLocaleLowerCase();return c?"dddd"===b?(e=je.call(this._weekdaysParse,g),-1!==e?e:null):"ddd"===b?(e=je.call(this._shortWeekdaysParse,g),-1!==e?e:null):(e=je.call(this._minWeekdaysParse,g),-1!==e?e:null):"dddd"===b?(e=je.call(this._weekdaysParse,g),-1!==e?e:(e=je.call(this._shortWeekdaysParse,g),-1!==e?e:(e=je.call(this._minWeekdaysParse,g),-1!==e?e:null))):"ddd"===b?(e=je.call(this._shortWeekdaysParse,g),-1!==e?e:(e=je.call(this._weekdaysParse,g),-1!==e?e:(e=je.call(this._minWeekdaysParse,g),-1!==e?e:null))):(e=je.call(this._minWeekdaysParse,g),-1!==e?e:(e=je.call(this._weekdaysParse,g),-1!==e?e:(e=je.call(this._shortWeekdaysParse,g),-1!==e?e:null)))}function fc(a,b,c){var d,e,f;if(this._weekdaysParseExact)return ec.call(this,a,b,c);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),d=0;7>d;d++){if(e=h([2e3,1]).day(d),c&&!this._fullWeekdaysParse[d]&&(this._fullWeekdaysParse[d]=new RegExp("^"+this.weekdays(e,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[d]=new RegExp("^"+this.weekdaysShort(e,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[d]=new RegExp("^"+this.weekdaysMin(e,"").replace(".",".?")+"$","i")),this._weekdaysParse[d]||(f="^"+this.weekdays(e,"")+"|^"+this.weekdaysShort(e,"")+"|^"+this.weekdaysMin(e,""),this._weekdaysParse[d]=new RegExp(f.replace(".",""),"i")),c&&"dddd"===b&&this._fullWeekdaysParse[d].test(a))return d;if(c&&"ddd"===b&&this._shortWeekdaysParse[d].test(a))return d;if(c&&"dd"===b&&this._minWeekdaysParse[d].test(a))return d;if(!c&&this._weekdaysParse[d].test(a))return d}}function gc(a){if(!this.isValid())return null!=a?this:NaN;var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=ac(a,this.localeData()),this.add(a-b,"d")):b}function hc(a){if(!this.isValid())return null!=a?this:NaN;var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function ic(a){return this.isValid()?null==a?this.day()||7:this.day(this.day()%7?a:a-7):null!=a?this:NaN}function jc(a){return this._weekdaysParseExact?(f(this,"_weekdaysRegex")||mc.call(this),a?this._weekdaysStrictRegex:this._weekdaysRegex):this._weekdaysStrictRegex&&a?this._weekdaysStrictRegex:this._weekdaysRegex}function kc(a){return this._weekdaysParseExact?(f(this,"_weekdaysRegex")||mc.call(this),a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):this._weekdaysShortStrictRegex&&a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex}function lc(a){return this._weekdaysParseExact?(f(this,"_weekdaysRegex")||mc.call(this),a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):this._weekdaysMinStrictRegex&&a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex}function mc(){function a(a,b){return b.length-a.length}var b,c,d,e,f,g=[],i=[],j=[],k=[];for(b=0;7>b;b++)c=h([2e3,1]).day(b),d=this.weekdaysMin(c,""),e=this.weekdaysShort(c,""),f=this.weekdays(c,""),g.push(d),i.push(e),j.push(f),k.push(d),k.push(e),k.push(f);for(g.sort(a),i.sort(a),j.sort(a),k.sort(a),b=0;7>b;b++)i[b]=Z(i[b]),j[b]=Z(j[b]),k[b]=Z(k[b]);this._weekdaysRegex=new RegExp("^("+k.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+j.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+g.join("|")+")","i")}function nc(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function oc(){return this.hours()%12||12}function pc(){return this.hours()||24}function qc(a,b){R(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}function rc(a,b){return b._meridiemParse}function sc(a){return"p"===(a+"").toLowerCase().charAt(0)}function tc(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function uc(a,b){b[Pe]=r(1e3*("0."+a))}function vc(){return this._isUTC?"UTC":""}function wc(){return this._isUTC?"Coordinated Universal Time":""}function xc(a){return Ka(1e3*a)}function yc(){return Ka.apply(null,arguments).parseZone()}function zc(a,b,c){var d=this._calendar[a];return w(d)?d.call(b,c):d}function Ac(a){var b=this._longDateFormat[a],c=this._longDateFormat[a.toUpperCase()];return b||!c?b:(this._longDateFormat[a]=c.replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a])}function Bc(){return this._invalidDate}function Cc(a){return this._ordinal.replace("%d",a)}function Dc(a){return a}function Ec(a,b,c,d){var e=this._relativeTime[c];return w(e)?e(a,b,c,d):e.replace(/%d/i,a)}function Fc(a,b){var c=this._relativeTime[a>0?"future":"past"];return w(c)?c(b):c.replace(/%s/i,b)}function Gc(a,b,c,d){var e=H(),f=h().set(d,b);return e[c](f,a)}function Hc(a,b,c){if("number"==typeof a&&(b=a,a=void 0),a=a||"",null!=b)return Gc(a,b,c,"month");var d,e=[];for(d=0;12>d;d++)e[d]=Gc(a,d,c,"month");return e}function Ic(a,b,c,d){"boolean"==typeof a?("number"==typeof b&&(c=b,b=void 0),b=b||""):(b=a,c=b,a=!1,"number"==typeof b&&(c=b,b=void 0),b=b||"");var e=H(),f=a?e._week.dow:0;if(null!=c)return Gc(b,(c+f)%7,d,"day");var g,h=[];for(g=0;7>g;g++)h[g]=Gc(b,(g+f)%7,d,"day");return h}function Jc(a,b){return Hc(a,b,"months")}function Kc(a,b){return Hc(a,b,"monthsShort")}function Lc(a,b,c){return Ic(a,b,c,"weekdays")}function Mc(a,b,c){return Ic(a,b,c,"weekdaysShort")}function Nc(a,b,c){return Ic(a,b,c,"weekdaysMin")}function Oc(){var a=this._data;return this._milliseconds=Jf(this._milliseconds),this._days=Jf(this._days),this._months=Jf(this._months),a.milliseconds=Jf(a.milliseconds),a.seconds=Jf(a.seconds),a.minutes=Jf(a.minutes),a.hours=Jf(a.hours),a.months=Jf(a.months),a.years=Jf(a.years),this}function Pc(a,b,c,d){var e=db(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}function Qc(a,b){return Pc(this,a,b,1)}function Rc(a,b){return Pc(this,a,b,-1)}function Sc(a){return 0>a?Math.floor(a):Math.ceil(a)}function Tc(){var a,b,c,d,e,f=this._milliseconds,g=this._days,h=this._months,i=this._data;return f>=0&&g>=0&&h>=0||0>=f&&0>=g&&0>=h||(f+=864e5*Sc(Vc(h)+g),g=0,h=0),i.milliseconds=f%1e3,a=q(f/1e3),i.seconds=a%60,b=q(a/60),i.minutes=b%60,c=q(b/60),i.hours=c%24,g+=q(c/24),e=q(Uc(g)),h+=e,g-=Sc(Vc(e)),d=q(h/12),h%=12,i.days=g,i.months=h,i.years=d,this}function Uc(a){return 4800*a/146097}function Vc(a){return 146097*a/4800}function Wc(a){var b,c,d=this._milliseconds;if(a=K(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+Uc(b),"month"===a?c:c/12;switch(b=this._days+Math.round(Vc(this._months)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 1440*b+d/6e4;case"second":return 86400*b+d/1e3;case"millisecond":return Math.floor(864e5*b)+d;default:throw new Error("Unknown unit "+a)}}function Xc(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*r(this._months/12)}function Yc(a){return function(){return this.as(a)}}function Zc(a){
+return a=K(a),this[a+"s"]()}function $c(a){return function(){return this._data[a]}}function _c(){return q(this.days()/7)}function ad(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function bd(a,b,c){var d=db(a).abs(),e=Zf(d.as("s")),f=Zf(d.as("m")),g=Zf(d.as("h")),h=Zf(d.as("d")),i=Zf(d.as("M")),j=Zf(d.as("y")),k=e<$f.s&&["s",e]||1>=f&&["m"]||f<$f.m&&["mm",f]||1>=g&&["h"]||g<$f.h&&["hh",g]||1>=h&&["d"]||h<$f.d&&["dd",h]||1>=i&&["M"]||i<$f.M&&["MM",i]||1>=j&&["y"]||["yy",j];return k[2]=b,k[3]=+a>0,k[4]=c,ad.apply(null,k)}function cd(a,b){return void 0===$f[a]?!1:void 0===b?$f[a]:($f[a]=b,!0)}function dd(a){var b=this.localeData(),c=bd(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function ed(){var a,b,c,d=_f(this._milliseconds)/1e3,e=_f(this._days),f=_f(this._months);a=q(d/60),b=q(a/60),d%=60,a%=60,c=q(f/12),f%=12;var g=c,h=f,i=e,j=b,k=a,l=d,m=this.asSeconds();return m?(0>m?"-":"")+"P"+(g?g+"Y":"")+(h?h+"M":"")+(i?i+"D":"")+(j||k||l?"T":"")+(j?j+"H":"")+(k?k+"M":"")+(l?l+"S":""):"P0D"}
//! 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
-function Zc(a,b){var c=a.split("_");return b%10===1&&b%100!==11?c[0]:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?c[1]:c[2]}function $c(a,b,c){var d={mm:b?"хвіліна_хвіліны_хвілін":"хвіліну_хвіліны_хвілін",hh:b?"гадзіна_гадзіны_гадзін":"гадзіну_гадзіны_гадзін",dd:"дзень_дні_дзён",MM:"месяц_месяцы_месяцаў",yy:"год_гады_гадоў"};return"m"===c?b?"хвіліна":"хвіліну":"h"===c?b?"гадзіна":"гадзіну":a+" "+Zc(d[c],+a)}
+function fd(a,b){var c=a.split("_");return b%10===1&&b%100!==11?c[0]:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?c[1]:c[2]}function gd(a,b,c){var d={mm:b?"хвіліна_хвіліны_хвілін":"хвіліну_хвіліны_хвілін",hh:b?"гадзіна_гадзіны_гадзін":"гадзіну_гадзіны_гадзін",dd:"дзень_дні_дзён",MM:"месяц_месяцы_месяцаў",yy:"год_гады_гадоў"};return"m"===c?b?"хвіліна":"хвіліну":"h"===c?b?"гадзіна":"гадзіну":a+" "+fd(d[c],+a)}
//! moment.js locale configuration
//! locale : breton (br)
//! author : Jean-Baptiste Le Duigou : https://github.com/jbleduigou
-function _c(a,b,c){var d={mm:"munutenn",MM:"miz",dd:"devezh"};return a+" "+cd(d[c],a)}function ad(a){switch(bd(a)){case 1:case 3:case 4:case 5:case 9:return a+" bloaz";default:return a+" vloaz"}}function bd(a){return a>9?bd(a%10):a}function cd(a,b){return 2===b?dd(a):a}function dd(a){var b={m:"v",b:"v",d:"z"};return void 0===b[a.charAt(0)]?a:b[a.charAt(0)]+a.substring(1)}
+function hd(a,b,c){var d={mm:"munutenn",MM:"miz",dd:"devezh"};return a+" "+kd(d[c],a)}function id(a){switch(jd(a)){case 1:case 3:case 4:case 5:case 9:return a+" bloaz";default:return a+" vloaz"}}function jd(a){return a>9?jd(a%10):a}function kd(a,b){return 2===b?ld(a):a}function ld(a){var b={m:"v",b:"v",d:"z"};return void 0===b[a.charAt(0)]?a:b[a.charAt(0)]+a.substring(1)}
//! moment.js locale configuration
//! locale : bosnian (bs)
//! author : Nedim Cholich : https://github.com/frontyard
//! based on (hr) translation by Bojan Marković
-function ed(a,b,c){var d=a+" ";switch(c){case"m":return b?"jedna minuta":"jedne minute";case"mm":return d+=1===a?"minuta":2===a||3===a||4===a?"minute":"minuta";case"h":return b?"jedan sat":"jednog sata";case"hh":return d+=1===a?"sat":2===a||3===a||4===a?"sata":"sati";case"dd":return d+=1===a?"dan":"dana";case"MM":return d+=1===a?"mjesec":2===a||3===a||4===a?"mjeseca":"mjeseci";case"yy":return d+=1===a?"godina":2===a||3===a||4===a?"godine":"godina"}}function fd(a){return a>1&&5>a&&1!==~~(a/10)}function gd(a,b,c,d){var e=a+" ";switch(c){case"s":return b||d?"pár sekund":"pár sekundami";case"m":return b?"minuta":d?"minutu":"minutou";case"mm":return b||d?e+(fd(a)?"minuty":"minut"):e+"minutami";break;case"h":return b?"hodina":d?"hodinu":"hodinou";case"hh":return b||d?e+(fd(a)?"hodiny":"hodin"):e+"hodinami";break;case"d":return b||d?"den":"dnem";case"dd":return b||d?e+(fd(a)?"dny":"dní"):e+"dny";break;case"M":return b||d?"měsíc":"měsícem";case"MM":return b||d?e+(fd(a)?"měsíce":"měsíců"):e+"měsíci";break;case"y":return b||d?"rok":"rokem";case"yy":return b||d?e+(fd(a)?"roky":"let"):e+"lety"}}
+function md(a,b,c){var d=a+" ";switch(c){case"m":return b?"jedna minuta":"jedne minute";case"mm":return d+=1===a?"minuta":2===a||3===a||4===a?"minute":"minuta";case"h":return b?"jedan sat":"jednog sata";case"hh":return d+=1===a?"sat":2===a||3===a||4===a?"sata":"sati";case"dd":return d+=1===a?"dan":"dana";case"MM":return d+=1===a?"mjesec":2===a||3===a||4===a?"mjeseca":"mjeseci";case"yy":return d+=1===a?"godina":2===a||3===a||4===a?"godine":"godina"}}function nd(a){return a>1&&5>a&&1!==~~(a/10)}function od(a,b,c,d){var e=a+" ";switch(c){case"s":return b||d?"pár sekund":"pár sekundami";case"m":return b?"minuta":d?"minutu":"minutou";case"mm":return b||d?e+(nd(a)?"minuty":"minut"):e+"minutami";break;case"h":return b?"hodina":d?"hodinu":"hodinou";case"hh":return b||d?e+(nd(a)?"hodiny":"hodin"):e+"hodinami";break;case"d":return b||d?"den":"dnem";case"dd":return b||d?e+(nd(a)?"dny":"dní"):e+"dny";break;case"M":return b||d?"měsíc":"měsícem";case"MM":return b||d?e+(nd(a)?"měsíce":"měsíců"):e+"měsíci";break;case"y":return b||d?"rok":"rokem";case"yy":return b||d?e+(nd(a)?"roky":"let"):e+"lety"}}
//! moment.js locale configuration
//! locale : austrian german (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
-function hd(a,b,c,d){var e={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[a+" Tage",a+" Tagen"],M:["ein Monat","einem Monat"],MM:[a+" Monate",a+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[a+" Jahre",a+" Jahren"]};return b?e[c][0]:e[c][1]}
+function pd(a,b,c,d){var e={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[a+" Tage",a+" Tagen"],M:["ein Monat","einem Monat"],MM:[a+" Monate",a+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[a+" Jahre",a+" Jahren"]};return b?e[c][0]:e[c][1]}
//! 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
-function id(a,b,c,d){var e={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[a+" Tage",a+" Tagen"],M:["ein Monat","einem Monat"],MM:[a+" Monate",a+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[a+" Jahre",a+" Jahren"]};return b?e[c][0]:e[c][1]}
+function qd(a,b,c,d){var e={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[a+" Tage",a+" Tagen"],M:["ein Monat","einem Monat"],MM:[a+" Monate",a+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[a+" Jahre",a+" Jahren"]};return b?e[c][0]:e[c][1]}
//! moment.js locale configuration
//! locale : estonian (et)
//! author : Henry Kehlmann : https://github.com/madhenry
//! improvements : Illimar Tambek : https://github.com/ragulka
-function jd(a,b,c,d){var e={s:["mõne sekundi","mõni sekund","paar sekundit"],m:["ühe minuti","üks minut"],mm:[a+" minuti",a+" minutit"],h:["ühe tunni","tund aega","üks tund"],hh:[a+" tunni",a+" tundi"],d:["ühe päeva","üks päev"],M:["kuu aja","kuu aega","üks kuu"],MM:[a+" kuu",a+" kuud"],y:["ühe aasta","aasta","üks aasta"],yy:[a+" aasta",a+" aastat"]};return b?e[c][2]?e[c][2]:e[c][1]:d?e[c][0]:e[c][1]}function kd(a,b,c,d){var e="";switch(c){case"s":return d?"muutaman sekunnin":"muutama sekunti";case"m":return d?"minuutin":"minuutti";case"mm":e=d?"minuutin":"minuuttia";break;case"h":return d?"tunnin":"tunti";case"hh":e=d?"tunnin":"tuntia";break;case"d":return d?"päivän":"päivä";case"dd":e=d?"päivän":"päivää";break;case"M":return d?"kuukauden":"kuukausi";case"MM":e=d?"kuukauden":"kuukautta";break;case"y":return d?"vuoden":"vuosi";case"yy":e=d?"vuoden":"vuotta"}return e=ld(a,d)+" "+e}function ld(a,b){return 10>a?b?kg[a]:jg[a]:a}
+function rd(a,b,c,d){var e={s:["mõne sekundi","mõni sekund","paar sekundit"],m:["ühe minuti","üks minut"],mm:[a+" minuti",a+" minutit"],h:["ühe tunni","tund aega","üks tund"],hh:[a+" tunni",a+" tundi"],d:["ühe päeva","üks päev"],M:["kuu aja","kuu aega","üks kuu"],MM:[a+" kuu",a+" kuud"],y:["ühe aasta","aasta","üks aasta"],yy:[a+" aasta",a+" aastat"]};return b?e[c][2]?e[c][2]:e[c][1]:d?e[c][0]:e[c][1]}function sd(a,b,c,d){var e="";switch(c){case"s":return d?"muutaman sekunnin":"muutama sekunti";case"m":return d?"minuutin":"minuutti";case"mm":e=d?"minuutin":"minuuttia";break;case"h":return d?"tunnin":"tunti";case"hh":e=d?"tunnin":"tuntia";break;case"d":return d?"päivän":"päivä";case"dd":e=d?"päivän":"päivää";break;case"M":return d?"kuukauden":"kuukausi";case"MM":e=d?"kuukauden":"kuukautta";break;case"y":return d?"vuoden":"vuosi";case"yy":e=d?"vuoden":"vuotta"}return e=td(a,d)+" "+e}function td(a,b){return 10>a?b?yg[a]:xg[a]:a}
//! moment.js locale configuration
//! locale : hrvatski (hr)
//! author : Bojan Marković : https://github.com/bmarkovic
-function md(a,b,c){var d=a+" ";switch(c){case"m":return b?"jedna minuta":"jedne minute";case"mm":return d+=1===a?"minuta":2===a||3===a||4===a?"minute":"minuta";case"h":return b?"jedan sat":"jednog sata";case"hh":return d+=1===a?"sat":2===a||3===a||4===a?"sata":"sati";case"dd":return d+=1===a?"dan":"dana";case"MM":return d+=1===a?"mjesec":2===a||3===a||4===a?"mjeseca":"mjeseci";case"yy":return d+=1===a?"godina":2===a||3===a||4===a?"godine":"godina"}}function nd(a,b,c,d){var e=a;switch(c){case"s":return d||b?"néhány másodperc":"néhány másodperce";case"m":return"egy"+(d||b?" perc":" perce");case"mm":return e+(d||b?" perc":" perce");case"h":return"egy"+(d||b?" óra":" órája");case"hh":return e+(d||b?" óra":" órája");case"d":return"egy"+(d||b?" nap":" napja");case"dd":return e+(d||b?" nap":" napja");case"M":return"egy"+(d||b?" hónap":" hónapja");case"MM":return e+(d||b?" hónap":" hónapja");case"y":return"egy"+(d||b?" év":" éve");case"yy":return e+(d||b?" év":" éve")}return""}function od(a){return(a?"":"[múlt] ")+"["+ug[this.day()]+"] LT[-kor]"}
+function ud(a,b,c){var d=a+" ";switch(c){case"m":return b?"jedna minuta":"jedne minute";case"mm":return d+=1===a?"minuta":2===a||3===a||4===a?"minute":"minuta";case"h":return b?"jedan sat":"jednog sata";case"hh":return d+=1===a?"sat":2===a||3===a||4===a?"sata":"sati";case"dd":return d+=1===a?"dan":"dana";case"MM":return d+=1===a?"mjesec":2===a||3===a||4===a?"mjeseca":"mjeseci";case"yy":return d+=1===a?"godina":2===a||3===a||4===a?"godine":"godina"}}function vd(a,b,c,d){var e=a;switch(c){case"s":return d||b?"néhány másodperc":"néhány másodperce";case"m":return"egy"+(d||b?" perc":" perce");case"mm":return e+(d||b?" perc":" perce");case"h":return"egy"+(d||b?" óra":" órája");case"hh":return e+(d||b?" óra":" órája");case"d":return"egy"+(d||b?" nap":" napja");case"dd":return e+(d||b?" nap":" napja");case"M":return"egy"+(d||b?" hónap":" hónapja");case"MM":return e+(d||b?" hónap":" hónapja");case"y":return"egy"+(d||b?" év":" éve");case"yy":return e+(d||b?" év":" éve")}return""}function wd(a){return(a?"":"[múlt] ")+"["+Ig[this.day()]+"] LT[-kor]"}
//! moment.js locale configuration
//! locale : icelandic (is)
//! author : Hinrik Örn Sigurðsson : https://github.com/hinrik
-function pd(a){return a%100===11?!0:a%10===1?!1:!0}function qd(a,b,c,d){var e=a+" ";switch(c){case"s":return b||d?"nokkrar sekúndur":"nokkrum sekúndum";case"m":return b?"mínúta":"mínútu";case"mm":return pd(a)?e+(b||d?"mínútur":"mínútum"):b?e+"mínúta":e+"mínútu";case"hh":return pd(a)?e+(b||d?"klukkustundir":"klukkustundum"):e+"klukkustund";case"d":return b?"dagur":d?"dag":"degi";case"dd":return pd(a)?b?e+"dagar":e+(d?"daga":"dögum"):b?e+"dagur":e+(d?"dag":"degi");case"M":return b?"mánuður":d?"mánuð":"mánuði";case"MM":return pd(a)?b?e+"mánuðir":e+(d?"mánuði":"mánuðum"):b?e+"mánuður":e+(d?"mánuð":"mánuði");case"y":return b||d?"ár":"ári";case"yy":return pd(a)?e+(b||d?"ár":"árum"):e+(b||d?"ár":"ári")}}
+function xd(a){return a%100===11?!0:a%10===1?!1:!0}function yd(a,b,c,d){var e=a+" ";switch(c){case"s":return b||d?"nokkrar sekúndur":"nokkrum sekúndum";case"m":return b?"mínúta":"mínútu";case"mm":return xd(a)?e+(b||d?"mínútur":"mínútum"):b?e+"mínúta":e+"mínútu";case"hh":return xd(a)?e+(b||d?"klukkustundir":"klukkustundum"):e+"klukkustund";case"d":return b?"dagur":d?"dag":"degi";case"dd":return xd(a)?b?e+"dagar":e+(d?"daga":"dögum"):b?e+"dagur":e+(d?"dag":"degi");case"M":return b?"mánuður":d?"mánuð":"mánuði";case"MM":return xd(a)?b?e+"mánuðir":e+(d?"mánuði":"mánuðum"):b?e+"mánuður":e+(d?"mánuð":"mánuði");case"y":return b||d?"ár":"ári";case"yy":return xd(a)?e+(b||d?"ár":"árum"):e+(b||d?"ár":"ári")}}
//! moment.js locale configuration
//! locale : Luxembourgish (lb)
//! author : mweimerskirch : https://github.com/mweimerskirch, David Raison : https://github.com/kwisatz
-function rd(a,b,c,d){var e={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 b?e[c][0]:e[c][1]}function sd(a){var b=a.substr(0,a.indexOf(" "));return ud(b)?"a "+a:"an "+a}function td(a){var b=a.substr(0,a.indexOf(" "));return ud(b)?"viru "+a:"virun "+a}function ud(a){if(a=parseInt(a,10),isNaN(a))return!1;if(0>a)return!0;if(10>a)return a>=4&&7>=a?!0:!1;if(100>a){var b=a%10,c=a/10;return ud(0===b?c:b)}if(1e4>a){for(;a>=10;)a/=10;return ud(a)}return a/=1e3,ud(a)}function vd(a,b,c,d){return b?"kelios sekundės":d?"kelių sekundžių":"kelias sekundes"}function wd(a,b,c,d){return b?yd(c)[0]:d?yd(c)[1]:yd(c)[2]}function xd(a){return a%10===0||a>10&&20>a}function yd(a){return wg[a].split("_")}function zd(a,b,c,d){var e=a+" ";return 1===a?e+wd(a,b,c[0],d):b?e+(xd(a)?yd(c)[1]:yd(c)[0]):d?e+yd(c)[1]:e+(xd(a)?yd(c)[1]:yd(c)[2])}function Ad(a,b,c){return c?b%10===1&&11!==b?a[2]:a[3]:b%10===1&&11!==b?a[0]:a[1]}function Bd(a,b,c){return a+" "+Ad(xg[c],a,b)}function Cd(a,b,c){return Ad(xg[c],a,b)}function Dd(a,b){return b?"dažas sekundes":"dažām sekundēm"}function Ed(a,b,c,d){var e="";if(b)switch(c){case"s":e="काही सेकंद";break;case"m":e="एक मिनिट";break;case"mm":e="%d मिनिटे";break;case"h":e="एक तास";break;case"hh":e="%d तास";break;case"d":e="एक दिवस";break;case"dd":e="%d दिवस";break;case"M":e="एक महिना";break;case"MM":e="%d महिने";break;case"y":e="एक वर्ष";break;case"yy":e="%d वर्षे"}else switch(c){case"s":e="काही सेकंदां";break;case"m":e="एका मिनिटा";break;case"mm":e="%d मिनिटां";break;case"h":e="एका तासा";break;case"hh":e="%d तासां";break;case"d":e="एका दिवसा";break;case"dd":e="%d दिवसां";break;case"M":e="एका महिन्या";break;case"MM":e="%d महिन्यां";break;case"y":e="एका वर्षा";break;case"yy":e="%d वर्षां"}return e.replace(/%d/i,a)}function Fd(a){return 5>a%10&&a%10>1&&~~(a/10)%10!==1}function Gd(a,b,c){var d=a+" ";switch(c){case"m":return b?"minuta":"minutę";case"mm":return d+(Fd(a)?"minuty":"minut");case"h":return b?"godzina":"godzinę";case"hh":return d+(Fd(a)?"godziny":"godzin");case"MM":return d+(Fd(a)?"miesiące":"miesięcy");case"yy":return d+(Fd(a)?"lata":"lat")}}
+function zd(a,b,c,d){var e={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 b?e[c][0]:e[c][1]}function Ad(a){var b=a.substr(0,a.indexOf(" "));return Cd(b)?"a "+a:"an "+a}function Bd(a){var b=a.substr(0,a.indexOf(" "));return Cd(b)?"viru "+a:"virun "+a}function Cd(a){if(a=parseInt(a,10),isNaN(a))return!1;if(0>a)return!0;if(10>a)return a>=4&&7>=a?!0:!1;if(100>a){var b=a%10,c=a/10;return Cd(0===b?c:b)}if(1e4>a){for(;a>=10;)a/=10;return Cd(a)}return a/=1e3,Cd(a)}function Dd(a,b,c,d){return b?"kelios sekundės":d?"kelių sekundžių":"kelias sekundes"}function Ed(a,b,c,d){return b?Gd(c)[0]:d?Gd(c)[1]:Gd(c)[2]}function Fd(a){return a%10===0||a>10&&20>a}function Gd(a){return Lg[a].split("_")}function Hd(a,b,c,d){var e=a+" ";return 1===a?e+Ed(a,b,c[0],d):b?e+(Fd(a)?Gd(c)[1]:Gd(c)[0]):d?e+Gd(c)[1]:e+(Fd(a)?Gd(c)[1]:Gd(c)[2])}function Id(a,b,c){return c?b%10===1&&11!==b?a[2]:a[3]:b%10===1&&11!==b?a[0]:a[1]}function Jd(a,b,c){return a+" "+Id(Mg[c],a,b)}function Kd(a,b,c){return Id(Mg[c],a,b)}function Ld(a,b){return b?"dažas sekundes":"dažām sekundēm"}function Md(a,b,c,d){var e="";if(b)switch(c){case"s":e="काही सेकंद";break;case"m":e="एक मिनिट";break;case"mm":e="%d मिनिटे";break;case"h":e="एक तास";break;case"hh":e="%d तास";break;case"d":e="एक दिवस";break;case"dd":e="%d दिवस";break;case"M":e="एक महिना";break;case"MM":e="%d महिने";break;case"y":e="एक वर्ष";break;case"yy":e="%d वर्षे"}else switch(c){case"s":e="काही सेकंदां";break;case"m":e="एका मिनिटा";break;case"mm":e="%d मिनिटां";break;case"h":e="एका तासा";break;case"hh":e="%d तासां";break;case"d":e="एका दिवसा";break;case"dd":e="%d दिवसां";break;case"M":e="एका महिन्या";break;case"MM":e="%d महिन्यां";break;case"y":e="एका वर्षा";break;case"yy":e="%d वर्षां"}return e.replace(/%d/i,a)}function Nd(a){return 5>a%10&&a%10>1&&~~(a/10)%10!==1}function Od(a,b,c){var d=a+" ";switch(c){case"m":return b?"minuta":"minutę";case"mm":return d+(Nd(a)?"minuty":"minut");case"h":return b?"godzina":"godzinę";case"hh":return d+(Nd(a)?"godziny":"godzin");case"MM":return d+(Nd(a)?"miesiące":"miesięcy");case"yy":return d+(Nd(a)?"lata":"lat")}}
//! moment.js locale configuration
//! locale : romanian (ro)
//! author : Vlad Gurdiga : https://github.com/gurdiga
//! author : Valentin Agachi : https://github.com/avaly
-function Hd(a,b,c){var d={mm:"minute",hh:"ore",dd:"zile",MM:"luni",yy:"ani"},e=" ";return(a%100>=20||a>=100&&a%100===0)&&(e=" de "),a+e+d[c]}
+function Pd(a,b,c){var d={mm:"minute",hh:"ore",dd:"zile",MM:"luni",yy:"ani"},e=" ";return(a%100>=20||a>=100&&a%100===0)&&(e=" de "),a+e+d[c]}
//! 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
-function Id(a,b){var c=a.split("_");return b%10===1&&b%100!==11?c[0]:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?c[1]:c[2]}function Jd(a,b,c){var d={mm:b?"минута_минуты_минут":"минуту_минуты_минут",hh:"час_часа_часов",dd:"день_дня_дней",MM:"месяц_месяца_месяцев",yy:"год_года_лет"};return"m"===c?b?"минута":"минуту":a+" "+Id(d[c],+a)}function Kd(a){return a>1&&5>a}function Ld(a,b,c,d){var e=a+" ";switch(c){case"s":return b||d?"pár sekúnd":"pár sekundami";case"m":return b?"minúta":d?"minútu":"minútou";case"mm":return b||d?e+(Kd(a)?"minúty":"minút"):e+"minútami";break;case"h":return b?"hodina":d?"hodinu":"hodinou";case"hh":return b||d?e+(Kd(a)?"hodiny":"hodín"):e+"hodinami";break;case"d":return b||d?"deň":"dňom";case"dd":return b||d?e+(Kd(a)?"dni":"dní"):e+"dňami";break;case"M":return b||d?"mesiac":"mesiacom";case"MM":return b||d?e+(Kd(a)?"mesiace":"mesiacov"):e+"mesiacmi";break;case"y":return b||d?"rok":"rokom";case"yy":return b||d?e+(Kd(a)?"roky":"rokov"):e+"rokmi"}}
+function Qd(a,b){var c=a.split("_");return b%10===1&&b%100!==11?c[0]:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?c[1]:c[2]}function Rd(a,b,c){var d={mm:b?"минута_минуты_минут":"минуту_минуты_минут",hh:"час_часа_часов",dd:"день_дня_дней",MM:"месяц_месяца_месяцев",yy:"год_года_лет"};return"m"===c?b?"минута":"минуту":a+" "+Qd(d[c],+a)}function Sd(a){return a>1&&5>a}function Td(a,b,c,d){var e=a+" ";switch(c){case"s":return b||d?"pár sekúnd":"pár sekundami";case"m":return b?"minúta":d?"minútu":"minútou";case"mm":return b||d?e+(Sd(a)?"minúty":"minút"):e+"minútami";break;case"h":return b?"hodina":d?"hodinu":"hodinou";case"hh":return b||d?e+(Sd(a)?"hodiny":"hodín"):e+"hodinami";break;case"d":return b||d?"deň":"dňom";case"dd":return b||d?e+(Sd(a)?"dni":"dní"):e+"dňami";break;case"M":return b||d?"mesiac":"mesiacom";case"MM":return b||d?e+(Sd(a)?"mesiace":"mesiacov"):e+"mesiacmi";break;case"y":return b||d?"rok":"rokom";case"yy":return b||d?e+(Sd(a)?"roky":"rokov"):e+"rokmi"}}
//! moment.js locale configuration
//! locale : slovenian (sl)
//! author : Robert Sedovšek : https://github.com/sedovsek
-function Md(a,b,c,d){var e=a+" ";switch(c){case"s":return b||d?"nekaj sekund":"nekaj sekundami";case"m":return b?"ena minuta":"eno minuto";case"mm":return e+=1===a?b?"minuta":"minuto":2===a?b||d?"minuti":"minutama":5>a?b||d?"minute":"minutami":b||d?"minut":"minutami";case"h":return b?"ena ura":"eno uro";case"hh":return e+=1===a?b?"ura":"uro":2===a?b||d?"uri":"urama":5>a?b||d?"ure":"urami":b||d?"ur":"urami";case"d":return b||d?"en dan":"enim dnem";case"dd":return e+=1===a?b||d?"dan":"dnem":2===a?b||d?"dni":"dnevoma":b||d?"dni":"dnevi";case"M":return b||d?"en mesec":"enim mesecem";case"MM":return e+=1===a?b||d?"mesec":"mesecem":2===a?b||d?"meseca":"mesecema":5>a?b||d?"mesece":"meseci":b||d?"mesecev":"meseci";case"y":return b||d?"eno leto":"enim letom";case"yy":return e+=1===a?b||d?"leto":"letom":2===a?b||d?"leti":"letoma":5>a?b||d?"leta":"leti":b||d?"let":"leti"}}function Nd(a){var b=a;return b=-1!==a.indexOf("jaj")?b.slice(0,-3)+"leS":-1!==a.indexOf("jar")?b.slice(0,-3)+"waQ":-1!==a.indexOf("DIS")?b.slice(0,-3)+"nem":b+" pIq"}function Od(a){var b=a;return b=-1!==a.indexOf("jaj")?b.slice(0,-3)+"Hu’":-1!==a.indexOf("jar")?b.slice(0,-3)+"wen":-1!==a.indexOf("DIS")?b.slice(0,-3)+"ben":b+" ret"}function Pd(a,b,c,d){var e=Qd(a);switch(c){case"mm":return e+" tup";case"hh":return e+" rep";case"dd":return e+" jaj";case"MM":return e+" jar";case"yy":return e+" DIS"}}function Qd(a){var b=Math.floor(a%1e3/100),c=Math.floor(a%100/10),d=a%10,e="";return b>0&&(e+=Sg[b]+"vatlh"),c>0&&(e+=(""!==e?" ":"")+Sg[c]+"maH"),d>0&&(e+=(""!==e?" ":"")+Sg[d]),""===e?"pagh":e}function Rd(a,b,c,d){var e={s:["viensas secunds","'iensas secunds"],m:["'n míut","'iens míut"],mm:[a+" míuts",""+a+" míuts"],h:["'n þora","'iensa þora"],hh:[a+" þoras",""+a+" þoras"],d:["'n ziua","'iensa ziua"],dd:[a+" ziuas",""+a+" ziuas"],M:["'n mes","'iens mes"],MM:[a+" mesen",""+a+" mesen"],y:["'n ar","'iens ar"],yy:[a+" ars",""+a+" ars"]};return d?e[c][0]:b?e[c][0]:e[c][1]}
+function Ud(a,b,c,d){var e=a+" ";switch(c){case"s":return b||d?"nekaj sekund":"nekaj sekundami";case"m":return b?"ena minuta":"eno minuto";case"mm":return e+=1===a?b?"minuta":"minuto":2===a?b||d?"minuti":"minutama":5>a?b||d?"minute":"minutami":b||d?"minut":"minutami";case"h":return b?"ena ura":"eno uro";case"hh":return e+=1===a?b?"ura":"uro":2===a?b||d?"uri":"urama":5>a?b||d?"ure":"urami":b||d?"ur":"urami";case"d":return b||d?"en dan":"enim dnem";case"dd":return e+=1===a?b||d?"dan":"dnem":2===a?b||d?"dni":"dnevoma":b||d?"dni":"dnevi";case"M":return b||d?"en mesec":"enim mesecem";case"MM":return e+=1===a?b||d?"mesec":"mesecem":2===a?b||d?"meseca":"mesecema":5>a?b||d?"mesece":"meseci":b||d?"mesecev":"meseci";case"y":return b||d?"eno leto":"enim letom";case"yy":return e+=1===a?b||d?"leto":"letom":2===a?b||d?"leti":"letoma":5>a?b||d?"leta":"leti":b||d?"let":"leti"}}function Vd(a){var b=a;return b=-1!==a.indexOf("jaj")?b.slice(0,-3)+"leS":-1!==a.indexOf("jar")?b.slice(0,-3)+"waQ":-1!==a.indexOf("DIS")?b.slice(0,-3)+"nem":b+" pIq"}function Wd(a){var b=a;return b=-1!==a.indexOf("jaj")?b.slice(0,-3)+"Hu’":-1!==a.indexOf("jar")?b.slice(0,-3)+"wen":-1!==a.indexOf("DIS")?b.slice(0,-3)+"ben":b+" ret"}function Xd(a,b,c,d){var e=Yd(a);switch(c){case"mm":return e+" tup";case"hh":return e+" rep";case"dd":return e+" jaj";case"MM":return e+" jar";case"yy":return e+" DIS"}}function Yd(a){var b=Math.floor(a%1e3/100),c=Math.floor(a%100/10),d=a%10,e="";return b>0&&(e+=fh[b]+"vatlh"),c>0&&(e+=(""!==e?" ":"")+fh[c]+"maH"),d>0&&(e+=(""!==e?" ":"")+fh[d]),""===e?"pagh":e}function Zd(a,b,c,d){var e={s:["viensas secunds","'iensas secunds"],m:["'n míut","'iens míut"],mm:[a+" míuts",""+a+" míuts"],h:["'n þora","'iensa þora"],hh:[a+" þoras",""+a+" þoras"],d:["'n ziua","'iensa ziua"],dd:[a+" ziuas",""+a+" ziuas"],M:["'n mes","'iens mes"],MM:[a+" mesen",""+a+" mesen"],y:["'n ar","'iens ar"],yy:[a+" ars",""+a+" ars"]};return d?e[c][0]:b?e[c][0]:e[c][1]}
//! moment.js locale configuration
//! locale : ukrainian (uk)
//! author : zemlanin : https://github.com/zemlanin
//! Author : Menelion Elensúle : https://github.com/Oire
-function Sd(a,b){var c=a.split("_");return b%10===1&&b%100!==11?c[0]:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?c[1]:c[2]}function Td(a,b,c){var d={mm:b?"хвилина_хвилини_хвилин":"хвилину_хвилини_хвилин",hh:b?"година_години_годин":"годину_години_годин",dd:"день_дні_днів",MM:"місяць_місяці_місяців",yy:"рік_роки_років"};return"m"===c?b?"хвилина":"хвилину":"h"===c?b?"година":"годину":a+" "+Sd(d[c],+a)}function Ud(a,b){var c={nominative:"неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота".split("_"),accusative:"неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу".split("_"),genitive:"неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи".split("_")},d=/(\[[ВвУу]\]) ?dddd/.test(b)?"accusative":/\[?(?:минулої|наступної)? ?\] ?dddd/.test(b)?"genitive":"nominative";return c[d][a.day()]}function Vd(a){return function(){return a+"о"+(11===this.hours()?"б":"")+"] LT"}}var Wd,Xd=a.momentProperties=[],Yd=!1,Zd={};a.suppressDeprecationWarnings=!1;var $d,_d={},ae={},be=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,ce=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,de={},ee={},fe=/\d/,ge=/\d\d/,he=/\d{3}/,ie=/\d{4}/,je=/[+-]?\d{6}/,ke=/\d\d?/,le=/\d\d\d\d?/,me=/\d\d\d\d\d\d?/,ne=/\d{1,3}/,oe=/\d{1,4}/,pe=/[+-]?\d{1,6}/,qe=/\d+/,re=/[+-]?\d+/,se=/Z|[+-]\d\d:?\d\d/gi,te=/Z|[+-]\d\d(?::?\d\d)?/gi,ue=/[+-]?\d+(\.\d{1,3})?/,ve=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,we={},xe={},ye=0,ze=1,Ae=2,Be=3,Ce=4,De=5,Ee=6,Fe=7,Ge=8;R("M",["MM",2],"Mo",function(){return this.month()+1}),R("MMM",0,0,function(a){return this.localeData().monthsShort(this,a)}),R("MMMM",0,0,function(a){return this.localeData().months(this,a)}),J("month","M"),W("M",ke),W("MM",ke,ge),W("MMM",function(a,b){return b.monthsShortRegex(a)}),W("MMMM",function(a,b){return b.monthsRegex(a)}),$(["M","MM"],function(a,b){b[ze]=r(a)-1}),$(["MMM","MMMM"],function(a,b,c,d){var e=c._locale.monthsParse(a,d,c._strict);null!=e?b[ze]=e:j(c).invalidMonth=a});var He=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/,Ie="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Je="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Ke=ve,Le=ve,Me=/^\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)?)?/,Ne=/^\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)?)?/,Oe=/Z|[+-]\d\d(?::?\d\d)?/,Pe=[["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}/]],Qe=[["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/]],Re=/^\/?Date\((\-?\d+)/i;a.createFromInputFallback=u("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),R("Y",0,0,function(){var a=this.year();return 9999>=a?""+a:"+"+a}),R(0,["YY",2],0,function(){return this.year()%100}),R(0,["YYYY",4],0,"year"),R(0,["YYYYY",5],0,"year"),R(0,["YYYYYY",6,!0],0,"year"),J("year","y"),W("Y",re),W("YY",ke,ge),W("YYYY",oe,ie),W("YYYYY",pe,je),W("YYYYYY",pe,je),$(["YYYYY","YYYYYY"],ye),$("YYYY",function(b,c){c[ye]=2===b.length?a.parseTwoDigitYear(b):r(b)}),$("YY",function(b,c){c[ye]=a.parseTwoDigitYear(b)}),$("Y",function(a,b){b[ye]=parseInt(a,10)}),a.parseTwoDigitYear=function(a){return r(a)+(r(a)>68?1900:2e3)};var Se=M("FullYear",!1);a.ISO_8601=function(){};var Te=u("moment().min is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var a=Ja.apply(null,arguments);return this.isValid()&&a.isValid()?this>a?this:a:l()}),Ue=u("moment().max is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var a=Ja.apply(null,arguments);return this.isValid()&&a.isValid()?a>this?this:a:l()}),Ve=function(){return Date.now?Date.now():+new Date};Pa("Z",":"),Pa("ZZ",""),W("Z",te),W("ZZ",te),$(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Qa(te,a)});var We=/([\+\-]|\d\d)/gi;a.updateOffset=function(){};var Xe=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?\d*)?$/,Ye=/^(-)?P(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)W)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?$/;cb.fn=Na.prototype;var Ze=hb(1,"add"),$e=hb(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";var _e=u("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});R(0,["gg",2],0,function(){return this.weekYear()%100}),R(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Ob("gggg","weekYear"),Ob("ggggg","weekYear"),Ob("GGGG","isoWeekYear"),Ob("GGGGG","isoWeekYear"),J("weekYear","gg"),J("isoWeekYear","GG"),W("G",re),W("g",re),W("GG",ke,ge),W("gg",ke,ge),W("GGGG",oe,ie),W("gggg",oe,ie),W("GGGGG",pe,je),W("ggggg",pe,je),_(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=r(a)}),_(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),R("Q",0,"Qo","quarter"),J("quarter","Q"),W("Q",fe),$("Q",function(a,b){b[ze]=3*(r(a)-1)}),R("w",["ww",2],"wo","week"),R("W",["WW",2],"Wo","isoWeek"),J("week","w"),J("isoWeek","W"),W("w",ke),W("ww",ke,ge),W("W",ke),W("WW",ke,ge),_(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=r(a)});var af={dow:0,doy:6};R("D",["DD",2],"Do","date"),J("date","D"),W("D",ke),W("DD",ke,ge),W("Do",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),$(["D","DD"],Ae),$("Do",function(a,b){b[Ae]=r(a.match(ke)[0],10)});var bf=M("Date",!0);R("d",0,"do","day"),R("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),R("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),R("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),R("e",0,0,"weekday"),R("E",0,0,"isoWeekday"),J("day","d"),J("weekday","e"),J("isoWeekday","E"),W("d",ke),W("e",ke),W("E",ke),W("dd",ve),W("ddd",ve),W("dddd",ve),_(["dd","ddd","dddd"],function(a,b,c,d){var e=c._locale.weekdaysParse(a,d,c._strict);null!=e?b.d=e:j(c).invalidWeekday=a}),_(["d","e","E"],function(a,b,c,d){b[d]=r(a)});var cf="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),df="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),ef="Su_Mo_Tu_We_Th_Fr_Sa".split("_");R("DDD",["DDDD",3],"DDDo","dayOfYear"),J("dayOfYear","DDD"),W("DDD",ne),W("DDDD",he),$(["DDD","DDDD"],function(a,b,c){c._dayOfYear=r(a)}),R("H",["HH",2],0,"hour"),R("h",["hh",2],0,ic),R("hmm",0,0,function(){return""+ic.apply(this)+Q(this.minutes(),2)}),R("hmmss",0,0,function(){return""+ic.apply(this)+Q(this.minutes(),2)+Q(this.seconds(),2)}),R("Hmm",0,0,function(){return""+this.hours()+Q(this.minutes(),2)}),R("Hmmss",0,0,function(){return""+this.hours()+Q(this.minutes(),2)+Q(this.seconds(),2)}),jc("a",!0),jc("A",!1),J("hour","h"),W("a",kc),W("A",kc),W("H",ke),W("h",ke),W("HH",ke,ge),W("hh",ke,ge),W("hmm",le),W("hmmss",me),W("Hmm",le),W("Hmmss",me),$(["H","HH"],Be),$(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),$(["h","hh"],function(a,b,c){b[Be]=r(a),j(c).bigHour=!0}),$("hmm",function(a,b,c){var d=a.length-2;b[Be]=r(a.substr(0,d)),b[Ce]=r(a.substr(d)),j(c).bigHour=!0}),$("hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[Be]=r(a.substr(0,d)),b[Ce]=r(a.substr(d,2)),b[De]=r(a.substr(e)),j(c).bigHour=!0}),$("Hmm",function(a,b,c){var d=a.length-2;b[Be]=r(a.substr(0,d)),b[Ce]=r(a.substr(d))}),$("Hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[Be]=r(a.substr(0,d)),b[Ce]=r(a.substr(d,2)),b[De]=r(a.substr(e))});var ff=/[ap]\.?m?\.?/i,gf=M("Hours",!0);R("m",["mm",2],0,"minute"),J("minute","m"),W("m",ke),W("mm",ke,ge),$(["m","mm"],Ce);var hf=M("Minutes",!1);R("s",["ss",2],0,"second"),J("second","s"),W("s",ke),W("ss",ke,ge),$(["s","ss"],De);var jf=M("Seconds",!1);R("S",0,0,function(){return~~(this.millisecond()/100)}),R(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),R(0,["SSS",3],0,"millisecond"),R(0,["SSSS",4],0,function(){return 10*this.millisecond()}),R(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),R(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),R(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),R(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),R(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),J("millisecond","ms"),W("S",ne,fe),W("SS",ne,ge),W("SSS",ne,he);var kf;for(kf="SSSS";kf.length<=9;kf+="S")W(kf,qe);for(kf="S";kf.length<=9;kf+="S")$(kf,nc);var lf=M("Milliseconds",!1);R("z",0,0,"zoneAbbr"),R("zz",0,0,"zoneName");var mf=o.prototype;mf.add=Ze,mf.calendar=jb,mf.clone=kb,mf.diff=rb,mf.endOf=Db,mf.format=vb,mf.from=wb,mf.fromNow=xb,mf.to=yb,mf.toNow=zb,mf.get=P,mf.invalidAt=Mb,mf.isAfter=lb,mf.isBefore=mb,mf.isBetween=nb,mf.isSame=ob,mf.isSameOrAfter=pb,mf.isSameOrBefore=qb,mf.isValid=Kb,mf.lang=_e,mf.locale=Ab,mf.localeData=Bb,mf.max=Ue,mf.min=Te,mf.parsingFlags=Lb,mf.set=P,mf.startOf=Cb,mf.subtract=$e,mf.toArray=Hb,mf.toObject=Ib,mf.toDate=Gb,mf.toISOString=ub,mf.toJSON=Jb,mf.toString=tb,mf.unix=Fb,mf.valueOf=Eb,mf.creationData=Nb,mf.year=Se,mf.isLeapYear=sa,mf.weekYear=Pb,mf.isoWeekYear=Qb,mf.quarter=mf.quarters=Vb,mf.month=ga,mf.daysInMonth=ha,mf.week=mf.weeks=Zb,mf.isoWeek=mf.isoWeeks=$b,mf.weeksInYear=Sb,mf.isoWeeksInYear=Rb,mf.date=bf,mf.day=mf.days=ec,mf.weekday=fc,mf.isoWeekday=gc,mf.dayOfYear=hc,mf.hour=mf.hours=gf,mf.minute=mf.minutes=hf,mf.second=mf.seconds=jf,mf.millisecond=mf.milliseconds=lf,mf.utcOffset=Ta,mf.utc=Va,mf.local=Wa,mf.parseZone=Xa,mf.hasAlignedHourOffset=Ya,mf.isDST=Za,mf.isDSTShifted=$a,mf.isLocal=_a,mf.isUtcOffset=ab,mf.isUtc=bb,mf.isUTC=bb,mf.zoneAbbr=oc,mf.zoneName=pc,mf.dates=u("dates accessor is deprecated. Use date instead.",bf),mf.months=u("months accessor is deprecated. Use month instead",ga),mf.years=u("years accessor is deprecated. Use year instead",Se),mf.zone=u("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",Ua);var nf=mf,of={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},pf={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"},qf="Invalid date",rf="%d",sf=/\d{1,2}/,tf={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"},uf=A.prototype;uf._calendar=of,uf.calendar=sc,uf._longDateFormat=pf,uf.longDateFormat=tc,uf._invalidDate=qf,uf.invalidDate=uc,uf._ordinal=rf,uf.ordinal=vc,uf._ordinalParse=sf,uf.preparse=wc,uf.postformat=wc,uf._relativeTime=tf,uf.relativeTime=xc,uf.pastFuture=yc,uf.set=y,uf.months=ca,uf._months=Ie,uf.monthsShort=da,uf._monthsShort=Je,uf.monthsParse=ea,uf._monthsRegex=Le,uf.monthsRegex=ja,uf._monthsShortRegex=Ke,uf.monthsShortRegex=ia,uf.week=Wb,uf._week=af,uf.firstDayOfYear=Yb,uf.firstDayOfWeek=Xb,uf.weekdays=ac,uf._weekdays=cf,uf.weekdaysMin=cc,uf._weekdaysMin=ef,uf.weekdaysShort=bc,uf._weekdaysShort=df,uf.weekdaysParse=dc,uf.isPM=lc,uf._meridiemParse=ff,uf.meridiem=mc,E("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===r(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),a.lang=u("moment.lang is deprecated. Use moment.locale instead.",E),a.langData=u("moment.langData is deprecated. Use moment.localeData instead.",H);var vf=Math.abs,wf=Qc("ms"),xf=Qc("s"),yf=Qc("m"),zf=Qc("h"),Af=Qc("d"),Bf=Qc("w"),Cf=Qc("M"),Df=Qc("y"),Ef=Sc("milliseconds"),Ff=Sc("seconds"),Gf=Sc("minutes"),Hf=Sc("hours"),If=Sc("days"),Jf=Sc("months"),Kf=Sc("years"),Lf=Math.round,Mf={s:45,m:45,h:22,d:26,M:11},Nf=Math.abs,Of=Na.prototype;Of.abs=Gc,Of.add=Ic,Of.subtract=Jc,Of.as=Oc,Of.asMilliseconds=wf,Of.asSeconds=xf,Of.asMinutes=yf,Of.asHours=zf,Of.asDays=Af,Of.asWeeks=Bf,Of.asMonths=Cf,Of.asYears=Df,Of.valueOf=Pc,Of._bubble=Lc,Of.get=Rc,Of.milliseconds=Ef,Of.seconds=Ff,Of.minutes=Gf,Of.hours=Hf,Of.days=If,Of.weeks=Tc,Of.months=Jf,Of.years=Kf,Of.humanize=Xc,Of.toISOString=Yc,Of.toString=Yc,Of.toJSON=Yc,Of.locale=Ab,Of.localeData=Bb,Of.toIsoString=u("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Yc),Of.lang=_e,R("X",0,0,"unix"),R("x",0,0,"valueOf"),W("x",re),W("X",ue),$("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),$("x",function(a,b,c){c._d=new Date(r(a))}),
+function $d(a,b){var c=a.split("_");return b%10===1&&b%100!==11?c[0]:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?c[1]:c[2]}function _d(a,b,c){var d={mm:b?"хвилина_хвилини_хвилин":"хвилину_хвилини_хвилин",hh:b?"година_години_годин":"годину_години_годин",dd:"день_дні_днів",MM:"місяць_місяці_місяців",yy:"рік_роки_років"};return"m"===c?b?"хвилина":"хвилину":"h"===c?b?"година":"годину":a+" "+$d(d[c],+a)}function ae(a,b){var c={nominative:"неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота".split("_"),accusative:"неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу".split("_"),genitive:"неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи".split("_")},d=/(\[[ВвУу]\]) ?dddd/.test(b)?"accusative":/\[?(?:минулої|наступної)? ?\] ?dddd/.test(b)?"genitive":"nominative";return c[d][a.day()]}function be(a){return function(){return a+"о"+(11===this.hours()?"б":"")+"] LT"}}var ce,de;de=Array.prototype.some?Array.prototype.some:function(a){for(var b=Object(this),c=b.length>>>0,d=0;c>d;d++)if(d in b&&a.call(this,b[d],d,b))return!0;return!1};var ee=a.momentProperties=[],fe=!1,ge={};a.suppressDeprecationWarnings=!1,a.deprecationHandler=null;var he;he=Object.keys?Object.keys:function(a){var b,c=[];for(b in a)f(a,b)&&c.push(b);return c};var ie,je,ke={},le={},me=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,ne=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,oe={},pe={},qe=/\d/,re=/\d\d/,se=/\d{3}/,te=/\d{4}/,ue=/[+-]?\d{6}/,ve=/\d\d?/,we=/\d\d\d\d?/,xe=/\d\d\d\d\d\d?/,ye=/\d{1,3}/,ze=/\d{1,4}/,Ae=/[+-]?\d{1,6}/,Be=/\d+/,Ce=/[+-]?\d+/,De=/Z|[+-]\d\d:?\d\d/gi,Ee=/Z|[+-]\d\d(?::?\d\d)?/gi,Fe=/[+-]?\d+(\.\d{1,3})?/,Ge=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,He={},Ie={},Je=0,Ke=1,Le=2,Me=3,Ne=4,Oe=5,Pe=6,Qe=7,Re=8;je=Array.prototype.indexOf?Array.prototype.indexOf:function(a){var b;for(b=0;b<this.length;++b)if(this[b]===a)return b;return-1},R("M",["MM",2],"Mo",function(){return this.month()+1}),R("MMM",0,0,function(a){return this.localeData().monthsShort(this,a)}),R("MMMM",0,0,function(a){return this.localeData().months(this,a)}),J("month","M"),W("M",ve),W("MM",ve,re),W("MMM",function(a,b){return b.monthsShortRegex(a)}),W("MMMM",function(a,b){return b.monthsRegex(a)}),$(["M","MM"],function(a,b){b[Ke]=r(a)-1}),$(["MMM","MMMM"],function(a,b,c,d){var e=c._locale.monthsParse(a,d,c._strict);null!=e?b[Ke]=e:j(c).invalidMonth=a});var Se=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/,Te="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Ue="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Ve=Ge,We=Ge,Xe=/^\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)?)?/,Ye=/^\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)?)?/,Ze=/Z|[+-]\d\d(?::?\d\d)?/,$e=[["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}/]],_e=[["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/]],af=/^\/?Date\((\-?\d+)/i;a.createFromInputFallback=u("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),R("Y",0,0,function(){var a=this.year();return 9999>=a?""+a:"+"+a}),R(0,["YY",2],0,function(){return this.year()%100}),R(0,["YYYY",4],0,"year"),R(0,["YYYYY",5],0,"year"),R(0,["YYYYYY",6,!0],0,"year"),J("year","y"),W("Y",Ce),W("YY",ve,re),W("YYYY",ze,te),W("YYYYY",Ae,ue),W("YYYYYY",Ae,ue),$(["YYYYY","YYYYYY"],Je),$("YYYY",function(b,c){c[Je]=2===b.length?a.parseTwoDigitYear(b):r(b)}),$("YY",function(b,c){c[Je]=a.parseTwoDigitYear(b)}),$("Y",function(a,b){b[Je]=parseInt(a,10)}),a.parseTwoDigitYear=function(a){return r(a)+(r(a)>68?1900:2e3)};var bf=M("FullYear",!0);a.ISO_8601=function(){};var cf=u("moment().min is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var a=Ka.apply(null,arguments);return this.isValid()&&a.isValid()?this>a?this:a:l()}),df=u("moment().max is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var a=Ka.apply(null,arguments);return this.isValid()&&a.isValid()?a>this?this:a:l()}),ef=function(){return Date.now?Date.now():+new Date};Qa("Z",":"),Qa("ZZ",""),W("Z",Ee),W("ZZ",Ee),$(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Ra(Ee,a)});var ff=/([\+\-]|\d\d)/gi;a.updateOffset=function(){};var gf=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?\d*)?$/,hf=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;db.fn=Oa.prototype;var jf=ib(1,"add"),kf=ib(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",a.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var lf=u("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});R(0,["gg",2],0,function(){return this.weekYear()%100}),R(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Pb("gggg","weekYear"),Pb("ggggg","weekYear"),Pb("GGGG","isoWeekYear"),Pb("GGGGG","isoWeekYear"),J("weekYear","gg"),J("isoWeekYear","GG"),W("G",Ce),W("g",Ce),W("GG",ve,re),W("gg",ve,re),W("GGGG",ze,te),W("gggg",ze,te),W("GGGGG",Ae,ue),W("ggggg",Ae,ue),_(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=r(a)}),_(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),R("Q",0,"Qo","quarter"),J("quarter","Q"),W("Q",qe),$("Q",function(a,b){b[Ke]=3*(r(a)-1)}),R("w",["ww",2],"wo","week"),R("W",["WW",2],"Wo","isoWeek"),J("week","w"),J("isoWeek","W"),W("w",ve),W("ww",ve,re),W("W",ve),W("WW",ve,re),_(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=r(a)});var mf={dow:0,doy:6};R("D",["DD",2],"Do","date"),J("date","D"),W("D",ve),W("DD",ve,re),W("Do",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),$(["D","DD"],Le),$("Do",function(a,b){b[Le]=r(a.match(ve)[0],10)});var nf=M("Date",!0);R("d",0,"do","day"),R("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),R("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),R("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),R("e",0,0,"weekday"),R("E",0,0,"isoWeekday"),J("day","d"),J("weekday","e"),J("isoWeekday","E"),W("d",ve),W("e",ve),W("E",ve),W("dd",function(a,b){return b.weekdaysMinRegex(a)}),W("ddd",function(a,b){return b.weekdaysShortRegex(a)}),W("dddd",function(a,b){return b.weekdaysRegex(a)}),_(["dd","ddd","dddd"],function(a,b,c,d){var e=c._locale.weekdaysParse(a,d,c._strict);null!=e?b.d=e:j(c).invalidWeekday=a}),_(["d","e","E"],function(a,b,c,d){b[d]=r(a)});var of="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),pf="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),qf="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),rf=Ge,sf=Ge,tf=Ge;R("DDD",["DDDD",3],"DDDo","dayOfYear"),J("dayOfYear","DDD"),W("DDD",ye),W("DDDD",se),$(["DDD","DDDD"],function(a,b,c){c._dayOfYear=r(a)}),R("H",["HH",2],0,"hour"),R("h",["hh",2],0,oc),R("k",["kk",2],0,pc),R("hmm",0,0,function(){return""+oc.apply(this)+Q(this.minutes(),2)}),R("hmmss",0,0,function(){return""+oc.apply(this)+Q(this.minutes(),2)+Q(this.seconds(),2)}),R("Hmm",0,0,function(){return""+this.hours()+Q(this.minutes(),2)}),R("Hmmss",0,0,function(){return""+this.hours()+Q(this.minutes(),2)+Q(this.seconds(),2)}),qc("a",!0),qc("A",!1),J("hour","h"),W("a",rc),W("A",rc),W("H",ve),W("h",ve),W("HH",ve,re),W("hh",ve,re),W("hmm",we),W("hmmss",xe),W("Hmm",we),W("Hmmss",xe),$(["H","HH"],Me),$(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),$(["h","hh"],function(a,b,c){b[Me]=r(a),j(c).bigHour=!0}),$("hmm",function(a,b,c){var d=a.length-2;b[Me]=r(a.substr(0,d)),b[Ne]=r(a.substr(d)),j(c).bigHour=!0}),$("hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[Me]=r(a.substr(0,d)),b[Ne]=r(a.substr(d,2)),b[Oe]=r(a.substr(e)),j(c).bigHour=!0}),$("Hmm",function(a,b,c){var d=a.length-2;b[Me]=r(a.substr(0,d)),b[Ne]=r(a.substr(d))}),$("Hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[Me]=r(a.substr(0,d)),b[Ne]=r(a.substr(d,2)),b[Oe]=r(a.substr(e))});var uf=/[ap]\.?m?\.?/i,vf=M("Hours",!0);R("m",["mm",2],0,"minute"),J("minute","m"),W("m",ve),W("mm",ve,re),$(["m","mm"],Ne);var wf=M("Minutes",!1);R("s",["ss",2],0,"second"),J("second","s"),W("s",ve),W("ss",ve,re),$(["s","ss"],Oe);var xf=M("Seconds",!1);R("S",0,0,function(){return~~(this.millisecond()/100)}),R(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),R(0,["SSS",3],0,"millisecond"),R(0,["SSSS",4],0,function(){return 10*this.millisecond()}),R(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),R(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),R(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),R(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),R(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),J("millisecond","ms"),W("S",ye,qe),W("SS",ye,re),W("SSS",ye,se);var yf;for(yf="SSSS";yf.length<=9;yf+="S")W(yf,Be);for(yf="S";yf.length<=9;yf+="S")$(yf,uc);var zf=M("Milliseconds",!1);R("z",0,0,"zoneAbbr"),R("zz",0,0,"zoneName");var Af=o.prototype;Af.add=jf,Af.calendar=kb,Af.clone=lb,Af.diff=sb,Af.endOf=Eb,Af.format=wb,Af.from=xb,Af.fromNow=yb,Af.to=zb,Af.toNow=Ab,Af.get=P,Af.invalidAt=Nb,Af.isAfter=mb,Af.isBefore=nb,Af.isBetween=ob,Af.isSame=pb,Af.isSameOrAfter=qb,Af.isSameOrBefore=rb,Af.isValid=Lb,Af.lang=lf,Af.locale=Bb,Af.localeData=Cb,Af.max=df,Af.min=cf,Af.parsingFlags=Mb,Af.set=P,Af.startOf=Db,Af.subtract=kf,Af.toArray=Ib,Af.toObject=Jb,Af.toDate=Hb,Af.toISOString=vb,Af.toJSON=Kb,Af.toString=ub,Af.unix=Gb,Af.valueOf=Fb,Af.creationData=Ob,Af.year=bf,Af.isLeapYear=ta,Af.weekYear=Qb,Af.isoWeekYear=Rb,Af.quarter=Af.quarters=Wb,Af.month=ha,Af.daysInMonth=ia,Af.week=Af.weeks=$b,Af.isoWeek=Af.isoWeeks=_b,Af.weeksInYear=Tb,Af.isoWeeksInYear=Sb,Af.date=nf,Af.day=Af.days=gc,Af.weekday=hc,Af.isoWeekday=ic,Af.dayOfYear=nc,Af.hour=Af.hours=vf,Af.minute=Af.minutes=wf,Af.second=Af.seconds=xf,Af.millisecond=Af.milliseconds=zf,Af.utcOffset=Ua,Af.utc=Wa,Af.local=Xa,Af.parseZone=Ya,Af.hasAlignedHourOffset=Za,Af.isDST=$a,Af.isDSTShifted=_a,Af.isLocal=ab,Af.isUtcOffset=bb,Af.isUtc=cb,Af.isUTC=cb,Af.zoneAbbr=vc,Af.zoneName=wc,Af.dates=u("dates accessor is deprecated. Use date instead.",nf),Af.months=u("months accessor is deprecated. Use month instead",ha),Af.years=u("years accessor is deprecated. Use year instead",bf),Af.zone=u("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",Va);var Bf=Af,Cf={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},Df={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"},Ef="Invalid date",Ff="%d",Gf=/\d{1,2}/,Hf={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"},If=A.prototype;If._calendar=Cf,If.calendar=zc,If._longDateFormat=Df,If.longDateFormat=Ac,If._invalidDate=Ef,If.invalidDate=Bc,If._ordinal=Ff,If.ordinal=Cc,If._ordinalParse=Gf,If.preparse=Dc,If.postformat=Dc,If._relativeTime=Hf,If.relativeTime=Ec,If.pastFuture=Fc,If.set=y,If.months=ca,If._months=Te,If.monthsShort=da,If._monthsShort=Ue,If.monthsParse=fa,If._monthsRegex=We,If.monthsRegex=ka,If._monthsShortRegex=Ve,If.monthsShortRegex=ja,If.week=Xb,If._week=mf,If.firstDayOfYear=Zb,If.firstDayOfWeek=Yb,If.weekdays=bc,If._weekdays=of,If.weekdaysMin=dc,If._weekdaysMin=qf,If.weekdaysShort=cc,If._weekdaysShort=pf,If.weekdaysParse=fc,If._weekdaysRegex=rf,If.weekdaysRegex=jc,If._weekdaysShortRegex=sf,If.weekdaysShortRegex=kc,If._weekdaysMinRegex=tf,If.weekdaysMinRegex=lc,If.isPM=sc,If._meridiemParse=uf,If.meridiem=tc,E("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===r(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),a.lang=u("moment.lang is deprecated. Use moment.locale instead.",E),a.langData=u("moment.langData is deprecated. Use moment.localeData instead.",H);var Jf=Math.abs,Kf=Yc("ms"),Lf=Yc("s"),Mf=Yc("m"),Nf=Yc("h"),Of=Yc("d"),Pf=Yc("w"),Qf=Yc("M"),Rf=Yc("y"),Sf=$c("milliseconds"),Tf=$c("seconds"),Uf=$c("minutes"),Vf=$c("hours"),Wf=$c("days"),Xf=$c("months"),Yf=$c("years"),Zf=Math.round,$f={s:45,m:45,h:22,d:26,M:11},_f=Math.abs,ag=Oa.prototype;ag.abs=Oc,ag.add=Qc,ag.subtract=Rc,ag.as=Wc,ag.asMilliseconds=Kf,ag.asSeconds=Lf,ag.asMinutes=Mf,ag.asHours=Nf,ag.asDays=Of,ag.asWeeks=Pf,ag.asMonths=Qf,ag.asYears=Rf,ag.valueOf=Xc,ag._bubble=Tc,ag.get=Zc,ag.milliseconds=Sf,ag.seconds=Tf,ag.minutes=Uf,ag.hours=Vf,ag.days=Wf,ag.weeks=_c,ag.months=Xf,ag.years=Yf,ag.humanize=dd,ag.toISOString=ed,ag.toString=ed,ag.toJSON=ed,ag.locale=Bb,ag.localeData=Cb,ag.toIsoString=u("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",ed),ag.lang=lf,R("X",0,0,"unix"),R("x",0,0,"valueOf"),W("x",Ce),W("X",Fe),$("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),$("x",function(a,b,c){c._d=new Date(r(a))}),
//! moment.js
-//! version : 2.12.0
+//! version : 2.13.0
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
-a.version="2.12.0",b(Ja),a.fn=nf,a.min=La,a.max=Ma,a.now=Ve,a.utc=h,a.unix=qc,a.months=Bc,a.isDate=d,a.locale=E,a.invalid=l,a.duration=cb,a.isMoment=p,a.weekdays=Dc,a.parseZone=rc,a.localeData=H,a.isDuration=Oa,a.monthsShort=Cc,a.weekdaysMin=Fc,a.defineLocale=F,a.updateLocale=G,a.locales=I,a.weekdaysShort=Ec,a.normalizeUnits=K,a.relativeTimeThreshold=Wc,a.prototype=nf;var Pf=a,Qf=(Pf.defineLocale("af",{months:"Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mar_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(a){return/^nm$/i.test(a)},meridiem:function(a,b,c){return 12>a?c?"vm":"VM":c?"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",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"},ordinalParse:/\d{1,2}(ste|de)/,ordinal:function(a){return a+(1===a||8===a||a>=20?"ste":"de")},week:{dow:1,doy:4}}),Pf.defineLocale("ar-ma",{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:"ثوان",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:6,doy:12}}),{1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"}),Rf={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"},Sf=(Pf.defineLocale("ar-sa",{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"},meridiemParse:/ص|م/,isPM:function(a){return"م"===a},meridiem:function(a,b,c){return 12>a?"ص":"م"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] 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 سنوات"},preparse:function(a){return a.replace(/[١٢٣٤٥٦٧٨٩٠]/g,function(a){return Rf[a]}).replace(/،/g,",")},postformat:function(a){return a.replace(/\d/g,function(a){return Qf[a]}).replace(/,/g,"،")},week:{dow:6,doy:12}}),Pf.defineLocale("ar-tn",{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:"ثوان",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:1,doy:4}}),{1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"}),Tf={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"},Uf=function(a){return 0===a?0:1===a?1:2===a?2:a%100>=3&&10>=a%100?3:a%100>=11?4:5},Vf={s:["أقل من ثانية","ثانية واحدة",["ثانيتان","ثانيتين"],"%d ثوان","%d ثانية","%d ثانية"],m:["أقل من دقيقة","دقيقة واحدة",["دقيقتان","دقيقتين"],"%d دقائق","%d دقيقة","%d دقيقة"],h:["أقل من ساعة","ساعة واحدة",["ساعتان","ساعتين"],"%d ساعات","%d ساعة","%d ساعة"],d:["أقل من يوم","يوم واحد",["يومان","يومين"],"%d أيام","%d يومًا","%d يوم"],M:["أقل من شهر","شهر واحد",["شهران","شهرين"],"%d أشهر","%d شهرا","%d شهر"],y:["أقل من عام","عام واحد",["عامان","عامين"],"%d أعوام","%d عامًا","%d عام"]},Wf=function(a){return function(b,c,d,e){var f=Uf(b),g=Vf[a][Uf(b)];return 2===f&&(g=g[c?0:1]),g.replace(/%d/i,b)}},Xf=["كانون الثاني يناير","شباط فبراير","آذار مارس","نيسان أبريل","أيار مايو","حزيران يونيو","تموز يوليو","آب أغسطس","أيلول سبتمبر","تشرين الأول أكتوبر","تشرين الثاني نوفمبر","كانون الأول ديسمبر"],Yf=(Pf.defineLocale("ar",{months:Xf,monthsShort:Xf,weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),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(a){return"م"===a},meridiem:function(a,b,c){return 12>a?"ص":"م"},calendar:{sameDay:"[اليوم عند الساعة] LT",nextDay:"[غدًا عند الساعة] LT",nextWeek:"dddd [عند الساعة] LT",lastDay:"[أمس عند الساعة] LT",lastWeek:"dddd [عند الساعة] LT",sameElse:"L"},relativeTime:{future:"بعد %s",past:"منذ %s",s:Wf("s"),m:Wf("m"),mm:Wf("m"),h:Wf("h"),hh:Wf("h"),d:Wf("d"),dd:Wf("d"),M:Wf("M"),MM:Wf("M"),y:Wf("y"),yy:Wf("y")},preparse:function(a){return a.replace(/\u200f/g,"").replace(/[١٢٣٤٥٦٧٨٩٠]/g,function(a){return Tf[a]}).replace(/،/g,",")},postformat:function(a){return a.replace(/\d/g,function(a){return Sf[a]}).replace(/,/g,"،")},week:{dow:6,doy:12}}),{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ı"}),Zf=(Pf.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("_"),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çə saniyyə",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(a){return/^(gündüz|axşam)$/.test(a)},meridiem:function(a,b,c){return 4>a?"gecə":12>a?"səhər":17>a?"gündüz":"axşam"},ordinalParse:/\d{1,2}-(ıncı|inci|nci|üncü|ncı|uncu)/,ordinal:function(a){if(0===a)return a+"-ıncı";var b=a%10,c=a%100-b,d=a>=100?100:null;return a+(Yf[b]||Yf[c]||Yf[d])},week:{dow:1,doy:7}}),Pf.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:$c,mm:$c,h:$c,hh:$c,d:"дзень",dd:$c,M:"месяц",MM:$c,y:"год",yy:$c},meridiemParse:/ночы|раніцы|дня|вечара/,isPM:function(a){return/^(дня|вечара)$/.test(a)},meridiem:function(a,b,c){return 4>a?"ночы":12>a?"раніцы":17>a?"дня":"вечара"},ordinalParse:/\d{1,2}-(і|ы|га)/,ordinal:function(a,b){switch(b){case"M":case"d":case"DDD":case"w":case"W":return a%10!==2&&a%10!==3||a%100===12||a%100===13?a+"-ы":a+"-і";case"D":return a+"-га";default:return a}},week:{dow:1,doy:7}}),Pf.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:"няколко секунди",m:"минута",mm:"%d минути",h:"час",hh:"%d часа",d:"ден",dd:"%d дни",M:"месец",MM:"%d месеца",y:"година",yy:"%d години"},ordinalParse:/\d{1,2}-(ев|ен|ти|ви|ри|ми)/,ordinal:function(a){var b=a%10,c=a%100;return 0===a?a+"-ев":0===c?a+"-ен":c>10&&20>c?a+"-ти":1===b?a+"-ви":2===b?a+"-ри":7===b||8===b?a+"-ми":a+"-ти"},week:{dow:1,doy:7}}),{1:"১",2:"২",3:"৩",4:"৪",5:"৫",6:"৬",7:"৭",8:"৮",9:"৯",0:"০"}),$f={"১":"1","২":"2","৩":"3","৪":"4","৫":"5","৬":"6","৭":"7","৮":"8","৯":"9","০":"0"},_f=(Pf.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:"কয়েক সেকেন্ড",m:"এক মিনিট",mm:"%d মিনিট",h:"এক ঘন্টা",hh:"%d ঘন্টা",d:"এক দিন",dd:"%d দিন",M:"এক মাস",MM:"%d মাস",y:"এক বছর",yy:"%d বছর"},preparse:function(a){return a.replace(/[১২৩৪৫৬৭৮৯০]/g,function(a){return $f[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return Zf[a]})},meridiemParse:/রাত|সকাল|দুপুর|বিকাল|রাত/,meridiemHour:function(a,b){return 12===a&&(a=0),"রাত"===b&&a>=4||"দুপুর"===b&&5>a||"বিকাল"===b?a+12:a},meridiem:function(a,b,c){return 4>a?"রাত":10>a?"সকাল":17>a?"দুপুর":20>a?"বিকাল":"রাত"},week:{dow:0,doy:6}}),{1:"༡",2:"༢",3:"༣",4:"༤",5:"༥",6:"༦",7:"༧",8:"༨",9:"༩",0:"༠"}),ag={"༡":"1","༢":"2","༣":"3","༤":"4","༥":"5","༦":"6","༧":"7","༨":"8","༩":"9","༠":"0"},bg=(Pf.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:"ལམ་སང",m:"སྐར་མ་གཅིག",mm:"%d སྐར་མ",h:"ཆུ་ཚོད་གཅིག",hh:"%d ཆུ་ཚོད",d:"ཉིན་གཅིག",dd:"%d ཉིན་",M:"ཟླ་བ་གཅིག",MM:"%d ཟླ་བ",y:"ལོ་གཅིག",yy:"%d ལོ"},preparse:function(a){return a.replace(/[༡༢༣༤༥༦༧༨༩༠]/g,function(a){return ag[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return _f[a]})},meridiemParse:/མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/,meridiemHour:function(a,b){return 12===a&&(a=0),"མཚན་མོ"===b&&a>=4||"ཉིན་གུང"===b&&5>a||"དགོང་དག"===b?a+12:a},meridiem:function(a,b,c){return 4>a?"མཚན་མོ":10>a?"ཞོགས་ཀས":17>a?"ཉིན་གུང":20>a?"དགོང་དག":"མཚན་མོ"},week:{dow:0,doy:6}}),Pf.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("_"),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ù",m:"ur vunutenn",mm:_c,h:"un eur",hh:"%d eur",d:"un devezh",dd:_c,M:"ur miz",MM:_c,y:"ur bloaz",yy:ad},ordinalParse:/\d{1,2}(añ|vet)/,ordinal:function(a){var b=1===a?"añ":"vet";return a+b},week:{dow:1,doy:4}}),Pf.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("_"),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("_"),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",m:ed,mm:ed,h:ed,hh:ed,d:"dan",dd:ed,M:"mjesec",MM:ed,y:"godinu",yy:ed},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),Pf.defineLocale("ca",{months:"gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre".split("_"),monthsShort:"gen._febr._mar._abr._mai._jun._jul._ag._set._oct._nov._des.".split("_"),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("_"),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:function(){return"[avui a "+(1!==this.hours()?"les":"la")+"] LT"},nextDay:function(){return"[demà a "+(1!==this.hours()?"les":"la")+"] LT"},nextWeek:function(){return"dddd [a "+(1!==this.hours()?"les":"la")+"] LT"},lastDay:function(){return"[ahir a "+(1!==this.hours()?"les":"la")+"] LT"},lastWeek:function(){return"[el] dddd [passat a "+(1!==this.hours()?"les":"la")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"fa %s",s:"uns 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"},ordinalParse:/\d{1,2}(r|n|t|è|a)/,ordinal:function(a,b){var c=1===a?"r":2===a?"n":3===a?"r":4===a?"t":"è";return("w"===b||"W"===b)&&(c="a"),a+c},week:{dow:1,doy:4}}),"leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec".split("_")),cg="led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro".split("_"),dg=(Pf.defineLocale("cs",{months:bg,monthsShort:cg,monthsParse:function(a,b){var c,d=[];for(c=0;12>c;c++)d[c]=new RegExp("^"+a[c]+"$|^"+b[c]+"$","i");return d}(bg,cg),shortMonthsParse:function(a){var b,c=[];for(b=0;12>b;b++)c[b]=new RegExp("^"+a[b]+"$","i");return c}(cg),longMonthsParse:function(a){var b,c=[];for(b=0;12>b;b++)c[b]=new RegExp("^"+a[b]+"$","i");return c}(bg),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"},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:gd,m:gd,mm:gd,h:gd,hh:gd,d:gd,dd:gd,M:gd,MM:gd,y:gd,yy:gd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),Pf.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(a){var b=/сехет$/i.exec(a)?"рен":/ҫул$/i.exec(a)?"тан":"ран";return a+b},past:"%s каялла",s:"пӗр-ик ҫеккунт",m:"пӗр минут",mm:"%d минут",h:"пӗр сехет",hh:"%d сехет",d:"пӗр кун",dd:"%d кун",M:"пӗр уйӑх",MM:"%d уйӑх",y:"пӗр ҫул",yy:"%d ҫул"},ordinalParse:/\d{1,2}-мӗш/,ordinal:"%d-мӗш",week:{dow:1,doy:7}}),Pf.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("_"),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",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"},ordinalParse:/\d{1,2}(fed|ain|af|il|ydd|ed|eg)/,ordinal:function(a){var b=a,c="",d=["","af","il","ydd","ydd","ed","ed","ed","fed","fed","fed","eg","fed","eg","eg","fed","eg","eg","fed","eg","fed"];return b>20?c=40===b||50===b||60===b||80===b||100===b?"fed":"ain":b>0&&(c=d[b]),a+c},week:{dow:1,doy:4}}),Pf.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 HH:mm"},calendar:{sameDay:"[I dag kl.] LT",nextDay:"[I morgen kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[I går kl.] LT",lastWeek:"[sidste] dddd [kl] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s siden",s:"få 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"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),Pf.defineLocale("de-at",{months:"Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jän._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),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("_"),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",m:hd,mm:"%d Minuten",h:hd,hh:"%d Stunden",d:hd,dd:hd,M:hd,MM:hd,y:hd,yy:hd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),Pf.defineLocale("de",{months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),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("_"),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",m:id,mm:"%d Minuten",h:id,hh:"%d Stunden",d:id,dd:id,M:id,MM:id,y:id,yy:id},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),["ޖެނުއަރީ","ފެބްރުއަރީ","މާރިޗު","އޭޕްރީލު","މޭ","ޖޫން","ޖުލައި","އޯގަސްޓު","ސެޕްޓެމްބަރު","އޮކްޓޯބަރު","ނޮވެމްބަރު","ޑިސެމްބަރު"]),eg=["އާދިއްތަ","ހޯމަ","އަންގާރަ","ބުދަ","ބުރާސްފަތި","ހުކުރު","ހޮނިހިރު"],fg=(Pf.defineLocale("dv",{months:dg,monthsShort:dg,weekdays:eg,weekdaysShort:eg,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(a){return"މފ"===a},meridiem:function(a,b,c){return 12>a?"މކ":"މފ"},calendar:{sameDay:"[މިއަދު] LT",nextDay:"[މާދަމާ] LT",nextWeek:"dddd LT",lastDay:"[އިއްޔެ] 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"},preparse:function(a){return a.replace(/،/g,",")},postformat:function(a){return a.replace(/,/g,"،")},week:{dow:7,doy:12}}),Pf.defineLocale("el",{monthsNominativeEl:"Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος".split("_"),monthsGenitiveEl:"Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου".split("_"),months:function(a,b){return/D/.test(b.substring(0,b.indexOf("MMMM")))?this._monthsGenitiveEl[a.month()]:this._monthsNominativeEl[a.month()]},monthsShort:"Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ".split("_"),weekdays:"Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο".split("_"),weekdaysShort:"Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ".split("_"),weekdaysMin:"Κυ_Δε_Τρ_Τε_Πε_Πα_Σα".split("_"),meridiem:function(a,b,c){return a>11?c?"μμ":"ΜΜ":c?"πμ":"ΠΜ"},isPM:function(a){return"μ"===(a+"").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(a,b){var c=this._calendarEl[a],d=b&&b.hours();return w(c)&&(c=c.apply(b)),c.replace("{}",d%12===1?"στη":"στις")},relativeTime:{future:"σε %s",past:"%s πριν",s:"λίγα δευτερόλεπτα",m:"ένα λεπτό",mm:"%d λεπτά",h:"μία ώρα",hh:"%d ώρες",d:"μία μέρα",dd:"%d μέρες",M:"ένας μήνας",MM:"%d μήνες",y:"ένας χρόνος",yy:"%d χρόνια"},ordinalParse:/\d{1,2}η/,ordinal:"%dη",week:{dow:1,doy:4}}),Pf.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",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"},ordinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}}),Pf.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",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"},ordinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),Pf.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",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"},ordinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}}),Pf.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",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"},ordinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}}),Pf.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",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"},ordinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}}),Pf.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[-an de] MMMM, YYYY",LLL:"D[-an de] MMMM, YYYY HH:mm",LLLL:"dddd, [la] D[-an de] MMMM, YYYY HH:mm"},meridiemParse:/[ap]\.t\.m/i,isPM:function(a){return"p"===a.charAt(0).toLowerCase()},meridiem:function(a,b,c){return a>11?c?"p.t.m.":"P.T.M.":c?"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:"je %s",past:"antaŭ %s",s:"sekundoj",m:"minuto",mm:"%d minutoj",h:"horo",hh:"%d horoj",d:"tago",dd:"%d tagoj",M:"monato",MM:"%d monatoj",y:"jaro",yy:"%d jaroj"},ordinalParse:/\d{1,2}a/,ordinal:"%da",week:{dow:1,doy:7}}),"ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_")),gg="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),hg=(Pf.defineLocale("es",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(a,b){return/-MMM-/.test(b)?gg[a.month()]:fg[a.month()]},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("_"),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"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos 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"},ordinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}}),Pf.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:jd,m:jd,mm:jd,h:jd,hh:jd,d:jd,dd:"%d päeva",M:jd,MM:jd,y:jd,yy:jd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),Pf.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("_"),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("_"),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",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"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),{1:"۱",2:"۲",3:"۳",4:"۴",5:"۵",6:"۶",7:"۷",8:"۸",9:"۹",0:"۰"}),ig={"۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","۰":"0"},jg=(Pf.defineLocale("fa",{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"},meridiemParse:/قبل از ظهر|بعد از ظهر/,isPM:function(a){return/بعد از ظهر/.test(a)},meridiem:function(a,b,c){return 12>a?"قبل از ظهر":"بعد از ظهر"},calendar:{sameDay:"[امروز ساعت] LT",nextDay:"[فردا ساعت] LT",nextWeek:"dddd [ساعت] LT",lastDay:"[دیروز ساعت] 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 سال"},preparse:function(a){return a.replace(/[۰-۹]/g,function(a){return ig[a]}).replace(/،/g,",")},postformat:function(a){return a.replace(/\d/g,function(a){return hg[a]}).replace(/,/g,"،")},ordinalParse:/\d{1,2}م/,ordinal:"%dم",week:{dow:6,doy:12}}),"nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän".split(" ")),kg=["nolla","yhden","kahden","kolmen","neljän","viiden","kuuden",jg[7],jg[8],jg[9]],lg=(Pf.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:kd,m:kd,mm:kd,h:kd,hh:kd,d:kd,dd:kd,M:kd,MM:kd,y:kd,yy:kd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),Pf.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",m:"ein minutt",mm:"%d minuttir",h:"ein tími",hh:"%d tímar",d:"ein dagur",dd:"%d dagar",M:"ein mánaði",MM:"%d mánaðir",y:"eitt ár",yy:"%d ár"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),Pf.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("_"),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("_"),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",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"},ordinalParse:/\d{1,2}(er|e)/,ordinal:function(a){return a+(1===a?"er":"e")}}),Pf.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("_"),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("_"),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",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"},ordinalParse:/\d{1,2}(er|e)/,ordinal:function(a){return a+(1===a?"er":"e")},week:{dow:1,doy:4}}),Pf.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("_"),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("_"),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",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"},ordinalParse:/\d{1,2}(er|)/,ordinal:function(a){return a+(1===a?"er":"")},week:{dow:1,doy:4}}),"jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.".split("_")),mg="jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),ng=(Pf.defineLocale("fy",{months:"jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber".split("_"),monthsShort:function(a,b){return/-MMM-/.test(b)?mg[a.month()]:lg[a.month()]},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("_"),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",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"},ordinalParse:/\d{1,2}(ste|de)/,ordinal:function(a){return a+(1===a||8===a||a>=20?"ste":"de")},week:{dow:1,doy:4}}),["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"]),og=["Faoi","Gear","Màrt","Gibl","Cèit","Ògmh","Iuch","Lùn","Sult","Dàmh","Samh","Dùbh"],pg=["Didòmhnaich","Diluain","Dimàirt","Diciadain","Diardaoin","Dihaoine","Disathairne"],qg=["Did","Dil","Dim","Dic","Dia","Dih","Dis"],rg=["Dò","Lu","Mà","Ci","Ar","Ha","Sa"],sg=(Pf.defineLocale("gd",{months:ng,monthsShort:og,monthsParseExact:!0,weekdays:pg,weekdaysShort:qg,weekdaysMin:rg,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",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"},ordinalParse:/\d{1,2}(d|na|mh)/,ordinal:function(a){var b=1===a?"d":a%10===2?"na":"mh";return a+b},week:{dow:1,doy:4}}),Pf.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("_"),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("_"),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:function(){return"[hoxe "+(1!==this.hours()?"ás":"á")+"] LT"},nextDay:function(){return"[mañá "+(1!==this.hours()?"ás":"á")+"] LT"},nextWeek:function(){return"dddd ["+(1!==this.hours()?"ás":"a")+"] LT"},lastDay:function(){return"[onte "+(1!==this.hours()?"á":"a")+"] LT"},lastWeek:function(){return"[o] dddd [pasado "+(1!==this.hours()?"ás":"a")+"] LT"},sameElse:"L"},relativeTime:{future:function(a){return"uns segundos"===a?"nuns segundos":"en "+a},past:"hai %s",s:"uns 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"},ordinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:7}}),Pf.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:"מספר שניות",m:"דקה",mm:"%d דקות",h:"שעה",hh:function(a){return 2===a?"שעתיים":a+" שעות"},d:"יום",dd:function(a){return 2===a?"יומיים":a+" ימים"},M:"חודש",MM:function(a){return 2===a?"חודשיים":a+" חודשים"},y:"שנה",yy:function(a){return 2===a?"שנתיים":a%10===0&&10!==a?a+" שנה":a+" שנים"}},meridiemParse:/אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i,isPM:function(a){return/^(אחה"צ|אחרי הצהריים|בערב)$/.test(a)},meridiem:function(a,b,c){return 5>a?"לפנות בוקר":10>a?"בבוקר":12>a?c?'לפנה"צ':"לפני הצהריים":18>a?c?'אחה"צ':"אחרי הצהריים":"בערב"}}),{1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"}),tg={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"},ug=(Pf.defineLocale("hi",{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:"कुछ ही क्षण",m:"एक मिनट",mm:"%d मिनट",h:"एक घंटा",hh:"%d घंटे",d:"एक दिन",dd:"%d दिन",M:"एक महीने",MM:"%d महीने",y:"एक वर्ष",yy:"%d वर्ष"},preparse:function(a){return a.replace(/[१२३४५६७८९०]/g,function(a){return tg[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return sg[a]})},meridiemParse:/रात|सुबह|दोपहर|शाम/,meridiemHour:function(a,b){return 12===a&&(a=0),"रात"===b?4>a?a:a+12:"सुबह"===b?a:"दोपहर"===b?a>=10?a:a+12:"शाम"===b?a+12:void 0},meridiem:function(a,b,c){return 4>a?"रात":10>a?"सुबह":17>a?"दोपहर":20>a?"शाम":"रात"},week:{dow:0,doy:6}}),Pf.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("_"),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("_"),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",m:md,mm:md,h:md,hh:md,d:"dan",dd:md,M:"mjesec",MM:md,y:"godinu",yy:md},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),"vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton".split(" ")),vg=(Pf.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(a){return"u"===a.charAt(1).toLowerCase()},meridiem:function(a,b,c){return 12>a?c===!0?"de":"DE":c===!0?"du":"DU"},calendar:{sameDay:"[ma] LT[-kor]",nextDay:"[holnap] LT[-kor]",nextWeek:function(){return od.call(this,!0)},lastDay:"[tegnap] LT[-kor]",lastWeek:function(){return od.call(this,!1)},sameElse:"L"},relativeTime:{future:"%s múlva",past:"%s",s:nd,m:nd,mm:nd,h:nd,hh:nd,d:nd,dd:nd,M:nd,MM:nd,y:nd,yy:nd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),Pf.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:"մի քանի վայրկյան",m:"րոպե",mm:"%d րոպե",h:"ժամ",hh:"%d ժամ",d:"օր",dd:"%d օր",M:"ամիս",MM:"%d ամիս",y:"տարի",yy:"%d տարի"},meridiemParse:/գիշերվա|առավոտվա|ցերեկվա|երեկոյան/,isPM:function(a){return/^(ցերեկվա|երեկոյան)$/.test(a)},meridiem:function(a){return 4>a?"գիշերվա":12>a?"առավոտվա":17>a?"ցերեկվա":"երեկոյան"},ordinalParse:/\d{1,2}|\d{1,2}-(ին|րդ)/,ordinal:function(a,b){switch(b){case"DDD":case"w":case"W":case"DDDo":return 1===a?a+"-ին":a+"-րդ";default:return a}},week:{dow:1,doy:7}}),Pf.defineLocale("id",{months:"Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_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(a,b){return 12===a&&(a=0),"pagi"===b?a:"siang"===b?a>=11?a:a+12:"sore"===b||"malam"===b?a+12:void 0},meridiem:function(a,b,c){return 11>a?"pagi":15>a?"siang":19>a?"sore":"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",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,doy:7}}),Pf.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:qd,m:qd,mm:qd,h:"klukkustund",hh:qd,d:qd,dd:qd,M:qd,MM:qd,y:qd,yy:qd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),Pf.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(a){return(/^[0-9].+$/.test(a)?"tra":"in")+" "+a},past:"%s fa",s:"alcuni 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"},ordinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}}),Pf.defineLocale("ja",{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:"Ah時m分",LTS:"Ah時m分s秒",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah時m分",LLLL:"YYYY年M月D日Ah時m分 dddd"},meridiemParse:/午前|午後/i,isPM:function(a){return"午後"===a},meridiem:function(a,b,c){return 12>a?"午前":"午後"},calendar:{sameDay:"[今日] LT",nextDay:"[明日] LT",nextWeek:"[来週]dddd LT",lastDay:"[昨日] LT",lastWeek:"[前週]dddd LT",sameElse:"L"},ordinalParse:/\d{1,2}日/,ordinal:function(a,b){switch(b){case"d":case"D":case"DDD":return a+"日";default:return a}},relativeTime:{future:"%s後",past:"%s前",s:"数秒",m:"1分",mm:"%d分",h:"1時間",hh:"%d時間",d:"1日",dd:"%d日",M:"1ヶ月",MM:"%dヶ月",y:"1年",yy:"%d年"}}),Pf.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(a,b){return 12===a&&(a=0),"enjing"===b?a:"siyang"===b?a>=11?a:a+12:"sonten"===b||"ndalu"===b?a+12:void 0},meridiem:function(a,b,c){return 11>a?"enjing":15>a?"siyang":19>a?"sonten":"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",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,doy:7}}),Pf.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(a){return/(წამი|წუთი|საათი|წელი)/.test(a)?a.replace(/ი$/,"ში"):a+"ში"},past:function(a){return/(წამი|წუთი|საათი|დღე|თვე)/.test(a)?a.replace(/(ი|ე)$/,"ის წინ"):/წელი/.test(a)?a.replace(/წელი$/,"წლის წინ"):void 0},s:"რამდენიმე წამი",m:"წუთი",mm:"%d წუთი",h:"საათი",hh:"%d საათი",d:"დღე",dd:"%d დღე",M:"თვე",MM:"%d თვე",y:"წელი",yy:"%d წელი"},ordinalParse:/0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/,ordinal:function(a){return 0===a?a:1===a?a+"-ლი":20>a||100>=a&&a%20===0||a%100===0?"მე-"+a:a+"-ე"},week:{dow:1,doy:7}}),{0:"-ші",1:"-ші",2:"-ші",3:"-ші",4:"-ші",5:"-ші",6:"-шы",7:"-ші",8:"-ші",9:"-шы",10:"-шы",20:"-шы",30:"-шы",40:"-шы",50:"-ші",60:"-шы",70:"-ші",80:"-ші",90:"-шы",100:"-ші"}),wg=(Pf.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:"бірнеше секунд",m:"бір минут",mm:"%d минут",h:"бір сағат",hh:"%d сағат",d:"бір күн",dd:"%d күн",M:"бір ай",MM:"%d ай",y:"бір жыл",yy:"%d жыл"},ordinalParse:/\d{1,2}-(ші|шы)/,ordinal:function(a){var b=a%10,c=a>=100?100:null;return a+(vg[a]||vg[b]||vg[c])},week:{dow:1,doy:7}}),Pf.defineLocale("km",{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:"ប៉ុន្មានវិនាទី",m:"មួយនាទី",mm:"%d នាទី",h:"មួយម៉ោង",hh:"%d ម៉ោង",d:"មួយថ្ងៃ",dd:"%d ថ្ងៃ",M:"មួយខែ",MM:"%d ខែ",y:"មួយឆ្នាំ",yy:"%d ឆ្នាំ"},week:{dow:1,doy:4}}),Pf.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시 m분",LTS:"A h시 m분 s초",L:"YYYY.MM.DD",LL:"YYYY년 MMMM D일",LLL:"YYYY년 MMMM D일 A h시 m분",LLLL:"YYYY년 MMMM D일 dddd A h시 m분"},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년"},ordinalParse:/\d{1,2}일/,ordinal:"%d일",meridiemParse:/오전|오후/,isPM:function(a){return"오후"===a},meridiem:function(a,b,c){return 12>a?"오전":"오후"}}),Pf.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("_"),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("_"),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(){switch(this.day()){case 2:case 4:return"[Leschten] dddd [um] LT";default:return"[Leschte] dddd [um] LT"}}},relativeTime:{future:sd,past:td,s:"e puer Sekonnen",m:rd,mm:"%d Minutten",h:rd,hh:"%d Stonnen",d:rd,dd:"%d Deeg",M:rd,MM:"%d Méint",y:rd,yy:"%d Joer"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),Pf.defineLocale("lo",{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"},meridiemParse:/ຕອນເຊົ້າ|ຕອນແລງ/,
-isPM:function(a){return"ຕອນແລງ"===a},meridiem:function(a,b,c){return 12>a?"ຕອນເຊົ້າ":"ຕອນແລງ"},calendar:{sameDay:"[ມື້ນີ້ເວລາ] LT",nextDay:"[ມື້ອື່ນເວລາ] LT",nextWeek:"[ວັນ]dddd[ໜ້າເວລາ] LT",lastDay:"[ມື້ວານນີ້ເວລາ] LT",lastWeek:"[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT",sameElse:"L"},relativeTime:{future:"ອີກ %s",past:"%sຜ່ານມາ",s:"ບໍ່ເທົ່າໃດວິນາທີ",m:"1 ນາທີ",mm:"%d ນາທີ",h:"1 ຊົ່ວໂມງ",hh:"%d ຊົ່ວໂມງ",d:"1 ມື້",dd:"%d ມື້",M:"1 ເດືອນ",MM:"%d ເດືອນ",y:"1 ປີ",yy:"%d ປີ"},ordinalParse:/(ທີ່)\d{1,2}/,ordinal:function(a){return"ທີ່"+a}}),{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"}),xg=(Pf.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("_")},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("_"),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:vd,m:wd,mm:zd,h:wd,hh:zd,d:wd,dd:zd,M:wd,MM:zd,y:wd,yy:zd},ordinalParse:/\d{1,2}-oji/,ordinal:function(a){return a+"-oji"},week:{dow:1,doy:4}}),{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("_")}),yg=(Pf.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("_"),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:Dd,m:Cd,mm:Bd,h:Cd,hh:Bd,d:Cd,dd:Bd,M:Cd,MM:Bd,y:Cd,yy:Bd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),{words:{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(a,b){return 1===a?b[0]:a>=2&&4>=a?b[1]:b[2]},translate:function(a,b,c){var d=yg.words[c];return 1===c.length?b?d[0]:d[1]:a+" "+yg.correctGrammaticalCase(a,d)}}),zg=(Pf.defineLocale("me",{months:["januar","februar","mart","april","maj","jun","jul","avgust","septembar","oktobar","novembar","decembar"],monthsShort:["jan.","feb.","mar.","apr.","maj","jun","jul","avg.","sep.","okt.","nov.","dec."],weekdays:["nedjelja","ponedjeljak","utorak","srijeda","četvrtak","petak","subota"],weekdaysShort:["ned.","pon.","uto.","sri.","čet.","pet.","sub."],weekdaysMin:["ne","po","ut","sr","če","pe","su"],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 a=["[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 a[this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"nekoliko sekundi",m:yg.translate,mm:yg.translate,h:yg.translate,hh:yg.translate,d:"dan",dd:yg.translate,M:"mjesec",MM:yg.translate,y:"godinu",yy:yg.translate},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),Pf.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:"неколку секунди",m:"минута",mm:"%d минути",h:"час",hh:"%d часа",d:"ден",dd:"%d дена",M:"месец",MM:"%d месеци",y:"година",yy:"%d години"},ordinalParse:/\d{1,2}-(ев|ен|ти|ви|ри|ми)/,ordinal:function(a){var b=a%10,c=a%100;return 0===a?a+"-ев":0===c?a+"-ен":c>10&&20>c?a+"-ти":1===b?a+"-ви":2===b?a+"-ри":7===b||8===b?a+"-ми":a+"-ти"},week:{dow:1,doy:7}}),Pf.defineLocale("ml",{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:"അൽപ നിമിഷങ്ങൾ",m:"ഒരു മിനിറ്റ്",mm:"%d മിനിറ്റ്",h:"ഒരു മണിക്കൂർ",hh:"%d മണിക്കൂർ",d:"ഒരു ദിവസം",dd:"%d ദിവസം",M:"ഒരു മാസം",MM:"%d മാസം",y:"ഒരു വർഷം",yy:"%d വർഷം"},meridiemParse:/രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i,meridiemHour:function(a,b){return 12===a&&(a=0),"രാത്രി"===b&&a>=4||"ഉച്ച കഴിഞ്ഞ്"===b||"വൈകുന്നേരം"===b?a+12:a},meridiem:function(a,b,c){return 4>a?"രാത്രി":12>a?"രാവിലെ":17>a?"ഉച്ച കഴിഞ്ഞ്":20>a?"വൈകുന്നേരം":"രാത്രി"}}),{1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"}),Ag={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"},Bg=(Pf.defineLocale("mr",{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:Ed,m:Ed,mm:Ed,h:Ed,hh:Ed,d:Ed,dd:Ed,M:Ed,MM:Ed,y:Ed,yy:Ed},preparse:function(a){return a.replace(/[१२३४५६७८९०]/g,function(a){return Ag[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return zg[a]})},meridiemParse:/रात्री|सकाळी|दुपारी|सायंकाळी/,meridiemHour:function(a,b){return 12===a&&(a=0),"रात्री"===b?4>a?a:a+12:"सकाळी"===b?a:"दुपारी"===b?a>=10?a:a+12:"सायंकाळी"===b?a+12:void 0},meridiem:function(a,b,c){return 4>a?"रात्री":10>a?"सकाळी":17>a?"दुपारी":20>a?"सायंकाळी":"रात्री"},week:{dow:0,doy:6}}),Pf.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(a,b){return 12===a&&(a=0),"pagi"===b?a:"tengahari"===b?a>=11?a:a+12:"petang"===b||"malam"===b?a+12:void 0},meridiem:function(a,b,c){return 11>a?"pagi":15>a?"tengahari":19>a?"petang":"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",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,doy:7}}),Pf.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(a,b){return 12===a&&(a=0),"pagi"===b?a:"tengahari"===b?a>=11?a:a+12:"petang"===b||"malam"===b?a+12:void 0},meridiem:function(a,b,c){return 11>a?"pagi":15>a?"tengahari":19>a?"petang":"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",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,doy:7}}),{1:"၁",2:"၂",3:"၃",4:"၄",5:"၅",6:"၆",7:"၇",8:"၈",9:"၉",0:"၀"}),Cg={"၁":"1","၂":"2","၃":"3","၄":"4","၅":"5","၆":"6","၇":"7","၈":"8","၉":"9","၀":"0"},Dg=(Pf.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:"စက္ကန်.အနည်းငယ်",m:"တစ်မိနစ်",mm:"%d မိနစ်",h:"တစ်နာရီ",hh:"%d နာရီ",d:"တစ်ရက်",dd:"%d ရက်",M:"တစ်လ",MM:"%d လ",y:"တစ်နှစ်",yy:"%d နှစ်"},preparse:function(a){return a.replace(/[၁၂၃၄၅၆၇၈၉၀]/g,function(a){return Cg[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return Bg[a]})},week:{dow:1,doy:4}}),Pf.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("_"),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("_"),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:"for %s siden",s:"noen 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"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),{1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"}),Eg={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"},Fg=(Pf.defineLocale("ne",{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 बजे"},preparse:function(a){return a.replace(/[१२३४५६७८९०]/g,function(a){return Eg[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return Dg[a]})},meridiemParse:/राति|बिहान|दिउँसो|साँझ/,meridiemHour:function(a,b){return 12===a&&(a=0),"राति"===b?4>a?a:a+12:"बिहान"===b?a:"दिउँसो"===b?a>=10?a:a+12:"साँझ"===b?a+12:void 0},meridiem:function(a,b,c){return 3>a?"राति":12>a?"बिहान":16>a?"दिउँसो":20>a?"साँझ":"राति"},calendar:{sameDay:"[आज] LT",nextDay:"[भोलि] LT",nextWeek:"[आउँदो] dddd[,] LT",lastDay:"[हिजो] 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 बर्ष"},week:{dow:0,doy:6}}),"jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_")),Gg="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"),Hg=(Pf.defineLocale("nl",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(a,b){return/-MMM-/.test(b)?Gg[a.month()]:Fg[a.month()]},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("_"),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",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"},ordinalParse:/\d{1,2}(ste|de)/,ordinal:function(a){return a+(1===a||8===a||a>=20?"ste":"de")},week:{dow:1,doy:4}}),Pf.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:"for %s sidan",s:"nokre 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"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),{1:"੧",2:"੨",3:"੩",4:"੪",5:"੫",6:"੬",7:"੭",8:"੮",9:"੯",0:"੦"}),Ig={"੧":"1","੨":"2","੩":"3","੪":"4","੫":"5","੬":"6","੭":"7","੮":"8","੯":"9","੦":"0"},Jg=(Pf.defineLocale("pa-in",{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:"ਕੁਝ ਸਕਿੰਟ",m:"ਇਕ ਮਿੰਟ",mm:"%d ਮਿੰਟ",h:"ਇੱਕ ਘੰਟਾ",hh:"%d ਘੰਟੇ",d:"ਇੱਕ ਦਿਨ",dd:"%d ਦਿਨ",M:"ਇੱਕ ਮਹੀਨਾ",MM:"%d ਮਹੀਨੇ",y:"ਇੱਕ ਸਾਲ",yy:"%d ਸਾਲ"},preparse:function(a){return a.replace(/[੧੨੩੪੫੬੭੮੯੦]/g,function(a){return Ig[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return Hg[a]})},meridiemParse:/ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/,meridiemHour:function(a,b){return 12===a&&(a=0),"ਰਾਤ"===b?4>a?a:a+12:"ਸਵੇਰ"===b?a:"ਦੁਪਹਿਰ"===b?a>=10?a:a+12:"ਸ਼ਾਮ"===b?a+12:void 0},meridiem:function(a,b,c){return 4>a?"ਰਾਤ":10>a?"ਸਵੇਰ":17>a?"ਦੁਪਹਿਰ":20>a?"ਸ਼ਾਮ":"ਰਾਤ"},week:{dow:0,doy:6}}),"styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień".split("_")),Kg="stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia".split("_"),Lg=(Pf.defineLocale("pl",{months:function(a,b){return""===b?"("+Kg[a.month()]+"|"+Jg[a.month()]+")":/D MMMM/.test(b)?Kg[a.month()]:Jg[a.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:"nie_pon_wt_śr_czw_pt_sb".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:"[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",m:Gd,mm:Gd,h:Gd,hh:Gd,d:"1 dzień",dd:"%d dni",M:"miesiąc",MM:Gd,y:"rok",yy:Gd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),Pf.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:"Dom_2ª_3ª_4ª_5ª_6ª_Sáb".split("_"),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 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"%s atrás",s:"poucos 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"},ordinalParse:/\d{1,2}º/,ordinal:"%dº"}),Pf.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:"Dom_2ª_3ª_4ª_5ª_6ª_Sáb".split("_"),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 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"há %s",s:"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"},ordinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}}),Pf.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("_"),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",m:"un minut",mm:Hd,h:"o oră",hh:Hd,d:"o zi",dd:Hd,M:"o lună",MM:Hd,y:"un an",yy:Hd},week:{dow:1,doy:7}}),[/^янв/i,/^фев/i,/^мар/i,/^апр/i,/^ма[й|я]/i,/^июн/i,/^июл/i,/^авг/i,/^сен/i,/^окт/i,/^ноя/i,/^дек/i]),Mg=(Pf.defineLocale("ru",{months:{format:"января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_"),standalone:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_")},monthsShort:{format:"янв_фев_мар_апр_мая_июня_июля_авг_сен_окт_ноя_дек".split("_"),standalone:"янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек".split("_")},weekdays:{standalone:"воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"),format:"воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу".split("_"),isFormat:/\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?\] ?dddd/},weekdaysShort:"вс_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"вс_пн_вт_ср_чт_пт_сб".split("_"),monthsParse:Lg,longMonthsParse:Lg,shortMonthsParse:Lg,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(a){if(a.week()===this.week())return 2===this.day()?"[Во] dddd [в] LT":"[В] dddd [в] LT";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"}},lastWeek:function(a){if(a.week()===this.week())return 2===this.day()?"[Во] dddd [в] LT":"[В] dddd [в] LT";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"}},sameElse:"L"},relativeTime:{future:"через %s",past:"%s назад",s:"несколько секунд",m:Jd,mm:Jd,h:"час",hh:Jd,d:"день",dd:Jd,M:"месяц",MM:Jd,y:"год",yy:Jd},meridiemParse:/ночи|утра|дня|вечера/i,isPM:function(a){return/^(дня|вечера)$/.test(a)},meridiem:function(a,b,c){return 4>a?"ночи":12>a?"утра":17>a?"дня":"вечера"},ordinalParse:/\d{1,2}-(й|го|я)/,ordinal:function(a,b){switch(b){case"M":case"d":case"DDD":return a+"-й";case"D":return a+"-го";case"w":case"W":return a+"-я";default:return a}},week:{dow:1,doy:7}}),Pf.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",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"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),Pf.defineLocale("si",{months:"ජනවාරි_පෙබරවාරි_මාර්තු_අප්රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්".split("_"),monthsShort:"ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ".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:ss"},calendar:{sameDay:"[අද] LT[ට]",nextDay:"[හෙට] LT[ට]",nextWeek:"dddd LT[ට]",lastDay:"[ඊයේ] 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"},ordinalParse:/\d{1,2} වැනි/,ordinal:function(a){return a+" වැනි"},meridiemParse:/පෙර වරු|පස් වරු|පෙ.ව|ප.ව./,isPM:function(a){return"ප.ව."===a||"පස් වරු"===a},meridiem:function(a,b,c){return a>11?c?"ප.ව.":"පස් වරු":c?"පෙ.ව.":"පෙර වරු"}}),"január_február_marec_apríl_máj_jún_júl_august_september_október_november_december".split("_")),Ng="jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec".split("_"),Og=(Pf.defineLocale("sk",{months:Mg,monthsShort:Ng,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:Ld,m:Ld,mm:Ld,h:Ld,hh:Ld,d:Ld,dd:Ld,M:Ld,MM:Ld,y:Ld,yy:Ld},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),Pf.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("_"),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("_"),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:Md,m:Md,mm:Md,h:Md,hh:Md,d:Md,dd:Md,M:Md,MM:Md,y:Md,yy:Md},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),Pf.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("_"),meridiemParse:/PD|MD/,isPM:function(a){return"M"===a.charAt(0)},meridiem:function(a,b,c){return 12>a?"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",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"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),{words:{m:["један минут","једне минуте"],mm:["минут","минуте","минута"],h:["један сат","једног сата"],hh:["сат","сата","сати"],dd:["дан","дана","дана"],MM:["месец","месеца","месеци"],yy:["година","године","година"]},correctGrammaticalCase:function(a,b){return 1===a?b[0]:a>=2&&4>=a?b[1]:b[2]},translate:function(a,b,c){var d=Og.words[c];return 1===c.length?b?d[0]:d[1]:a+" "+Og.correctGrammaticalCase(a,d)}}),Pg=(Pf.defineLocale("sr-cyrl",{months:["јануар","фебруар","март","април","мај","јун","јул","август","септембар","октобар","новембар","децембар"],monthsShort:["јан.","феб.","мар.","апр.","мај","јун","јул","авг.","сеп.","окт.","нов.","дец."],weekdays:["недеља","понедељак","уторак","среда","четвртак","петак","субота"],weekdaysShort:["нед.","пон.","уто.","сре.","чет.","пет.","суб."],weekdaysMin:["не","по","ут","ср","че","пе","су"],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 a=["[прошле] [недеље] [у] LT","[прошлог] [понедељка] [у] LT","[прошлог] [уторка] [у] LT","[прошле] [среде] [у] LT","[прошлог] [четвртка] [у] LT","[прошлог] [петка] [у] LT","[прошле] [суботе] [у] LT"];
-return a[this.day()]},sameElse:"L"},relativeTime:{future:"за %s",past:"пре %s",s:"неколико секунди",m:Og.translate,mm:Og.translate,h:Og.translate,hh:Og.translate,d:"дан",dd:Og.translate,M:"месец",MM:Og.translate,y:"годину",yy:Og.translate},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),{words:{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(a,b){return 1===a?b[0]:a>=2&&4>=a?b[1]:b[2]},translate:function(a,b,c){var d=Pg.words[c];return 1===c.length?b?d[0]:d[1]:a+" "+Pg.correctGrammaticalCase(a,d)}}),Qg=(Pf.defineLocale("sr",{months:["januar","februar","mart","april","maj","jun","jul","avgust","septembar","oktobar","novembar","decembar"],monthsShort:["jan.","feb.","mar.","apr.","maj","jun","jul","avg.","sep.","okt.","nov.","dec."],weekdays:["nedelja","ponedeljak","utorak","sreda","četvrtak","petak","subota"],weekdaysShort:["ned.","pon.","uto.","sre.","čet.","pet.","sub."],weekdaysMin:["ne","po","ut","sr","če","pe","su"],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 a=["[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 a[this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"pre %s",s:"nekoliko sekundi",m:Pg.translate,mm:Pg.translate,h:Pg.translate,hh:Pg.translate,d:"dan",dd:Pg.translate,M:"mesec",MM:Pg.translate,y:"godinu",yy:Pg.translate},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),Pf.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 HH:mm",LLLL:"dddd D MMMM 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",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"},ordinalParse:/\d{1,2}(e|a)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"e":1===b?"a":2===b?"a":"e";return a+c},week:{dow:1,doy:4}}),Pf.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("_"),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",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,doy:7}}),{1:"௧",2:"௨",3:"௩",4:"௪",5:"௫",6:"௬",7:"௭",8:"௮",9:"௯",0:"௦"}),Rg={"௧":"1","௨":"2","௩":"3","௪":"4","௫":"5","௬":"6","௭":"7","௮":"8","௯":"9","௦":"0"},Sg=(Pf.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:"ஒரு சில விநாடிகள்",m:"ஒரு நிமிடம்",mm:"%d நிமிடங்கள்",h:"ஒரு மணி நேரம்",hh:"%d மணி நேரம்",d:"ஒரு நாள்",dd:"%d நாட்கள்",M:"ஒரு மாதம்",MM:"%d மாதங்கள்",y:"ஒரு வருடம்",yy:"%d ஆண்டுகள்"},ordinalParse:/\d{1,2}வது/,ordinal:function(a){return a+"வது"},preparse:function(a){return a.replace(/[௧௨௩௪௫௬௭௮௯௦]/g,function(a){return Rg[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return Qg[a]})},meridiemParse:/யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/,meridiem:function(a,b,c){return 2>a?" யாமம்":6>a?" வைகறை":10>a?" காலை":14>a?" நண்பகல்":18>a?" எற்பாடு":22>a?" மாலை":" யாமம்"},meridiemHour:function(a,b){return 12===a&&(a=0),"யாமம்"===b?2>a?a:a+12:"வைகறை"===b||"காலை"===b?a:"நண்பகல்"===b&&a>=10?a:a+12},week:{dow:0,doy:6}}),Pf.defineLocale("te",{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:"కొన్ని క్షణాలు",m:"ఒక నిమిషం",mm:"%d నిమిషాలు",h:"ఒక గంట",hh:"%d గంటలు",d:"ఒక రోజు",dd:"%d రోజులు",M:"ఒక నెల",MM:"%d నెలలు",y:"ఒక సంవత్సరం",yy:"%d సంవత్సరాలు"},ordinalParse:/\d{1,2}వ/,ordinal:"%dవ",meridiemParse:/రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/,meridiemHour:function(a,b){return 12===a&&(a=0),"రాత్రి"===b?4>a?a:a+12:"ఉదయం"===b?a:"మధ్యాహ్నం"===b?a>=10?a:a+12:"సాయంత్రం"===b?a+12:void 0},meridiem:function(a,b,c){return 4>a?"రాత్రి":10>a?"ఉదయం":17>a?"మధ్యాహ్నం":20>a?"సాయంత్రం":"రాత్రి"},week:{dow:0,doy:6}}),Pf.defineLocale("th",{months:"มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม".split("_"),monthsShort:"มกรา_กุมภา_มีนา_เมษา_พฤษภา_มิถุนา_กรกฎา_สิงหา_กันยา_ตุลา_พฤศจิกา_ธันวา".split("_"),weekdays:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์".split("_"),weekdaysShort:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์".split("_"),weekdaysMin:"อา._จ._อ._พ._พฤ._ศ._ส.".split("_"),longDateFormat:{LT:"H นาฬิกา m นาที",LTS:"H นาฬิกา m นาที s วินาที",L:"YYYY/MM/DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY เวลา H นาฬิกา m นาที",LLLL:"วันddddที่ D MMMM YYYY เวลา H นาฬิกา m นาที"},meridiemParse:/ก่อนเที่ยง|หลังเที่ยง/,isPM:function(a){return"หลังเที่ยง"===a},meridiem:function(a,b,c){return 12>a?"ก่อนเที่ยง":"หลังเที่ยง"},calendar:{sameDay:"[วันนี้ เวลา] LT",nextDay:"[พรุ่งนี้ เวลา] LT",nextWeek:"dddd[หน้า เวลา] LT",lastDay:"[เมื่อวานนี้ เวลา] LT",lastWeek:"[วัน]dddd[ที่แล้ว เวลา] LT",sameElse:"L"},relativeTime:{future:"อีก %s",past:"%sที่แล้ว",s:"ไม่กี่วินาที",m:"1 นาที",mm:"%d นาที",h:"1 ชั่วโมง",hh:"%d ชั่วโมง",d:"1 วัน",dd:"%d วัน",M:"1 เดือน",MM:"%d เดือน",y:"1 ปี",yy:"%d ปี"}}),Pf.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:"[Ngayon sa] LT",nextDay:"[Bukas sa] LT",nextWeek:"dddd [sa] LT",lastDay:"[Kahapon sa] LT",lastWeek:"dddd [huling linggo] LT",sameElse:"L"},relativeTime:{future:"sa loob ng %s",past:"%s ang nakalipas",s:"ilang 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"},ordinalParse:/\d{1,2}/,ordinal:function(a){return a},week:{dow:1,doy:4}}),"pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut".split("_")),Tg=(Pf.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("_"),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:Nd,past:Od,s:"puS lup",m:"wa’ tup",mm:Pd,h:"wa’ rep",hh:Pd,d:"wa’ jaj",dd:Pd,M:"wa’ jar",MM:Pd,y:"wa’ DIS",yy:Pd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy: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ı"}),Ug=(Pf.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:"[haftaya] dddd [saat] LT",lastDay:"[dün] LT",lastWeek:"[geçen hafta] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s önce",s:"birkaç 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"},ordinalParse:/\d{1,2}'(inci|nci|üncü|ncı|uncu|ıncı)/,ordinal:function(a){if(0===a)return a+"'ıncı";var b=a%10,c=a%100-b,d=a>=100?100:null;return a+(Tg[b]||Tg[c]||Tg[d])},week:{dow:1,doy:7}}),Pf.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(a){return"d'o"===a.toLowerCase()},meridiem:function(a,b,c){return a>11?c?"d'o":"D'O":c?"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:Rd,m:Rd,mm:Rd,h:Rd,hh:Rd,d:Rd,dd:Rd,M:Rd,MM:Rd,y:Rd,yy:Rd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),Pf.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",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,doy:12}}),Pf.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:"ⵉⵎⵉⴽ",m:"ⵎⵉⵏⵓⴺ",mm:"%d ⵎⵉⵏⵓⴺ",h:"ⵙⴰⵄⴰ",hh:"%d ⵜⴰⵙⵙⴰⵄⵉⵏ",d:"ⴰⵙⵙ",dd:"%d oⵙⵙⴰⵏ",M:"ⴰⵢoⵓⵔ",MM:"%d ⵉⵢⵢⵉⵔⵏ",y:"ⴰⵙⴳⴰⵙ",yy:"%d ⵉⵙⴳⴰⵙⵏ"},week:{dow:6,doy:12}}),Pf.defineLocale("uk",{months:{format:"січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня".split("_"),standalone:"січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень".split("_")},monthsShort:"січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд".split("_"),weekdays:Ud,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:Vd("[Сьогодні "),nextDay:Vd("[Завтра "),lastDay:Vd("[Вчора "),nextWeek:Vd("[У] dddd ["),lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return Vd("[Минулої] dddd [").call(this);case 1:case 2:case 4:return Vd("[Минулого] dddd [").call(this)}},sameElse:"L"},relativeTime:{future:"за %s",past:"%s тому",s:"декілька секунд",m:Td,mm:Td,h:"годину",hh:Td,d:"день",dd:Td,M:"місяць",MM:Td,y:"рік",yy:Td},meridiemParse:/ночі|ранку|дня|вечора/,isPM:function(a){return/^(дня|вечора)$/.test(a)},meridiem:function(a,b,c){return 4>a?"ночі":12>a?"ранку":17>a?"дня":"вечора"},ordinalParse:/\d{1,2}-(й|го)/,ordinal:function(a,b){switch(b){case"M":case"d":case"DDD":case"w":case"W":return a+"-й";case"D":return a+"-го";default:return a}},week:{dow:1,doy:7}}),Pf.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:"фурсат",m:"бир дакика",mm:"%d дакика",h:"бир соат",hh:"%d соат",d:"бир кун",dd:"%d кун",M:"бир ой",MM:"%d ой",y:"бир йил",yy:"%d йил"},week:{dow:1,doy:7}}),Pf.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("_"),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("_"),meridiemParse:/sa|ch/i,isPM:function(a){return/^ch$/i.test(a)},meridiem:function(a,b,c){return 12>a?c?"sa":"SA":c?"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",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"},ordinalParse:/\d{1,2}/,ordinal:function(a){return a},week:{dow:1,doy:4}}),Pf.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:"Ah点mm分",LTS:"Ah点m分s秒",L:"YYYY-MM-DD",LL:"YYYY年MMMD日",LLL:"YYYY年MMMD日Ah点mm分",LLLL:"YYYY年MMMD日ddddAh点mm分",l:"YYYY-MM-DD",ll:"YYYY年MMMD日",lll:"YYYY年MMMD日Ah点mm分",llll:"YYYY年MMMD日ddddAh点mm分"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(a,b){return 12===a&&(a=0),"凌晨"===b||"早上"===b||"上午"===b?a:"下午"===b||"晚上"===b?a+12:a>=11?a:a+12},meridiem:function(a,b,c){var d=100*a+b;return 600>d?"凌晨":900>d?"早上":1130>d?"上午":1230>d?"中午":1800>d?"下午":"晚上"},calendar:{sameDay:function(){return 0===this.minutes()?"[今天]Ah[点整]":"[今天]LT"},nextDay:function(){return 0===this.minutes()?"[明天]Ah[点整]":"[明天]LT"},lastDay:function(){return 0===this.minutes()?"[昨天]Ah[点整]":"[昨天]LT"},nextWeek:function(){var a,b;return a=Pf().startOf("week"),b=this.unix()-a.unix()>=604800?"[下]":"[本]",0===this.minutes()?b+"dddAh点整":b+"dddAh点mm"},lastWeek:function(){var a,b;return a=Pf().startOf("week"),b=this.unix()<a.unix()?"[上]":"[本]",0===this.minutes()?b+"dddAh点整":b+"dddAh点mm"},sameElse:"LL"},ordinalParse:/\d{1,2}(日|月|周)/,ordinal:function(a,b){switch(b){case"d":case"D":case"DDD":return a+"日";case"M":return a+"月";case"w":case"W":return a+"周";default:return a}},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},week:{dow:1,doy:4}}),Pf.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:"Ah點mm分",LTS:"Ah點m分s秒",L:"YYYY年MMMD日",LL:"YYYY年MMMD日",LLL:"YYYY年MMMD日Ah點mm分",LLLL:"YYYY年MMMD日ddddAh點mm分",l:"YYYY年MMMD日",ll:"YYYY年MMMD日",lll:"YYYY年MMMD日Ah點mm分",llll:"YYYY年MMMD日ddddAh點mm分"},meridiemParse:/早上|上午|中午|下午|晚上/,meridiemHour:function(a,b){return 12===a&&(a=0),"早上"===b||"上午"===b?a:"中午"===b?a>=11?a:a+12:"下午"===b||"晚上"===b?a+12:void 0},meridiem:function(a,b,c){var d=100*a+b;return 900>d?"早上":1130>d?"上午":1230>d?"中午":1800>d?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:"[下]ddddLT",lastDay:"[昨天]LT",lastWeek:"[上]ddddLT",sameElse:"L"},ordinalParse:/\d{1,2}(日|月|週)/,ordinal:function(a,b){switch(b){case"d":case"D":case"DDD":return a+"日";case"M":return a+"月";case"w":case"W":return a+"週";default:return a}},relativeTime:{future:"%s內",past:"%s前",s:"幾秒",m:"一分鐘",mm:"%d分鐘",h:"一小時",hh:"%d小時",d:"一天",dd:"%d天",M:"一個月",MM:"%d個月",y:"一年",yy:"%d年"}}),Pf);return Ug.locale("en"),Ug});
\ No newline at end of file
+a.version="2.13.0",b(Ka),a.fn=Bf,a.min=Ma,a.max=Na,a.now=ef,a.utc=h,a.unix=xc,a.months=Jc,a.isDate=d,a.locale=E,a.invalid=l,a.duration=db,a.isMoment=p,a.weekdays=Lc,a.parseZone=yc,a.localeData=H,a.isDuration=Pa,a.monthsShort=Kc,a.weekdaysMin=Nc,a.defineLocale=F,a.updateLocale=G,a.locales=I,a.weekdaysShort=Mc,a.normalizeUnits=K,a.relativeTimeThreshold=cd,a.prototype=Bf;var bg=a,cg=(bg.defineLocale("af",{months:"Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mar_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(a){return/^nm$/i.test(a)},meridiem:function(a,b,c){return 12>a?c?"vm":"VM":c?"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",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"},ordinalParse:/\d{1,2}(ste|de)/,ordinal:function(a){return a+(1===a||8===a||a>=20?"ste":"de")},week:{dow:1,doy:4}}),bg.defineLocale("ar-ma",{months:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),weekdays:"الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".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:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] 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 سنوات"},week:{dow:6,doy:12}}),{1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"}),dg={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"},eg=(bg.defineLocale("ar-sa",{months:"يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".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:/ص|م/,isPM:function(a){return"م"===a},meridiem:function(a,b,c){return 12>a?"ص":"م"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] 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 سنوات"},preparse:function(a){return a.replace(/[١٢٣٤٥٦٧٨٩٠]/g,function(a){return dg[a]}).replace(/،/g,",")},postformat:function(a){return a.replace(/\d/g,function(a){return cg[a]}).replace(/,/g,"،")},week:{dow:6,doy:12}}),bg.defineLocale("ar-tn",{months:"جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),monthsShort:"جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".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:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] 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 سنوات"},week:{dow:1,doy:4}}),{1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"}),fg={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"},gg=function(a){return 0===a?0:1===a?1:2===a?2:a%100>=3&&10>=a%100?3:a%100>=11?4:5},hg={s:["أقل من ثانية","ثانية واحدة",["ثانيتان","ثانيتين"],"%d ثوان","%d ثانية","%d ثانية"],m:["أقل من دقيقة","دقيقة واحدة",["دقيقتان","دقيقتين"],"%d دقائق","%d دقيقة","%d دقيقة"],h:["أقل من ساعة","ساعة واحدة",["ساعتان","ساعتين"],"%d ساعات","%d ساعة","%d ساعة"],d:["أقل من يوم","يوم واحد",["يومان","يومين"],"%d أيام","%d يومًا","%d يوم"],M:["أقل من شهر","شهر واحد",["شهران","شهرين"],"%d أشهر","%d شهرا","%d شهر"],y:["أقل من عام","عام واحد",["عامان","عامين"],"%d أعوام","%d عامًا","%d عام"]},ig=function(a){return function(b,c,d,e){var f=gg(b),g=hg[a][gg(b)];return 2===f&&(g=g[c?0:1]),g.replace(/%d/i,b)}},jg=["كانون الثاني يناير","شباط فبراير","آذار مارس","نيسان أبريل","أيار مايو","حزيران يونيو","تموز يوليو","آب أغسطس","أيلول سبتمبر","تشرين الأول أكتوبر","تشرين الثاني نوفمبر","كانون الأول ديسمبر"],kg=(bg.defineLocale("ar",{months:jg,monthsShort:jg,weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,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(a){return"م"===a},meridiem:function(a,b,c){return 12>a?"ص":"م"},calendar:{sameDay:"[اليوم عند الساعة] LT",nextDay:"[غدًا عند الساعة] LT",nextWeek:"dddd [عند الساعة] LT",lastDay:"[أمس عند الساعة] LT",lastWeek:"dddd [عند الساعة] LT",sameElse:"L"},relativeTime:{future:"بعد %s",past:"منذ %s",s:ig("s"),m:ig("m"),mm:ig("m"),h:ig("h"),hh:ig("h"),d:ig("d"),dd:ig("d"),M:ig("M"),MM:ig("M"),y:ig("y"),yy:ig("y")},preparse:function(a){return a.replace(/\u200f/g,"").replace(/[١٢٣٤٥٦٧٨٩٠]/g,function(a){return fg[a]}).replace(/،/g,",")},postformat:function(a){return a.replace(/\d/g,function(a){return eg[a]}).replace(/,/g,"،")},week:{dow:6,doy:12}}),{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ı"}),lg=(bg.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:!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ü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çə saniyyə",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(a){return/^(gündüz|axşam)$/.test(a)},meridiem:function(a,b,c){return 4>a?"gecə":12>a?"səhər":17>a?"gündüz":"axşam"},ordinalParse:/\d{1,2}-(ıncı|inci|nci|üncü|ncı|uncu)/,ordinal:function(a){if(0===a)return a+"-ıncı";var b=a%10,c=a%100-b,d=a>=100?100:null;return a+(kg[b]||kg[c]||kg[d])},week:{dow:1,doy:7}}),bg.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:gd,mm:gd,h:gd,hh:gd,d:"дзень",dd:gd,M:"месяц",MM:gd,y:"год",yy:gd},meridiemParse:/ночы|раніцы|дня|вечара/,isPM:function(a){return/^(дня|вечара)$/.test(a)},meridiem:function(a,b,c){return 4>a?"ночы":12>a?"раніцы":17>a?"дня":"вечара"},ordinalParse:/\d{1,2}-(і|ы|га)/,ordinal:function(a,b){switch(b){case"M":case"d":case"DDD":case"w":case"W":return a%10!==2&&a%10!==3||a%100===12||a%100===13?a+"-ы":a+"-і";case"D":return a+"-га";default:return a}},week:{dow:1,doy:7}}),bg.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:"няколко секунди",m:"минута",mm:"%d минути",h:"час",hh:"%d часа",d:"ден",dd:"%d дни",M:"месец",MM:"%d месеца",y:"година",yy:"%d години"},ordinalParse:/\d{1,2}-(ев|ен|ти|ви|ри|ми)/,ordinal:function(a){var b=a%10,c=a%100;return 0===a?a+"-ев":0===c?a+"-ен":c>10&&20>c?a+"-ти":1===b?a+"-ви":2===b?a+"-ри":7===b||8===b?a+"-ми":a+"-ти"},week:{dow:1,doy:7}}),{1:"১",2:"২",3:"৩",4:"৪",5:"৫",6:"৬",7:"৭",8:"৮",9:"৯",0:"০"}),mg={"১":"1","২":"2","৩":"3","৪":"4","৫":"5","৬":"6","৭":"7","৮":"8","৯":"9","০":"0"},ng=(bg.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:"কয়েক সেকেন্ড",m:"এক মিনিট",mm:"%d মিনিট",h:"এক ঘন্টা",hh:"%d ঘন্টা",d:"এক দিন",dd:"%d দিন",M:"এক মাস",MM:"%d মাস",y:"এক বছর",yy:"%d বছর"},preparse:function(a){return a.replace(/[১২৩৪৫৬৭৮৯০]/g,function(a){return mg[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return lg[a]})},meridiemParse:/রাত|সকাল|দুপুর|বিকাল|রাত/,meridiemHour:function(a,b){return 12===a&&(a=0),"রাত"===b&&a>=4||"দুপুর"===b&&5>a||"বিকাল"===b?a+12:a},meridiem:function(a,b,c){return 4>a?"রাত":10>a?"সকাল":17>a?"দুপুর":20>a?"বিকাল":"রাত"},week:{dow:0,doy:6}}),{1:"༡",2:"༢",3:"༣",4:"༤",5:"༥",6:"༦",7:"༧",8:"༨",9:"༩",0:"༠"}),og={"༡":"1","༢":"2","༣":"3","༤":"4","༥":"5","༦":"6","༧":"7","༨":"8","༩":"9","༠":"0"},pg=(bg.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:"ལམ་སང",m:"སྐར་མ་གཅིག",mm:"%d སྐར་མ",h:"ཆུ་ཚོད་གཅིག",hh:"%d ཆུ་ཚོད",d:"ཉིན་གཅིག",dd:"%d ཉིན་",M:"ཟླ་བ་གཅིག",MM:"%d ཟླ་བ",y:"ལོ་གཅིག",yy:"%d ལོ"},preparse:function(a){return a.replace(/[༡༢༣༤༥༦༧༨༩༠]/g,function(a){return og[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return ng[a]})},meridiemParse:/མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/,meridiemHour:function(a,b){return 12===a&&(a=0),"མཚན་མོ"===b&&a>=4||"ཉིན་གུང"===b&&5>a||"དགོང་དག"===b?a+12:a},meridiem:function(a,b,c){return 4>a?"མཚན་མོ":10>a?"ཞོགས་ཀས":17>a?"ཉིན་གུང":20>a?"དགོང་དག":"མཚན་མོ"},week:{dow:0,doy:6}}),bg.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ù",m:"ur vunutenn",mm:hd,h:"un eur",hh:"%d eur",d:"un devezh",dd:hd,M:"ur miz",MM:hd,y:"ur bloaz",yy:id},ordinalParse:/\d{1,2}(añ|vet)/,ordinal:function(a){var b=1===a?"añ":"vet";return a+b},week:{dow:1,doy:4}}),bg.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:!0,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:!0,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",m:md,mm:md,h:md,hh:md,d:"dan",dd:md,M:"mjesec",MM:md,y:"godinu",yy:md},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),bg.defineLocale("ca",{months:"gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre".split("_"),monthsShort:"gen._febr._mar._abr._mai._jun._jul._ag._set._oct._nov._des.".split("_"),monthsParseExact:!0,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:!0,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:function(){return"[avui a "+(1!==this.hours()?"les":"la")+"] LT"},nextDay:function(){return"[demà a "+(1!==this.hours()?"les":"la")+"] LT"},nextWeek:function(){return"dddd [a "+(1!==this.hours()?"les":"la")+"] LT"},lastDay:function(){return"[ahir a "+(1!==this.hours()?"les":"la")+"] LT"},lastWeek:function(){return"[el] dddd [passat a "+(1!==this.hours()?"les":"la")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"fa %s",s:"uns 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"},ordinalParse:/\d{1,2}(r|n|t|è|a)/,ordinal:function(a,b){var c=1===a?"r":2===a?"n":3===a?"r":4===a?"t":"è";return("w"===b||"W"===b)&&(c="a"),a+c},week:{dow:1,doy:4}}),"leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec".split("_")),qg="led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro".split("_"),rg=(bg.defineLocale("cs",{months:pg,monthsShort:qg,monthsParse:function(a,b){var c,d=[];for(c=0;12>c;c++)d[c]=new RegExp("^"+a[c]+"$|^"+b[c]+"$","i");return d}(pg,qg),shortMonthsParse:function(a){var b,c=[];for(b=0;12>b;b++)c[b]=new RegExp("^"+a[b]+"$","i");return c}(qg),longMonthsParse:function(a){var b,c=[];for(b=0;12>b;b++)c[b]=new RegExp("^"+a[b]+"$","i");return c}(pg),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"},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:od,m:od,mm:od,h:od,hh:od,d:od,dd:od,M:od,MM:od,y:od,yy:od},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),bg.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(a){var b=/сехет$/i.exec(a)?"рен":/ҫул$/i.exec(a)?"тан":"ран";return a+b},past:"%s каялла",s:"пӗр-ик ҫеккунт",m:"пӗр минут",mm:"%d минут",h:"пӗр сехет",hh:"%d сехет",d:"пӗр кун",dd:"%d кун",M:"пӗр уйӑх",MM:"%d уйӑх",y:"пӗр ҫул",yy:"%d ҫул"},ordinalParse:/\d{1,2}-мӗш/,ordinal:"%d-мӗш",week:{dow:1,doy:7}}),bg.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:!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:"[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",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"},ordinalParse:/\d{1,2}(fed|ain|af|il|ydd|ed|eg)/,ordinal:function(a){var b=a,c="",d=["","af","il","ydd","ydd","ed","ed","ed","fed","fed","fed","eg","fed","eg","eg","fed","eg","eg","fed","eg","fed"];return b>20?c=40===b||50===b||60===b||80===b||100===b?"fed":"ain":b>0&&(c=d[b]),a+c},week:{dow:1,doy:4}}),bg.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 HH:mm"},calendar:{sameDay:"[I dag kl.] LT",nextDay:"[I morgen kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[I går kl.] LT",lastWeek:"[sidste] dddd [kl] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s siden",s:"få 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"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),bg.defineLocale("de-at",{months:"Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jän._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,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:!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:"[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",m:pd,mm:"%d Minuten",h:pd,hh:"%d Stunden",d:pd,dd:pd,M:pd,MM:pd,y:pd,yy:pd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),bg.defineLocale("de",{months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,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:!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:"[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",m:qd,mm:"%d Minuten",h:qd,hh:"%d Stunden",d:qd,dd:qd,M:qd,MM:qd,y:qd,yy:qd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),["ޖެނުއަރީ","ފެބްރުއަރީ","މާރިޗު","އޭޕްރީލު","މޭ","ޖޫން","ޖުލައި","އޯގަސްޓު","ސެޕްޓެމްބަރު","އޮކްޓޯބަރު","ނޮވެމްބަރު","ޑިސެމްބަރު"]),sg=["އާދިއްތަ","ހޯމަ","އަންގާރަ","ބުދަ","ބުރާސްފަތި","ހުކުރު","ހޮނިހިރު"],tg=(bg.defineLocale("dv",{months:rg,monthsShort:rg,weekdays:sg,weekdaysShort:sg,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(a){return"މފ"===a},meridiem:function(a,b,c){return 12>a?"މކ":"މފ"},calendar:{sameDay:"[މިއަދު] LT",nextDay:"[މާދަމާ] LT",nextWeek:"dddd LT",lastDay:"[އިއްޔެ] 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"},preparse:function(a){return a.replace(/،/g,",")},postformat:function(a){return a.replace(/,/g,"،")},week:{dow:7,doy:12}}),bg.defineLocale("el",{monthsNominativeEl:"Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος".split("_"),monthsGenitiveEl:"Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου".split("_"),months:function(a,b){return/D/.test(b.substring(0,b.indexOf("MMMM")))?this._monthsGenitiveEl[a.month()]:this._monthsNominativeEl[a.month()]},monthsShort:"Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ".split("_"),weekdays:"Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο".split("_"),weekdaysShort:"Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ".split("_"),weekdaysMin:"Κυ_Δε_Τρ_Τε_Πε_Πα_Σα".split("_"),meridiem:function(a,b,c){return a>11?c?"μμ":"ΜΜ":c?"πμ":"ΠΜ"},isPM:function(a){return"μ"===(a+"").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(a,b){var c=this._calendarEl[a],d=b&&b.hours();return w(c)&&(c=c.apply(b)),c.replace("{}",d%12===1?"στη":"στις")},relativeTime:{future:"σε %s",past:"%s πριν",s:"λίγα δευτερόλεπτα",m:"ένα λεπτό",mm:"%d λεπτά",h:"μία ώρα",hh:"%d ώρες",d:"μία μέρα",dd:"%d μέρες",M:"ένας μήνας",MM:"%d μήνες",y:"ένας χρόνος",yy:"%d χρόνια"},ordinalParse:/\d{1,2}η/,ordinal:"%dη",week:{dow:1,doy:4}}),bg.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",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"},ordinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}}),bg.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",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"},ordinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),bg.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",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"},ordinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}}),bg.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",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"},ordinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}}),bg.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",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"},ordinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}}),bg.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[-an de] MMMM, YYYY",LLL:"D[-an de] MMMM, YYYY HH:mm",LLLL:"dddd, [la] D[-an de] MMMM, YYYY HH:mm"},meridiemParse:/[ap]\.t\.m/i,isPM:function(a){return"p"===a.charAt(0).toLowerCase()},meridiem:function(a,b,c){return a>11?c?"p.t.m.":"P.T.M.":c?"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:"je %s",past:"antaŭ %s",s:"sekundoj",m:"minuto",mm:"%d minutoj",h:"horo",hh:"%d horoj",d:"tago",dd:"%d tagoj",M:"monato",MM:"%d monatoj",y:"jaro",yy:"%d jaroj"},ordinalParse:/\d{1,2}a/,ordinal:"%da",week:{dow:1,doy:7}}),"ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_")),ug="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),vg=(bg.defineLocale("es",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(a,b){return/-MMM-/.test(b)?ug[a.month()]:tg[a.month()]},monthsParseExact:!0,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:!0,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"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos 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"},ordinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}}),bg.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:rd,m:rd,mm:rd,h:rd,hh:rd,d:rd,dd:"%d päeva",M:rd,MM:rd,y:rd,yy:rd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),bg.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:!0,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:!0,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",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"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),{1:"۱",2:"۲",3:"۳",4:"۴",5:"۵",6:"۶",7:"۷",8:"۸",9:"۹",0:"۰"}),wg={"۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","۰":"0"},xg=(bg.defineLocale("fa",{months:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),monthsShort:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),weekdays:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_"),weekdaysShort:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_"),weekdaysMin:"ی_د_س_چ_پ_ج_ش".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:/قبل از ظهر|بعد از ظهر/,isPM:function(a){return/بعد از ظهر/.test(a)},meridiem:function(a,b,c){return 12>a?"قبل از ظهر":"بعد از ظهر"},calendar:{sameDay:"[امروز ساعت] LT",nextDay:"[فردا ساعت] LT",nextWeek:"dddd [ساعت] LT",lastDay:"[دیروز ساعت] 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 سال"},preparse:function(a){return a.replace(/[۰-۹]/g,function(a){return wg[a]}).replace(/،/g,",")},postformat:function(a){return a.replace(/\d/g,function(a){return vg[a]}).replace(/,/g,"،")},ordinalParse:/\d{1,2}م/,ordinal:"%dم",week:{dow:6,doy:12}}),"nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän".split(" ")),yg=["nolla","yhden","kahden","kolmen","neljän","viiden","kuuden",xg[7],xg[8],xg[9]],zg=(bg.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:sd,m:sd,mm:sd,h:sd,hh:sd,d:sd,dd:sd,M:sd,MM:sd,y:sd,yy:sd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),bg.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",m:"ein minutt",mm:"%d minuttir",h:"ein tími",hh:"%d tímar",d:"ein dagur",dd:"%d dagar",M:"ein mánaði",MM:"%d mánaðir",y:"eitt ár",yy:"%d ár"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),bg.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:!0,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:!0,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",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"},ordinalParse:/\d{1,2}(er|e)/,ordinal:function(a){return a+(1===a?"er":"e")}}),bg.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:!0,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:!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:"[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",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"},ordinalParse:/\d{1,2}(er|e)/,ordinal:function(a){return a+(1===a?"er":"e")},week:{dow:1,doy:4}}),bg.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:!0,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:!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:"[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",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"},ordinalParse:/\d{1,2}(er|)/,ordinal:function(a){return a+(1===a?"er":"")},week:{dow:1,doy:4}}),"jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.".split("_")),Ag="jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),Bg=(bg.defineLocale("fy",{months:"jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber".split("_"),monthsShort:function(a,b){return/-MMM-/.test(b)?Ag[a.month()]:zg[a.month()]},monthsParseExact:!0,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:!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:"[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",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"},ordinalParse:/\d{1,2}(ste|de)/,ordinal:function(a){return a+(1===a||8===a||a>=20?"ste":"de")},week:{dow:1,doy:4}}),["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"]),Cg=["Faoi","Gear","Màrt","Gibl","Cèit","Ògmh","Iuch","Lùn","Sult","Dàmh","Samh","Dùbh"],Dg=["Didòmhnaich","Diluain","Dimàirt","Diciadain","Diardaoin","Dihaoine","Disathairne"],Eg=["Did","Dil","Dim","Dic","Dia","Dih","Dis"],Fg=["Dò","Lu","Mà","Ci","Ar","Ha","Sa"],Gg=(bg.defineLocale("gd",{months:Bg,monthsShort:Cg,monthsParseExact:!0,weekdays:Dg,weekdaysShort:Eg,weekdaysMin:Fg,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",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"},ordinalParse:/\d{1,2}(d|na|mh)/,ordinal:function(a){var b=1===a?"d":a%10===2?"na":"mh";return a+b},week:{dow:1,doy:4}}),bg.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:!0,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:!0,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:function(){return"[hoxe "+(1!==this.hours()?"ás":"á")+"] LT"},nextDay:function(){return"[mañá "+(1!==this.hours()?"ás":"á")+"] LT"},nextWeek:function(){return"dddd ["+(1!==this.hours()?"ás":"a")+"] LT"},lastDay:function(){return"[onte "+(1!==this.hours()?"á":"a")+"] LT"},lastWeek:function(){return"[o] dddd [pasado "+(1!==this.hours()?"ás":"a")+"] LT"},sameElse:"L"},relativeTime:{future:function(a){return"uns segundos"===a?"nuns segundos":"en "+a},past:"hai %s",s:"uns 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"},ordinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:7}}),bg.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:"מספר שניות",m:"דקה",mm:"%d דקות",h:"שעה",hh:function(a){return 2===a?"שעתיים":a+" שעות"},d:"יום",dd:function(a){return 2===a?"יומיים":a+" ימים"},M:"חודש",MM:function(a){return 2===a?"חודשיים":a+" חודשים"},y:"שנה",yy:function(a){return 2===a?"שנתיים":a%10===0&&10!==a?a+" שנה":a+" שנים"}},meridiemParse:/אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i,isPM:function(a){return/^(אחה"צ|אחרי הצהריים|בערב)$/.test(a)},meridiem:function(a,b,c){return 5>a?"לפנות בוקר":10>a?"בבוקר":12>a?c?'לפנה"צ':"לפני הצהריים":18>a?c?'אחה"צ':"אחרי הצהריים":"בערב"}}),{1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"}),Hg={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"},Ig=(bg.defineLocale("hi",{months:"जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर".split("_"),monthsShort:"जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.".split("_"),monthsParseExact:!0,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:"कुछ ही क्षण",m:"एक मिनट",mm:"%d मिनट",h:"एक घंटा",hh:"%d घंटे",d:"एक दिन",dd:"%d दिन",M:"एक महीने",MM:"%d महीने",y:"एक वर्ष",yy:"%d वर्ष"},preparse:function(a){return a.replace(/[१२३४५६७८९०]/g,function(a){return Hg[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return Gg[a]})},meridiemParse:/रात|सुबह|दोपहर|शाम/,meridiemHour:function(a,b){return 12===a&&(a=0),"रात"===b?4>a?a:a+12:"सुबह"===b?a:"दोपहर"===b?a>=10?a:a+12:"शाम"===b?a+12:void 0},meridiem:function(a,b,c){return 4>a?"रात":10>a?"सुबह":17>a?"दोपहर":20>a?"शाम":"रात"},week:{dow:0,doy:6}}),bg.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:!0,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:!0,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",m:ud,mm:ud,h:ud,hh:ud,d:"dan",dd:ud,M:"mjesec",MM:ud,y:"godinu",yy:ud},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),"vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton".split(" ")),Jg=(bg.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(a){return"u"===a.charAt(1).toLowerCase()},meridiem:function(a,b,c){return 12>a?c===!0?"de":"DE":c===!0?"du":"DU"},calendar:{sameDay:"[ma] LT[-kor]",nextDay:"[holnap] LT[-kor]",nextWeek:function(){return wd.call(this,!0)},lastDay:"[tegnap] LT[-kor]",lastWeek:function(){return wd.call(this,!1)},sameElse:"L"},relativeTime:{future:"%s múlva",past:"%s",s:vd,m:vd,mm:vd,h:vd,hh:vd,d:vd,dd:vd,M:vd,MM:vd,y:vd,yy:vd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),bg.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:"մի քանի վայրկյան",m:"րոպե",mm:"%d րոպե",h:"ժամ",hh:"%d ժամ",d:"օր",dd:"%d օր",M:"ամիս",MM:"%d ամիս",y:"տարի",yy:"%d տարի"},meridiemParse:/գիշերվա|առավոտվա|ցերեկվա|երեկոյան/,isPM:function(a){return/^(ցերեկվա|երեկոյան)$/.test(a)},meridiem:function(a){return 4>a?"գիշերվա":12>a?"առավոտվա":17>a?"ցերեկվա":"երեկոյան"},ordinalParse:/\d{1,2}|\d{1,2}-(ին|րդ)/,ordinal:function(a,b){switch(b){case"DDD":case"w":case"W":case"DDDo":return 1===a?a+"-ին":a+"-րդ";default:return a}},week:{dow:1,doy:7}}),bg.defineLocale("id",{months:"Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_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(a,b){return 12===a&&(a=0),"pagi"===b?a:"siang"===b?a>=11?a:a+12:"sore"===b||"malam"===b?a+12:void 0},meridiem:function(a,b,c){return 11>a?"pagi":15>a?"siang":19>a?"sore":"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",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,doy:7}}),bg.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:yd,m:yd,mm:yd,h:"klukkustund",hh:yd,d:yd,dd:yd,M:yd,MM:yd,y:yd,yy:yd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),bg.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(a){return(/^[0-9].+$/.test(a)?"tra":"in")+" "+a},past:"%s fa",s:"alcuni 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"},ordinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}}),bg.defineLocale("ja",{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:"Ah時m分",LTS:"Ah時m分s秒",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah時m分",LLLL:"YYYY年M月D日Ah時m分 dddd"},meridiemParse:/午前|午後/i,isPM:function(a){return"午後"===a},meridiem:function(a,b,c){return 12>a?"午前":"午後"},calendar:{sameDay:"[今日] LT",nextDay:"[明日] LT",nextWeek:"[来週]dddd LT",lastDay:"[昨日] LT",lastWeek:"[前週]dddd LT",sameElse:"L"},ordinalParse:/\d{1,2}日/,ordinal:function(a,b){switch(b){case"d":case"D":case"DDD":return a+"日";default:return a}},relativeTime:{future:"%s後",past:"%s前",s:"数秒",m:"1分",mm:"%d分",h:"1時間",hh:"%d時間",d:"1日",dd:"%d日",M:"1ヶ月",MM:"%dヶ月",y:"1年",yy:"%d年"}}),bg.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(a,b){return 12===a&&(a=0),"enjing"===b?a:"siyang"===b?a>=11?a:a+12:"sonten"===b||"ndalu"===b?a+12:void 0},meridiem:function(a,b,c){return 11>a?"enjing":15>a?"siyang":19>a?"sonten":"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",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,doy:7}}),bg.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(a){return/(წამი|წუთი|საათი|წელი)/.test(a)?a.replace(/ი$/,"ში"):a+"ში"},past:function(a){return/(წამი|წუთი|საათი|დღე|თვე)/.test(a)?a.replace(/(ი|ე)$/,"ის წინ"):/წელი/.test(a)?a.replace(/წელი$/,"წლის წინ"):void 0},s:"რამდენიმე წამი",m:"წუთი",mm:"%d წუთი",h:"საათი",hh:"%d საათი",d:"დღე",dd:"%d დღე",M:"თვე",MM:"%d თვე",y:"წელი",yy:"%d წელი"},ordinalParse:/0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/,ordinal:function(a){return 0===a?a:1===a?a+"-ლი":20>a||100>=a&&a%20===0||a%100===0?"მე-"+a:a+"-ე"},week:{dow:1,doy:7}}),{0:"-ші",1:"-ші",2:"-ші",3:"-ші",4:"-ші",5:"-ші",6:"-шы",7:"-ші",8:"-ші",9:"-шы",10:"-шы",20:"-шы",30:"-шы",40:"-шы",50:"-ші",60:"-шы",70:"-ші",80:"-ші",90:"-шы",100:"-ші"}),Kg=(bg.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:"бірнеше секунд",m:"бір минут",mm:"%d минут",h:"бір сағат",hh:"%d сағат",d:"бір күн",dd:"%d күн",M:"бір ай",MM:"%d ай",y:"бір жыл",yy:"%d жыл"},ordinalParse:/\d{1,2}-(ші|шы)/,ordinal:function(a){var b=a%10,c=a>=100?100:null;return a+(Jg[a]||Jg[b]||Jg[c])},week:{dow:1,doy:7}}),bg.defineLocale("km",{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:"ប៉ុន្មានវិនាទី",m:"មួយនាទី",mm:"%d នាទី",h:"មួយម៉ោង",hh:"%d ម៉ោង",d:"មួយថ្ងៃ",dd:"%d ថ្ងៃ",M:"មួយខែ",MM:"%d ខែ",y:"មួយឆ្នាំ",yy:"%d ឆ្នាំ"},week:{dow:1,doy:4}}),bg.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시 m분",LTS:"A h시 m분 s초",L:"YYYY.MM.DD",LL:"YYYY년 MMMM D일",LLL:"YYYY년 MMMM D일 A h시 m분",LLLL:"YYYY년 MMMM D일 dddd A h시 m분"},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년"},ordinalParse:/\d{1,2}일/,ordinal:"%d일",meridiemParse:/오전|오후/,isPM:function(a){return"오후"===a},meridiem:function(a,b,c){return 12>a?"오전":"오후"}}),{0:"-чү",1:"-чи",2:"-чи",3:"-чү",4:"-чү",5:"-чи",6:"-чы",7:"-чи",8:"-чи",9:"-чу",10:"-чу",20:"-чы",30:"-чу",40:"-чы",50:"-чү",60:"-чы",70:"-чи",80:"-чи",90:"-чу",100:"-чү"}),Lg=(bg.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:"бирнече секунд",m:"бир мүнөт",mm:"%d мүнөт",h:"бир саат",hh:"%d саат",d:"бир күн",dd:"%d күн",M:"бир ай",MM:"%d ай",y:"бир жыл",yy:"%d жыл"},ordinalParse:/\d{1,2}-(чи|чы|чү|чу)/,ordinal:function(a){var b=a%10,c=a>=100?100:null;return a+(Kg[a]||Kg[b]||Kg[c])},week:{dow:1,doy:7}}),bg.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:!0,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:!0,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(){switch(this.day()){case 2:case 4:return"[Leschten] dddd [um] LT";default:return"[Leschte] dddd [um] LT"}}},relativeTime:{future:Ad,past:Bd,s:"e puer Sekonnen",m:zd,mm:"%d Minutten",h:zd,hh:"%d Stonnen",d:zd,dd:"%d Deeg",M:zd,MM:"%d Méint",y:zd,yy:"%d Joer"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),bg.defineLocale("lo",{months:"ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ".split("_"),monthsShort:"ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ".split("_"),weekdays:"ອາທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ".split("_"),weekdaysShort:"ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ".split("_"),weekdaysMin:"ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ".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:/ຕອນເຊົ້າ|ຕອນແລງ/,isPM:function(a){return"ຕອນແລງ"===a},meridiem:function(a,b,c){return 12>a?"ຕອນເຊົ້າ":"ຕອນແລງ"},calendar:{sameDay:"[ມື້ນີ້ເວລາ] LT",nextDay:"[ມື້ອື່ນເວລາ] LT",nextWeek:"[ວັນ]dddd[ໜ້າເວລາ] LT",lastDay:"[ມື້ວານນີ້ເວລາ] LT",lastWeek:"[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT",sameElse:"L"},relativeTime:{future:"ອີກ %s",past:"%sຜ່ານມາ",s:"ບໍ່ເທົ່າໃດວິນາທີ",m:"1 ນາທີ",mm:"%d ນາທີ",h:"1 ຊົ່ວໂມງ",hh:"%d ຊົ່ວໂມງ",d:"1 ມື້",dd:"%d ມື້",M:"1 ເດືອນ",MM:"%d ເດືອນ",y:"1 ປີ",yy:"%d ປີ"},ordinalParse:/(ທີ່)\d{1,2}/,ordinal:function(a){return"ທີ່"+a}}),{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"}),Mg=(bg.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("_")},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:!0,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:Dd,m:Ed,mm:Hd,h:Ed,hh:Hd,d:Ed,dd:Hd,M:Ed,MM:Hd,y:Ed,yy:Hd},ordinalParse:/\d{1,2}-oji/,ordinal:function(a){return a+"-oji"},week:{dow:1,doy:4}}),{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("_")}),Ng=(bg.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:!0,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:Ld,m:Kd,mm:Jd,h:Kd,hh:Jd,d:Kd,dd:Jd,M:Kd,MM:Jd,y:Kd,yy:Jd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),{words:{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(a,b){return 1===a?b[0]:a>=2&&4>=a?b[1]:b[2]},translate:function(a,b,c){var d=Ng.words[c];return 1===c.length?b?d[0]:d[1]:a+" "+Ng.correctGrammaticalCase(a,d)}}),Og=(bg.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:!0,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:!0,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 a=["[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 a[this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"nekoliko sekundi",m:Ng.translate,mm:Ng.translate,h:Ng.translate,hh:Ng.translate,d:"dan",dd:Ng.translate,M:"mjesec",MM:Ng.translate,y:"godinu",yy:Ng.translate},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),bg.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:"неколку секунди",m:"минута",mm:"%d минути",h:"час",hh:"%d часа",d:"ден",dd:"%d дена",M:"месец",MM:"%d месеци",y:"година",yy:"%d години"},ordinalParse:/\d{1,2}-(ев|ен|ти|ви|ри|ми)/,ordinal:function(a){var b=a%10,c=a%100;return 0===a?a+"-ев":0===c?a+"-ен":c>10&&20>c?a+"-ти":1===b?a+"-ви":2===b?a+"-ри":7===b||8===b?a+"-ми":a+"-ти"},week:{dow:1,doy:7}}),bg.defineLocale("ml",{months:"ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ".split("_"),monthsShort:"ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.".split("_"),monthsParseExact:!0,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:"അൽപ നിമിഷങ്ങൾ",m:"ഒരു മിനിറ്റ്",mm:"%d മിനിറ്റ്",h:"ഒരു മണിക്കൂർ",hh:"%d മണിക്കൂർ",d:"ഒരു ദിവസം",dd:"%d ദിവസം",M:"ഒരു മാസം",MM:"%d മാസം",y:"ഒരു വർഷം",yy:"%d വർഷം"},meridiemParse:/രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i,meridiemHour:function(a,b){return 12===a&&(a=0),"രാത്രി"===b&&a>=4||"ഉച്ച കഴിഞ്ഞ്"===b||"വൈകുന്നേരം"===b?a+12:a},meridiem:function(a,b,c){return 4>a?"രാത്രി":12>a?"രാവിലെ":17>a?"ഉച്ച കഴിഞ്ഞ്":20>a?"വൈകുന്നേരം":"രാത്രി"}}),{1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"}),Pg={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"},Qg=(bg.defineLocale("mr",{months:"जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर".split("_"),monthsShort:"जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.".split("_"),monthsParseExact:!0,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:Md,m:Md,mm:Md,h:Md,hh:Md,d:Md,dd:Md,M:Md,MM:Md,y:Md,yy:Md},preparse:function(a){return a.replace(/[१२३४५६७८९०]/g,function(a){return Pg[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return Og[a]})},meridiemParse:/रात्री|सकाळी|दुपारी|सायंकाळी/,meridiemHour:function(a,b){return 12===a&&(a=0),"रात्री"===b?4>a?a:a+12:"सकाळी"===b?a:"दुपारी"===b?a>=10?a:a+12:"सायंकाळी"===b?a+12:void 0},meridiem:function(a,b,c){return 4>a?"रात्री":10>a?"सकाळी":17>a?"दुपारी":20>a?"सायंकाळी":"रात्री"},week:{dow:0,doy:6}}),bg.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(a,b){return 12===a&&(a=0),"pagi"===b?a:"tengahari"===b?a>=11?a:a+12:"petang"===b||"malam"===b?a+12:void 0},meridiem:function(a,b,c){return 11>a?"pagi":15>a?"tengahari":19>a?"petang":"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",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,doy:7}}),bg.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(a,b){return 12===a&&(a=0),"pagi"===b?a:"tengahari"===b?a>=11?a:a+12:"petang"===b||"malam"===b?a+12:void 0},meridiem:function(a,b,c){return 11>a?"pagi":15>a?"tengahari":19>a?"petang":"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",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,doy:7}}),{1:"၁",2:"၂",3:"၃",4:"၄",5:"၅",6:"၆",7:"၇",8:"၈",9:"၉",0:"၀"}),Rg={"၁":"1","၂":"2","၃":"3","၄":"4","၅":"5","၆":"6","၇":"7","၈":"8","၉":"9","၀":"0"},Sg=(bg.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:"စက္ကန်.အနည်းငယ်",m:"တစ်မိနစ်",mm:"%d မိနစ်",h:"တစ်နာရီ",hh:"%d နာရီ",d:"တစ်ရက်",dd:"%d ရက်",M:"တစ်လ",MM:"%d လ",y:"တစ်နှစ်",yy:"%d နှစ်"},preparse:function(a){return a.replace(/[၁၂၃၄၅၆၇၈၉၀]/g,function(a){return Rg[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return Qg[a]})},week:{dow:1,doy:4}}),bg.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:!0,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:!0,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",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"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),{1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"}),Tg={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"},Ug=(bg.defineLocale("ne",{months:"जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर".split("_"),monthsShort:"जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.".split("_"),monthsParseExact:!0,weekdays:"आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार".split("_"),weekdaysShort:"आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.".split("_"),weekdaysMin:"आ._सो._मं._बु._बि._शु._श.".split("_"),weekdaysParseExact:!0,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(a){return a.replace(/[१२३४५६७८९०]/g,function(a){return Tg[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return Sg[a]})},meridiemParse:/राति|बिहान|दिउँसो|साँझ/,meridiemHour:function(a,b){return 12===a&&(a=0),"राति"===b?4>a?a:a+12:"बिहान"===b?a:"दिउँसो"===b?a>=10?a:a+12:"साँझ"===b?a+12:void 0},meridiem:function(a,b,c){return 3>a?"राति":12>a?"बिहान":16>a?"दिउँसो":20>a?"साँझ":"राति"},calendar:{sameDay:"[आज] LT",nextDay:"[भोलि] LT",nextWeek:"[आउँदो] dddd[,] LT",lastDay:"[हिजो] 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 बर्ष"},week:{dow:0,doy:6}}),"jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_")),Vg="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"),Wg=(bg.defineLocale("nl",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(a,b){return/-MMM-/.test(b)?Vg[a.month()]:Ug[a.month()]},monthsParseExact:!0,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:!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:"[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",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"},ordinalParse:/\d{1,2}(ste|de)/,ordinal:function(a){return a+(1===a||8===a||a>=20?"ste":"de")},week:{dow:1,doy:4}}),bg.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",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"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),{1:"੧",2:"੨",3:"੩",4:"੪",5:"੫",6:"੬",7:"੭",8:"੮",9:"੯",0:"੦"}),Xg={"੧":"1","੨":"2","੩":"3","੪":"4","੫":"5","੬":"6","੭":"7","੮":"8","੯":"9","੦":"0"},Yg=(bg.defineLocale("pa-in",{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:"ਕੁਝ ਸਕਿੰਟ",m:"ਇਕ ਮਿੰਟ",mm:"%d ਮਿੰਟ",h:"ਇੱਕ ਘੰਟਾ",hh:"%d ਘੰਟੇ",d:"ਇੱਕ ਦਿਨ",dd:"%d ਦਿਨ",M:"ਇੱਕ ਮਹੀਨਾ",MM:"%d ਮਹੀਨੇ",y:"ਇੱਕ ਸਾਲ",yy:"%d ਸਾਲ"},preparse:function(a){return a.replace(/[੧੨੩੪੫੬੭੮੯੦]/g,function(a){return Xg[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return Wg[a]})},meridiemParse:/ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/,meridiemHour:function(a,b){return 12===a&&(a=0),"ਰਾਤ"===b?4>a?a:a+12:"ਸਵੇਰ"===b?a:"ਦੁਪਹਿਰ"===b?a>=10?a:a+12:"ਸ਼ਾਮ"===b?a+12:void 0},meridiem:function(a,b,c){return 4>a?"ਰਾਤ":10>a?"ਸਵੇਰ":17>a?"ਦੁਪਹਿਰ":20>a?"ਸ਼ਾਮ":"ਰਾਤ"},week:{dow:0,doy:6}}),"styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień".split("_")),Zg="stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia".split("_"),$g=(bg.defineLocale("pl",{months:function(a,b){return""===b?"("+Zg[a.month()]+"|"+Yg[a.month()]+")":/D MMMM/.test(b)?Zg[a.month()]:Yg[a.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:"nie_pon_wt_śr_czw_pt_sb".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:"[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",m:Od,mm:Od,h:Od,hh:Od,d:"1 dzień",dd:"%d dni",M:"miesiąc",MM:Od,y:"rok",yy:Od},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),bg.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:"Dom_2ª_3ª_4ª_5ª_6ª_Sáb".split("_"),weekdaysParseExact:!0,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 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"%s atrás",s:"poucos 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"},ordinalParse:/\d{1,2}º/,ordinal:"%dº"}),bg.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:"Dom_2ª_3ª_4ª_5ª_6ª_Sáb".split("_"),weekdaysParseExact:!0,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 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"há %s",s:"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"},ordinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}}),bg.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:!0,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",m:"un minut",mm:Pd,h:"o oră",hh:Pd,d:"o zi",dd:Pd,M:"o lună",MM:Pd,y:"un an",yy:Pd},week:{dow:1,doy:7}}),[/^янв/i,/^фев/i,/^мар/i,/^апр/i,/^ма[йя]/i,/^июн/i,/^июл/i,/^авг/i,/^сен/i,/^окт/i,/^ноя/i,/^дек/i]),_g=(bg.defineLocale("ru",{months:{format:"января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_"),standalone:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_")},monthsShort:{format:"янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.".split("_"),standalone:"янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.".split("_")},weekdays:{standalone:"воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"),format:"воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу".split("_"),isFormat:/\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?\] ?dddd/},weekdaysShort:"вс_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"вс_пн_вт_ср_чт_пт_сб".split("_"),monthsParse:$g,longMonthsParse:$g,shortMonthsParse:$g,monthsRegex:/^(сентябр[яь]|октябр[яь]|декабр[яь]|феврал[яь]|январ[яь]|апрел[яь]|августа?|ноябр[яь]|сент\.|февр\.|нояб\.|июнь|янв.|июль|дек.|авг.|апр.|марта|мар[.т]|окт.|июн[яь]|июл[яь]|ма[яй])/i,monthsShortRegex:/^(сентябр[яь]|октябр[яь]|декабр[яь]|феврал[яь]|январ[яь]|апрел[яь]|августа?|ноябр[яь]|сент\.|февр\.|нояб\.|июнь|янв.|июль|дек.|авг.|апр.|марта|мар[.т]|окт.|июн[яь]|июл[яь]|ма[яй])/i,monthsStrictRegex:/^(сентябр[яь]|октябр[яь]|декабр[яь]|феврал[яь]|январ[яь]|апрел[яь]|августа?|ноябр[яь]|марта?|июн[яь]|июл[яь]|ма[яй])/i,monthsShortStrictRegex:/^(нояб\.|февр\.|сент\.|июль|янв\.|июн[яь]|мар[.т]|авг\.|апр\.|окт\.|дек\.|ма[яй])/i,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(a){if(a.week()===this.week())return 2===this.day()?"[Во] dddd [в] LT":"[В] dddd [в] LT";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"}},lastWeek:function(a){if(a.week()===this.week())return 2===this.day()?"[Во] dddd [в] LT":"[В] dddd [в] LT";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"}},sameElse:"L"},relativeTime:{future:"через %s",past:"%s назад",s:"несколько секунд",m:Rd,mm:Rd,h:"час",hh:Rd,d:"день",dd:Rd,M:"месяц",MM:Rd,y:"год",yy:Rd},meridiemParse:/ночи|утра|дня|вечера/i,isPM:function(a){return/^(дня|вечера)$/.test(a)},meridiem:function(a,b,c){return 4>a?"ночи":12>a?"утра":17>a?"дня":"вечера"},ordinalParse:/\d{1,2}-(й|го|я)/,ordinal:function(a,b){switch(b){case"M":case"d":case"DDD":return a+"-й";case"D":return a+"-го";case"w":case"W":return a+"-я";default:return a}},week:{dow:1,doy:7}}),bg.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",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"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),bg.defineLocale("si",{months:"ජනවාරි_පෙබරවාරි_මාර්තු_අප්රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්".split("_"),monthsShort:"ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ".split("_"),weekdays:"ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා".split("_"),weekdaysShort:"ඉරි_සඳු_අඟ_බදා_බ්රහ_සිකු_සෙන".split("_"),weekdaysMin:"ඉ_ස_අ_බ_බ්ර_සි_සෙ".split("_"),weekdaysParseExact:!0,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:"තත්පර කිහිපය",m:"මිනිත්තුව",mm:"මිනිත්තු %d",h:"පැය",hh:"පැය %d",d:"දිනය",dd:"දින %d",M:"මාසය",MM:"මාස %d",y:"වසර",yy:"වසර %d"},ordinalParse:/\d{1,2} වැනි/,ordinal:function(a){return a+" වැනි"},meridiemParse:/පෙර වරු|පස් වරු|පෙ.ව|ප.ව./,isPM:function(a){return"ප.ව."===a||"පස් වරු"===a},meridiem:function(a,b,c){return a>11?c?"ප.ව.":"පස් වරු":c?"පෙ.ව.":"පෙර වරු"}}),"január_február_marec_apríl_máj_jún_júl_august_september_október_november_december".split("_")),ah="jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec".split("_"),bh=(bg.defineLocale("sk",{months:_g,monthsShort:ah,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:Td,m:Td,mm:Td,h:Td,hh:Td,d:Td,dd:Td,M:Td,MM:Td,y:Td,yy:Td},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),bg.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:!0,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:!0,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:Ud,m:Ud,mm:Ud,h:Ud,hh:Ud,d:Ud,dd:Ud,M:Ud,MM:Ud,y:Ud,yy:Ud},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),bg.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:!0,meridiemParse:/PD|MD/,isPM:function(a){return"M"===a.charAt(0)},meridiem:function(a,b,c){return 12>a?"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",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"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),{words:{m:["један минут","једне минуте"],mm:["минут","минуте","минута"],h:["један сат","једног сата"],hh:["сат","сата","сати"],dd:["дан","дана","дана"],MM:["месец","месеца","месеци"],yy:["година","године","година"]},correctGrammaticalCase:function(a,b){return 1===a?b[0]:a>=2&&4>=a?b[1]:b[2]},translate:function(a,b,c){var d=bh.words[c];return 1===c.length?b?d[0]:d[1]:a+" "+bh.correctGrammaticalCase(a,d)}}),ch=(bg.defineLocale("sr-cyrl",{months:"јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар".split("_"),monthsShort:"јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.".split("_"),monthsParseExact:!0,weekdays:"недеља_понедељак_уторак_среда_четвртак_петак_субота".split("_"),weekdaysShort:"нед._пон._уто._сре._чет._пет._суб.".split("_"),weekdaysMin:"не_по_ут_ср_че_пе_су".split("_"),weekdaysParseExact:!0,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 a=["[прошле] [недеље] [у] LT","[прошлог] [понедељка] [у] LT","[прошлог] [уторка] [у] LT","[прошле] [среде] [у] LT","[прошлог] [четвртка] [у] LT","[прошлог] [петка] [у] LT","[прошле] [суботе] [у] LT"];return a[this.day()]},sameElse:"L"},relativeTime:{future:"за %s",past:"пре %s",s:"неколико секунди",m:bh.translate,mm:bh.translate,h:bh.translate,hh:bh.translate,d:"дан",dd:bh.translate,M:"месец",MM:bh.translate,y:"годину",yy:bh.translate},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),{words:{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(a,b){return 1===a?b[0]:a>=2&&4>=a?b[1]:b[2]},translate:function(a,b,c){var d=ch.words[c];return 1===c.length?b?d[0]:d[1]:a+" "+ch.correctGrammaticalCase(a,d)}}),dh=(bg.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:!0,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:!0,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 a=["[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 a[this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"pre %s",s:"nekoliko sekundi",m:ch.translate,mm:ch.translate,h:ch.translate,hh:ch.translate,d:"dan",dd:ch.translate,M:"mesec",MM:ch.translate,y:"godinu",yy:ch.translate},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),bg.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:!0,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",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(a,b,c){return 11>a?"ekuseni":15>a?"emini":19>a?"entsambama":"ebusuku"},meridiemHour:function(a,b){return 12===a&&(a=0),"ekuseni"===b?a:"emini"===b?a>=11?a:a+12:"entsambama"===b||"ebusuku"===b?0===a?0:a+12:void 0},ordinalParse:/\d{1,2}/,ordinal:"%d",week:{dow:1,doy:4}}),bg.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",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"},ordinalParse:/\d{1,2}(e|a)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"e":1===b?"a":2===b?"a":"e";return a+c},week:{dow:1,doy:4}}),bg.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:!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:"[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",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,doy:7}}),{1:"௧",2:"௨",3:"௩",4:"௪",5:"௫",6:"௬",7:"௭",8:"௮",9:"௯",0:"௦"}),eh={"௧":"1","௨":"2","௩":"3","௪":"4","௫":"5","௬":"6","௭":"7","௮":"8","௯":"9","௦":"0"},fh=(bg.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:"ஒரு சில விநாடிகள்",m:"ஒரு நிமிடம்",mm:"%d நிமிடங்கள்",h:"ஒரு மணி நேரம்",hh:"%d மணி நேரம்",d:"ஒரு நாள்",dd:"%d நாட்கள்",M:"ஒரு மாதம்",MM:"%d மாதங்கள்",y:"ஒரு வருடம்",yy:"%d ஆண்டுகள்"},ordinalParse:/\d{1,2}வது/,ordinal:function(a){return a+"வது"},preparse:function(a){return a.replace(/[௧௨௩௪௫௬௭௮௯௦]/g,function(a){return eh[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return dh[a]})},meridiemParse:/யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/,meridiem:function(a,b,c){return 2>a?" யாமம்":6>a?" வைகறை":10>a?" காலை":14>a?" நண்பகல்":18>a?" எற்பாடு":22>a?" மாலை":" யாமம்"},meridiemHour:function(a,b){return 12===a&&(a=0),"யாமம்"===b?2>a?a:a+12:"வைகறை"===b||"காலை"===b?a:"நண்பகல்"===b&&a>=10?a:a+12},week:{dow:0,doy:6}}),bg.defineLocale("te",{months:"జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జూలై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్".split("_"),monthsShort:"జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జూలై_ఆగ._సెప్._అక్టో._నవ._డిసె.".split("_"),monthsParseExact:!0,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:"కొన్ని క్షణాలు",m:"ఒక నిమిషం",mm:"%d నిమిషాలు",h:"ఒక గంట",hh:"%d గంటలు",d:"ఒక రోజు",dd:"%d రోజులు",M:"ఒక నెల",MM:"%d నెలలు",y:"ఒక సంవత్సరం",yy:"%d సంవత్సరాలు"},ordinalParse:/\d{1,2}వ/,ordinal:"%dవ",meridiemParse:/రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/,meridiemHour:function(a,b){return 12===a&&(a=0),"రాత్రి"===b?4>a?a:a+12:"ఉదయం"===b?a:"మధ్యాహ్నం"===b?a>=10?a:a+12:"సాయంత్రం"===b?a+12:void 0},meridiem:function(a,b,c){return 4>a?"రాత్రి":10>a?"ఉదయం":17>a?"మధ్యాహ్నం":20>a?"సాయంత్రం":"రాత్రి"},week:{dow:0,doy:6}}),bg.defineLocale("th",{months:"มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม".split("_"),monthsShort:"มกรา_กุมภา_มีนา_เมษา_พฤษภา_มิถุนา_กรกฎา_สิงหา_กันยา_ตุลา_พฤศจิกา_ธันวา".split("_"),monthsParseExact:!0,weekdays:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์".split("_"),weekdaysShort:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์".split("_"),weekdaysMin:"อา._จ._อ._พ._พฤ._ศ._ส.".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H นาฬิกา m นาที",LTS:"H นาฬิกา m นาที s วินาที",L:"YYYY/MM/DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY เวลา H นาฬิกา m นาที",LLLL:"วันddddที่ D MMMM YYYY เวลา H นาฬิกา m นาที"},meridiemParse:/ก่อนเที่ยง|หลังเที่ยง/,isPM:function(a){return"หลังเที่ยง"===a},meridiem:function(a,b,c){return 12>a?"ก่อนเที่ยง":"หลังเที่ยง"},calendar:{sameDay:"[วันนี้ เวลา] LT",nextDay:"[พรุ่งนี้ เวลา] LT",nextWeek:"dddd[หน้า เวลา] LT",lastDay:"[เมื่อวานนี้ เวลา] LT",lastWeek:"[วัน]dddd[ที่แล้ว เวลา] LT",sameElse:"L"},relativeTime:{future:"อีก %s",past:"%sที่แล้ว",s:"ไม่กี่วินาที",m:"1 นาที",mm:"%d นาที",h:"1 ชั่วโมง",hh:"%d ชั่วโมง",d:"1 วัน",dd:"%d วัน",M:"1 เดือน",MM:"%d เดือน",y:"1 ปี",yy:"%d ปี"}}),bg.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:"[Ngayon sa] LT",nextDay:"[Bukas sa] LT",nextWeek:"dddd [sa] LT",lastDay:"[Kahapon sa] LT",lastWeek:"dddd [huling linggo] LT",sameElse:"L"},relativeTime:{future:"sa loob ng %s",past:"%s ang nakalipas",s:"ilang 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"},ordinalParse:/\d{1,2}/,ordinal:function(a){return a},week:{dow:1,doy:4}}),"pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut".split("_")),gh=(bg.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:!0,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:Vd,past:Wd,s:"puS lup",m:"wa’ tup",mm:Xd,h:"wa’ rep",hh:Xd,d:"wa’ jaj",dd:Xd,M:"wa’ jar",MM:Xd,y:"wa’ DIS",yy:Xd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy: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ı"}),hh=(bg.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:"[haftaya] dddd [saat] LT",lastDay:"[dün] LT",lastWeek:"[geçen hafta] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s önce",s:"birkaç 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"},ordinalParse:/\d{1,2}'(inci|nci|üncü|ncı|uncu|ıncı)/,ordinal:function(a){if(0===a)return a+"'ıncı";var b=a%10,c=a%100-b,d=a>=100?100:null;return a+(gh[b]||gh[c]||gh[d])},week:{dow:1,doy:7}}),bg.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(a){return"d'o"===a.toLowerCase()},meridiem:function(a,b,c){return a>11?c?"d'o":"D'O":c?"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:Zd,m:Zd,mm:Zd,h:Zd,hh:Zd,d:Zd,dd:Zd,M:Zd,MM:Zd,y:Zd,yy:Zd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),bg.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",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,doy:12}}),bg.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:"ⵉⵎⵉⴽ",m:"ⵎⵉⵏⵓⴺ",mm:"%d ⵎⵉⵏⵓⴺ",h:"ⵙⴰⵄⴰ",hh:"%d ⵜⴰⵙⵙⴰⵄⵉⵏ",d:"ⴰⵙⵙ",dd:"%d oⵙⵙⴰⵏ",M:"ⴰⵢoⵓⵔ",MM:"%d ⵉⵢⵢⵉⵔⵏ",y:"ⴰⵙⴳⴰⵙ",yy:"%d ⵉⵙⴳⴰⵙⵏ"},week:{dow:6,doy:12}}),bg.defineLocale("uk",{months:{format:"січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня".split("_"),standalone:"січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень".split("_")},monthsShort:"січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд".split("_"),weekdays:ae,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:be("[Сьогодні "),nextDay:be("[Завтра "),lastDay:be("[Вчора "),nextWeek:be("[У] dddd ["),lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return be("[Минулої] dddd [").call(this);case 1:case 2:case 4:return be("[Минулого] dddd [").call(this)}},sameElse:"L"},relativeTime:{future:"за %s",past:"%s тому",s:"декілька секунд",m:_d,mm:_d,h:"годину",hh:_d,d:"день",dd:_d,M:"місяць",MM:_d,y:"рік",yy:_d},meridiemParse:/ночі|ранку|дня|вечора/,isPM:function(a){return/^(дня|вечора)$/.test(a)},meridiem:function(a,b,c){return 4>a?"ночі":12>a?"ранку":17>a?"дня":"вечора"},ordinalParse:/\d{1,2}-(й|го)/,ordinal:function(a,b){switch(b){case"M":case"d":case"DDD":case"w":case"W":return a+"-й";case"D":return a+"-го";default:return a}},week:{dow:1,doy:7}}),bg.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:"фурсат",m:"бир дакика",mm:"%d дакика",h:"бир соат",hh:"%d соат",d:"бир кун",dd:"%d кун",M:"бир ой",MM:"%d ой",y:"бир йил",yy:"%d йил"},week:{dow:1,doy:7}}),bg.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:!0,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:!0,meridiemParse:/sa|ch/i,isPM:function(a){return/^ch$/i.test(a)},meridiem:function(a,b,c){return 12>a?c?"sa":"SA":c?"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",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"},ordinalParse:/\d{1,2}/,ordinal:function(a){return a},week:{dow:1,doy:4}}),bg.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:!0,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:!0,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",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"},ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}}),bg.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:"Ah点mm分",LTS:"Ah点m分s秒",L:"YYYY-MM-DD",LL:"YYYY年MMMD日",LLL:"YYYY年MMMD日Ah点mm分",LLLL:"YYYY年MMMD日ddddAh点mm分",l:"YYYY-MM-DD",ll:"YYYY年MMMD日",lll:"YYYY年MMMD日Ah点mm分",llll:"YYYY年MMMD日ddddAh点mm分"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(a,b){return 12===a&&(a=0),"凌晨"===b||"早上"===b||"上午"===b?a:"下午"===b||"晚上"===b?a+12:a>=11?a:a+12},meridiem:function(a,b,c){var d=100*a+b;return 600>d?"凌晨":900>d?"早上":1130>d?"上午":1230>d?"中午":1800>d?"下午":"晚上"},calendar:{sameDay:function(){return 0===this.minutes()?"[今天]Ah[点整]":"[今天]LT"},nextDay:function(){return 0===this.minutes()?"[明天]Ah[点整]":"[明天]LT"},lastDay:function(){return 0===this.minutes()?"[昨天]Ah[点整]":"[昨天]LT"},nextWeek:function(){var a,b;return a=bg().startOf("week"),b=this.diff(a,"days")>=7?"[下]":"[本]",0===this.minutes()?b+"dddAh点整":b+"dddAh点mm"},lastWeek:function(){var a,b;return a=bg().startOf("week"),b=this.unix()<a.unix()?"[上]":"[本]",0===this.minutes()?b+"dddAh点整":b+"dddAh点mm"},sameElse:"LL"},ordinalParse:/\d{1,2}(日|月|周)/,ordinal:function(a,b){switch(b){case"d":case"D":case"DDD":return a+"日";case"M":return a+"月";case"w":case"W":return a+"周";default:return a}},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},week:{dow:1,doy:4}}),bg.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:"Ah點mm分",LTS:"Ah點m分s秒",L:"YYYY年MMMD日",LL:"YYYY年MMMD日",LLL:"YYYY年MMMD日Ah點mm分",LLLL:"YYYY年MMMD日ddddAh點mm分",l:"YYYY年MMMD日",ll:"YYYY年MMMD日",lll:"YYYY年MMMD日Ah點mm分",llll:"YYYY年MMMD日ddddAh點mm分"},meridiemParse:/早上|上午|中午|下午|晚上/,meridiemHour:function(a,b){return 12===a&&(a=0),"早上"===b||"上午"===b?a:"中午"===b?a>=11?a:a+12:"下午"===b||"晚上"===b?a+12:void 0},meridiem:function(a,b,c){var d=100*a+b;return 900>d?"早上":1130>d?"上午":1230>d?"中午":1800>d?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:"[下]ddddLT",lastDay:"[昨天]LT",lastWeek:"[上]ddddLT",sameElse:"L"},ordinalParse:/\d{1,2}(日|月|週)/,ordinal:function(a,b){switch(b){case"d":case"D":case"DDD":return a+"日";case"M":return a+"月";case"w":case"W":return a+"週";default:return a}},relativeTime:{future:"%s內",past:"%s前",s:"幾秒",m:"1分鐘",mm:"%d分鐘",h:"1小時",hh:"%d小時",d:"1天",dd:"%d天",M:"1個月",MM:"%d個月",y:"1年",yy:"%d年"}}),bg);return hh.locale("en"),hh});
\ No newline at end of file
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'Vandag om 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Vandag om 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Vandag om 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Môre om 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Vandag om 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Gister om 02:00', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'اليوم على الساعة 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'اليوم على الساعة 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'اليوم على الساعة 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'غدا على الساعة 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'اليوم على الساعة 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'أمس على الساعة 02:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'اليوم على الساعة 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'اليوم على الساعة 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'اليوم على الساعة 13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'غدا على الساعة 12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'اليوم على الساعة 11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'أمس على الساعة 12:00', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
test('calendar day', function (assert) {
- var a = moment().hours(2).minutes(0).seconds(0);
+ var a = moment().hours(12).minutes(0).seconds(0);
- assert.equal(moment(a).calendar(), 'اليوم على الساعة ٠٢:٠٠', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'اÙ\84Ù\8aÙ\88Ù\85 عÙ\84Ù\89 اÙ\84ساعة Ù ٢:٢٥', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'اÙ\84Ù\8aÙ\88Ù\85 عÙ\84Ù\89 اÙ\84ساعة Ù ٣:٠٠', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'غدا عÙ\84Ù\89 اÙ\84ساعة Ù Ù¢:Ù Ù ', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'اÙ\84Ù\8aÙ\88Ù\85 عÙ\84Ù\89 اÙ\84ساعة Ù ١:٠٠', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ø£Ù\85س عÙ\84Ù\89 اÙ\84ساعة Ù Ù¢:Ù Ù ', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'اليوم على الساعة ١٢:٠٠', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'اÙ\84Ù\8aÙ\88Ù\85 عÙ\84Ù\89 اÙ\84ساعة Ù¡٢:٢٥', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'اÙ\84Ù\8aÙ\88Ù\85 عÙ\84Ù\89 اÙ\84ساعة Ù¡٣:٠٠', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'غدا عÙ\84Ù\89 اÙ\84ساعة ١٢:Ù Ù ', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'اÙ\84Ù\8aÙ\88Ù\85 عÙ\84Ù\89 اÙ\84ساعة Ù¡١:٠٠', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ø£Ù\85س عÙ\84Ù\89 اÙ\84ساعة ١٢:Ù Ù ', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'اليوم على الساعة 02:00', 'today at the same time');
- assert.equal(moment(a).add({
- m: 25
- }).calendar(), 'اليوم على الساعة 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({
- h: 1
- }).calendar(), 'اليوم على الساعة 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({
- d: 1
- }).calendar(), 'غدا على الساعة 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({
- h: 1
- }).calendar(), 'اليوم على الساعة 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({
- d: 1
- }).calendar(), 'أمس على الساعة 02:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'اليوم على الساعة 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'اليوم على الساعة 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'اليوم على الساعة 13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'غدا على الساعة 12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'اليوم على الساعة 11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'أمس على الساعة 12:00', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
test('calendar day', function (assert) {
- var a = moment().hours(2).minutes(0).seconds(0);
+ var a = moment().hours(12).minutes(0).seconds(0);
- assert.equal(moment(a).calendar(), 'اليوم عند الساعة ٠٢:٠٠', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'اÙ\84Ù\8aÙ\88Ù\85 عÙ\86د اÙ\84ساعة Ù ٢:٢٥', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'اÙ\84Ù\8aÙ\88Ù\85 عÙ\86د اÙ\84ساعة Ù ٣:٠٠', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'غدÙ\8bا عÙ\86د اÙ\84ساعة Ù Ù¢:Ù Ù ', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'اÙ\84Ù\8aÙ\88Ù\85 عÙ\86د اÙ\84ساعة Ù ١:٠٠', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ø£Ù\85س عÙ\86د اÙ\84ساعة Ù Ù¢:Ù Ù ', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'اليوم عند الساعة ١٢:٠٠', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'اÙ\84Ù\8aÙ\88Ù\85 عÙ\86د اÙ\84ساعة Ù¡٢:٢٥', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'اÙ\84Ù\8aÙ\88Ù\85 عÙ\86د اÙ\84ساعة Ù¡٣:٠٠', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'غدÙ\8bا عÙ\86د اÙ\84ساعة ١٢:Ù Ù ', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'اÙ\84Ù\8aÙ\88Ù\85 عÙ\86د اÙ\84ساعة Ù¡١:٠٠', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ø£Ù\85س عÙ\86د اÙ\84ساعة ١٢:Ù Ù ', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'bugün saat 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'bugün saat 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'bugün saat 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'sabah saat 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'bugün saat 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'dünən 02:00', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'Сёння ў 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Сёння ў 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Сёння ў 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Заўтра ў 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Сёння ў 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Учора ў 02:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'Сёння ў 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'Сёння ў 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'Сёння ў 13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'Заўтра ў 12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'Сёння ў 11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'Учора ў 12:00', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'Днес в 2:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Днес в 2:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Днес в 3:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Утре в 2:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Днес в 1:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Вчера в 2:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'Днес в 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'Днес в 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'Днес в 13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'Утре в 12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'Днес в 11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'Вчера в 12:00', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
test('calendar day', function (assert) {
- var a = moment().hours(2).minutes(0).seconds(0);
+ var a = moment().hours(12).minutes(0).seconds(0);
- assert.equal(moment(a).calendar(), 'আজ রাত ২:০০ সময়', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'à¦\86à¦\9c রাত ২:২৫ সমà§\9f', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 3}).calendar(), 'à¦\86à¦\9c সà¦\95াল à§«:০০ সমà§\9f', 'Now plus 3 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'à¦\86à¦\97ামà§\80à¦\95াল রাত ২:০০ সমà§\9f', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'à¦\86à¦\9c রাত à§§:০০ সমà§\9f', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'à¦\97তà¦\95াল রাত ২:০০ সমà§\9f', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'আজ দুপুর ১২:০০ সময়', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'à¦\86à¦\9c দà§\81পà§\81র ১২:২৫ সমà§\9f', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 3}).calendar(), 'à¦\86à¦\9c দà§\81পà§\81র à§©:০০ সমà§\9f', 'Now plus 3 hours');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'à¦\86à¦\97ামà§\80à¦\95াল দà§\81পà§\81র ১২:০০ সমà§\9f', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'à¦\86à¦\9c দà§\81পà§\81র à§§à§§:০০ সমà§\9f', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'à¦\97তà¦\95াল দà§\81পà§\81র ১২:০০ সমà§\9f', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
test('calendar day', function (assert) {
- var a = moment().hours(2).minutes(0).seconds(0);
+ var a = moment().hours(12).minutes(0).seconds(0);
- assert.equal(moment(a).calendar(), 'དི་རིང མཚན་མོ ༢:༠༠', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'à½\91ིà¼\8bརིà½\84 à½\98à½\9aà½\93à¼\8bà½\98ོ ༢:༢༥', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 3}).calendar(), 'à½\91ིà¼\8bརིà½\84 à½\9eོà½\82སà¼\8bà½\80ས ༥:༠༠', 'Now plus 3 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'སà½\84à¼\8bà½\89ིà½\93 à½\98à½\9aà½\93à¼\8bà½\98ོ ༢:༠༠', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'à½\91ིà¼\8bརིà½\84 à½\98à½\9aà½\93à¼\8bà½\98ོ ༡:༠༠', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'à½\81à¼\8bསà½\84 à½\98à½\9aà½\93à¼\8bà½\98ོ ༢:༠༠', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'དི་རིང ཉིན་གུང ༡༢:༠༠', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'à½\91ིà¼\8bརིà½\84 à½\89ིà½\93à¼\8bà½\82ུà½\84 ༡༢:༢༥', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 3}).calendar(), 'à½\91ིà¼\8bརིà½\84 à½\89ིà½\93à¼\8bà½\82ུà½\84 ༣:༠༠', 'Now plus 3 hours');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'སà½\84à¼\8bà½\89ིà½\93 à½\89ིà½\93à¼\8bà½\82ུà½\84 ༡༢:༠༠', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'à½\91ིà¼\8bརིà½\84 à½\89ིà½\93à¼\8bà½\82ུà½\84 ༡༡:༠༠', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'à½\81à¼\8bསà½\84 à½\89ིà½\93à¼\8bà½\82ུà½\84 ༡༢:༠༠', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
test('calendar day', function (assert) {
moment.locale('br');
- var a = moment().hours(2).minutes(0).seconds(0);
+ var a = moment().hours(12).minutes(0).seconds(0);
- assert.equal(moment(a).calendar(), 'Hiziv da 2e00 AM', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Hiziv da 2e25 AM', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Hiziv da 3e00 AM', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Warc\'hoazh da 2e00 AM', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hiziv da 1e00 AM', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Dec\'h da 2e00 AM', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
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));
+ 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(' ');
});
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(), 'danas u 2:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'danas u 2:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'danas u 3:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'sutra u 2:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'danas u 1:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'jučer u 2:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'danas u 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'danas u 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'danas u 13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'sutra u 12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'danas u 11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'jučer u 12:00', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'avui a les 2:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'avui a les 2:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'avui a les 3:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'demà a les 2:00', 'tomorrow at the same time');
- assert.equal(moment(a).add({d: 1, h : -1}).calendar(), 'demà a la 1:00', 'tomorrow minus 1 hour');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'avui a la 1:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'ahir a les 2:00', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'dnes v 2:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'dnes v 2:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'dnes v 3:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'zítra v 2:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'dnes v 1:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'včera v 2:00', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
test('calendar day', function (assert) {
- var a = moment().hours(2).minutes(0).seconds(0);
- assert.equal(moment(a).calendar(), 'Паян 02:00 сехетре', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Паян 02:25 сехетре', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Паян 03:00 сехетре', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Ыран 02:00 сехетре', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Паян 01:00 сехетре', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ӗнер 02:00 сехетре', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
assert.equal(moment().add({d: 5}).fromNow(), 'mewn 5 diwrnod', 'in 5 days');
});
- test('same day', function (assert) {
- var a = moment().hours(2).minutes(0).seconds(0);
+ test('calendar day', function (assert) {
+ var a = moment().hours(12).minutes(0).seconds(0);
- assert.equal(moment(a).calendar(), 'Heddiw am 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Heddiw am 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Heddiw am 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Yfory am 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Heddiw am 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ddoe am 02:00', 'yesterday at the same time');
+ 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('same next week', function (assert) {
+ test('calendar next week', function (assert) {
var i, m;
for (i = 2; i < 7; i++) {
}
});
- test('same last week', function (assert) {
+ test('calendar last week', function (assert) {
var i, m;
for (i = 2; i < 7; i++) {
}
});
- test('same all else', function (assert) {
+ test('calendar all else', function (assert) {
var weeksAgo = moment().subtract({w: 1}),
weeksFromNow = moment().add({w: 1});
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
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('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('[sidste] dddd [kl] LT'), 'Today - ' + i + ' days current time');
+ m.hours(0).minutes(0).seconds(0).milliseconds(0);
+ assert.equal(m.calendar(), m.format('[sidste] dddd [kl] LT'), 'Today - ' + i + ' days beginning of day');
+ m.hours(23).minutes(59).seconds(59).milliseconds(999);
+ assert.equal(m.calendar(), m.format('[sidste] 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');
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'heute um 02:00 Uhr', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'heute um 02:25 Uhr', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'heute um 03:00 Uhr', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'morgen um 02:00 Uhr', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'heute um 01:00 Uhr', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'gestern um 02:00 Uhr', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'heute um 02:00 Uhr', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'heute um 02:25 Uhr', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'heute um 03:00 Uhr', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'morgen um 02:00 Uhr', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'heute um 01:00 Uhr', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'gestern um 02:00 Uhr', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
}
});
+
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'Σήμερα στις 2:00 ΠΜ', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Σήμερα στις 2:25 ΠΜ', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'ΣήμεÏ\81α Ï\83Ï\84ιÏ\82 3:00 Î Î\9c', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Αύριο στις 2:00 ΠΜ', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'ΣήμεÏ\81α Ï\83Ï\84η 1:00 Î Î\9c', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Χθες στις 2:00 ΠΜ', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'Σήμερα στις 12:00 ΜΜ', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'Σήμερα στις 12:25 ΜΜ', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'ΣήμεÏ\81α Ï\83Ï\84η 1:00 Î\9cÎ\9c', '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(), 'ΣήμεÏ\81α Ï\83Ï\84ιÏ\82 11:00 Î Î\9c', '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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
test('calendar day', function (assert) {
- var a = moment().hours(2).minutes(0).seconds(0);
+ var a = moment().hours(12).minutes(0).seconds(0);
- assert.equal(moment(a).calendar(), 'Today at 2:00 AM', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Today at 2:25 AM', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Today at 3:00 AM', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Tomorrow at 2:00 AM', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Today at 1:00 AM', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Yesterday at 2:00 AM', '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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
test('calendar day', function (assert) {
- var a = moment().hours(2).minutes(0).seconds(0);
+ var a = moment().hours(12).minutes(0).seconds(0);
- assert.equal(moment(a).calendar(), 'Today at 2:00 AM', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Today at 2:25 AM', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Today at 3:00 AM', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Tomorrow at 2:00 AM', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Today at 1:00 AM', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Yesterday at 2:00 AM', '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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
test('calendar day', function (assert) {
- var a = moment().hours(2).minutes(0).seconds(0);
+ var a = moment().hours(12).minutes(0).seconds(0);
- assert.equal(moment(a).calendar(), 'Today at 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Today at 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Today at 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Tomorrow at 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Today at 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Yesterday at 02: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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
test('calendar day', function (assert) {
- var a = moment().hours(2).minutes(0).seconds(0);
+ var a = moment().hours(12).minutes(0).seconds(0);
- assert.equal(moment(a).calendar(), 'Today at 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Today at 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Today at 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Tomorrow at 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Today at 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Yesterday at 02: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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
test('calendar day', function (assert) {
- var a = moment().hours(2).minutes(0).seconds(0);
+ var a = moment().hours(12).minutes(0).seconds(0);
- assert.equal(moment(a).calendar(), 'Today at 2:00 AM', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Today at 2:25 AM', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Today at 3:00 AM', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Tomorrow at 2:00 AM', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Today at 1:00 AM', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Yesterday at 2:00 AM', '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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
test('calendar day', function (assert) {
- var a = moment().hours(2).minutes(0).seconds(0);
+ var a = moment().hours(12).minutes(0).seconds(0);
- assert.equal(moment(a).calendar(), 'Today at 2:00 AM', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Today at 2:25 AM', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Today at 3:00 AM', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Tomorrow at 2:00 AM', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Today at 1:00 AM', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Yesterday at 2:00 AM', '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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'Hodiaŭ je 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Hodiaŭ je 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Hodiaŭ je 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Morgaŭ je 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hodiaŭ je 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Hieraŭ je 02:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'Hodiaŭ je 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'Hodiaŭ je 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'Hodiaŭ je 13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'Morgaŭ je 12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hodiaŭ je 11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'Hieraŭ je 12:00', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'hoy a las 2:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'hoy a las 2:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'hoy a las 3:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'mañana a las 2:00', 'tomorrow at the same time');
- assert.equal(moment(a).add({d: 1, h : -1}).calendar(), 'mañana a la 1:00', 'tomorrow minus 1 hour');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'hoy a la 1:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'ayer a las 2: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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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äna, 2:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Täna, 2:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Täna, 3:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Homme, 2:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Täna, 1:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Eile, 2:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'Täna, 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'Täna, 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'Täna, 13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'Homme, 12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'Täna, 11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'Eile, 12:00', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'gaur 02:00etan', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'gaur 02:25etan', 'now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'gaur 03:00etan', 'now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'bihar 02:00etan', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'gaur 01:00etan', 'now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'atzo 02:00etan', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'gaur 12:00etan', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'gaur 12:25etan', 'now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'gaur 13:00etan', 'now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'bihar 12:00etan', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'gaur 11:00etan', 'now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'atzo 12:00etan', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
test('calendar day', function (assert) {
- var a = moment().hours(2).minutes(0).seconds(0);
+ var a = moment().hours(12).minutes(0).seconds(0);
- assert.equal(moment(a).calendar(), 'امروز ساعت ۰۲:۰۰', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'اÙ\85رÙ\88ز ساعت Û°۲:۲۵', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'اÙ\85رÙ\88ز ساعت Û°۳:۰۰', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Ù\81ردا ساعت Û°۲:۰۰', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'اÙ\85رÙ\88ز ساعت Û°۱:۰۰', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'دÛ\8cرÙ\88ز ساعت Û°۲:۰۰', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'امروز ساعت ۱۲:۰۰', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'اÙ\85رÙ\88ز ساعت Û±۲:۲۵', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'اÙ\85رÙ\88ز ساعت Û±۳:۰۰', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'Ù\81ردا ساعت Û±۲:۰۰', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'اÙ\85رÙ\88ز ساعت Û±۱:۰۰', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'دÛ\8cرÙ\88ز ساعت Û±۲:۰۰', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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änään klo 02.00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'tänään klo 02.25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'tänään klo 03.00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'huomenna klo 02.00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'tänään klo 01.00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'eilen klo 02.00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'tänään klo 12.00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'tänään klo 12.25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'tänään klo 13.00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'huomenna klo 12.00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'tänään klo 11.00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'eilen klo 12.00', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
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');
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
test('same 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(), 'Aujourd\'hui à 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Aujourd\'hui à 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Aujourd\'hui à 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Demain à 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Aujourd\'hui à 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Hier à 02:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'Aujourd\'hui à 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'Aujourd\'hui à 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'Aujourd\'hui à 13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'Demain à 12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'Aujourd\'hui à 11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'Hier à 12:00', 'yesterday at the same time');
});
test('same next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
test('same 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(), 'Aujourd\'hui à 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Aujourd\'hui à 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Aujourd\'hui à 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Demain à 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Aujourd\'hui à 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Hier à 02:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'Aujourd\'hui à 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'Aujourd\'hui à 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'Aujourd\'hui à 13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'Demain à 12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'Aujourd\'hui à 11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'Hier à 12:00', 'yesterday at the same time');
});
test('same next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
test('same 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(), 'Aujourd\'hui à 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Aujourd\'hui à 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Aujourd\'hui à 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Demain à 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Aujourd\'hui à 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Hier à 02:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'Aujourd\'hui à 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'Aujourd\'hui à 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'Aujourd\'hui à 13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'Demain à 12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'Aujourd\'hui à 11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'Hier à 12:00', 'yesterday at the same time');
});
test('same next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'hjoed om 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'hjoed om 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'hjoed om 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'moarn om 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'hjoed om 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'juster om 02:00', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'An-diugh aig 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'An-diugh aig 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'An-diugh aig 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'A-màireach aig 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'An-diugh aig 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'An-dè aig 02:00', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'hoxe ás 2:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'hoxe ás 2:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'hoxe ás 3:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'mañá ás 2:00', 'tomorrow at the same time');
- assert.equal(moment(a).add({d: 1, h : -1}).calendar(), 'mañá á 1:00', 'tomorrow minus 1 hour');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'hoxe á 1:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'onte á 2:00', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'היום ב־02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'היום ב־02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'היום ב־03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'מחר ב־02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'היום ב־01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'אתמול ב־02:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'היום ב־12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'היום ב־12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'היום ב־13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'מחר ב־12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'היום ב־11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'אתמול ב־12:00', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
test('calendar day', function (assert) {
- var a = moment().hours(2).minutes(0).seconds(0);
+ var a = moment().hours(12).minutes(0).seconds(0);
- assert.equal(moment(a).calendar(), 'आज रात २:०० बजे', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'à¤\86à¤\9c रात २:२५ बà¤\9cà¥\87', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 3}).calendar(), 'à¤\86à¤\9c सà¥\81बह ५:०० बà¤\9cà¥\87', 'Now plus 3 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'à¤\95ल रात २:०० बà¤\9cà¥\87', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'à¤\86à¤\9c रात १:०० बà¤\9cà¥\87', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'à¤\95ल रात २:०० बà¤\9cà¥\87', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'आज दोपहर १२:०० बजे', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'à¤\86à¤\9c दà¥\8bपहर १२:२५ बà¤\9cà¥\87', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 3}).calendar(), 'à¤\86à¤\9c दà¥\8bपहर ३:०० बà¤\9cà¥\87', 'Now plus 3 hours');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'à¤\95ल दà¥\8bपहर १२:०० बà¤\9cà¥\87', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'à¤\86à¤\9c दà¥\8bपहर ११:०० बà¤\9cà¥\87', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'à¤\95ल दà¥\8bपहर १२:०० बà¤\9cà¥\87', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'danas u 2:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'danas u 2:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'danas u 3:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'sutra u 2:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'danas u 1:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'jučer u 2:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'danas u 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'danas u 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'danas u 13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'sutra u 12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'danas u 11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'jučer u 12:00', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'ma 2:00-kor', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'ma 2:25-kor', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'ma 3:00-kor', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'holnap 2:00-kor', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'ma 1:00-kor', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'tegnap 2:00-kor', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'ma 12:00-kor', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'ma 12:25-kor', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'ma 13:00-kor', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'holnap 12:00-kor', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'ma 11:00-kor', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'tegnap 12:00-kor', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'այսօր 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'այսօր 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'այսօր 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'վաղը 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'այսօր 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'երեկ 02:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'այսօր 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'այսօր 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'այսօր 13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'վաղը 12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'այսօր 11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'երեկ 12:00', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'Hari ini pukul 02.00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Hari ini pukul 02.25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Hari ini pukul 03.00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Besok pukul 02.00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hari ini pukul 01.00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kemarin pukul 02.00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'Hari ini pukul 12.00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'Hari ini pukul 12.25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'Hari ini pukul 13.00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'Besok pukul 12.00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hari ini pukul 11.00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kemarin pukul 12.00', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'í dag kl. 2:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'í dag kl. 2:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'í dag kl. 3:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'á morgun kl. 2:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'í dag kl. 1:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'í gær kl. 2:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'í dag kl. 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'í dag kl. 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'í dag kl. 13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'á morgun kl. 12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'í dag kl. 11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'í gær kl. 12:00', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'Oggi alle 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Oggi alle 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Oggi alle 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Domani alle 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Oggi alle 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ieri alle 02:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'Oggi alle 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'Oggi alle 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'Oggi alle 13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'Domani alle 12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'Oggi alle 11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ieri alle 12:00', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), '今日 午前2時0分', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'ä»\8aæ\97¥ å\8d\88å\89\8d2æ\99\8225å\88\86', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'ä»\8aæ\97¥ å\8d\88å\89\8d3æ\99\820å\88\86', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'æ\98\8eæ\97¥ å\8d\88å\89\8d2時0分', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), '今日 午前1時0分', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'æ\98¨æ\97¥ å\8d\88å\89\8d2時0分', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), '今日 午後12時0分', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'ä»\8aæ\97¥ å\8d\88å¾\8c12æ\99\8225å\88\86', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'ä»\8aæ\97¥ å\8d\88å¾\8c1æ\99\820å\88\86', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'æ\98\8eæ\97¥ å\8d\88å¾\8c12時0分', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), '今日 午前11時0分', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'æ\98¨æ\97¥ å\8d\88å¾\8c12時0分', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'Dinten puniko pukul 02.00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Dinten puniko pukul 02.25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Dinten puniko pukul 03.00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Mbenjang pukul 02.00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Dinten puniko pukul 01.00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kala wingi pukul 02.00', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'დღეს 2:00 AM-ზე', 'დღეს ამავე დროს');
- assert.equal(moment(a).add({m: 25}).calendar(), 'დღეს 2:25 AM-ზე', 'ახლანდელ დროს დამატებული 25 წუთი');
- assert.equal(moment(a).add({h: 1}).calendar(), 'დღეს 3:00 AM-ზე', 'ახლანდელ დროს დამატებული 1 საათი');
- assert.equal(moment(a).add({d: 1}).calendar(), 'ხვალ 2:00 AM-ზე', 'ხვალ ამავე დროს');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'დღეს 1:00 AM-ზე', 'ახლანდელ დროს გამოკლებული 1 საათი');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'გუშინ 2:00 AM-ზე', 'გუშინ ამავე დროს');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
localeModule('kk');
test('parse', function (assert) {
- var tests = 'Ò\9aаңÑ\82аÑ\80 Ò\9aаң_Ð\90Ò\9bпан Ð\90Ò\9bп_Ð\9dаÑ\83Ñ\80Ñ\8bз Ð\9dаÑ\83_СÓ\99Ñ\83Ñ\96Ñ\80 СÓ\99Ñ\83_Ð\9cамÑ\8bÑ\80 Ð\9cам_Ð\9cаÑ\83Ñ\81Ñ\8bм Ð\9cаÑ\83_ШÑ\96лде ШÑ\96л_ТамÑ\8bз Там_Ò\9aÑ\8bÑ\80күйек Ò\9aÑ\8bÑ\80_Ò\9aазан Ò\9aаз_Ò\9aаÑ\80аÑ\88а Ò\9aаÑ\80_Ð\96елÑ\82оÒ\9bÑ\81ан Ð\96ел'.split('_'), i;
+ var tests = 'Ò\9bаңÑ\82аÑ\80 Ò\9bаң_аÒ\9bпан аÒ\9bп_наÑ\83Ñ\80Ñ\8bз наÑ\83_Ñ\81Ó\99Ñ\83Ñ\96Ñ\80 Ñ\81Ó\99Ñ\83_мамÑ\8bÑ\80 мам_маÑ\83Ñ\81Ñ\8bм маÑ\83_Ñ\88Ñ\96лде Ñ\88Ñ\96л_Ñ\82амÑ\8bз Ñ\82ам_Ò\9bÑ\8bÑ\80күйек Ò\9bÑ\8bÑ\80_Ò\9bазан Ò\9bаз_Ò\9bаÑ\80аÑ\88а Ò\9bаÑ\80_желÑ\82оÒ\9bÑ\81ан жел'.split('_'), i;
function equalTest(input, mmm, i) {
assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
}
test('format', function (assert) {
var a = [
- ['dddd, Do MMMM YYYY, HH:mm:ss', 'Ð\96екÑ\81енбÑ\96, 14-Ñ\88Ñ\96 Ð\90қпан 2010, 15:25:50'],
- ['ddd, hA', 'Ð\96ек, 3PM'],
- ['M Mo MM MMMM MMM', '2 2-Ñ\88Ñ\96 02 Ð\90Ò\9bпан Ð\90қп'],
+ ['dddd, Do MMMM YYYY, HH:mm:ss', 'жекÑ\81енбÑ\96, 14-Ñ\88Ñ\96 ақпан 2010, 15:25:50'],
+ ['ddd, hA', 'жек, 3PM'],
+ ['M Mo MM MMMM MMM', '2 2-Ñ\88Ñ\96 02 аÒ\9bпан ақп'],
['YYYY YY', '2010 10'],
['D Do DD', '14 14-ші 14'],
- ['d do dddd ddd dd', '0 0-Ñ\88Ñ\96 Ð\96екÑ\81енбÑ\96 Ð\96ек Ð\96к'],
+ ['d do dddd ddd dd', '0 0-Ñ\88Ñ\96 жекÑ\81енбÑ\96 жек жк'],
['DDD DDDo DDDD', '45 45-ші 045'],
['w wo ww', '7 7-ші 07'],
['h hh', '3 03'],
['[жылдың] DDDo [күні]', 'жылдың 45-ші күні'],
['LTS', '15:25:50'],
['L', '14.02.2010'],
- ['LL', '14 Ð\90қпан 2010'],
- ['LLL', '14 Ð\90қпан 2010 15:25'],
- ['LLLL', 'Ð\96екÑ\81енбÑ\96, 14 Ð\90қпан 2010 15:25'],
+ ['LL', '14 ақпан 2010'],
+ ['LLL', '14 ақпан 2010 15:25'],
+ ['LLLL', 'жекÑ\81енбÑ\96, 14 ақпан 2010 15:25'],
['l', '14.2.2010'],
- ['ll', '14 Ð\90қп 2010'],
- ['lll', '14 Ð\90қп 2010 15:25'],
- ['llll', 'Ð\96ек, 14 Ð\90қп 2010 15:25']
+ ['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;
});
test('format month', function (assert) {
- var expected = 'Ò\9aаңÑ\82аÑ\80 Ò\9aаң_Ð\90Ò\9bпан Ð\90Ò\9bп_Ð\9dаÑ\83Ñ\80Ñ\8bз Ð\9dаÑ\83_СÓ\99Ñ\83Ñ\96Ñ\80 СÓ\99Ñ\83_Ð\9cамÑ\8bÑ\80 Ð\9cам_Ð\9cаÑ\83Ñ\81Ñ\8bм Ð\9cаÑ\83_ШÑ\96лде ШÑ\96л_ТамÑ\8bз Там_Ò\9aÑ\8bÑ\80күйек Ò\9aÑ\8bÑ\80_Ò\9aазан Ò\9aаз_Ò\9aаÑ\80аÑ\88а Ò\9aаÑ\80_Ð\96елÑ\82оÒ\9bÑ\81ан Ð\96ел'.split('_'), i;
+ var expected = 'Ò\9bаңÑ\82аÑ\80 Ò\9bаң_аÒ\9bпан аÒ\9bп_наÑ\83Ñ\80Ñ\8bз наÑ\83_Ñ\81Ó\99Ñ\83Ñ\96Ñ\80 Ñ\81Ó\99Ñ\83_мамÑ\8bÑ\80 мам_маÑ\83Ñ\81Ñ\8bм маÑ\83_Ñ\88Ñ\96лде Ñ\88Ñ\96л_Ñ\82амÑ\8bз Ñ\82ам_Ò\9bÑ\8bÑ\80күйек Ò\9bÑ\8bÑ\80_Ò\9bазан Ò\9bаз_Ò\9bаÑ\80аÑ\88а Ò\9bаÑ\80_желÑ\82оÒ\9bÑ\81ан жел'.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 = 'Ð\96екÑ\81енбÑ\96 Ð\96ек Ð\96к_Ð\94үйÑ\81енбÑ\96 Ð\94үй Ð\94й_СейÑ\81енбÑ\96 Сей Сй_СÓ\99Ñ\80Ñ\81енбÑ\96 СÓ\99Ñ\80 СÑ\80_Ð\91ейÑ\81енбÑ\96 Ð\91ей Ð\91й_Ð\96ұма Ð\96ұм Ð\96м_СенбÑ\96 Сен Сн'.split('_'), i;
+ var expected = 'жекÑ\81енбÑ\96 жек жк_дүйÑ\81енбÑ\96 дүй дй_Ñ\81ейÑ\81енбÑ\96 Ñ\81ей Ñ\81й_Ñ\81Ó\99Ñ\80Ñ\81енбÑ\96 Ñ\81Ó\99Ñ\80 Ñ\81Ñ\80_бейÑ\81енбÑ\96 бей бй_жұма жұм жм_Ñ\81енбÑ\96 Ñ\81ен Ñ\81н'.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('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(), 'Бүгін сағат 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Бүгін сағат 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Бүгін сағат 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Ертең сағат 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Бүгін сағат 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Кеше сағат 02:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'Бүгін сағат 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'Бүгін сағат 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'Бүгін сағат 13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'Ертең сағат 12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'Бүгін сағат 11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'Кеше сағат 12:00', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
localeModule('km');
test('parse', function (assert) {
- var tests = 'á\9e\98á\9e\80á\9e\9aá\9e¶ á\9e\98á\9e\80á\9e\9aá\9e¶_á\9e\80á\9e»á\9e\98á\9f\92á\9e\97á\9f\88 á\9e\80á\9e»á\9e\98á\9f\92á\9e\97á\9f\88_á\9e\98á\9e·á\9e\93á\9e¶ á\9e\98á\9e·នា_មេសា មេសា_ឧសភា ឧសភា_មិថុនា មិថុនា_កក្កដា កក្កដា_សីហា សីហា_កញ្ញា កញ្ញា_តុលា តុលា_វិច្ឆិកា វិច្ឆិកា_ធ្នូ ធ្នូ'.split('_'),
+ var tests = 'á\9e\98á\9e\80á\9e\9aá\9e¶ á\9e\98á\9e\80á\9e\9aá\9e¶_á\9e\80á\9e»á\9e\98á\9f\92á\9e\97á\9f\88 á\9e\80á\9e»á\9e\98á\9f\92á\9e\97á\9f\88_á\9e\98á\9e¸á\9e\93á\9e¶ á\9e\98á\9e¸នា_មេសា មេសា_ឧសភា ឧសភា_មិថុនា មិថុនា_កក្កដា កក្កដា_សីហា សីហា_កញ្ញា កញ្ញា_តុលា តុលា_វិច្ឆិកា វិច្ឆិកា_ធ្នូ ធ្នូ'.split('_'),
i;
function equalTest(input, mmm, i) {
});
test('format month', function (assert) {
- var expected = 'á\9e\98á\9e\80á\9e\9aá\9e¶ á\9e\98á\9e\80á\9e\9aá\9e¶_á\9e\80á\9e»á\9e\98á\9f\92á\9e\97á\9f\88 á\9e\80á\9e»á\9e\98á\9f\92á\9e\97á\9f\88_á\9e\98á\9e·á\9e\93á\9e¶ á\9e\98á\9e·នា_មេសា មេសា_ឧសភា ឧសភា_មិថុនា មិថុនា_កក្កដា កក្កដា_សីហា សីហា_កញ្ញា កញ្ញា_តុលា តុលា_វិច្ឆិកា វិច្ឆិកា_ធ្នូ ធ្នូ'.split('_'),
+ var expected = 'á\9e\98á\9e\80á\9e\9aá\9e¶ á\9e\98á\9e\80á\9e\9aá\9e¶_á\9e\80á\9e»á\9e\98á\9f\92á\9e\97á\9f\88 á\9e\80á\9e»á\9e\98á\9f\92á\9e\97á\9f\88_á\9e\98á\9e¸á\9e\93á\9e¶ á\9e\98á\9e¸នា_មេសា មេសា_ឧសភា ឧសភា_មិថុនា មិថុនា_កក្កដា កក្កដា_សីហា សីហា_កញ្ញា កញ្ញា_តុលា តុលា_វិច្ឆិកា វិច្ឆិកា_ធ្នូ ធ្នូ'.split('_'),
i;
for (i = 0; i < expected.length; i++) {
assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
});
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(), 'ថ្ងៃនេះ ម៉ោង 02:00', 'today at the same time');
- assert.equal(moment(a).add({
- m: 25
- }).calendar(), 'ថ្ងៃនេះ ម៉ោង 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({
- h: 1
- }).calendar(), 'ថ្ងៃនេះ ម៉ោង 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({
- d: 1
- }).calendar(), 'ស្អែក ម៉ោង 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({
- h: 1
- }).calendar(), 'ថ្ងៃនេះ ម៉ោង 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({
- d: 1
- }).calendar(), 'ម្សិលមិញ ម៉ោង 02:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'ថ្ងៃនេះ ម៉ោង 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'ថ្ងៃនេះ ម៉ោង 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'ថ្ងៃនេះ ម៉ោង 13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'ស្អែក ម៉ោង 12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'ថ្ងៃនេះ ម៉ោង 11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'ម្សិលមិញ ម៉ោង 12:00', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
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: 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: 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({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: 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: 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: 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: 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');
+ assert.equal(moment(30000).from(0), '몇 초 후', 'prefix');
+ assert.equal(moment(0).from(30000), '몇 초 전', 'suffix');
});
test('now from now', function (assert) {
- assert.equal(moment().fromNow(), '몇초 전', 'now from now should display as in the past');
+ assert.equal(moment().fromNow(), '몇 초 전', 'now from now should display as in the past');
});
test('fromNow', function (assert) {
- assert.equal(moment().add({s: 30}).fromNow(), '몇초 후', 'in a few seconds');
+ assert.equal(moment().add({s: 30}).fromNow(), '몇 초 후', 'in a few seconds');
assert.equal(moment().add({d: 5}).fromNow(), '5일 후', 'in 5 days');
});
test('calendar day', function (assert) {
- var a = moment().hours(2).minutes(0).seconds(0);
+ var a = moment().hours(12).minutes(0).seconds(0);
- assert.equal(moment(a).calendar(), '오늘 오전 2시 0분', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), '오늘 오전 2시 25분', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), '오늘 오전 3시 0분', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), '내일 오전 2시 0분', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), '오늘 오전 1시 0분', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), '어제 오전 2시 0분', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), '오늘 오후 12시 0분', '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시 0분', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), '내일 오후 12시 0분', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), '오늘 오전 11시 0분', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), '어제 오후 12시 0분', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
defineCommonLocaleTests(name, -1, -1);
}
- localeModule('lb');
+ localeModule('ky');
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;
-
+ 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);
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']
+ ['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;
}
});
+ 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 = '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;
+ 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 = '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;
+ 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), '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');
+ 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), 'an e puer Sekonnen', 'prefix');
- assert.equal(moment(0).from(30000), 'virun e puer Sekonnen', 'suffix');
+ assert.equal(moment(30000).from(0), 'бирнече секунд ичинде', 'prefix');
+ assert.equal(moment(0).from(30000), 'бирнече секунд мурун', 'suffix');
+ });
+
+ test('now from now', function (assert) {
+ assert.equal(moment().fromNow(), 'бирнече секунд мурун', 'now from now should display as in the past');
});
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');
+ assert.equal(moment().add({s: 30}).fromNow(), 'бирнече секунд ичинде', 'in a few seconds');
+ assert.equal(moment().add({d: 5}).fromNow(), '5 күн ичинде', 'in 5 days');
});
- test('calendar last week', function (assert) {
- var i, m, weekday, datestring;
+ 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().subtract({d: 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');
+ }
+ });
- // 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');
+ test('calendar last week', function (assert) {
+ var i, m;
- assert.equal(m.calendar(), m.format(datestring), 'Today + ' + i + ' days current time');
+ 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(datestring), 'Today + ' + i + ' days beginning of day');
+ assert.equal(m.calendar(), m.format('[Өткен аптанын] dddd [күнү] [саат] LT'), 'Today - ' + i + ' days beginning of day');
m.hours(23).minutes(59).seconds(59).milliseconds(999);
- assert.equal(m.calendar(), m.format(datestring), 'Today + ' + i + ' days end of day');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : 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 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 defaults(a, b, c) {
+ if (a != null) {
+ return a;
+ }
+ if (b != null) {
+ return b;
+ }
+ return c;
+ }
+
+ function defineCommonLocaleTests(locale, options) {
+ test('lenient 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 ordinal parsing ' + i + ' year check');
+ assert.equal(testMoment.month(), 0,
+ 'lenient ordinal parsing ' + i + ' month check');
+ assert.equal(testMoment.date(), i,
+ 'lenient ordinal parsing ' + i + ' date check');
+ }
+ });
+
+ test('lenient 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 ordinal parsing of number ' + i + ' year check');
+ assert.equal(testMoment.month(), 0,
+ 'lenient ordinal parsing of number ' + i + ' month check');
+ assert.equal(testMoment.date(), i,
+ 'lenient ordinal parsing of number ' + i + ' date check');
+ }
+ });
+
+ test('strict 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 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 :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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;
+
+ var expect = QUnit.expect;
+
+ function module (name, lifecycle) {
+ QUnit.module(name, {
+ setup : function () {
+ moment.locale('en');
+ moment.createFromInputFallback = function (config) {
+ throw new Error('input not handled by moment: ' + config._i);
+ };
+ setupDeprecationHandler(test, moment, 'core');
+ if (lifecycle && lifecycle.setup) {
+ lifecycle.setup();
+ }
+ },
+ teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
+ if (lifecycle && lifecycle.teardown) {
+ lifecycle.teardown();
+ }
+ }
+ });
+ }
+
+ function localeModule (name, lifecycle) {
+ QUnit.module('locale:' + name, {
+ setup : 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();
+ }
+ },
+ teardown : function () {
+ moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'ມື້ນີ້ເວລາ 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'ມື້ນີ້ເວລາ 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'ມື້ນີ້ເວລາ 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'ມື້ອື່ນເວລາ 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'ມື້ນີ້ເວລາ 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'ມື້ວານນີ້ເວລາ 02:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'ມື້ນີ້ເວລາ 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'ມື້ນີ້ເວລາ 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'ມື້ນີ້ເວລາ 13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'ມື້ອື່ນເວລາ 12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'ມື້ນີ້ເວລາ 11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'ມື້ວານນີ້ເວລາ 12:00', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
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.locale('lt', {week: {dow: 0, doy: 6}});
+ 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.locale('lt', {week: {dow: 1, doy: 4}});
+ moment.updateLocale('lt', null);
});
test('from', function (assert) {
});
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(), 'Šiandien 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Šiandien 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Šiandien 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Rytoj 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Šiandien 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Vakar 02:00', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'Šodien pulksten 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Šodien pulksten 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Šodien pulksten 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Rīt pulksten 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Šodien pulksten 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Vakar pulksten 02:00', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'danas u 2:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'danas u 2:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'danas u 3:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'sjutra u 2:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'danas u 1:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'juče u 2:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'danas u 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'danas u 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'danas u 13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), '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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'Денес во 2:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Денес во 2:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Денес во 3:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Утре во 2:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Денес во 1:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Вчера во 2:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'Денес во 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'Денес во 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'Денес во 13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'Утре во 12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'Денес во 11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'Вчера во 12:00', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'ഇന്ന് രാത്രി 2:00 -നു', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'à´\87à´¨àµ\8dà´¨àµ\8d രാതàµ\8dà´°à´¿ 2:25 -à´¨àµ\81', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 3}).calendar(), 'à´\87à´¨àµ\8dà´¨àµ\8d രാവിലàµ\86 5:00 -à´¨àµ\81', 'Now plus 3 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'നാളàµ\86 രാതàµ\8dà´°à´¿ 2:00 -à´¨àµ\81', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'à´\87à´¨àµ\8dà´¨àµ\8d രാതàµ\8dà´°à´¿ 1:00 -à´¨àµ\81', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'à´\87à´¨àµ\8dനലàµ\86 രാതàµ\8dà´°à´¿ 2:00 -à´¨àµ\81', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'ഇന്ന് ഉച്ച കഴിഞ്ഞ് 12:00 -നു', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'à´\87à´¨àµ\8dà´¨àµ\8d à´\89à´\9aàµ\8dà´\9a à´\95à´´à´¿à´\9eàµ\8dà´\9eàµ\8d 12:25 -à´¨àµ\81', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 3}).calendar(), 'à´\87à´¨àµ\8dà´¨àµ\8d à´\89à´\9aàµ\8dà´\9a à´\95à´´à´¿à´\9eàµ\8dà´\9eàµ\8d 3:00 -à´¨àµ\81', 'Now plus 3 hours');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'നാളàµ\86 à´\89à´\9aàµ\8dà´\9a à´\95à´´à´¿à´\9eàµ\8dà´\9eàµ\8d 12:00 -à´¨àµ\81', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'à´\87à´¨àµ\8dà´¨àµ\8d രാവിലàµ\86 11:00 -à´¨àµ\81', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'à´\87à´¨àµ\8dനലàµ\86 à´\89à´\9aàµ\8dà´\9a à´\95à´´à´¿à´\9eàµ\8dà´\9eàµ\8d 12:00 -à´¨àµ\81', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
test('calendar day', function (assert) {
- var a = moment().hours(2).minutes(0).seconds(0);
+ var a = moment().hours(12).minutes(0).seconds(0);
- assert.equal(moment(a).calendar(), 'आज रात्री २:०० वाजता', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'à¤\86à¤\9c रातà¥\8dरà¥\80 २:२५ वाà¤\9cता', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 3}).calendar(), 'à¤\86à¤\9c सà¤\95ाळà¥\80 ५:०० वाà¤\9cता', 'Now plus 3 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'à¤\89दà¥\8dया रातà¥\8dरà¥\80 २:०० वाà¤\9cता', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'à¤\86à¤\9c रातà¥\8dरà¥\80 १:०० वाà¤\9cता', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'à¤\95ाल रातà¥\8dरà¥\80 २:०० वाà¤\9cता', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'आज दुपारी १२:०० वाजता', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'à¤\86à¤\9c दà¥\81पारà¥\80 १२:२५ वाà¤\9cता', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 3}).calendar(), 'à¤\86à¤\9c दà¥\81पारà¥\80 ३:०० वाà¤\9cता', 'Now plus 3 hours');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'à¤\89दà¥\8dया दà¥\81पारà¥\80 १२:०० वाà¤\9cता', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'à¤\86à¤\9c दà¥\81पारà¥\80 ११:०० वाà¤\9cता', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'à¤\95ाल दà¥\81पारà¥\80 १२:०० वाà¤\9cता', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'Hari ini pukul 02.00', 'hari ini pada waktu yang sama');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Hari ini pukul 02.25', 'Sekarang tambah 25 minit');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Hari ini pukul 03.00', 'Sekarang tambah 1 jam');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Esok pukul 02.00', 'esok pada waktu yang sama');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hari ini pukul 01.00', 'Sekarang tolak 1 jam');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kelmarin pukul 02.00', 'kelmarin pada waktu yang sama');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'Hari ini pukul 02.00', 'hari ini pada waktu yang sama');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Hari ini pukul 02.25', 'Sekarang tambah 25 minit');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Hari ini pukul 03.00', 'Sekarang tambah 1 jam');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Esok pukul 02.00', 'esok pada waktu yang sama');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hari ini pukul 01.00', 'Sekarang tolak 1 jam');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kelmarin pukul 02.00', 'kelmarin pada waktu yang sama');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'ယနေ. ၀၂:၀၀ မှာ', 'ယနေ. ဒီအချိန်');
- 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(), 'မနေ.က ၀၂:၀၀ မှာ', 'မနေ.က ဒီအချိန်');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
test('suffix', function (assert) {
assert.equal(moment(30000).from(0), 'om noen sekunder', 'prefix');
- assert.equal(moment(0).from(30000), 'for noen sekunder siden', 'suffix');
+ assert.equal(moment(0).from(30000), 'noen sekunder siden', 'suffix');
});
test('now from now', function (assert) {
- assert.equal(moment().fromNow(), 'for noen sekunder siden', 'now from now should display as in the past');
+ assert.equal(moment().fromNow(), 'noen sekunder siden', 'now from now should display as in the past');
});
test('fromNow', function (assert) {
});
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(), 'i dag kl. 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'i dag kl. 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'i dag kl. 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'i morgen kl. 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'i dag kl. 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'i går kl. 02:00', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'à¤\86à¤\9c रातिà¤\95à¥\8b २:०० बà¤\9cà¥\87', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'à¤\86à¤\9c रातिà¤\95à¥\8b २:२५ बà¤\9cà¥\87', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'à¤\86à¤\9c बिहानà¤\95à¥\8b ३:०० बजे', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'à¤à¥\8bलि रातिà¤\95à¥\8b २:०० बजे', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'à¤\86à¤\9c रातिà¤\95à¥\8b १:०० बजे', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'हिà¤\9cà¥\8b रातिà¤\95à¥\8b २:०० बà¤\9cà¥\87', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'à¤\86à¤\9c दिà¤\89à¤\81सà¥\8bà¤\95à¥\8b १२:०० बà¤\9cà¥\87', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'à¤\86à¤\9c दिà¤\89à¤\81सà¥\8bà¤\95à¥\8b १२:२५ बà¤\9cà¥\87', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'à¤\86à¤\9c दिà¤\89à¤\81सà¥\8bà¤\95à¥\8b १:०० बजे', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'à¤à¥\8bलि दिà¤\89à¤\81सà¥\8bà¤\95à¥\8b १२:०० बजे', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'à¤\86à¤\9c बिहानà¤\95à¥\8b ११:०० बजे', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'हिà¤\9cà¥\8b दिà¤\89à¤\81सà¥\8bà¤\95à¥\8b १२:०० बà¤\9cà¥\87', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'vandaag om 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'vandaag om 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'vandaag om 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'morgen om 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'vandaag om 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'gisteren om 02:00', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
test('suffix', function (assert) {
assert.equal(moment(30000).from(0), 'om nokre sekund', 'prefix');
- assert.equal(moment(0).from(30000), 'for nokre sekund sidan', 'suffix');
+ assert.equal(moment(0).from(30000), 'nokre sekund sidan', 'suffix');
});
test('now from now', function (assert) {
- assert.equal(moment().fromNow(), 'for nokre sekund sidan', 'now from now should display as in the past');
+ assert.equal(moment().fromNow(), 'nokre sekund sidan', 'now from now should display as in the past');
});
test('fromNow', function (assert) {
});
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(), 'I dag klokka 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'I dag klokka 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'I dag klokka 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'I morgon klokka 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'I dag klokka 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'I går klokka 02:00', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
test('calendar day', function (assert) {
- var a = moment().hours(2).minutes(0).seconds(0);
+ var a = moment().hours(12).minutes(0).seconds(0);
- assert.equal(moment(a).calendar(), 'ਅਜ ਰਾਤ ੨:੦੦ ਵਜੇ', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'à¨\85à¨\9c ਰਾਤ ੨:੨੫ ਵà¨\9cà©\87', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 3}).calendar(), 'à¨\85à¨\9c ਸਵà©\87ਰ à©«:੦੦ ਵà¨\9cà©\87', 'Now plus 3 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'à¨\95ਲ ਰਾਤ ੨:੦੦ ਵਜੇ', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'à¨\85à¨\9c ਰਾਤ à©§:੦੦ ਵà¨\9cà©\87', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'à¨\95ਲ ਰਾਤ ੨:੦੦ ਵà¨\9cà©\87', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'ਅਜ ਦੁਪਹਿਰ ੧੨:੦੦ ਵਜੇ', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'à¨\85à¨\9c ਦà©\81ਪਹਿਰ ੧੨:੨੫ ਵà¨\9cà©\87', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 3}).calendar(), 'à¨\85à¨\9c ਦà©\81ਪਹਿਰ à©©:੦੦ ਵà¨\9cà©\87', 'Now plus 3 hours');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'à¨\95ਲ ਦà©\81ਪਹਿਰ à©§੨:੦੦ ਵਜੇ', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'à¨\85à¨\9c ਦà©\81ਪਹਿਰ à©§à©§:੦੦ ਵà¨\9cà©\87', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'à¨\95ਲ ਦà©\81ਪਹਿਰ ੧੨:੦੦ ਵà¨\9cà©\87', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
}
});
- test('meridiem', 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(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('strict ordinal parsing', function (assert) {
var i, ordinalStr, testMoment;
for (i = 1; i <= 31; ++i) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'Dziś o 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Dziś o 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Dziś o 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Jutro o 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Dziś o 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Wczoraj o 02:00', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'Hoje às 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Hoje às 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Hoje às 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Amanhã às 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hoje às 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ontem às 02: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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'Hoje às 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Hoje às 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Hoje às 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Amanhã às 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hoje às 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ontem às 02: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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'azi la 2:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'azi la 2:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'azi la 3:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'mâine la 2:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'azi la 1:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'ieri la 2:00', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
localeModule('ru');
test('parse', function (assert) {
- var tests = 'январь янв_февраль фев_март март_апрель апр_май май_июнь июнь_июль июль_август авг_сентябрь сен_октябрь окт_ноябрь ноя_декабрь дек'.split('_'), i;
+ var tests = 'январь янв._февраль февр._март март_апрель апр._май май_июнь июнь_июль июль_август авг._сентябрь сент._октябрь окт._ноябрь нояб._декабрь дек.'.split('_'), i;
function equalTest(input, mmm, i) {
assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
}
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 февраль фев'],
+ ['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-й воскресенье вс вс'],
['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']
+ ['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;
});
test('format month', function (assert) {
- var expected = 'январь янв_февраль фев_март март_апрель апр_май май_июнь июнь_июль июль_август авг_сентябрь сен_октябрь окт_ноябрь ноя_декабрь дек'.split('_'), i;
+ var expected = 'январь янв._февраль февр._март март_апрель апр._май май_июнь июнь_июль июль_август авг._сентябрь сент._октябрь окт._ноябрь нояб._декабрь дек.'.split('_'), i;
for (i = 0; i < expected.length; i++) {
assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
}
test('format month short case', function (assert) {
var monthsShort = {
- 'nominative': 'янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек'.split('_'),
- 'accusative': 'янв_фев_мар_апр_мая_июня_июля_авг_сен_окт_ноя_дек'.split('_')
+ '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]);
test('format month short case with escaped symbols', function (assert) {
var monthsShort = {
- 'nominative': 'янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек'.split('_'),
- 'accusative': 'янв_фев_мар_апр_мая_июня_июля_авг_сен_окт_ноя_дек'.split('_')
+ '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]);
});
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(), 'Сегодня в 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Сегодня в 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Сегодня в 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Завтра в 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Сегодня в 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Вчера в 02:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'Сегодня в 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'Сегодня в 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'Сегодня в 13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'Завтра в 12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'Сегодня в 11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'Вчера в 12:00', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'otne ti 02:00', 'Today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'otne ti 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'otne ti 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'ihttin ti 02:00', 'Tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'otne ti 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'ikte ti 02:00', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'අද පෙ.ව. 2:00ට', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'අද පෙ.ව. 2:25ට', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'අද පෙ.ව. 3:00ට', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'හෙට පෙ.ව. 2:00ට', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'අද පෙ.ව. 1:00ට', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'ඊයේ පෙ.ව. 2:00ට', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'අද ප.ව. 12:00ට', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'අද ප.ව. 12:25ට', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'අද ප.ව. 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'dnes o 2:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'dnes o 2:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'dnes o 3:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'zajtra o 2:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'dnes o 1:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'včera o 2:00', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'danes ob 2:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'danes ob 2:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'danes ob 3:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'jutri ob 2:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'danes ob 1:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'včeraj ob 2:00', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'Sot në 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Sot në 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Sot në 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Nesër në 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Sot në 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Dje në 02:00', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'данас у 2:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'данас у 2:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'данас у 3:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'сутра у 2:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'данас у 1:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'јуче у 2:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'данас у 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'данас у 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'данас у 13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'сутра у 12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'данас у 11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'јуче у 12:00', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'danas u 2:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'danas u 2:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'danas u 3:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'sutra u 2:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'danas u 1:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'juče u 2:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'danas u 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'danas u 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'danas u 13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'sutra u 12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'danas u 11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'juče u 12:00', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
defineCommonLocaleTests(name, -1, -1);
}
- localeModule('sv');
+ localeModule('ss');
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;
+ 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));
}
}
});
+ 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', 'söndag, februari 14e 2010, 3:25:50 pm'],
- ['ddd, hA', 'sön, 3PM'],
- ['M Mo MM MMMM MMM', '2 2a 02 februari feb'],
+ ['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 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'],
+ ['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', '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 15:25'],
- ['LLLL', 'söndag 14 februari 2010 15:25'],
- ['l', '2010-2-14'],
- ['ll', '14 feb 2010'],
- ['lll', '14 feb 2010 15:25'],
- ['llll', 'sön 14 feb 2010 15:25']
+ ['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;
});
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, 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'), '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, 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'), '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, 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'), '31a', '31a');
+ assert.equal(moment([2011, 0, 31]).format('DDDo'), '31', '31');
});
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;
+ 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 = '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;
+ 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), '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');
+ 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), 'om några sekunder', 'prefix');
- assert.equal(moment(0).from(30000), 'för några sekunder sedan', 'suffix');
+ 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(), 'för några sekunder sedan', 'now from now should display as in the past');
+ 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(), 'om några sekunder', 'in a few seconds');
- assert.equal(moment().add({d: 5}).fromNow(), 'om 5 dagar', 'in 5 days');
+ 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(2).minutes(0).seconds(0);
+ var a = moment().hours(12).minutes(0).seconds(0);
- assert.equal(moment(a).calendar(), 'Idag 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Idag 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Idag 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Imorgon 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Idag 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Igår 02:00', 'yesterday at the same time');
+ 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('[På] dddd LT'), 'Today + ' + i + ' days current time');
+ 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('[På] dddd LT'), 'Today + ' + i + ' days beginning of day');
+ 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('[På] dddd LT'), 'Today + ' + i + ' days end of day');
+ 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('[I] dddd[s] LT'), 'Today - ' + i + ' days current time');
+ 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('[I] dddd[s] LT'), 'Today - ' + i + ' days beginning of day');
+ 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('[I] dddd[s] LT'), 'Today - ' + i + ' days end of day');
+ assert.equal(m.calendar(), m.format('dddd [leliphelile] [nga] LT'), 'Today - ' + i + ' days end of day');
}
});
});
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');
+ 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');
});
}));
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
defineCommonLocaleTests(name, -1, -1);
}
- localeModule('sw');
+ localeModule('sv');
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;
+ 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));
}
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'],
+ ['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 14 14'],
- ['d do dddd ddd dd', '0 0 Jumapili Jpl J2'],
- ['DDD DDDo DDDD', '45 45 045'],
- ['w wo ww', '7 7 07'],
+ ['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'],
- ['[siku] DDDo [ya mwaka]', 'siku 45 ya mwaka'],
+ ['[the] DDDo [day of the year]', 'the 45e day of the year'],
['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']
+ ['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;
});
test('format ordinal', function (assert) {
- assert.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1');
- assert.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2');
- assert.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3');
- assert.equal(moment([2011, 0, 4]).format('DDDo'), '4', '4');
- assert.equal(moment([2011, 0, 5]).format('DDDo'), '5', '5');
- assert.equal(moment([2011, 0, 6]).format('DDDo'), '6', '6');
- assert.equal(moment([2011, 0, 7]).format('DDDo'), '7', '7');
- assert.equal(moment([2011, 0, 8]).format('DDDo'), '8', '8');
- assert.equal(moment([2011, 0, 9]).format('DDDo'), '9', '9');
- assert.equal(moment([2011, 0, 10]).format('DDDo'), '10', '10');
+ assert.equal(moment([2011, 0, 1]).format('DDDo'), '1a', '1a');
+ assert.equal(moment([2011, 0, 2]).format('DDDo'), '2a', '2a');
+ assert.equal(moment([2011, 0, 3]).format('DDDo'), '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'), '11', '11');
- assert.equal(moment([2011, 0, 12]).format('DDDo'), '12', '12');
- assert.equal(moment([2011, 0, 13]).format('DDDo'), '13', '13');
- assert.equal(moment([2011, 0, 14]).format('DDDo'), '14', '14');
- assert.equal(moment([2011, 0, 15]).format('DDDo'), '15', '15');
- assert.equal(moment([2011, 0, 16]).format('DDDo'), '16', '16');
- assert.equal(moment([2011, 0, 17]).format('DDDo'), '17', '17');
- assert.equal(moment([2011, 0, 18]).format('DDDo'), '18', '18');
- assert.equal(moment([2011, 0, 19]).format('DDDo'), '19', '19');
- assert.equal(moment([2011, 0, 20]).format('DDDo'), '20', '20');
+ assert.equal(moment([2011, 0, 11]).format('DDDo'), '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'), '21', '21');
- assert.equal(moment([2011, 0, 22]).format('DDDo'), '22', '22');
- assert.equal(moment([2011, 0, 23]).format('DDDo'), '23', '23');
- assert.equal(moment([2011, 0, 24]).format('DDDo'), '24', '24');
- assert.equal(moment([2011, 0, 25]).format('DDDo'), '25', '25');
- assert.equal(moment([2011, 0, 26]).format('DDDo'), '26', '26');
- assert.equal(moment([2011, 0, 27]).format('DDDo'), '27', '27');
- assert.equal(moment([2011, 0, 28]).format('DDDo'), '28', '28');
- assert.equal(moment([2011, 0, 29]).format('DDDo'), '29', '29');
- assert.equal(moment([2011, 0, 30]).format('DDDo'), '30', '30');
+ assert.equal(moment([2011, 0, 21]).format('DDDo'), '21a', '21a');
+ assert.equal(moment([2011, 0, 22]).format('DDDo'), '22a', '22a');
+ assert.equal(moment([2011, 0, 23]).format('DDDo'), '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'), '31', '31');
+ assert.equal(moment([2011, 0, 31]).format('DDDo'), '31a', '31a');
});
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;
+ 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 = 'Jumapili Jpl J2_Jumatatu Jtat J3_Jumanne Jnne J4_Jumatano Jtan J5_Alhamisi Alh Al_Ijumaa Ijm Ij_Jumamosi Jmos J1'.split('_'), i;
+ 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), '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');
+ 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), 'hivi punde baadaye', 'prefix');
- assert.equal(moment(0).from(30000), 'tokea hivi punde', 'suffix');
+ 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(), 'tokea hivi punde', 'now from now should display as in the past');
+ 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(), 'hivi punde baadaye', 'in a few seconds');
- assert.equal(moment().add({d: 5}).fromNow(), 'masiku 5 baadaye', 'in 5 days');
+ 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(2).minutes(0).seconds(0);
- assert.equal(moment(a).calendar(), 'leo saa 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'leo saa 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'leo saa 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'kesho saa 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'leo saa 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'jana 02:00', 'yesterday at the same time');
+ 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('[wiki ijayo] dddd [saat] LT'), 'Today + ' + i + ' days current time');
+ 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('[wiki ijayo] dddd [saat] LT'), 'Today + ' + i + ' days beginning of day');
+ 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('[wiki ijayo] dddd [saat] LT'), 'Today + ' + i + ' days end of day');
+ 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('[wiki iliyopita] dddd [saat] LT'), 'Today - ' + i + ' days current time');
+ 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('[wiki iliyopita] dddd [saat] LT'), 'Today - ' + i + ' days beginning of day');
+ 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('[wiki iliyopita] dddd [saat] LT'), 'Today - ' + i + ' days end of day');
+ assert.equal(m.calendar(), m.format('[I] dddd[s] LT'), 'Today - ' + i + ' days end of day');
}
});
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});
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');
+ 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');
});
}));
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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;
+
+ var expect = QUnit.expect;
+
+ function module (name, lifecycle) {
+ QUnit.module(name, {
+ setup : function () {
+ moment.locale('en');
+ moment.createFromInputFallback = function (config) {
+ throw new Error('input not handled by moment: ' + config._i);
+ };
+ setupDeprecationHandler(test, moment, 'core');
+ if (lifecycle && lifecycle.setup) {
+ lifecycle.setup();
+ }
+ },
+ teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
+ if (lifecycle && lifecycle.teardown) {
+ lifecycle.teardown();
+ }
+ }
+ });
+ }
+
+ function localeModule (name, lifecycle) {
+ QUnit.module('locale:' + name, {
+ setup : 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();
+ }
+ },
+ teardown : 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 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 defaults(a, b, c) {
+ if (a != null) {
+ return a;
+ }
+ if (b != null) {
+ return b;
+ }
+ return c;
+ }
+
+ function defineCommonLocaleTests(locale, options) {
+ test('lenient 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 ordinal parsing ' + i + ' year check');
+ assert.equal(testMoment.month(), 0,
+ 'lenient ordinal parsing ' + i + ' month check');
+ assert.equal(testMoment.date(), i,
+ 'lenient ordinal parsing ' + i + ' date check');
+ }
+ });
+
+ test('lenient 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 ordinal parsing of number ' + i + ' year check');
+ assert.equal(testMoment.month(), 0,
+ 'lenient ordinal parsing of number ' + i + ' month check');
+ assert.equal(testMoment.date(), i,
+ 'lenient ordinal parsing of number ' + i + ' date check');
+ }
+ });
+
+ test('strict 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 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 :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'இன்று ௦௨:௦௦', 'இன்று 02:00');
- assert.equal(moment(a).add({m: 25}).calendar(), 'இன்று ௦௨:௨௫', 'இன்று 02:25');
- assert.equal(moment(a).add({h: 1}).calendar(), 'இன்று ௦௩:௦௦', 'இன்று 03:00');
- assert.equal(moment(a).add({d: 1}).calendar(), 'நாளை ௦௨:௦௦', 'நாளை 02:00');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'à®\87னà¯\8dà®±à¯\81 ௦௧:௦௦', 'à®\87னà¯\8dà®±à¯\81 0௧:00');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'நà¯\87à®±à¯\8dà®±à¯\81 ௦௨:௦௦', 'நà¯\87à®±à¯\8dà®±à¯\81 02:00');
+ 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(), 'à®\87னà¯\8dà®±à¯\81 ௧௧:௦௦', 'à®\87னà¯\8dà®±à¯\81 11:00');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'நà¯\87à®±à¯\8dà®±à¯\81 ௧௨:௦௦', 'நà¯\87à®±à¯\8dà®±à¯\81 12:00');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'నేడు రాత్రి 2:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'à°¨à±\87à°¡à±\81 రాతà±\8dà°°à°¿ 2:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 3}).calendar(), 'à°¨à±\87à°¡à±\81 à°\89దయà°\82 5:00', 'Now plus 3 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'à°°à±\87à°ªà±\81 రాతà±\8dà°°à°¿ 2:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'à°¨à±\87à°¡à±\81 రాతà±\8dà°°à°¿ 1:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'నినà±\8dà°¨ రాతà±\8dà°°à°¿ 2:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'నేడు మధ్యాహ్నం 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'à°¨à±\87à°¡à±\81 మధà±\8dయాహà±\8dà°¨à°\82 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 3}).calendar(), 'à°¨à±\87à°¡à±\81 మధà±\8dయాహà±\8dà°¨à°\82 3:00', 'Now plus 3 hours');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'à°°à±\87à°ªà±\81 మధà±\8dయాహà±\8dà°¨à°\82 12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'à°¨à±\87à°¡à±\81 మధà±\8dయాహà±\8dà°¨à°\82 11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'నినà±\8dà°¨ మధà±\8dయాహà±\8dà°¨à°\82 12:00', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'วันนี้ เวลา 2 นาฬิกา 0 นาที', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'วันนี้ เวลา 2 นาฬิกา 25 นาที', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'วันนี้ เวลา 3 นาฬิกา 0 นาที', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'พรุ่งนี้ เวลา 2 นาฬิกา 0 นาที', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'วันนี้ เวลา 1 นาฬิกา 0 นาที', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'เมื่อวานนี้ เวลา 2 นาฬิกา 0 นาที', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'วันนี้ เวลา 12 นาฬิกา 0 นาที', '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 นาฬิกา 0 นาที', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'พรุ่งนี้ เวลา 12 นาฬิกา 0 นาที', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'วันนี้ เวลา 11 นาฬิกา 0 นาที', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'เมื่อวานนี้ เวลา 12 นาฬิกา 0 นาที', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
test('same 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(), 'Ngayon sa 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Ngayon sa 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Ngayon sa 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Bukas sa 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Ngayon sa 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kahapon sa 02:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'Ngayon sa 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'Ngayon sa 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'Ngayon sa 13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'Bukas sa 12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'Ngayon sa 11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kahapon sa 12:00', 'yesterday at the same time');
});
test('same next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'DaHjaj 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'DaHjaj 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'DaHjaj 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'wa’leS 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'DaHjaj 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'wa’Hu’ 02:00', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'bugün saat 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'bugün saat 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'bugün saat 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'yarın saat 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'bugün saat 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'dün 02:00', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'oxhi à 02.00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'oxhi à 02.25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'oxhi à 03.00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'demà à 02.00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'oxhi à 01.00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'ieiri à 02.00', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'asdkh g 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'asdkh g 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'asdkh g 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'aska g 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'asdkh g 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'assant g 02:00', 'yesterday at the same time');
+ 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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'ⴰⵙⴷⵅ ⴴ 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'ⴰⵙⴷⵅ ⴴ 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'ⴰⵙⴷⵅ ⴴ 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'ⴰⵙⴽⴰ ⴴ 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'ⴰⵙⴷⵅ ⴴ 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'ⴰⵚⴰⵏⵜ ⴴ 02:00', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'ⴰⵙⴷⵅ ⴴ 12:00', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'ⴰⵙⴷⵅ ⴴ 12:25', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'ⴰⵙⴷⵅ ⴴ 13:00', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'ⴰⵙⴽⴰ ⴴ 12:00', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'ⴰⵙⴷⵅ ⴴ 11:00', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'ⴰⵚⴰⵏⵜ ⴴ 12:00', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
test('calendar day', function (assert) {
- var a = moment().hours(2).minutes(0).seconds(0);
-
- assert.equal(moment(a).calendar(), 'Сьогодні о 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Сьогодні о 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Сьогодні о 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Завтра о 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Сьогодні о 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Вчора о 02:00', 'yesterday at the same time');
+ 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).add({h: 9}).calendar(), 'Сьогодні об 11:00', 'same day at 11 o\'clock');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'Сьогодні об 11:00', 'same day at 11 o\'clock');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), 'Бугун соат 02:00 да', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Бугун соат 02:25 да', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Бугун соат 03:00 да', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Эртага 02:00 да', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Бугун соат 01:00 да', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Кеча соат 02:00 да', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'Бугун соат 12:00 да', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'Бугун соат 12:25 да', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'Бугун соат 13:00 да', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'Эртага 12:00 да', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'Бугун соат 11:00 да', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'Кеча соат 12:00 да', 'yesterday at the same time');
});
test('calendar next week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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;
+
+ var expect = QUnit.expect;
+
+ function module (name, lifecycle) {
+ QUnit.module(name, {
+ setup : function () {
+ moment.locale('en');
+ moment.createFromInputFallback = function (config) {
+ throw new Error('input not handled by moment: ' + config._i);
+ };
+ setupDeprecationHandler(test, moment, 'core');
+ if (lifecycle && lifecycle.setup) {
+ lifecycle.setup();
+ }
+ },
+ teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
+ if (lifecycle && lifecycle.teardown) {
+ lifecycle.teardown();
+ }
+ }
+ });
+ }
+
+ function localeModule (name, lifecycle) {
+ QUnit.module('locale:' + name, {
+ setup : 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();
+ }
+ },
+ teardown : function () {
+ moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
+ if (lifecycle && lifecycle.teardown) {
+ lifecycle.teardown();
+ }
+ }
+ });
+ defineCommonLocaleTests(name, -1, -1);
+ }
+
+ 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');
+ });
+
+}));
+
+;(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 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 defaults(a, b, c) {
+ if (a != null) {
+ return a;
+ }
+ if (b != null) {
+ return b;
+ }
+ return c;
+ }
+
+ function defineCommonLocaleTests(locale, options) {
+ test('lenient 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 ordinal parsing ' + i + ' year check');
+ assert.equal(testMoment.month(), 0,
+ 'lenient ordinal parsing ' + i + ' month check');
+ assert.equal(testMoment.date(), i,
+ 'lenient ordinal parsing ' + i + ' date check');
+ }
+ });
+
+ test('lenient 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 ordinal parsing of number ' + i + ' year check');
+ assert.equal(testMoment.month(), 0,
+ 'lenient ordinal parsing of number ' + i + ' month check');
+ assert.equal(testMoment.date(), i,
+ 'lenient ordinal parsing of number ' + i + ' date check');
+ }
+ });
+
+ test('strict 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 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 :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
defineCommonLocaleTests(name, -1, -1);
}
- localeModule('vi');
+ localeModule('x-pseudo');
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('_');
-
+ 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);
+ 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', '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 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 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', 'ch CH'],
- ['[ngày thứ] DDDo [của năm]', 'ngày thứ 45 của năm'],
- ['LTS', '15:25: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 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'],
+ ['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 Th02 2010'],
- ['lll', '14 Th02 2010 15:25'],
- ['llll', 'CN, 14 Th02 2010 15:25']
+ ['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'), '1', '1');
- assert.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2');
- assert.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3');
- assert.equal(moment([2011, 0, 4]).format('DDDo'), '4', '4');
- assert.equal(moment([2011, 0, 5]).format('DDDo'), '5', '5');
- assert.equal(moment([2011, 0, 6]).format('DDDo'), '6', '6');
- assert.equal(moment([2011, 0, 7]).format('DDDo'), '7', '7');
- assert.equal(moment([2011, 0, 8]).format('DDDo'), '8', '8');
- assert.equal(moment([2011, 0, 9]).format('DDDo'), '9', '9');
- assert.equal(moment([2011, 0, 10]).format('DDDo'), '10', '10');
+ assert.equal(moment([2011, 0, 1]).format('DDDo'), '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'), '11', '11');
- assert.equal(moment([2011, 0, 12]).format('DDDo'), '12', '12');
- assert.equal(moment([2011, 0, 13]).format('DDDo'), '13', '13');
- assert.equal(moment([2011, 0, 14]).format('DDDo'), '14', '14');
- assert.equal(moment([2011, 0, 15]).format('DDDo'), '15', '15');
- assert.equal(moment([2011, 0, 16]).format('DDDo'), '16', '16');
- assert.equal(moment([2011, 0, 17]).format('DDDo'), '17', '17');
- assert.equal(moment([2011, 0, 18]).format('DDDo'), '18', '18');
- assert.equal(moment([2011, 0, 19]).format('DDDo'), '19', '19');
- assert.equal(moment([2011, 0, 20]).format('DDDo'), '20', '20');
+ assert.equal(moment([2011, 0, 11]).format('DDDo'), '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'), '21', '21');
- assert.equal(moment([2011, 0, 22]).format('DDDo'), '22', '22');
- assert.equal(moment([2011, 0, 23]).format('DDDo'), '23', '23');
- assert.equal(moment([2011, 0, 24]).format('DDDo'), '24', '24');
- assert.equal(moment([2011, 0, 25]).format('DDDo'), '25', '25');
- assert.equal(moment([2011, 0, 26]).format('DDDo'), '26', '26');
- assert.equal(moment([2011, 0, 27]).format('DDDo'), '27', '27');
- assert.equal(moment([2011, 0, 28]).format('DDDo'), '28', '28');
- assert.equal(moment([2011, 0, 29]).format('DDDo'), '29', '29');
- assert.equal(moment([2011, 0, 30]).format('DDDo'), '30', '30');
+ assert.equal(moment([2011, 0, 21]).format('DDDo'), '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'), '31', '31');
+ 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('_');
-
+ 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]);
+ 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('_');
-
+ 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), '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), 'á ~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), '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), 'í~ñ á ~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(), 'vài giây trước', 'now from now should display as in the past');
+ 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(), '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(), 'í~ñ á ~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(), 'Hôm nay lúc 02:00', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Hôm nay lúc 02:25', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Hôm nay lúc 03:00', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Ngày mai lúc 02:00', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hôm nay lúc 01:00', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Hôm qua lúc 02:00', 'yesterday at the same time');
+ 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 [tuần tới lúc] LT'), 'Today + ' + i + ' days current time');
+ 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 [tuần tới lúc] LT'), 'Today + ' + i + ' days beginning of day');
+ 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 [tuần tới lúc] LT'), 'Today + ' + i + ' days end of day');
+ assert.equal(m.calendar(), m.format('dddd [át] LT'), 'Today + ' + i + ' days end of day');
}
});
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('[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('dddd [tuần rồi lúc] LT'), 'Today - ' + i + ' days beginning of day');
+ 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('dddd [tuần rồi lúc] LT'), 'Today - ' + i + ' days end of day');
+ assert.equal(m.calendar(), m.format('[L~ást] dddd [át] LT'), 'Today - ' + i + ' days end of day');
}
});
});
test('weeks year starting sunday formatted', function (assert) {
- assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52', 'Jan 1 2012 should be week 52');
- assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1', 'Jan 2 2012 should be week 1');
- assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1', 'Jan 8 2012 should be week 1');
- assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2', 'Jan 9 2012 should be week 2');
- assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2', 'Jan 15 2012 should be week 2');
+ assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 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');
});
}));
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
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(), '今天凌晨2点整', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), '今天凌晨2点25分', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), '今天凌晨3点整', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), '明天凌晨2点整', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), '今天凌晨1点整', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), '昨天凌晨2点整', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), '今天中午12点整', '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点整', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), '明天中午12点整', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), '今天上午11点整', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), '昨天中午12点整', 'yesterday at the same time');
});
test('calendar current week', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
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: 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), '一小時', '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: 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), '一天', '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: 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 day = a day');
+ 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), '一個月', '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: 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 month = a month');
+ 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), '一年', '345 days = a year');
+ 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 year = a year');
+ 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('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(), '今天早上2點00分', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), '今天早上2點25分', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), '今天早上3點00分', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), '明天早上2點00分', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), '今天早上1點00分', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), '昨天早上2點00分', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), '今天中午12點00分', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), '今天中午12點25分', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), '今天下午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) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
test('add string long reverse args', function (assert) {
var a = moment(), b;
+
+ test.expectedDeprecations('moment().add(period, number)');
+
a.year(2011);
a.month(9);
a.date(12);
test('add string long singular reverse args', function (assert) {
var a = moment(), b;
+
+ test.expectedDeprecations('moment().add(period, number)');
+
a.year(2011);
a.month(9);
a.date(12);
test('add string short reverse args', function (assert) {
var a = moment();
+ test.expectedDeprecations('moment().add(period, number)');
+
a.year(2011);
a.month(9);
a.date(12);
assert.equal(a.add(1, 'Q').month(), 1, 'Add quarter');
});
- test('add strings string short args', function (assert) {
+ test('add strings string short reversed', function (assert) {
var a = moment();
+ test.expectedDeprecations('moment().add(period, number)');
+
a.year(2011);
a.month(9);
a.date(12);
assert.equal(a.add('Q', '1').month(), 1, 'Add quarter');
});
- test('subtract strings string short args', function (assert) {
+ test('subtract strings string short reversed', function (assert) {
var a = moment();
+ test.expectedDeprecations('moment().subtract(period, number)');
+
a.year(2011);
a.month(9);
a.date(12);
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
module('calendar');
test('passing a function', function (assert) {
- var a = moment().hours(2).minutes(0).seconds(0);
+ var a = moment().hours(13).minutes(0).seconds(0);
assert.equal(moment(a).calendar(null, {
'sameDay': function () {
return 'h:mmA';
}
- }), '2:00AM', 'should equate');
+ }), '1:00PM', 'should equate');
});
}));
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
test('parsing iso week year/week/weekday', function (assert) {
- assert.equal(moment.utc('2007-W01').format(), '2007-01-01T00:00:00+00:00', '2008 week 1 (1st Jan Mon)');
- assert.equal(moment.utc('2008-W01').format(), '2007-12-31T00:00:00+00:00', '2008 week 1 (1st Jan Tue)');
- assert.equal(moment.utc('2003-W01').format(), '2002-12-30T00:00:00+00:00', '2008 week 1 (1st Jan Wed)');
- assert.equal(moment.utc('2009-W01').format(), '2008-12-29T00:00:00+00:00', '2009 week 1 (1st Jan Thu)');
- assert.equal(moment.utc('2010-W01').format(), '2010-01-04T00:00:00+00:00', '2010 week 1 (1st Jan Fri)');
- assert.equal(moment.utc('2011-W01').format(), '2011-01-03T00:00:00+00:00', '2011 week 1 (1st Jan Sat)');
- assert.equal(moment.utc('2012-W01').format(), '2012-01-02T00:00:00+00:00', '2012 week 1 (1st Jan Sun)');
+ assert.equal(moment.utc('2007-W01').format(), '2007-01-01T00:00:00Z', '2008 week 1 (1st Jan Mon)');
+ assert.equal(moment.utc('2008-W01').format(), '2007-12-31T00:00:00Z', '2008 week 1 (1st Jan Tue)');
+ assert.equal(moment.utc('2003-W01').format(), '2002-12-30T00:00:00Z', '2008 week 1 (1st Jan Wed)');
+ assert.equal(moment.utc('2009-W01').format(), '2008-12-29T00:00:00Z', '2009 week 1 (1st Jan Thu)');
+ assert.equal(moment.utc('2010-W01').format(), '2010-01-04T00:00:00Z', '2010 week 1 (1st Jan Fri)');
+ assert.equal(moment.utc('2011-W01').format(), '2011-01-03T00:00:00Z', '2011 week 1 (1st Jan Sat)');
+ assert.equal(moment.utc('2012-W01').format(), '2012-01-02T00:00:00Z', '2012 week 1 (1st Jan Sun)');
});
test('parsing week year/week/weekday (dow 1, doy 4)', function (assert) {
moment.locale('dow:1,doy:4', {week: {dow: 1, doy: 4}});
- assert.equal(moment.utc('2007-01', 'gggg-ww').format(), '2007-01-01T00:00:00+00:00', '2007 week 1 (1st Jan Mon)');
- assert.equal(moment.utc('2008-01', 'gggg-ww').format(), '2007-12-31T00:00:00+00:00', '2008 week 1 (1st Jan Tue)');
- assert.equal(moment.utc('2003-01', 'gggg-ww').format(), '2002-12-30T00:00:00+00:00', '2003 week 1 (1st Jan Wed)');
- assert.equal(moment.utc('2009-01', 'gggg-ww').format(), '2008-12-29T00:00:00+00:00', '2009 week 1 (1st Jan Thu)');
- assert.equal(moment.utc('2010-01', 'gggg-ww').format(), '2010-01-04T00:00:00+00:00', '2010 week 1 (1st Jan Fri)');
- assert.equal(moment.utc('2011-01', 'gggg-ww').format(), '2011-01-03T00:00:00+00:00', '2011 week 1 (1st Jan Sat)');
- assert.equal(moment.utc('2012-01', 'gggg-ww').format(), '2012-01-02T00:00:00+00:00', '2012 week 1 (1st Jan Sun)');
+ assert.equal(moment.utc('2007-01', 'gggg-ww').format(), '2007-01-01T00:00:00Z', '2007 week 1 (1st Jan Mon)');
+ assert.equal(moment.utc('2008-01', 'gggg-ww').format(), '2007-12-31T00:00:00Z', '2008 week 1 (1st Jan Tue)');
+ assert.equal(moment.utc('2003-01', 'gggg-ww').format(), '2002-12-30T00:00:00Z', '2003 week 1 (1st Jan Wed)');
+ assert.equal(moment.utc('2009-01', 'gggg-ww').format(), '2008-12-29T00:00:00Z', '2009 week 1 (1st Jan Thu)');
+ assert.equal(moment.utc('2010-01', 'gggg-ww').format(), '2010-01-04T00:00:00Z', '2010 week 1 (1st Jan Fri)');
+ assert.equal(moment.utc('2011-01', 'gggg-ww').format(), '2011-01-03T00:00:00Z', '2011 week 1 (1st Jan Sat)');
+ assert.equal(moment.utc('2012-01', 'gggg-ww').format(), '2012-01-02T00:00:00Z', '2012 week 1 (1st Jan Sun)');
moment.defineLocale('dow:1,doy:4', null);
});
test('parsing week year/week/weekday (dow 1, doy 7)', function (assert) {
moment.locale('dow:1,doy:7', {week: {dow: 1, doy: 7}});
- assert.equal(moment.utc('2007-01', 'gggg-ww').format(), '2007-01-01T00:00:00+00:00', '2007 week 1 (1st Jan Mon)');
- assert.equal(moment.utc('2008-01', 'gggg-ww').format(), '2007-12-31T00:00:00+00:00', '2008 week 1 (1st Jan Tue)');
- assert.equal(moment.utc('2003-01', 'gggg-ww').format(), '2002-12-30T00:00:00+00:00', '2003 week 1 (1st Jan Wed)');
- assert.equal(moment.utc('2009-01', 'gggg-ww').format(), '2008-12-29T00:00:00+00:00', '2009 week 1 (1st Jan Thu)');
- assert.equal(moment.utc('2010-01', 'gggg-ww').format(), '2009-12-28T00:00:00+00:00', '2010 week 1 (1st Jan Fri)');
- assert.equal(moment.utc('2011-01', 'gggg-ww').format(), '2010-12-27T00:00:00+00:00', '2011 week 1 (1st Jan Sat)');
- assert.equal(moment.utc('2012-01', 'gggg-ww').format(), '2011-12-26T00:00:00+00:00', '2012 week 1 (1st Jan Sun)');
+ assert.equal(moment.utc('2007-01', 'gggg-ww').format(), '2007-01-01T00:00:00Z', '2007 week 1 (1st Jan Mon)');
+ assert.equal(moment.utc('2008-01', 'gggg-ww').format(), '2007-12-31T00:00:00Z', '2008 week 1 (1st Jan Tue)');
+ assert.equal(moment.utc('2003-01', 'gggg-ww').format(), '2002-12-30T00:00:00Z', '2003 week 1 (1st Jan Wed)');
+ assert.equal(moment.utc('2009-01', 'gggg-ww').format(), '2008-12-29T00:00:00Z', '2009 week 1 (1st Jan Thu)');
+ assert.equal(moment.utc('2010-01', 'gggg-ww').format(), '2009-12-28T00:00:00Z', '2010 week 1 (1st Jan Fri)');
+ assert.equal(moment.utc('2011-01', 'gggg-ww').format(), '2010-12-27T00:00:00Z', '2011 week 1 (1st Jan Sat)');
+ assert.equal(moment.utc('2012-01', 'gggg-ww').format(), '2011-12-26T00:00:00Z', '2012 week 1 (1st Jan Sun)');
moment.defineLocale('dow:1,doy:7', null);
});
test('parsing week year/week/weekday (dow 0, doy 6)', function (assert) {
moment.locale('dow:0,doy:6', {week: {dow: 0, doy: 6}});
- assert.equal(moment.utc('2007-01', 'gggg-ww').format(), '2006-12-31T00:00:00+00:00', '2007 week 1 (1st Jan Mon)');
- assert.equal(moment.utc('2008-01', 'gggg-ww').format(), '2007-12-30T00:00:00+00:00', '2008 week 1 (1st Jan Tue)');
- assert.equal(moment.utc('2003-01', 'gggg-ww').format(), '2002-12-29T00:00:00+00:00', '2003 week 1 (1st Jan Wed)');
- assert.equal(moment.utc('2009-01', 'gggg-ww').format(), '2008-12-28T00:00:00+00:00', '2009 week 1 (1st Jan Thu)');
- assert.equal(moment.utc('2010-01', 'gggg-ww').format(), '2009-12-27T00:00:00+00:00', '2010 week 1 (1st Jan Fri)');
- assert.equal(moment.utc('2011-01', 'gggg-ww').format(), '2010-12-26T00:00:00+00:00', '2011 week 1 (1st Jan Sat)');
- assert.equal(moment.utc('2012-01', 'gggg-ww').format(), '2012-01-01T00:00:00+00:00', '2012 week 1 (1st Jan Sun)');
+ assert.equal(moment.utc('2007-01', 'gggg-ww').format(), '2006-12-31T00:00:00Z', '2007 week 1 (1st Jan Mon)');
+ assert.equal(moment.utc('2008-01', 'gggg-ww').format(), '2007-12-30T00:00:00Z', '2008 week 1 (1st Jan Tue)');
+ assert.equal(moment.utc('2003-01', 'gggg-ww').format(), '2002-12-29T00:00:00Z', '2003 week 1 (1st Jan Wed)');
+ assert.equal(moment.utc('2009-01', 'gggg-ww').format(), '2008-12-28T00:00:00Z', '2009 week 1 (1st Jan Thu)');
+ assert.equal(moment.utc('2010-01', 'gggg-ww').format(), '2009-12-27T00:00:00Z', '2010 week 1 (1st Jan Fri)');
+ assert.equal(moment.utc('2011-01', 'gggg-ww').format(), '2010-12-26T00:00:00Z', '2011 week 1 (1st Jan Sat)');
+ assert.equal(moment.utc('2012-01', 'gggg-ww').format(), '2012-01-01T00:00:00Z', '2012 week 1 (1st Jan Sun)');
moment.defineLocale('dow:0,doy:6', null);
});
test('parsing week year/week/weekday (dow 6, doy 12)', function (assert) {
moment.locale('dow:6,doy:12', {week: {dow: 6, doy: 12}});
- assert.equal(moment.utc('2007-01', 'gggg-ww').format(), '2006-12-30T00:00:00+00:00', '2007 week 1 (1st Jan Mon)');
- assert.equal(moment.utc('2008-01', 'gggg-ww').format(), '2007-12-29T00:00:00+00:00', '2008 week 1 (1st Jan Tue)');
- assert.equal(moment.utc('2003-01', 'gggg-ww').format(), '2002-12-28T00:00:00+00:00', '2003 week 1 (1st Jan Wed)');
- assert.equal(moment.utc('2009-01', 'gggg-ww').format(), '2008-12-27T00:00:00+00:00', '2009 week 1 (1st Jan Thu)');
- assert.equal(moment.utc('2010-01', 'gggg-ww').format(), '2009-12-26T00:00:00+00:00', '2010 week 1 (1st Jan Fri)');
- assert.equal(moment.utc('2011-01', 'gggg-ww').format(), '2011-01-01T00:00:00+00:00', '2011 week 1 (1st Jan Sat)');
- assert.equal(moment.utc('2012-01', 'gggg-ww').format(), '2011-12-31T00:00:00+00:00', '2012 week 1 (1st Jan Sun)');
+ assert.equal(moment.utc('2007-01', 'gggg-ww').format(), '2006-12-30T00:00:00Z', '2007 week 1 (1st Jan Mon)');
+ assert.equal(moment.utc('2008-01', 'gggg-ww').format(), '2007-12-29T00:00:00Z', '2008 week 1 (1st Jan Tue)');
+ assert.equal(moment.utc('2003-01', 'gggg-ww').format(), '2002-12-28T00:00:00Z', '2003 week 1 (1st Jan Wed)');
+ assert.equal(moment.utc('2009-01', 'gggg-ww').format(), '2008-12-27T00:00:00Z', '2009 week 1 (1st Jan Thu)');
+ assert.equal(moment.utc('2010-01', 'gggg-ww').format(), '2009-12-26T00:00:00Z', '2010 week 1 (1st Jan Fri)');
+ assert.equal(moment.utc('2011-01', 'gggg-ww').format(), '2011-01-01T00:00:00Z', '2011 week 1 (1st Jan Sat)');
+ assert.equal(moment.utc('2012-01', 'gggg-ww').format(), '2011-12-31T00:00:00Z', '2012 week 1 (1st Jan Sun)');
+ moment.defineLocale('dow:6,doy:12', null);
});
test('parsing ISO with Z', function (assert) {
});
test('parsing iso with more subsecond precision digits', function (assert) {
- assert.equal(moment.utc('2013-07-31T22:00:00.0000000Z').format(), '2013-07-31T22:00:00+00:00', 'more than 3 subsecond digits');
+ assert.equal(moment.utc('2013-07-31T22:00:00.0000000Z').format(), '2013-07-31T22:00:00Z', 'more than 3 subsecond digits');
});
test('null or empty', function (assert) {
ver('1999 37 Di', 'gggg ww dd', '1999 09 19', 'localized d uses 0-indexed days: 0 = sund');
}
finally {
+ moment.defineLocale('dow:1,doy:4', null);
moment.locale('en');
}
});
});
test('utc with array of formats', function (assert) {
- assert.equal(moment.utc('2014-01-01', ['YYYY-MM-DD', 'YYYY-MM']).format(), '2014-01-01T00:00:00+00:00', 'moment.utc works with array of formats');
+ assert.equal(moment.utc('2014-01-01', ['YYYY-MM-DD', 'YYYY-MM']).format(), '2014-01-01T00:00:00Z', 'moment.utc works with array of formats');
});
test('parsing invalid string weekdays', function (assert) {
assert.equal(moment('1-1-2010', 'M-D-Y', true).year(), 2010, 'parsing Y');
});
+ test('parsing flags retain parsed date parts', function (assert) {
+ var a = moment('10 p', 'hh:mm a');
+ assert.equal(a.parsingFlags().parsedDateParts[3], 10, 'parsed 10 as the hour');
+ assert.equal(a.parsingFlags().parsedDateParts[0], undefined, 'year was not parsed');
+ assert.equal(a.parsingFlags().meridiem, 'p', 'meridiem flag was added');
+ var b = moment('10:30', ['MMDDYY', 'HH:mm']);
+ assert.equal(b.parsingFlags().parsedDateParts[3], 10, 'multiple format parshing matched hour');
+ assert.equal(b.parsingFlags().parsedDateParts[0], undefined, 'array is properly copied, no residual data from first token parse');
+ });
+
+ test('parsing only meridiem results in invalid date', function (assert) {
+ assert.ok(!moment('alkj', 'hh:mm a').isValid(), 'because an a token is used, a meridiem will be parsed but nothing else was so invalid');
+ assert.ok(moment('02:30 p more extra stuff', 'hh:mm a').isValid(), 'because other tokens were parsed, date is valid');
+ assert.ok(moment('1/1/2016 extra data', ['a', 'M/D/YYYY']).isValid(), 'took second format, does not pick up on meridiem parsed from first format (good copy)');
+ });
+
}));
;(function (global, factory) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
var firstTime = true;
return extend(function () {
+ if (hooks.deprecationHandler != null) {
+ hooks.deprecationHandler(null, msg);
+ }
if (firstTime) {
warn(msg + '\nArguments: ' + Array.prototype.slice.call(arguments).join(', ') + '\n' + (new Error()).stack);
firstTime = false;
var deprecations = {};
function deprecateSimple(name, msg) {
+ if (hooks.deprecationHandler != null) {
+ hooks.deprecationHandler(name, msg);
+ }
if (!deprecations[name]) {
warn(msg);
deprecations[name] = true;
}
hooks.suppressDeprecationWarnings = false;
+ hooks.deprecationHandler = null;
module('deprecate');
test('deprecate', function (assert) {
+ // NOTE: hooks inside deprecate.js and moment are different, so this is can
+ // not be test.expectedDeprecations(...)
var fn = function () {};
var deprecatedFn = deprecate('testing deprecation', fn);
deprecatedFn();
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
equal(assert, moment([2012, 1, 29]).diff([2013, 1, 28], 'years', true), -1, 'Feb 29 2012 to Feb 28 2013 should be 1-(1 / 28.5) / 12 years');
});
+ test('negative zero', function (assert) {
+ function isNegative (n) {
+ return (1 / n) < 0;
+ }
+ assert.ok(!isNegative(moment([2012, 0, 1]).diff(moment([2012, 0, 1]), 'months')), 'month diff on same date is zero, not -0');
+ assert.ok(!isNegative(moment([2012, 0, 1]).diff(moment([2012, 0, 1]), 'years')), 'year diff on same date is zero, not -0');
+ assert.ok(!isNegative(moment([2012, 0, 1]).diff(moment([2012, 0, 1]), 'quarters')), 'quarter diff on same date is zero, not -0');
+ });
+
}));
;(function (global, factory) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
test('toIsoString deprecation', function (assert) {
+ test.expectedDeprecations('toIsoString()');
+
assert.equal(moment.duration({}).toIsoString(), moment.duration({}).toISOString(), 'toIsoString delegates to toISOString');
});
assert.equal(moment.duration('-P2Y').asSeconds(), moment.duration({y: -2}).asSeconds(), 'python isodate 22');
assert.equal(moment.duration('-P3Y6M4DT12H30M5S').asSeconds(), moment.duration({y: -3, M: -6, d: -4, h: -12, m: -30, s: -5}).asSeconds(), 'python isodate 23');
assert.equal(moment.duration('-P1DT2H3M4S').asSeconds(), moment.duration({d: -1, h: -2, m: -3, s: -4}).asSeconds(), 'python isodate 24');
+ assert.equal(moment.duration('PT-6H3M').asSeconds(), moment.duration({h: -6, m: 3}).asSeconds(), 'python isodate 25');
+ assert.equal(moment.duration('-PT-6H3M').asSeconds(), moment.duration({h: 6, m: -3}).asSeconds(), 'python isodate 26');
+ assert.equal(moment.duration('-P-3Y-6M-4DT-12H-30M-5S').asSeconds(), moment.duration({y: 3, M: 6, d: 4, h: 12, m: 30, s: 5}).asSeconds(), 'python isodate 27');
+ assert.equal(moment.duration('P-3Y-6M-4DT-12H-30M-5S').asSeconds(), moment.duration({y: -3, M: -6, d: -4, h: -12, m: -30, s: -5}).asSeconds(), 'python isodate 28');
+ assert.equal(moment.duration('-P-2W').asSeconds(), moment.duration({w: 2}).asSeconds(), 'python isodate 29');
+ assert.equal(moment.duration('P-2W').asSeconds(), moment.duration({w: -2}).asSeconds(), 'python isodate 30');
});
test('ISO 8601 misuse cases', function (assert) {
assert.equal(moment.duration('PT.5S').asSeconds(), 0.5, 'accept no leading zero for decimal');
assert.equal(moment.duration('PT1,S').asSeconds(), 1, 'accept trailing decimal separator');
assert.equal(moment.duration('PT1M0,,5S').asSeconds(), 60, 'extra decimal separators are ignored as 0');
- assert.equal(moment.duration('P-1DS').asSeconds(), 0, 'wrong position of negative');
});
test('humanize', function (assert) {
assert.equal(dm.asMinutes(), 13, 'asMinutes()');
});
+ test('minutes getter for floating point hours', function (assert) {
+ // Tests for issue #2978.
+ // For certain floating point hours, .minutes() getter produced incorrect values due to the rounding errors
+ assert.equal(moment.duration(2.3, 'h').minutes(), 18, 'minutes()');
+ assert.equal(moment.duration(4.1, 'h').minutes(), 6, 'minutes()');
+ });
+
test('isDuration', function (assert) {
assert.ok(moment.isDuration(moment.duration(12345678)), 'correctly says true');
assert.ok(!moment.isDuration(moment()), 'moment object is not a duration');
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
assert.ok(isoRegex.exec(moment().format()), 'default format (' + moment().format() + ') should match ISO');
});
+ test('default UTC format', function (assert) {
+ var isoRegex = /\d{4}.\d\d.\d\dT\d\d.\d\d.\d\dZ/;
+ assert.ok(isoRegex.exec(moment.utc().format()), 'default UTC format (' + moment.utc().format() + ') should match ISO');
+ });
+
test('toJSON', function (assert) {
var supportsJson = typeof JSON !== 'undefined' && JSON.stringify && JSON.stringify.call,
date = moment('2012-10-09T21:30:40.678+0100');
'405-12-31': '0405-52'
}, i, isoWeekYear, formatted5, formatted4, formatted2;
- moment.locale('dow:1,doy:4', {week: {dow: 1, doy: 4}});
+ moment.defineLocale('dow:1,doy:4', {week: {dow: 1, doy: 4}});
for (i in cases) {
isoWeekYear = cases[i].split('-')[0];
formatted2 = moment(i, 'YYYY-MM-DD').format('gg');
assert.equal(isoWeekYear.slice(2, 4), formatted2, i + ': gg should be ' + isoWeekYear + ', but ' + formatted2);
}
+ moment.defineLocale('dow:1,doy:4', null);
});
test('iso weekday formats', function (assert) {
});
test('weekday formats', function (assert) {
- moment.locale('dow: 3,doy: 5', {week: {dow: 3, doy: 5}});
+ moment.defineLocale('dow: 3,doy: 5', {week: {dow: 3, doy: 5}});
assert.equal(moment([1985, 1, 6]).format('e'), '0', 'Feb 6 1985 is Wednesday -- 0th day');
assert.equal(moment([2029, 8, 20]).format('e'), '1', 'Sep 20 2029 is Thursday -- 1st day');
assert.equal(moment([2013, 3, 26]).format('e'), '2', 'Apr 26 2013 is Friday -- 2nd day');
assert.equal(moment([1970, 0, 4]).format('e'), '4', 'Jan 4 1970 is Sunday -- 4th day');
assert.equal(moment([2001, 4, 14]).format('e'), '5', 'May 14 2001 is Monday -- 5th day');
assert.equal(moment([2000, 0, 4]).format('e'), '6', 'Jan 4 2000 is Tuesday -- 6th day');
+ moment.defineLocale('dow: 3,doy: 5', null);
});
test('toString is just human readable format', function (assert) {
});
test('toJSON skips postformat', function (assert) {
- moment.locale('postformat', {
+ moment.defineLocale('postformat', {
postformat: function (s) {
s.replace(/./g, 'X');
}
});
assert.equal(moment.utc([2000, 0, 1]).toJSON(), '2000-01-01T00:00:00.000Z', 'toJSON doesn\'t postformat');
- moment.locale('postformat', null);
+ moment.defineLocale('postformat', null);
});
test('calendar day timezone', function (assert) {
assert.equal(moment('18:34:56', 'HH:mm:ss').format('Hmmss'), '183456');
});
+ test('k and kk', function (assert) {
+ assert.equal(moment('01:23:45', 'HH:mm:ss').format('k'), '1');
+ assert.equal(moment('12:34:56', 'HH:mm:ss').format('k'), '12');
+ assert.equal(moment('01:23:45', 'HH:mm:ss').format('kk'), '01');
+ assert.equal(moment('12:34:56', 'HH:mm:ss').format('kk'), '12');
+ assert.equal(moment('00:34:56', 'HH:mm:ss').format('kk'), '24');
+ assert.equal(moment('00:00:00', 'HH:mm:ss').format('kk'), '24');
+ });
+
test('Y token', function (assert) {
assert.equal(moment('2010-01-01', 'YYYY-MM-DD', true).format('Y'), '2010', 'format 2010 with Y');
assert.equal(moment('-123-01-01', 'Y-MM-DD', true).format('Y'), '-123', 'format -123 with Y');
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
test('setters plural', function (assert) {
var a = moment();
+ test.expectedDeprecations('years accessor', 'months accessor', 'dates accessor');
+
a.years(2011);
a.months(9);
a.dates(12);
assert.equal(a.month(), 3, 'month edge case');
});
- // Disable this, until we weekYear setter is fixed.
- // https://github.com/moment/moment/issues/1379
- // test('setters programatic with weeks', function (assert) {
- // var a = moment();
- // a.set('weekYear', 2001);
- // a.set('week', 49);
- // a.set('day', 4);
- // assert.equals(a.weekYear(), 2001);
- // assert.equals(a.week(), 49);
- // assert.equals(a.day(), 4);
-
- // a.set('weekday', 1);
- // assert.equals(a.weekday(), 1);
+ test('setters programatic with weeks', function (assert) {
+ var a = moment();
+ a.set('weekYear', 2001);
+ a.set('week', 49);
+ a.set('day', 4);
- // assert.done();
- //},
+ assert.equal(a.weekYear(), 2001, 'weekYear');
+ assert.equal(a.week(), 49, 'week');
+ assert.equal(a.day(), 4, 'day');
- // I think this suffers from the same issue as the non-iso version.
- // test('setters programatic with weeks ISO', function (assert) {
- // var a = moment();
- // a.set('isoWeekYear', 2001);
- // a.set('isoWeek', 49);
- // a.set('isoWeekday', 4);
+ a.set('weekday', 1);
+ assert.equal(a.weekday(), 1, 'weekday');
+ });
- // assert.equals(a.weekYear(), 2001);
- // assert.equals(a.week(), 49);
- // assert.equals(a.day(), 4);
+ test('setters programatic with weeks ISO', function (assert) {
+ var a = moment();
+ a.set('isoWeekYear', 2001);
+ a.set('isoWeek', 49);
+ a.set('isoWeekday', 4);
- // assert.done();
- //},
+ assert.equal(a.isoWeekYear(), 2001, 'isoWeekYear');
+ assert.equal(a.isoWeek(), 49, 'isoWeek');
+ assert.equal(a.isoWeekday(), 4, 'isoWeekday');
+ });
test('setters strings', function (assert) {
var a = moment([2012]).locale('en');
assert.equal(a.milliseconds(), 9, 'milliseconds');
});
+ test('setters across DST +1', function (assert) {
+ var oldUpdateOffset = moment.updateOffset,
+ // Based on a real story somewhere in America/Los_Angeles
+ dstAt = moment('2014-03-09T02:00:00-08:00').parseZone(),
+ m;
+
+ moment.updateOffset = function (mom, keepTime) {
+ if (mom.isBefore(dstAt)) {
+ mom.utcOffset(-8, keepTime);
+ } else {
+ mom.utcOffset(-7, keepTime);
+ }
+ };
+
+ m = moment('2014-03-15T00:00:00-07:00').parseZone();
+ m.year(2013);
+ assert.equal(m.format(), '2013-03-15T00:00:00-08:00', 'year across +1');
+
+ m = moment('2014-03-15T00:00:00-07:00').parseZone();
+ m.month(0);
+ assert.equal(m.format(), '2014-01-15T00:00:00-08:00', 'month across +1');
+
+ m = moment('2014-03-15T00:00:00-07:00').parseZone();
+ m.date(1);
+ assert.equal(m.format(), '2014-03-01T00:00:00-08:00', 'date across +1');
+
+ m = moment('2014-03-09T03:05:00-07:00').parseZone();
+ m.hour(0);
+ assert.equal(m.format(), '2014-03-09T00:05:00-08:00', 'hour across +1');
+
+ moment.updateOffset = oldUpdateOffset;
+ });
+
+ test('setters across DST -1', function (assert) {
+ var oldUpdateOffset = moment.updateOffset,
+ // Based on a real story somewhere in America/Los_Angeles
+ dstAt = moment('2014-11-02T02:00:00-07:00').parseZone(),
+ m;
+
+ moment.updateOffset = function (mom, keepTime) {
+ if (mom.isBefore(dstAt)) {
+ mom.utcOffset(-7, keepTime);
+ } else {
+ mom.utcOffset(-8, keepTime);
+ }
+ };
+
+ m = moment('2014-11-15T00:00:00-08:00').parseZone();
+ m.year(2013);
+ assert.equal(m.format(), '2013-11-15T00:00:00-07:00', 'year across -1');
+
+ m = moment('2014-11-15T00:00:00-08:00').parseZone();
+ m.month(0);
+ assert.equal(m.format(), '2014-01-15T00:00:00-07:00', 'month across -1');
+
+ m = moment('2014-11-15T00:00:00-08:00').parseZone();
+ m.date(1);
+ assert.equal(m.format(), '2014-11-01T00:00:00-07:00', 'date across -1');
+
+ m = moment('2014-11-02T03:30:00-08:00').parseZone();
+ m.hour(0);
+ assert.equal(m.format(), '2014-11-02T00:30:00-07:00', 'hour across -1');
+
+ moment.updateOffset = oldUpdateOffset;
+ });
+
}));
;(function (global, factory) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
invalid,
valid = moment();
+ test.expectedDeprecations('moment().min', 'moment().max');
+
for (i = 0; i < invalids.length; ++i) {
invalid = invalids[i];
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
assert.equal(+m, +mCopy, 'isBetween second should not change moment');
});
+ test('is between without units inclusivity', function (assert) {
+ var m = moment(new Date(2011, 3, 2, 3, 4, 5, 10)), mCopy = moment(m);
+ assert.equal(m.isBetween(
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2012, 3, 2, 3, 4, 5, 10)), null, '()'), false, 'start and end are excluded, start is equal to moment');
+ assert.equal(m.isBetween(
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)), null, '()'), false, 'start and end are excluded, end is equal to moment');
+ assert.equal(m.isBetween(
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2012, 3, 2, 3, 4, 5, 10)), null, '()'), true, 'start and end are excluded, is between');
+ assert.equal(m.isBetween(
+ moment(new Date(2009, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)), null, '()'), false, 'start and end are excluded, is not between');
+ assert.equal(m.isBetween(
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)), null, '()'), false, 'start and end are excluded, should fail on same start/end date.');
+
+ assert.equal(m.isBetween(
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2012, 3, 2, 3, 4, 5, 10)), null, '(]'), false, 'start is excluded and end is included should fail on same start date');
+ assert.equal(m.isBetween(
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)), null, '(]'), true, 'start is excluded and end is included should succeed on end date');
+ assert.equal(m.isBetween(
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2012, 3, 2, 3, 4, 5, 10)), null, '(]'), true, 'start is excluded and end is included, is between');
+ assert.equal(m.isBetween(
+ moment(new Date(2009, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)), null, '(]'), false, 'start is excluded and end is included, is not between');
+ assert.equal(m.isBetween(
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)), null, '(]'), false, 'start is excluded and end is included, should fail on same start/end date.');
+
+ assert.equal(m.isBetween(
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2012, 3, 2, 3, 4, 5, 10)), null, '[)'), true, 'start is included and end is excluded should succeed on same start date');
+ assert.equal(m.isBetween(
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)), null, '[)'), false, 'start is included and end is excluded should fail on same end date');
+ assert.equal(m.isBetween(
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2012, 3, 2, 3, 4, 5, 10)), null, '[)'), true, 'start is included and end is excluded, is between');
+ assert.equal(m.isBetween(
+ moment(new Date(2009, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)), null, '[)'), false, 'start is included and end is excluded, is not between');
+ assert.equal(m.isBetween(
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)), null, '[)'), false, 'start is included and end is excluded, should fail on same end and start date');
+
+ assert.equal(m.isBetween(
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2012, 3, 2, 3, 4, 5, 10)), null, '[]'), true, 'start and end inclusive should succeed on same start date');
+ assert.equal(m.isBetween(
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)), null, '[]'), true, 'start and end inclusive should succeed on same end date');
+ assert.equal(m.isBetween(
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2012, 3, 2, 3, 4, 5, 10)), null, '[]'), true, 'start and end inclusive, is between');
+ assert.equal(m.isBetween(
+ moment(new Date(2009, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)), null, '[]'), false, 'start and end inclusive, is not between');
+ assert.equal(m.isBetween(
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)), null, '[]'), true, 'start and end inclusive, should handle same end and start date');
+ });
+
+ test('is between milliseconds inclusivity', function (assert) {
+ var m = moment(new Date(2011, 3, 2, 3, 4, 5, 10)), mCopy = moment(m);
+ assert.equal(m.isBetween(
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'milliseconds'), true, 'options, no inclusive');
+ assert.equal(m.isBetween(
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'milliseconds', '()'), false, 'start and end are excluded, start is equal to moment');
+ assert.equal(m.isBetween(
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'milliseconds', '()'), false, 'start and end are excluded, end is equal to moment');
+ assert.equal(m.isBetween(
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'milliseconds', '()'), true, 'start and end are excluded, is between');
+ assert.equal(m.isBetween(
+ moment(new Date(2009, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)), 'milliseconds', '()'), false, 'start and end are excluded, is not between');
+ assert.equal(m.isBetween(
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'milliseconds', '()'), false, 'start and end are excluded, should fail on same start/end date.');
+
+ assert.equal(m.isBetween(
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'milliseconds', '(]'), false, 'start is excluded and end is included should fail on same start date');
+ assert.equal(m.isBetween(
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'milliseconds', '(]'), true, 'start is excluded and end is included should succeed on end date');
+ assert.equal(m.isBetween(
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'milliseconds', '(]'), true, 'start is excluded and end is included, is between');
+ assert.equal(m.isBetween(
+ moment(new Date(2009, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)), 'milliseconds', '(]'), false, 'start is excluded and end is included, is not between');
+ assert.equal(m.isBetween(
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'milliseconds', '(]'), false, 'start is excluded and end is included, should fail on same start/end date.');
+
+ assert.equal(m.isBetween(
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'milliseconds', '[)'), true, 'start is included and end is excluded should succeed on same start date');
+ assert.equal(m.isBetween(
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'milliseconds', '[)'), false, 'start is included and end is excluded should fail on same end date');
+ assert.equal(m.isBetween(
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'milliseconds', '[)'), true, 'start is included and end is excluded, is between');
+ assert.equal(m.isBetween(
+ moment(new Date(2009, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)), 'milliseconds', '[)'), false, 'start is included and end is excluded, is not between');
+ assert.equal(m.isBetween(
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'milliseconds', '[)'), false, 'start is included and end is excluded, should fail on same end and start date');
+
+ assert.equal(m.isBetween(
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'milliseconds', '[]'), true, 'start and end inclusive should succeed on same start date');
+ assert.equal(m.isBetween(
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'milliseconds', '[]'), true, 'start and end inclusive should succeed on same end date');
+ assert.equal(m.isBetween(
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'milliseconds', '[]'), true, 'start and end inclusive, is between');
+ assert.equal(m.isBetween(
+ moment(new Date(2009, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2010, 3, 2, 3, 4, 5, 10)), 'milliseconds', '[]'), false, 'start and end inclusive, is not between');
+ assert.equal(m.isBetween(
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)),
+ moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'milliseconds', '[]'), true, 'start and end inclusive, should handle same end and start date');
+ });
+
test('is between year', function (assert) {
var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m);
assert.equal(m.isBetween(
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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 :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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;
+
+ var expect = QUnit.expect;
+
+ function module (name, lifecycle) {
+ QUnit.module(name, {
+ setup : function () {
+ moment.locale('en');
+ moment.createFromInputFallback = function (config) {
+ throw new Error('input not handled by moment: ' + config._i);
+ };
+ setupDeprecationHandler(test, moment, 'core');
+ if (lifecycle && lifecycle.setup) {
+ lifecycle.setup();
+ }
+ },
+ teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
+ if (lifecycle && lifecycle.teardown) {
+ lifecycle.teardown();
+ }
+ }
+ });
+ }
+
+ function localeModule (name, lifecycle) {
+ QUnit.module('locale:' + name, {
+ setup : 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();
+ }
+ },
+ teardown : function () {
+ moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
+ if (lifecycle && lifecycle.teardown) {
+ lifecycle.teardown();
+ }
+ }
+ });
+ defineCommonLocaleTests(name, -1, -1);
+ }
+
+ module('listers');
+
+ test('default', function (assert) {
+ assert.deepEqual(moment.months(), ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);
+ assert.deepEqual(moment.monthsShort(), ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
+ assert.deepEqual(moment.weekdays(), ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']);
+ assert.deepEqual(moment.weekdaysShort(), ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']);
+ assert.deepEqual(moment.weekdaysMin(), ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']);
+ });
+
+ test('index', function (assert) {
+ assert.equal(moment.months(0), 'January');
+ assert.equal(moment.months(2), 'March');
+ assert.equal(moment.monthsShort(0), 'Jan');
+ assert.equal(moment.monthsShort(2), 'Mar');
+ assert.equal(moment.weekdays(0), 'Sunday');
+ assert.equal(moment.weekdays(2), 'Tuesday');
+ assert.equal(moment.weekdaysShort(0), 'Sun');
+ assert.equal(moment.weekdaysShort(2), 'Tue');
+ assert.equal(moment.weekdaysMin(0), 'Su');
+ assert.equal(moment.weekdaysMin(2), 'Tu');
+ });
+
+ test('localized', function (assert) {
+ var months = 'one_two_three_four_five_six_seven_eight_nine_ten_eleven_twelve'.split('_'),
+ monthsShort = 'on_tw_th_fo_fi_si_se_ei_ni_te_el_tw'.split('_'),
+ weekdays = 'one_two_three_four_five_six_seven'.split('_'),
+ weekdaysShort = 'on_tw_th_fo_fi_si_se'.split('_'),
+ weekdaysMin = '1_2_3_4_5_6_7'.split('_'),
+ weekdaysLocale = 'four_five_six_seven_one_two_three'.split('_'),
+ weekdaysShortLocale = 'fo_fi_si_se_on_tw_th'.split('_'),
+ weekdaysMinLocale = '4_5_6_7_1_2_3'.split('_'),
+ week = {
+ dow : 3,
+ doy : 6
+ };
+
+ moment.locale('numerologists', {
+ months : months,
+ monthsShort : monthsShort,
+ weekdays : weekdays,
+ weekdaysShort: weekdaysShort,
+ weekdaysMin: weekdaysMin,
+ week : week
+ });
+
+ assert.deepEqual(moment.months(), months);
+ assert.deepEqual(moment.monthsShort(), monthsShort);
+ assert.deepEqual(moment.weekdays(), weekdays);
+ assert.deepEqual(moment.weekdaysShort(), weekdaysShort);
+ assert.deepEqual(moment.weekdaysMin(), weekdaysMin);
+
+ assert.equal(moment.months(0), 'one');
+ assert.equal(moment.monthsShort(0), 'on');
+ assert.equal(moment.weekdays(0), 'one');
+ assert.equal(moment.weekdaysShort(0), 'on');
+ assert.equal(moment.weekdaysMin(0), '1');
+
+ assert.equal(moment.months(2), 'three');
+ assert.equal(moment.monthsShort(2), 'th');
+ assert.equal(moment.weekdays(2), 'three');
+ assert.equal(moment.weekdaysShort(2), 'th');
+ assert.equal(moment.weekdaysMin(2), '3');
+
+ assert.deepEqual(moment.weekdays(true), weekdaysLocale);
+ assert.deepEqual(moment.weekdaysShort(true), weekdaysShortLocale);
+ assert.deepEqual(moment.weekdaysMin(true), weekdaysMinLocale);
+
+ assert.equal(moment.weekdays(true, 0), 'four');
+ assert.equal(moment.weekdaysShort(true, 0), 'fo');
+ assert.equal(moment.weekdaysMin(true, 0), '4');
+
+ assert.equal(moment.weekdays(false, 2), 'three');
+ assert.equal(moment.weekdaysShort(false, 2), 'th');
+ assert.equal(moment.weekdaysMin(false, 2), '3');
+ });
+
+ test('with functions', function (assert) {
+ var monthsShort = 'one_two_three_four_five_six_seven_eight_nine_ten_eleven_twelve'.split('_'),
+ monthsShortWeird = 'onesy_twosy_threesy_foursy_fivesy_sixsy_sevensy_eightsy_ninesy_tensy_elevensy_twelvesy'.split('_');
+
+ moment.locale('difficult', {
+
+ monthsShort: function (m, format) {
+ var arr = format.match(/-MMM-/) ? monthsShortWeird : monthsShort;
+ return arr[m.month()];
+ }
+ });
+
+ assert.deepEqual(moment.monthsShort(), monthsShort);
+ assert.deepEqual(moment.monthsShort('MMM'), monthsShort);
+ assert.deepEqual(moment.monthsShort('-MMM-'), monthsShortWeird);
+
+ assert.deepEqual(moment.monthsShort('MMM', 2), 'three');
+ assert.deepEqual(moment.monthsShort('-MMM-', 2), 'threesy');
+ assert.deepEqual(moment.monthsShort(2), 'three');
+ });
+
+}));
+
+;(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 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 defaults(a, b, c) {
+ if (a != null) {
+ return a;
+ }
+ if (b != null) {
+ return b;
+ }
+ return c;
+ }
+
+ function defineCommonLocaleTests(locale, options) {
+ test('lenient 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 ordinal parsing ' + i + ' year check');
+ assert.equal(testMoment.month(), 0,
+ 'lenient ordinal parsing ' + i + ' month check');
+ assert.equal(testMoment.date(), i,
+ 'lenient ordinal parsing ' + i + ' date check');
+ }
+ });
+
+ test('lenient 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 ordinal parsing of number ' + i + ' year check');
+ assert.equal(testMoment.month(), 0,
+ 'lenient ordinal parsing of number ' + i + ' month check');
+ assert.equal(testMoment.date(), i,
+ 'lenient ordinal parsing of number ' + i + ' date check');
+ }
+ });
+
+ test('strict 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 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'));
}
});
});
});
- }
- /*global QUnit:false*/
+ test('month parsing correctness', function (assert) {
+ var i, m;
- var test = QUnit.test;
-
- var expect = QUnit.expect;
-
- function module (name, lifecycle) {
- QUnit.module(name, {
- setup : function () {
- moment.locale('en');
- moment.createFromInputFallback = function (config) {
- throw new Error('input not handled by moment: ' + config._i);
- };
- if (lifecycle && lifecycle.setup) {
- lifecycle.setup();
- }
- },
- teardown : function () {
- if (lifecycle && lifecycle.teardown) {
- lifecycle.teardown();
- }
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
}
- });
- }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
- function localeModule (name, lifecycle) {
- QUnit.module('locale:' + name, {
- setup : function () {
- moment.locale(name);
- moment.createFromInputFallback = function (config) {
- throw new Error('input not handled by moment: ' + config._i);
- };
- if (lifecycle && lifecycle.setup) {
- lifecycle.setup();
- }
- },
- teardown : function () {
- moment.locale('en');
- if (lifecycle && lifecycle.teardown) {
- lifecycle.teardown();
- }
+ r = moment(m.format(format), format, true);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict');
+ 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');
}
- });
- defineCommonLocaleTests(name, -1, -1);
- }
-
- module('listers');
-
- test('default', function (assert) {
- assert.deepEqual(moment.months(), ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);
- assert.deepEqual(moment.monthsShort(), ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
- assert.deepEqual(moment.weekdays(), ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']);
- assert.deepEqual(moment.weekdaysShort(), ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']);
- assert.deepEqual(moment.weekdaysMin(), ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']);
- });
-
- test('index', function (assert) {
- assert.equal(moment.months(0), 'January');
- assert.equal(moment.months(2), 'March');
- assert.equal(moment.monthsShort(0), 'Jan');
- assert.equal(moment.monthsShort(2), 'Mar');
- assert.equal(moment.weekdays(0), 'Sunday');
- assert.equal(moment.weekdays(2), 'Tuesday');
- assert.equal(moment.weekdaysShort(0), 'Sun');
- assert.equal(moment.weekdaysShort(2), 'Tue');
- assert.equal(moment.weekdaysMin(0), 'Su');
- assert.equal(moment.weekdaysMin(2), 'Tu');
- });
- test('localized', function (assert) {
- var months = 'one_two_three_four_five_six_seven_eight_nine_ten_eleven_twelve'.split('_'),
- monthsShort = 'on_tw_th_fo_fi_si_se_ei_ni_te_el_tw'.split('_'),
- weekdays = 'one_two_three_four_five_six_seven'.split('_'),
- weekdaysShort = 'on_tw_th_fo_fi_si_se'.split('_'),
- weekdaysMin = '1_2_3_4_5_6_7'.split('_');
-
- moment.locale('numerologists', {
- months : months,
- monthsShort : monthsShort,
- weekdays : weekdays,
- weekdaysShort: weekdaysShort,
- weekdaysMin: weekdaysMin
+ for (i = 0; i < 12; ++i) {
+ m = moment([2015, i, 15, 18]);
+ tester('MMM');
+ tester('MMM.');
+ tester('MMMM');
+ tester('MMMM.');
+ }
});
- assert.deepEqual(moment.months(), months);
- assert.deepEqual(moment.monthsShort(), monthsShort);
- assert.deepEqual(moment.weekdays(), weekdays);
- assert.deepEqual(moment.weekdaysShort(), weekdaysShort);
- assert.deepEqual(moment.weekdaysMin(), weekdaysMin);
-
- assert.equal(moment.months(0), 'one');
- assert.equal(moment.monthsShort(0), 'on');
- assert.equal(moment.weekdays(0), 'one');
- assert.equal(moment.weekdaysShort(0), 'on');
- assert.equal(moment.weekdaysMin(0), '1');
-
- assert.equal(moment.months(2), 'three');
- assert.equal(moment.monthsShort(2), 'th');
- assert.equal(moment.weekdays(2), 'three');
- assert.equal(moment.weekdaysShort(2), 'th');
- assert.equal(moment.weekdaysMin(2), '3');
- });
+ test('weekday parsing correctness', function (assert) {
+ var i, m;
- test('with functions', function (assert) {
- var monthsShort = 'one_two_three_four_five_six_seven_eight_nine_ten_eleven_twelve'.split('_'),
- monthsShortWeird = 'onesy_twosy_threesy_foursy_fivesy_sixsy_sevensy_eightsy_ninesy_tensy_elevensy_twelvesy'.split('_');
+ if (locale === 'tr' || locale === 'az') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
- moment.locale('difficult', {
+ r = moment(m.format(format), format, true);
+ assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict');
+ 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');
+ }
- monthsShort: function (m, format) {
- var arr = format.match(/-MMM-/) ? monthsShortWeird : monthsShort;
- return arr[m.month()];
+ for (i = 0; i < 7; ++i) {
+ m = moment.utc([2015, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
}
});
+ }
- assert.deepEqual(moment.monthsShort(), monthsShort);
- assert.deepEqual(moment.monthsShort('MMM'), monthsShort);
- assert.deepEqual(moment.monthsShort('-MMM-'), monthsShortWeird);
-
- assert.deepEqual(moment.monthsShort('MMM', 2), 'three');
- assert.deepEqual(moment.monthsShort('-MMM-', 2), 'threesy');
- assert.deepEqual(moment.monthsShort(2), 'three');
- });
-
-}));
-
-;(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, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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 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);
+ function teardownDeprecationHandler(test, moment, scope) {
+ moment.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(' '));
}
- return res;
}
}
- // Pick the first defined of two or three arguments.
- function defaults(a, b, c) {
- if (a != null) {
- return a;
- }
- if (b != null) {
- return b;
+ function matchedDeprecation(name, msg, deprecations) {
+ if (deprecations == null) {
+ return -1;
}
- return c;
- }
-
- function defineCommonLocaleTests(locale, options) {
- test('lenient 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 ordinal parsing ' + i + ' year check');
- assert.equal(testMoment.month(), 0,
- 'lenient ordinal parsing ' + i + ' month check');
- assert.equal(testMoment.date(), i,
- 'lenient ordinal parsing ' + i + ' date check');
- }
- });
-
- test('lenient 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 ordinal parsing of number ' + i + ' year check');
- assert.equal(testMoment.month(), 0,
- 'lenient ordinal parsing of number ' + i + ' month check');
- assert.equal(testMoment.date(), i,
- 'lenient ordinal parsing of number ' + i + ' date check');
+ for (var i = 0; i < deprecations.length; ++i) {
+ if (name != null && name === deprecations[i]) {
+ return i;
}
- });
-
- test('strict 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 ordinal parsing ' + i);
+ if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) {
+ return 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(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);
- });
- });
- });
+ }
+ return -1;
}
/*global QUnit:false*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
defineCommonLocaleTests(name, -1, -1);
}
+ var indexOf;
+
+ if (Array.prototype.indexOf) {
+ indexOf = Array.prototype.indexOf;
+ } else {
+ indexOf = function (o) {
+ // I know
+ var i;
+ for (i = 0; i < this.length; ++i) {
+ if (this[i] === o) {
+ return i;
+ }
+ }
+ return -1;
+ };
+ }
+
module('locale', {
setup : function () {
// TODO: Remove once locales are switched to ES6
});
test('library deprecations', function (assert) {
+ test.expectedDeprecations('moment.lang');
moment.lang('dude', {months: ['Movember']});
assert.equal(moment.locale(), 'dude', 'setting the lang sets the locale');
assert.equal(moment.lang(), moment.locale());
assert.equal(moment.langData(), moment.localeData(), 'langData is localeData');
+ moment.defineLocale('dude', null);
});
test('defineLocale', function (assert) {
moment.defineLocale('dude', {months: ['Movember']});
assert.equal(moment().locale(), 'dude', 'defineLocale also sets it');
assert.equal(moment().locale('dude').locale(), 'dude', 'defineLocale defines a locale');
+ moment.defineLocale('dude', null);
});
test('locales', function (assert) {
moment.defineLocale('dude', {months: ['Movember']});
- assert.equal(true, !!~moment.locales().indexOf('dude'), 'locales returns an array of defined locales');
- assert.equal(true, !!~moment.locales().indexOf('en'), 'locales should always include english');
+ assert.equal(true, !!~indexOf.call(moment.locales(), 'dude'), 'locales returns an array of defined locales');
+ assert.equal(true, !!~indexOf.call(moment.locales(), 'en'), 'locales should always include english');
+ moment.defineLocale('dude', null);
});
test('library convenience', function (assert) {
moment.locale('something', {week: {dow: 3}});
moment.locale('something');
assert.equal(moment.locale(), 'something', 'locale can be used to create the locale too');
+ moment.defineLocale('something', null);
});
test('firstDayOfWeek firstDayOfYear locale getters', function (assert) {
moment.locale('something');
assert.equal(moment.localeData().firstDayOfWeek(), 3, 'firstDayOfWeek');
assert.equal(moment.localeData().firstDayOfYear(), 4, 'firstDayOfYear');
+ moment.defineLocale('something', null);
});
test('instance locale method', function (assert) {
});
test('duration deprecations', function (assert) {
+ test.expectedDeprecations('moment().lang()');
assert.equal(moment.duration().lang(), moment.duration().localeData(), 'duration.lang is the same as duration.localeData');
});
test('instance localeData', function (assert) {
moment.defineLocale('dude', {week: {dow: 3}});
assert.equal(moment().locale('dude').localeData()._week.dow, 3);
+ moment.defineLocale('dude', null);
});
test('month name callback function', function (assert) {
});
test('changing parts of a locale config', function (assert) {
+ test.expectedDeprecations('defineLocaleOverride');
+
moment.locale('partial-lang', {
months : 'a b c d e f g h i j k l'.split(' ')
});
});
assert.equal(moment([2011, 0, 1]).format('MMMM MMM'), 'a A', 'should be able to set locale values after creating the localeuage');
+
+ moment.defineLocale('partial-lang', null);
});
test('start/endOf week feature for first-day-is-monday locales', function (assert) {
moment.locale('monday-lang');
assert.equal(moment([2013, 0, 1]).startOf('week').day(), 1, 'for locale monday-lang first day of the week should be monday');
assert.equal(moment([2013, 0, 1]).endOf('week').day(), 0, 'for locale monday-lang last day of the week should be sunday');
+ moment.defineLocale('monday-lang', null);
});
test('meridiem parsing', function (assert) {
moment.locale('meridiem-parsing');
assert.equal(moment('2012-01-01 3b', 'YYYY-MM-DD ha').hour(), 15, 'Custom parsing of meridiem should work');
assert.equal(moment('2012-01-01 3d', 'YYYY-MM-DD ha').hour(), 3, 'Custom parsing of meridiem should work');
+ moment.defineLocale('meridiem-parsing', null);
});
test('invalid date formatting', function (assert) {
assert.equal(moment.invalid().format(), 'KHAAAAAAAAAAAN!');
assert.equal(moment.invalid().format('YYYY-MM-DD'), 'KHAAAAAAAAAAAN!');
+ moment.defineLocale('has-invalid', null);
});
test('return locale name', function (assert) {
var registered = moment.locale('return-this', {});
assert.equal(registered, 'return-this', 'returns the locale configured');
+ moment.locale('return-this', null);
});
test('changing the global locale doesn\'t affect existing instances', function (assert) {
});
test('setting a language on instance returns the original moment for chaining', function (assert) {
+ test.expectedDeprecations('moment().lang()');
var mom = moment();
assert.equal(mom.lang('fr'), mom, 'setting the language (lang) returns the original moment for chaining');
});
test('lang(key) changes the language of the instance', function (assert) {
+ test.expectedDeprecations('moment().lang()');
var m = moment().month(0);
m.lang('fr');
assert.equal(m.locale(), 'fr', 'm.lang(key) changes instance locale');
});
test('moment().lang with missing key doesn\'t change locale', function (assert) {
+ test.expectedDeprecations('moment().lang()');
assert.equal(moment().lang('boo').localeData(), moment.localeData(),
'preserve global locale in case of bad locale id');
});
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.defineLocale('ordinal-2', {
ordinal : '%dx'
});
- moment.defineLocale('ordinal-2', {
- parentLocale: 'ordinal-2',
+ moment.updateLocale('ordinal-2', {
ordinal : function (num) {
return num + 'y';
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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 :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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;
+
+ var expect = QUnit.expect;
+
+ function module (name, lifecycle) {
+ QUnit.module(name, {
+ setup : function () {
+ moment.locale('en');
+ moment.createFromInputFallback = function (config) {
+ throw new Error('input not handled by moment: ' + config._i);
+ };
+ setupDeprecationHandler(test, moment, 'core');
+ if (lifecycle && lifecycle.setup) {
+ lifecycle.setup();
+ }
+ },
+ teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
+ if (lifecycle && lifecycle.teardown) {
+ lifecycle.teardown();
+ }
+ }
+ });
+ }
+
+ function localeModule (name, lifecycle) {
+ QUnit.module('locale:' + name, {
+ setup : 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();
+ }
+ },
+ teardown : function () {
+ moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
+ if (lifecycle && lifecycle.teardown) {
+ lifecycle.teardown();
+ }
+ }
+ });
+ defineCommonLocaleTests(name, -1, -1);
+ }
+
+ module('mutable');
+
+ test('manipulation methods', function (assert) {
+ var m = moment();
+
+ assert.equal(m, m.year(2011), 'year() should be mutable');
+ assert.equal(m, m.month(1), 'month() should be mutable');
+ assert.equal(m, m.hours(7), 'hours() should be mutable');
+ assert.equal(m, m.minutes(33), 'minutes() should be mutable');
+ assert.equal(m, m.seconds(44), 'seconds() should be mutable');
+ assert.equal(m, m.milliseconds(55), 'milliseconds() should be mutable');
+ assert.equal(m, m.day(2), 'day() should be mutable');
+ assert.equal(m, m.startOf('week'), 'startOf() should be mutable');
+ assert.equal(m, m.add(1, 'days'), 'add() should be mutable');
+ assert.equal(m, m.subtract(2, 'years'), 'subtract() should be mutable');
+ assert.equal(m, m.local(), 'local() should be mutable');
+ assert.equal(m, m.utc(), 'utc() should be mutable');
+ });
+
+ test('non mutable methods', function (assert) {
+ var m = moment();
+ assert.notEqual(m, m.clone(), 'clone() should not be mutable');
+ });
+
+}));
+
+;(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 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 defaults(a, b, c) {
+ if (a != null) {
+ return a;
+ }
+ if (b != null) {
+ return b;
+ }
+ return c;
+ }
+
+ function defineCommonLocaleTests(locale, options) {
+ test('lenient 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 ordinal parsing ' + i + ' year check');
+ assert.equal(testMoment.month(), 0,
+ 'lenient ordinal parsing ' + i + ' month check');
+ assert.equal(testMoment.date(), i,
+ 'lenient ordinal parsing ' + i + ' date check');
+ }
+ });
+
+ test('lenient 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 ordinal parsing of number ' + i + ' year check');
+ assert.equal(testMoment.month(), 0,
+ 'lenient ordinal parsing of number ' + i + ' month check');
+ assert.equal(testMoment.date(), i,
+ 'lenient ordinal parsing of number ' + i + ' date check');
+ }
+ });
+
+ test('strict 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 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'));
}
});
});
});
- }
- /*global QUnit:false*/
+ test('month parsing correctness', function (assert) {
+ var i, m;
- var test = QUnit.test;
-
- var expect = QUnit.expect;
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
- function module (name, lifecycle) {
- QUnit.module(name, {
- setup : function () {
- moment.locale('en');
- moment.createFromInputFallback = function (config) {
- throw new Error('input not handled by moment: ' + config._i);
- };
- if (lifecycle && lifecycle.setup) {
- lifecycle.setup();
- }
- },
- teardown : function () {
- if (lifecycle && lifecycle.teardown) {
- lifecycle.teardown();
- }
+ r = moment(m.format(format), format, true);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict');
+ 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');
}
- });
- }
- function localeModule (name, lifecycle) {
- QUnit.module('locale:' + name, {
- setup : function () {
- moment.locale(name);
- moment.createFromInputFallback = function (config) {
- throw new Error('input not handled by moment: ' + config._i);
- };
- if (lifecycle && lifecycle.setup) {
- lifecycle.setup();
- }
- },
- teardown : function () {
- moment.locale('en');
- if (lifecycle && lifecycle.teardown) {
- lifecycle.teardown();
- }
+ for (i = 0; i < 12; ++i) {
+ m = moment([2015, i, 15, 18]);
+ tester('MMM');
+ tester('MMM.');
+ tester('MMMM');
+ tester('MMMM.');
}
});
- defineCommonLocaleTests(name, -1, -1);
- }
-
- module('mutable');
- test('manipulation methods', function (assert) {
- var m = moment();
-
- assert.equal(m, m.year(2011), 'year() should be mutable');
- assert.equal(m, m.month(1), 'month() should be mutable');
- assert.equal(m, m.hours(7), 'hours() should be mutable');
- assert.equal(m, m.minutes(33), 'minutes() should be mutable');
- assert.equal(m, m.seconds(44), 'seconds() should be mutable');
- assert.equal(m, m.milliseconds(55), 'milliseconds() should be mutable');
- assert.equal(m, m.day(2), 'day() should be mutable');
- assert.equal(m, m.startOf('week'), 'startOf() should be mutable');
- assert.equal(m, m.add(1, 'days'), 'add() should be mutable');
- assert.equal(m, m.subtract(2, 'years'), 'subtract() should be mutable');
- assert.equal(m, m.local(), 'local() should be mutable');
- assert.equal(m, m.utc(), 'utc() should be mutable');
- });
+ test('weekday parsing correctness', function (assert) {
+ var i, m;
- test('non mutable methods', function (assert) {
- var m = moment();
- assert.notEqual(m, m.clone(), 'clone() should not be mutable');
- });
+ if (locale === 'tr' || locale === 'az') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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');
+ }
-;(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';
+ for (i = 0; i < 7; ++i) {
+ m = moment.utc([2015, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
- function each(array, callback) {
- var i;
- for (i = 0; i < array.length; i++) {
- callback(array[i], i, array);
- }
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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 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);
+ function teardownDeprecationHandler(test, moment, scope) {
+ moment.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(' '));
}
- return res;
}
}
- // Pick the first defined of two or three arguments.
- function defaults(a, b, c) {
- if (a != null) {
- return a;
- }
- if (b != null) {
- return b;
+ function matchedDeprecation(name, msg, deprecations) {
+ if (deprecations == null) {
+ return -1;
}
- return c;
- }
-
- function defineCommonLocaleTests(locale, options) {
- test('lenient 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 ordinal parsing ' + i + ' year check');
- assert.equal(testMoment.month(), 0,
- 'lenient ordinal parsing ' + i + ' month check');
- assert.equal(testMoment.date(), i,
- 'lenient ordinal parsing ' + i + ' date check');
+ for (var i = 0; i < deprecations.length; ++i) {
+ if (name != null && name === deprecations[i]) {
+ return i;
}
- });
-
- test('lenient 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 ordinal parsing of number ' + i + ' year check');
- assert.equal(testMoment.month(), 0,
- 'lenient ordinal parsing of number ' + i + ' month check');
- assert.equal(testMoment.date(), i,
- 'lenient ordinal parsing of number ' + i + ' date check');
+ if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) {
+ return i;
}
- });
-
- test('strict 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 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(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);
- });
- });
- });
+ }
+ return -1;
}
/*global QUnit:false*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
});
}
});
+ },
+ teardown: function () {
+ moment.defineLocale('symbol', null);
}
});
});
test('calendar day', function (assert) {
- var a = moment().hours(2).minutes(0).seconds(0);
+ var a = moment().hours(12).minutes(0).seconds(0);
- assert.equal(moment(a).calendar(), 'Today at @:)) AM', 'today at the same time');
- assert.equal(moment(a).add({m: 25}).calendar(), 'Today at @:@% AM', 'Now plus 25 min');
- assert.equal(moment(a).add({h: 1}).calendar(), 'Today at #:)) AM', 'Now plus 1 hour');
- assert.equal(moment(a).add({d: 1}).calendar(), 'Tomorrow at @:)) AM', 'tomorrow at the same time');
- assert.equal(moment(a).subtract({h: 1}).calendar(), 'Today at !:)) AM', 'Now minus 1 hour');
- assert.equal(moment(a).subtract({d: 1}).calendar(), 'Yesterday at @:)) AM', 'yesterday at the same time');
+ assert.equal(moment(a).calendar(), 'Today at !@:)) PM', 'today at the same time');
+ assert.equal(moment(a).add({m: 25}).calendar(), 'Today at !@:@% PM', 'Now plus 25 min');
+ assert.equal(moment(a).add({h: 1}).calendar(), 'Today at !:)) PM', 'Now plus 1 hour');
+ assert.equal(moment(a).add({d: 1}).calendar(), 'Tomorrow at !@:)) PM', 'tomorrow at the same time');
+ assert.equal(moment(a).subtract({h: 1}).calendar(), 'Today at !!:)) AM', 'Now minus 1 hour');
+ assert.equal(moment(a).subtract({d: 1}).calendar(), 'Yesterday at !@:)) PM', 'yesterday at the same time');
});
}));
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
assert.equal(m.milliseconds(), 999, 'set the seconds');
});
+ test('start of date', function (assert) {
+ var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('date'),
+ ms = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('dates');
+
+ assert.equal(+m, +ms, 'Plural or singular should work');
+ assert.equal(m.year(), 2011, 'keep the year');
+ assert.equal(m.month(), 1, 'keep the month');
+ assert.equal(m.date(), 2, 'keep the day');
+ assert.equal(m.hours(), 0, 'strip out the hours');
+ assert.equal(m.minutes(), 0, 'strip out the minutes');
+ assert.equal(m.seconds(), 0, 'strip out the seconds');
+ assert.equal(m.milliseconds(), 0, 'strip out the milliseconds');
+ });
+
+ test('end of date', function (assert) {
+ var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('date'),
+ ms = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('dates');
+
+ assert.equal(+m, +ms, 'Plural or singular should work');
+ assert.equal(m.year(), 2011, 'keep the year');
+ assert.equal(m.month(), 1, 'keep the month');
+ assert.equal(m.date(), 2, 'keep the day');
+ assert.equal(m.hours(), 23, 'set the hours');
+ assert.equal(m.minutes(), 59, 'set the minutes');
+ assert.equal(m.seconds(), 59, 'set the seconds');
+ assert.equal(m.milliseconds(), 999, 'set the seconds');
+ });
+
+
test('start of hour', function (assert) {
var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('hour'),
ms = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('hours'),
}
};
+ m = moment('2014-03-15T00:00:00-07:00').parseZone();
+ m.startOf('y');
+ assert.equal(m.format(), '2014-01-01T00:00:00-08:00', 'startOf(\'year\') across +1');
+
m = moment('2014-03-15T00:00:00-07:00').parseZone();
m.startOf('M');
assert.equal(m.format(), '2014-03-01T00:00:00-08:00', 'startOf(\'month\') across +1');
}
};
+ m = moment('2014-11-15T00:00:00-08:00').parseZone();
+ m.startOf('y');
+ assert.equal(m.format(), '2014-01-01T00:00:00-07:00', 'startOf(\'year\') across -1');
+
m = moment('2014-11-15T00:00:00-08:00').parseZone();
m.startOf('M');
assert.equal(m.format(), '2014-11-01T00:00:00-07:00', 'startOf(\'month\') across -1');
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
// local
m.local();
- if (m.zone() > 180) {
+ if (m.utcOffset() < -180) {
assert.equal(m.date(), 1, 'the date should be correct for local');
assert.equal(m.day(), 2, 'the day should be correct for local');
} else {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
assert.equal(moment().utcOffset(-120).format('ZZ'), '-0200', '+120 -> -0200');
});
- test('local to utc, keepLocalTime = true', function (assert) {
- var m = moment(),
- fmt = 'YYYY-DD-MM HH:mm:ss';
- assert.equal(m.clone().utc(true).format(fmt), m.format(fmt), 'local to utc failed to keep local time');
- });
-
- test('local to utc, keepLocalTime = false', function (assert) {
- var m = moment();
- assert.equal(m.clone().utc().valueOf(), m.valueOf(), 'local to utc failed to keep utc time (implicit)');
- assert.equal(m.clone().utc(false).valueOf(), m.valueOf(), 'local to utc failed to keep utc time (explicit)');
- });
-
- test('local to zone, keepLocalTime = true', function (assert) {
- var m = moment(),
- fmt = 'YYYY-DD-MM HH:mm:ss',
- z;
-
- // Apparently there is -12:00 and +14:00
- // http://en.wikipedia.org/wiki/UTC+14:00
- // http://en.wikipedia.org/wiki/UTC-12:00
- for (z = -12; z <= 14; ++z) {
- assert.equal(m.clone().utcOffset(z * 60, true).format(fmt),
- m.format(fmt),
- 'local to utcOffset(' + z + ':00) failed to keep local time');
- }
- });
-
- test('local to zone, keepLocalTime = false', function (assert) {
- var m = moment(),
- z;
-
- // Apparently there is -12:00 and +14:00
- // http://en.wikipedia.org/wiki/UTC+14:00
- // http://en.wikipedia.org/wiki/UTC-12:00
- for (z = -12; z <= 14; ++z) {
- assert.equal(m.clone().utcOffset(z * 60).valueOf(),
- m.valueOf(),
- 'local to utcOffset(' + z + ':00) failed to keep utc time (implicit)');
- assert.equal(m.clone().utcOffset(z * 60, false).valueOf(),
- m.valueOf(),
- 'local to utcOffset(' + z + ':00) failed to keep utc time (explicit)');
- }
- });
-
- test('utc to local, keepLocalTime = true', function (assert) {
- var um = moment.utc(),
- fmt = 'YYYY-DD-MM HH:mm:ss';
-
- assert.equal(um.clone().local(true).format(fmt), um.format(fmt), 'utc to local failed to keep local time');
- });
-
- test('utc to local, keepLocalTime = false', function (assert) {
- var um = moment.utc();
- assert.equal(um.clone().local().valueOf(), um.valueOf(), 'utc to local failed to keep utc time (implicit)');
- assert.equal(um.clone().local(false).valueOf(), um.valueOf(), 'utc to local failed to keep utc time (explicit)');
- });
-
- test('zone to local, keepLocalTime = true', function (assert) {
- var m = moment(),
- fmt = 'YYYY-DD-MM HH:mm:ss',
- z;
-
- // Apparently there is -12:00 and +14:00
- // http://en.wikipedia.org/wiki/UTC+14:00
- // http://en.wikipedia.org/wiki/UTC-12:00
- for (z = -12; z <= 14; ++z) {
- m.utcOffset(z * 60);
-
- assert.equal(m.clone().local(true).format(fmt),
- m.format(fmt),
- 'utcOffset(' + z + ':00) to local failed to keep local time');
- }
- });
-
- test('zone to local, keepLocalTime = false', function (assert) {
- var m = moment(),
- z;
-
- // Apparently there is -12:00 and +14:00
- // http://en.wikipedia.org/wiki/UTC+14:00
- // http://en.wikipedia.org/wiki/UTC-12:00
- for (z = -12; z <= 14; ++z) {
- m.utcOffset(z * 60);
-
- assert.equal(m.clone().local(false).valueOf(), m.valueOf(),
- 'utcOffset(' + z + ':00) to local failed to keep utc time (explicit)');
- assert.equal(m.clone().local().valueOf(), m.valueOf(),
- 'utcOffset(' + z + ':00) to local failed to keep utc time (implicit)');
- }
- });
-
}));
;(function (global, factory) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
// Verifies that the week number, week day computation is correct for all dow, doy combinations
test('week year roundtrip', function (assert) {
- var dow, doy, wd, m;
+ var dow, doy, wd, m, localeName;
for (dow = 0; dow < 7; ++dow) {
for (doy = dow; doy < dow + 7; ++doy) {
for (wd = 0; wd < 7; ++wd) {
- moment.locale('dow: ' + dow + ', doy: ' + doy, {week: {dow: dow, doy: doy}});
+ localeName = 'dow: ' + dow + ', doy: ' + doy;
+ moment.locale(localeName, {week: {dow: dow, doy: doy}});
// We use the 10th week as the 1st one can spill to the previous year
m = moment('2015 10 ' + wd, 'gggg w d', true);
assert.equal(m.format('gggg w d'), '2015 10 ' + wd, 'dow: ' + dow + ' doy: ' + doy + ' wd: ' + wd);
m = moment('2015 10 ' + wd, 'gggg w e', true);
assert.equal(m.format('gggg w e'), '2015 10 ' + wd, 'dow: ' + dow + ' doy: ' + doy + ' wd: ' + wd);
+ moment.defineLocale(localeName, null);
}
}
}
assert.equal(2, moment('2013-01-11', 'YYYY-MM-DD').week(), '2013-01-11 is week 2'); // 53 -- should be 2
assert.equal(3, moment('2013-01-12', 'YYYY-MM-DD').week(), '2013-01-12 is week 3'); // 1 -- should be 3
assert.equal(52, moment('2012-01-01', 'YYYY-MM-DD').weeksInYear(), 'weeks in 2012 are 52'); // 52
+ moment.defineLocale('dow: 6, doy: 12', null);
});
test('weeks numbers dow:1 doy:4', function (assert) {
assert.equal(moment([2011, 0, 3]).week(), 1, 'Jan 3 2011 should be week 1');
assert.equal(moment([2011, 0, 9]).week(), 1, 'Jan 9 2011 should be week 1');
assert.equal(moment([2011, 0, 10]).week(), 2, 'Jan 10 2011 should be week 2');
+ moment.defineLocale('dow: 1, doy: 4', null);
});
test('weeks numbers dow:6 doy:12', function (assert) {
assert.equal(moment([2011, 0, 8]).week(), 2, 'Jan 8 2011 should be week 2');
assert.equal(moment([2011, 0, 14]).week(), 2, 'Jan 14 2011 should be week 2');
assert.equal(moment([2011, 0, 15]).week(), 3, 'Jan 15 2011 should be week 3');
+ moment.defineLocale('dow: 6, doy: 12', null);
});
test('weeks numbers dow:1 doy:7', function (assert) {
assert.equal(moment([2011, 0, 3]).week(), 2, 'Jan 3 2011 should be week 2');
assert.equal(moment([2011, 0, 9]).week(), 2, 'Jan 9 2011 should be week 2');
assert.equal(moment([2011, 0, 10]).week(), 3, 'Jan 10 2011 should be week 3');
+ moment.defineLocale('dow: 1, doy: 7', null);
});
test('weeks numbers dow:0 doy:6', function (assert) {
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');
+ moment.defineLocale('dow: 0, doy: 6', null);
});
test('week year overflows', function (assert) {
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
defineCommonLocaleTests(name, -1, -1);
}
+ function isNearSpringDST() {
+ return moment().subtract(1, 'day').utcOffset() !== moment().add(1, 'day').utcOffset();
+ }
+
module('zone switching');
test('local to utc, keepLocalTime = true', function (assert) {
});
test('local to zone, keepLocalTime = true', function (assert) {
+ test.expectedDeprecations('moment().zone');
var m = moment(),
fmt = 'YYYY-DD-MM HH:mm:ss',
z;
});
test('local to zone, keepLocalTime = false', function (assert) {
+ test.expectedDeprecations('moment().zone');
var m = moment(),
z;
});
test('utc to local, keepLocalTime = true', function (assert) {
+ // Don't test near the spring DST transition
+ if (isNearSpringDST()) {
+ expect(0);
+ return;
+ }
+
var um = moment.utc(),
fmt = 'YYYY-DD-MM HH:mm:ss';
});
test('zone to local, keepLocalTime = true', function (assert) {
+ test.expectedDeprecations('moment().zone');
+ // Don't test near the spring DST transition
+ if (isNearSpringDST()) {
+ expect(0);
+ return;
+ }
+
var m = moment(),
fmt = 'YYYY-DD-MM HH:mm:ss',
z;
});
test('zone to local, keepLocalTime = false', function (assert) {
+ test.expectedDeprecations('moment().zone');
var m = moment(),
z;
for (h = 0; h < 24; ++h) {
for (m = 0; m < 60; m += 15) {
t1 = moment.utc([2000, 0, 1, h, m]);
- t2 = moment(t1.format('A h:mm'), 'A h:mm');
+ 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('month parsing correctness', function (assert) {
+ var i, m;
+
+ if (locale === 'tr') {
+ // I can't fix it :(
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r;
+ r = moment(m.format(format), format);
+ assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format);
+ 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');
+ 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') {
+ // There is a lower-case letter (ı), that converted to upper then
+ // lower changes to i
+ expect(0);
+ return;
+ }
+ function tester(format) {
+ var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format;
+ r = moment(m.format(format), format);
+ assert.equal(r.weekday(), m.weekday(), baseMsg);
+ 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');
+ 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, i, 15, 18]);
+ tester('dd');
+ tester('ddd');
+ tester('dddd');
+ }
+ });
+ }
+
+ function setupDeprecationHandler(test, moment, scope) {
+ test._expectedDeprecations = null;
+ test._observedDeprecations = null;
+ test._oldSupress = moment.suppressDeprecationWarnings;
+ moment.suppressDeprecationWarnings = true;
+ test.expectedDeprecations = function () {
+ test._expectedDeprecations = arguments;
+ test._observedDeprecations = [];
+ };
+ moment.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, scope) {
+ moment.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*/
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
+ teardownDeprecationHandler(test, moment, 'core');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
moment.createFromInputFallback = function (config) {
throw new Error('input not handled by moment: ' + config._i);
};
+ setupDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.setup) {
lifecycle.setup();
}
},
teardown : function () {
moment.locale('en');
+ teardownDeprecationHandler(test, moment, 'locale');
if (lifecycle && lifecycle.teardown) {
lifecycle.teardown();
}
defineCommonLocaleTests(name, -1, -1);
}
- module('zones');
+ module('zones', {
+ 'setup': function () {
+ test.expectedDeprecations('moment().zone');
+ }
+ });
test('set zone', function (assert) {
var zone = moment();
});
test('zone names', function (assert) {
+ test.expectedDeprecations();
assert.equal(moment().zoneAbbr(), '', 'Local zone abbr should be empty');
assert.equal(moment().format('z'), '', 'Local zone formatted abbr should be empty');
assert.equal(moment().zoneName(), '', 'Local zone name should be empty');
});
test('parse zone with more arguments', function (assert) {
+ test.expectedDeprecations();
var m;
m = moment.parseZone('2013 01 01 05 -13:00', 'YYYY MM DD HH ZZ');
assert.equal(m.format(), '2013-01-01T05:00:00-13:00', 'accept input and format');