var Dates={newInstance:function(a,c){c=c?parseTzId(c):zk.mm.tz.guess();if(0==arguments.length)var b=zk.mm();else"number"==typeof a?b=zk.mm(a):a instanceof DateImpl?(b=zk.mm(a._moment),c=a._timezone):a instanceof Array&&(b=new Date(Date.UTC.apply(null,a)),b=zk.mm.tz([b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate(),b.getUTCHours(),b.getUTCMinutes(),b.getUTCSeconds(),b.getUTCMilliseconds()],c));return new DateImpl(b,c)}};function DateImpl(a,c){this._moment=a;this._timezone=c}
function parseTzId(a){return/^GMT\+([0]\d|[1][0-2]):[0]{2}$/i.test(a)?"Etc/GMT-"+parseInt(a.substring(4,6)):/^GMT-([0]\d|[1][0-4]):[0]{2}$/i.test(a)?"Etc/GMT+"+parseInt(a.substring(4,6)):a}
DateImpl.prototype={tz:function(a){a&&(this._timezone=parseTzId(a));return this},_getTzMoment:function(){return this._moment.tz(this._timezone)},_getUTCMoment:function(){return this._moment.tz("UTC")},getTimeZone:function(){return this._timezone},getDate:function(){return this._getTzMoment().date()},getDay:function(){return this._getTzMoment().day()},getFullYear:function(){return this._getTzMoment().year()},getHours:function(){return this._getTzMoment().hour()},getMilliseconds:function(){return this._getTzMoment().millisecond()},
getMinutes:function(){return this._getTzMoment().minute()},getMonth:function(){return this._getTzMoment().month()},getSeconds:function(){return this._getTzMoment().second()},getTime:function(){return this._moment.valueOf()},getTimezoneOffset:function(){return-this._getTzMoment().utcOffset()},getUTCDate:function(){return this._getUTCMoment().date()},getUTCDay:function(){return this._getUTCMoment().day()},getUTCFullYear:function(){return this._getUTCMoment().year()},getUTCHours:function(){return this._getUTCMoment().hour()},
getUTCMilliseconds:function(){return this._getUTCMoment().millisecond()},getUTCMinutes:function(){return this._getUTCMoment().minute()},getUTCMonth:function(){return this._getUTCMoment().month()},getUTCSeconds:function(){return this._getUTCMoment().second()},getYear:function(){return this._getTzMoment().year()-1900},setDate:function(a){return this._getTzMoment().date(a).valueOf()},setFullYear:function(a,c,b){var d=this._getTzMoment();d.year(a);null!=c&&(d.month(c),null!=b&&d.date(b));return d.valueOf()},
setHours:function(a,c,b,d){var e=this._getTzMoment();e.hour(a);null!=c&&(e.minute(c),null!=b&&(e.second(b),null!=d&&e.millisecond(d)));return e.valueOf()},setMilliseconds:function(a){return this._getTzMoment().millisecond(a).valueOf()},setMinutes:function(a){return this._getTzMoment().minute(a).valueOf()},setMonth:function(a){return this._getTzMoment().month(a).valueOf()},setSeconds:function(a){return this._getTzMoment().second(a).valueOf()},setTime:function(a){this._moment=zk.mm(a);return this._moment.valueOf()},
setUTCDate:function(a){return this._getUTCMoment().date(a).valueOf()},setUTCFullYear:function(a){return this._getUTCMoment().year(a).valueOf()},setUTCHours:function(a){return this._getUTCMoment().hour(a).valueOf()},setUTCMilliseconds:function(a){return this._getUTCMoment().millisecond(a).valueOf()},setUTCMinutes:function(a){return this._getUTCMoment().minute(a).valueOf()},setUTCMonth:function(a){return this._getUTCMoment().month(a).valueOf()},setUTCSeconds:function(a){return this._getUTCMoment().second(a).valueOf()},
setYear:function(a){return this._getTzMoment().year(a).valueOf()},toString:function(){return this._getTzMoment().toString()},valueOf:function(){return this._moment.valueOf()}};
