!function(e,t){"function"==typeofdefine&&define.amd?define([],t):"object"==typeofmodule&&module.exports?module.exports=t():e.DateFormatter=t()}("undefined"!=typeofself?self:this,function(){varg={DAY:864e5,HOUR:3600,defaults:{dateSettings:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],meridiem:["AM","PM"],ordinal:function(e){vart=e%10,a={1:"st",2:"nd",3:"rd"};return1!==Math.floor(e%100/10)&&a[t]?a[t]:"th"}},separators:/[ \-+\/.:@]/g,validParts:/[dDjlNSwzWFmMntLoYyaABgGhHisueTIOPZcrU]/g,intParts:/[djwNzmnyYhHgGis]/g,tzParts:/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,tzClip:/[^-+\dA-Z]/g},getInt:function(e,t){returnparseInt(e,t||10)},compare:function(e,t){return"string"==typeofe&&"string"==typeoft&&e.toLowerCase()===t.toLowerCase()},lpad:function(e,t,a){e=e.toString();returna=a||"0",e.length<t?g.lpad(a+e,t):e},merge:function(e){vart,a;for(e=e||{},t=1;t<arguments.length;t++)if(a=arguments[t])for(varnina)a.hasOwnProperty(n)&&("object"==typeofa[n]?g.merge(e[n],a[n]):e[n]=a[n]);returne},getIndex:function(e,t){for(vara=0;a<t.length;a++)if(t[a].toLowerCase()===e.toLowerCase())returna;return-1}},e=function(e){vart=this,e=g.merge(g.defaults,e);t.dateSettings=e.dateSettings,t.separators=e.separators,t.validParts=e.validParts,t.intParts=e.intParts,t.tzParts=e.tzParts,t.tzClip=e.tzClip};returne.prototype={constructor:e,getMonth:function(e){vart=g.getIndex(e,this.dateSettings.monthsShort)+1;return0===t&&(t=g.getIndex(e,this.dateSettings.months)+1),t},parseDate:function(e,t){vara,n,r,o,i,s,d,u=this,l=!1,f=!1,c=u.dateSettings,m={date:null,year:null,month:null,day:null,hour:0,min:0,sec:0};if(!e)returnnull;if(einstanceofDate)returne;if("U"===t)return(r=g.getInt(e))?newDate(1e3*r):e;switch(typeofe){case"number":returnnewDate(e);case"string":break;default:returnnull}if(!(a=t.match(u.validParts))||0===a.length)thrownewError("Invalid date format definition.");for(r=a.length-1;0<=r;r--)"S"===a[r]&&a.splice(r,1);for(n=e.replace(u.separators,"\0").split("\0"),r=0;r<n.length;r++)switch(i=n[r],o=g.getInt(i),a[r]){case"y":case"Y":if(!o)returnnull;s=i.length,m.year=2===s?g.getInt((o<70?"20":"19")+i):o,l=!0;break;case"m":case"n":case"M":case"F":if(isNaN(o)){if(!(0<(d=u.getMonth(i))))returnnull;m.month=d}else{if(!(1<=o&&o<=12))returnnull;m.month=o}l=!0;break;case"d":case"j":if(!(1<=o&&o<=31))returnnull;m.day=o,l=!0;break;case"g":case"h":if(d=n[i=-1<a.indexOf("a")?a.indexOf("a"):-1<a.indexOf("A")?a.indexOf("A"):-1],-1!==i)d=g.compare(d,c.meridiem[0])?0:g.compare(d,c.meridiem[1])?12:-1,1<=o&&o<=12&&-1!=d?m.hour=o%12==0?d:o+d:0<=o&&o<=23&&(m.hour=o);else{if(!(0<=o&&o<=23))returnnull;m.hour=o}f=!0;break;case"G":case"H":if(!(0<=o&&o<=23))returnnull;m.hour=o,f=!0;break;case"i":if(!(0<=o&&o<=59))returnnull;m.min=o,f=!0;break;case"s":if(!(0<=o&&o<=59))returnnull;m.sec=o,f=!0}if(!0===l){varh=m.year||0,t=m.month?m.month-1:0,e=m.day||1;m.date=newDate(h,t,e,m.hour,m.min,m.sec,0)}else{if(!0!==f)returnnull;m.date=newDate(0,0,0,m.hour,m.min,m.sec,0)}returnm.date},guessDate:function(e,t){if("string"!=typeofe)returne;vara,n,r,o,i,s=e.replace(this.separators,"\0").split("\0"),d=t.match(this.validParts),u=newDate,l=0;if(!/^[djmn]/g.test(d[0]))returne;for(r=0;r<s.length;r++){if(l=2,o=s[r],i=g.getInt(o.substr(0,2)),isNaN(i))returnnull;switch(r){case0:"m"===d[0]||"n"===d[0]?u.setMonth(i-1):u.setDate(i);break;case1:"m"===d[0]||"n"===d[0]?u.setDate(i):u.setMonth(i-1);break;case2:if(n=u.getFullYear(),l=(a=o.length)<4?a:4,!(n=g.getInt(a<4?n.toString().substr(0,4-a)+o:o.substr(0,4))))returnnull;u.setFullYear(n);break;case3:u.setHours(i);break;case4:u.setMinutes(i);break;case5:u.setSeconds(i)}0<(o=o.substr(l)).length&&s.splice(r+1,0,o)}returnu