const i=function(s,u){var e=new Date;typeof s>"u"&&(s="r"),typeof u<"u"&&(u=parseInt(u,10),e.setTime(u)),this.get=function(t){if(t>="a"&&t<="z"||t>="A"&&t<="Z"){var r="_parse_"+t;if(this[r])return this[r]()}return t},this.parse=function(t){var r="";if(t.length>0)for(var a=0;a<t.length;a++){var n=t.charAt(a);r+=this.get(n)}return r},this.set=function(t,r){switch(r=parseInt(r,10),t){case"d":e.setDate(r);break;case"Y":e.setFullYear(r);break;case"H":case"G":e.setHours(r);break;case"i":e.setMinutes(r);break;case"s":e.setSeconds(r);break;case"m":case"n":e.setMonth(r-1);break}},this._parse_O=function(){var t=Math.abs(e.getTimezoneOffset()/60).toString();return t.length==1&&(t="0"+t),"+"+t+"00"},this._parse_r=function(){return this.parse("D, d M Y H:i:s O")},this._parse_Y=function(){return e.getFullYear().toString()},this._parse_y=function(){var t=this._parse_Y();return t.substr(2)},this._parse_L=function(){var t=parseInt(this.parse("Y"));return t%4==0&&(t%100>0||t%400==0)?"1":"0"},this._parse_m=function(){var t=this._parse_n();return t.length<2&&(t="0"+t),t},this._parse_n=function(){return(e.getMonth()+1).toString()},this._parse_t=function(){var t=32-new Date(this.get("Y"),this.get("m")-1,32).getDate();return t},this._parse_F=function(){var t=parseInt(this.parse("n")),r=["","January","February","March","April","May","June","July","August","September","October","November","December"];return r[t]},this._parse_M=function(){var t=parseInt(this.parse("n")),r=["","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return r[t]},this._parse_w=function(){return e.getDay().toString()},this._parse_D=function(){var t=parseInt(this._parse_w()),r=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];return r[t]},this._parse_l=function(){var t=parseInt(this._parse_w()),r=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];return r[t]},this._parse_d=function(){var t=this._parse_j();return t.length<2&&(t="0"+t),t},this._parse_j=function(){return e.getDate().toString()},this._parse_W=function(){var t=new i;t.set("m",1),t.set("d",1);for(var r=parseInt(t.parse("w")),a=parseInt(this.parse("m"),10),n=0,h=1;h<a;h++){var o=new i;o.set("m",h);var f=parseInt(o.parse("t"));n+=f}n+=parseInt(this.parse("d"),10);var _=parseInt(this.parse("w"));n=n-_+(r-1);var p=0;return _!=0?p=(n/7+1).toString():p=(n/7).toString(),p.length==1&&(p="0"+p),p},this._parse_z=function(){for(var t=parseInt(this.parse("m"),10),r=0,a=1;a<t;a++){var n=new i;n.set("m",a);var h=parseInt(n.parse("t"));r+=h}return r+=parseInt(this.parse("d"),10)-1,r},this._parse_i=function(){var t=e.getMinutes().toString();return t.length<2&&(t="0"+t),t},this._parse_s=function(){var t=e.getSeconds().toString();return t.length<2&&(t="0"+t),t},this._parse_H=function(){var t=this._parse_G();return t.length<2&&(t="0"+t),t},this._parse_G=function(){return e.getHours().toString()},this._parse_h=function(){var t=this._parse_g();return t.length<2&&(t="0"+t),t},this._parse_g=function(){var t=parseInt(this._parse_G(),10);return t>12&&(t=t-12),t.toString()},this._parse_U=function(){return this.time().toString()},this._parse_a=function(){var t=this.parse("H");return t<12?"am":"pm"},this._parse_A=function(){return this.parse("a").toUpperCase()},this.time=function(){return Math.round(e.getTime()/1e3)},this.toString=function(){return this.parse(s)}};i.toTime=function(s){if(arguments.length==1)return i.parse(s);if(arguments.length==3)return arguments[1]=parseInt(arguments[1],10)-1,new Date(arguments[0],arguments[1],arguments[2]).time()};Number.prototype.dateFormat=function(s){var u=new i(s,this*1e3);return u.toString()};Date.prototype.format=function(s){return new i(s,this.getTime()).toString()};
