UNPKG

@progress/kendo-ui

Version:

This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.

3 lines (2 loc) 10.6 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).kendo=t.kendo||{},t.kendo._globals=t.kendo._globals||{},t.kendo._globals.DateMathCmnChunk={}))}(this,(function(t){var e,n=function(t){return t?new Date(t.getTime()):null},o=function(t,e){var o=n(t);return 0===e&&23===o.getHours()&&o.setHours(o.getHours()+2),o},r=function(t,e){var r=n(t);return r.setDate(r.getDate()+e),o(r,t.getHours())},i=function(t,e,n,r,i,u,a){void 0===r&&(r=0),void 0===i&&(i=0),void 0===u&&(u=0),void 0===a&&(a=0);var c=new Date(t,e,n,r,i,u,a);return t>-1&&t<100&&c.setFullYear(c.getFullYear()-1900),o(c,r)},u=function(t){var e=i(t.getFullYear(),t.getMonth()+1,1,t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds());return r(e,-1)},a=function(t,e){var r=n(t),i=(12+(r.getMonth()+e)%12)%12;return r.setMonth(r.getMonth()+e),function(t,e){return t.getMonth()!==e?u(a(t,-1)):t}(o(r,t.getHours()),i)};!function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"}(e||(e={}));var c,s=function(t,r,i){void 0===i&&(i=e.Forward);var u=n(t),a=(r-u.getDay()+7*i)%7;return u.setDate(u.getDate()+a),o(u,t.getHours())};!function(t){t[t.Sunday=0]="Sunday",t[t.Monday=1]="Monday",t[t.Tuesday=2]="Tuesday",t[t.Wednesday=3]="Wednesday",t[t.Thursday=4]="Thursday",t[t.Friday=5]="Friday",t[t.Saturday=6]="Saturday"}(c||(c={}));var f=function(t){return i(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0)},l=function(t,e){return!t&&!e||t&&e&&t.getTime()===e.getTime()},p={rules:{},titles:{},zones:{}},h={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11},g={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6},d=function(t,e,n){var o,r=e[3],i=e[4],u=e[5],a="u"===u[3]?6e4*-n:0;if(isNaN(i)){if(0===i.indexOf("last")){o=new Date(Date.UTC(t,h[r]+1,1,u[0]-24,u[1],u[2])+a);var c=g[i.substr(4,3)],s=o.getUTCDay();o.setUTCDate(o.getUTCDate()+c-s-(c>s?7:0))}else if(i.indexOf(">=")>=0){o=new Date(Date.UTC(t,h[r],i.substr(5),u[0],u[1],u[2],0)+a);c=g[i.substr(0,3)],s=o.getUTCDay();o.setUTCDate(o.getUTCDate()+c-s+(c<s?7:0))}}else o=new Date(Date.UTC(t,h[r],i,u[0],u[1],u[2])+a);return o},T=(new Date).getTime(),D=function(t,e,n){void 0===e&&(e=T),void 0===n&&(n=0);var o=p.rules[t];if(!o){var r=t.split(":"),i=0;return r.length>1&&(i=60*r[0]+Number(r[1])),[-1e6,"max","-","Jan",1,[0,0,0],i,"-"]}var u=new Date(e).getUTCFullYear();(o=o.filter((function(t){var e=t[0],n=t[1];return e<=u&&(n>=u||e===u&&"only"===n||"max"===n)}))).push(e),o.sort((function(t,e){return"number"!=typeof t&&(t=Number(d(u,t,n))),"number"!=typeof e&&(e=Number(d(u,e,n))),t-e}));var a=o[o.indexOf(e)-1]||o[o.length-1];return isNaN(a)?a:null},m="The required {0} timezone information is not provided!",y=/\{(\d+)}?\}/g,C=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var o=e.reduce((function(t,e){return t.concat(e)}),[]);return t.replace(y,(function(t,e){return o[parseInt(e,10)]}))},U=function(t,e){if(void 0===e&&(e=(new Date).getTime()),"Etc/UTC"===t||"Etc/GMT"===t)return[0,"-","UTC",null];for(var n=function(t){var e=p.zones;if(!e)throw new Error(C(m,t));var n=e[t],o="string"==typeof n?e[n]:n;if(!o)throw new Error(C(m,t));return o}(t),o=n.length-1;o>=0;o--){var r=n[o][3];if(r&&e>r)break}var i=n[o+1];if(!i)throw new Error(C(m,t));return i},M=function(t,e){var n=e.getTime(),o=U(t,n);return{rule:D(o[1],n,o[0]),zone:o}},w=function(t,e){return void 0===e&&(e=2),(t<0?"-":"")+new Array(e).concat([Math.abs(t)]).join("0").slice(-e)},v=function(t,e){if(void 0===e&&(e=new Date),"Etc/UTC"===t||"Etc/GMT"===t)return 0;if(""===t)return e.getTimezoneOffset();var n=M(t,e),o=n.rule,r=n.zone;return parseFloat(o?r[0]-o[6]:r[0])};var _=function(t,e){return new Date(t.getTime()+6e4*e)},S=function(t,e){return new Date(t.getTime()+36e5*e)},b=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],E=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function z(t,e){var n=v(e,t),o=S(t,-1);return n<v(e,o)}function F(t,e){var n=z(t,e)?1:0;return S(t,n)}function O(t,e,n){if(e===n)return t;var o=v(e,t),r=v(n,t),i=o-r,u=_(t,i),a=v(n,u);return _(t,i+(r-a))}!function(){function t(t,e){this._utcDate=n(t),this.timezone=e;var o=v(e,t);this.timezoneOffset=o;var r=F(t,e);this._localDate=O(r,e,"Etc/UTC")}Object.defineProperty(t.prototype,"cachedLocalDate",{get:function(){return this._localDate},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cachedUTCDate",{get:function(){return this._utcDate},enumerable:!0,configurable:!0}),t.fromLocalDate=function(e,n){void 0===n&&(n="");var o=O(e,"Etc/UTC",n),r=z(o,n),i=v(n,o),u=0;r&&(u=i>0?-1:1);var a=S(o,u);return t.fromUTCDate(a,n)},t.fromUTCDate=function(e,n){return void 0===n&&(n=""),new t(e,n)},t.prototype.toLocalDate=function(){return n(this._localDate)},t.prototype.toUTCDate=function(){return n(this._utcDate)},t.prototype.toTimezone=function(e){if(this.timezone===e)return this.clone();var n=v(this.timezone,this._utcDate),o=_(this._utcDate,n);return t.fromLocalDate(o,e)},t.prototype.clone=function(){return t.fromUTCDate(this._utcDate,this.timezone)},t.prototype.addDays=function(e){var n=new Date(this._utcDate.getTime());return n.setUTCDate(n.getUTCDate()+e),t.fromUTCDate(n,this.timezone)},t.prototype.addTime=function(e){var n=F(new Date(this._utcDate.getTime()),this.timezone);n.setTime(n.getTime()+e);var o=F(n,this.timezone);return t.fromUTCDate(o,this.timezone)},t.prototype.stripTime=function(){var e=this._utcDate,n=Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),0,0,0);return t.fromUTCDate(new Date(n),this.timezone)},t.prototype.getTime=function(){return this._localDate.getTime()},t.prototype.getTimezoneOffset=function(){return this.timezoneOffset},t.prototype.getFullYear=function(){return this._utcDate.getUTCFullYear()},t.prototype.getMonth=function(){return this._utcDate.getUTCMonth()},t.prototype.getDate=function(){return this._utcDate.getUTCDate()},t.prototype.getDay=function(){return this._utcDate.getUTCDay()},t.prototype.getHours=function(){return this._utcDate.getUTCHours()},t.prototype.getMinutes=function(){return this._utcDate.getUTCMinutes()},t.prototype.getSeconds=function(){return this._utcDate.getUTCSeconds()},t.prototype.getMilliseconds=function(){return this._utcDate.getUTCMilliseconds()},t.prototype.getUTCDate=function(){return this._localDate.getUTCDate()},t.prototype.getUTCDay=function(){return this._localDate.getUTCDay()},t.prototype.getUTCFullYear=function(){return this._localDate.getUTCFullYear()},t.prototype.getUTCHours=function(){return this._localDate.getUTCHours()},t.prototype.getUTCMilliseconds=function(){return this._localDate.getUTCMilliseconds()},t.prototype.getUTCMinutes=function(){return this._localDate.getUTCMinutes()},t.prototype.getUTCMonth=function(){return this._localDate.getUTCMonth()},t.prototype.getUTCSeconds=function(){return this._localDate.getUTCSeconds()},t.prototype.setTime=function(t){throw new Error("Method not implemented.")},t.prototype.setMilliseconds=function(t){throw new Error("Method not implemented.")},t.prototype.setUTCMilliseconds=function(t){throw new Error("Method not implemented.")},t.prototype.setSeconds=function(t,e){throw new Error("Method not implemented.")},t.prototype.setUTCSeconds=function(t,e){throw new Error("Method not implemented.")},t.prototype.setMinutes=function(t,e,n){throw new Error("Method not implemented.")},t.prototype.setUTCMinutes=function(t,e,n){throw new Error("Method not implemented.")},t.prototype.setHours=function(t,e,n,o){throw new Error("Method not implemented.")},t.prototype.setUTCHours=function(t,e,n,o){throw new Error("Method not implemented.")},t.prototype.setDate=function(t){throw new Error("Method not implemented.")},t.prototype.setUTCDate=function(t){throw new Error("Method not implemented.")},t.prototype.setMonth=function(t,e){throw new Error("Method not implemented.")},t.prototype.setUTCMonth=function(t,e){throw new Error("Method not implemented.")},t.prototype.setFullYear=function(t,e,n){throw new Error("Method not implemented.")},t.prototype.setUTCFullYear=function(t,e,n){throw new Error("Method not implemented.")},t.prototype.toISOString=function(){return this._localDate.toISOString()},t.prototype.toJSON=function(){return this._localDate.toJSON()},t.prototype.toString=function(){var t,e=(t=this._utcDate,b[t.getUTCDay()]+" "+E[t.getUTCMonth()]),n=this.toTimeString();return e+" "+this.getDate()+" "+this.getFullYear()+" "+n},t.prototype.toDateString=function(){return(t=this._utcDate,new Date(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds())).toDateString();var t},t.prototype.toTimeString=function(){var t=w(this.getHours())+":"+w(this.getMinutes())+":"+w(this.getSeconds()),e=function(t){var e=t<=0?"+":"-",n=Math.abs(t);return"GMT"+e+w(Math.floor(n/60))+w(n%60)}(this.timezoneOffset),n=function(t,e){if(void 0===e&&(e=new Date),"Etc/UTC"===t)return"UTC";if("Etc/GMT"===t)return"GMT";if(""===t)return"";var n=M(t,e),o=n.zone,r=n.rule,i=o[2];if(i.indexOf("/")>=0)return i.split("/")[r&&+r[6]?1:0];if(i.indexOf("%s")>=0)return i.replace("%s",r&&"-"!==r[7]?r[7]:"");if(i.indexOf("%z")>=0){var u=-1*Math.trunc(o[0]/60),a=w(u,2),c=u>0?"+":"",s=Math.abs(Math.trunc(o[0]%60)),f=0===s?"":w(s,2);return i.replace("%z",""+c+a+f)}return i}(this.timezone,this._utcDate);return n&&(n=" ("+n+")"),t+" "+e+n},t.prototype.toLocaleString=function(t,e){return this._localDate.toLocaleString(t,e)},t.prototype.toLocaleDateString=function(t,e){return this._localDate.toLocaleDateString(t,e)},t.prototype.toLocaleTimeString=function(t,e){return this._localDate.toLocaleTimeString(t,e)},t.prototype.toUTCString=function(){return this.toTimezone("Etc/UTC").toString()},t.prototype[Symbol.toPrimitive]=function(t){return"string"===t||"default"===t?this.toString():this._localDate.getTime()},t.prototype.valueOf=function(){return this.getTime()},t.prototype.getVarDate=function(){throw new Error("Not implemented.")},t.prototype.format=function(t){throw new Error("Not implemented.")},t.prototype.formatUTC=function(t){throw new Error("Not implemented.")}}();t.__meta__={id:"date-math.cmn.chunk",name:"DateMathCmnChunk",category:"web",description:"A reusable outputed chunk of code",depends:[],hidden:!0,chunk:!0},t.a=i,t.b=a,t.c=n,t.d=s,t.e=r,t.f=function(t){return i(t.getFullYear(),t.getMonth(),1,t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds())},t.g=f,t.i=l,t.l=u})); //# sourceMappingURL=kendo.date-math.cmn.chunk.min.js.map