ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
2 lines • 9.9 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("date-fns/addMonths"),require("date-fns/addYears"),require("date-fns/differenceInCalendarDays"),require("date-fns/differenceInCalendarMonths"),require("date-fns/differenceInCalendarYears"),require("date-fns/differenceInHours"),require("date-fns/differenceInMinutes"),require("date-fns/differenceInSeconds"),require("date-fns/isFirstDayOfMonth"),require("date-fns/isLastDayOfMonth"),require("date-fns/isSameDay"),require("date-fns/isSameHour"),require("date-fns/isSameMinute"),require("date-fns/isSameMonth"),require("date-fns/isSameSecond"),require("date-fns/isSameYear"),require("date-fns/isToday"),require("date-fns/isValid"),require("date-fns/setDay"),require("date-fns/setMonth"),require("date-fns/setYear"),require("date-fns/startOfMonth"),require("date-fns/startOfWeek"),require("ng-zorro-antd/core/logger"),require("@angular/common"),require("ng-zorro-antd/core/util")):"function"==typeof define&&define.amd?define("ng-zorro-antd/core/time",["exports","date-fns/addMonths","date-fns/addYears","date-fns/differenceInCalendarDays","date-fns/differenceInCalendarMonths","date-fns/differenceInCalendarYears","date-fns/differenceInHours","date-fns/differenceInMinutes","date-fns/differenceInSeconds","date-fns/isFirstDayOfMonth","date-fns/isLastDayOfMonth","date-fns/isSameDay","date-fns/isSameHour","date-fns/isSameMinute","date-fns/isSameMonth","date-fns/isSameSecond","date-fns/isSameYear","date-fns/isToday","date-fns/isValid","date-fns/setDay","date-fns/setMonth","date-fns/setYear","date-fns/startOfMonth","date-fns/startOfWeek","ng-zorro-antd/core/logger","@angular/common","ng-zorro-antd/core/util"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self)["ng-zorro-antd"]=e["ng-zorro-antd"]||{},e["ng-zorro-antd"].core=e["ng-zorro-antd"].core||{},e["ng-zorro-antd"].core.time={}),e.addMonths,e.addYears,e.differenceInCalendarDays,e.differenceInCalendarMonths,e.differenceInCalendarYears,e.differenceInHours,e.differenceInMinutes,e.differenceInSeconds,e.isFirstDayOfMonth,e.isLastDayOfMonth,e.isSameDay,e.isSameHour,e.isSameMinute,e.isSameMonth,e.isSameSecond,e.isSameYear,e.isToday,e.isValid,e.setDay,e.setMonth,e.setYear,e.startOfMonth,e.startOfWeek,e["ng-zorro-antd"].core.logger,e.ng.common,e["ng-zorro-antd"].core.util)}(this,(function(e,t,a,n,r,i,o,s,d,u,f,c,l,h,p,m,y,D,g,M,v,S,b,w,N,I,q){"use strict";function Y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var k=Y(t),x=Y(a),O=Y(n),F=Y(r),T=Y(i),H=Y(o),W=Y(s),z=Y(d),C=Y(u),L=Y(f),j=Y(c),A=Y(l),B=Y(h),P=Y(p),R=Y(m),V=Y(y),E=Y(D),$=Y(g),_=Y(M),U=Y(v),G=Y(S),J=Y(b),K=Y(w);Object.create;function Q(e,t){var a="function"==typeof Symbol&&e[Symbol.iterator];if(!a)return e;var n,r,i=a.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)o.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(a=i.return)&&a.call(i)}finally{if(r)throw r.error}}return o}Object.create;var X=function(){function e(e){if(e)if(e instanceof Date)this.nativeDate=e;else{if("string"!=typeof e&&"number"!=typeof e)throw new Error('The input date type is not supported ("Date" is now recommended)');N.warn('The string type is not recommended for date-picker, use "Date" type'),this.nativeDate=new Date(e)}else this.nativeDate=new Date}return e.prototype.calendarStart=function(t){return new e(K.default(J.default(this.nativeDate),t))},e.prototype.getYear=function(){return this.nativeDate.getFullYear()},e.prototype.getMonth=function(){return this.nativeDate.getMonth()},e.prototype.getDay=function(){return this.nativeDate.getDay()},e.prototype.getTime=function(){return this.nativeDate.getTime()},e.prototype.getDate=function(){return this.nativeDate.getDate()},e.prototype.getHours=function(){return this.nativeDate.getHours()},e.prototype.getMinutes=function(){return this.nativeDate.getMinutes()},e.prototype.getSeconds=function(){return this.nativeDate.getSeconds()},e.prototype.getMilliseconds=function(){return this.nativeDate.getMilliseconds()},e.prototype.clone=function(){return new e(new Date(this.nativeDate))},e.prototype.setHms=function(t,a,n){return new e(new Date(this.nativeDate.setHours(t,a,n)))},e.prototype.setYear=function(t){return new e(G.default(this.nativeDate,t))},e.prototype.addYears=function(t){return new e(x.default(this.nativeDate,t))},e.prototype.setMonth=function(t){return new e(U.default(this.nativeDate,t))},e.prototype.addMonths=function(t){return new e(k.default(this.nativeDate,t))},e.prototype.setDay=function(t,a){return new e(_.default(this.nativeDate,t,a))},e.prototype.setDate=function(t){var a=new Date(this.nativeDate);return a.setDate(t),new e(a)},e.prototype.addDays=function(e){return this.setDate(this.getDate()+e)},e.prototype.add=function(e,t){switch(t){case"decade":return this.addYears(10*e);case"year":return this.addYears(e);case"month":default:return this.addMonths(e)}},e.prototype.isSame=function(e,t){var a;switch(void 0===t&&(t="day"),t){case"decade":a=function(e,t){return Math.abs(e.getFullYear()-t.getFullYear())<11};break;case"year":a=V.default;break;case"month":a=P.default;break;case"day":a=j.default;break;case"hour":a=A.default;break;case"minute":a=B.default;break;case"second":a=R.default;break;default:a=j.default}return a(this.nativeDate,this.toNativeDate(e))},e.prototype.isSameYear=function(e){return this.isSame(e,"year")},e.prototype.isSameMonth=function(e){return this.isSame(e,"month")},e.prototype.isSameDay=function(e){return this.isSame(e,"day")},e.prototype.isSameHour=function(e){return this.isSame(e,"hour")},e.prototype.isSameMinute=function(e){return this.isSame(e,"minute")},e.prototype.isSameSecond=function(e){return this.isSame(e,"second")},e.prototype.isBefore=function(e,t){if(void 0===t&&(t="day"),null===e)return!1;var a;switch(t){case"year":a=T.default;break;case"month":a=F.default;break;case"day":a=O.default;break;case"hour":a=H.default;break;case"minute":a=W.default;break;case"second":a=z.default;break;default:a=O.default}return a(this.nativeDate,this.toNativeDate(e))<0},e.prototype.isBeforeYear=function(e){return this.isBefore(e,"year")},e.prototype.isBeforeMonth=function(e){return this.isBefore(e,"month")},e.prototype.isBeforeDay=function(e){return this.isBefore(e,"day")},e.prototype.isToday=function(){return E.default(this.nativeDate)},e.prototype.isValid=function(){return $.default(this.nativeDate)},e.prototype.isFirstDayOfMonth=function(){return C.default(this.nativeDate)},e.prototype.isLastDayOfMonth=function(){return L.default(this.nativeDate)},e.prototype.toNativeDate=function(t){return t instanceof e?t.nativeDate:t},e}(),Z=function(){function e(e,t){this.format=e,this.localeId=t,this.regex=null,this.matchMap={hour:null,minute:null,second:null,periodNarrow:null,periodWide:null,periodAbbreviated:null},this.genRegexp()}return e.prototype.toDate=function(e){var t=this.getTimeResult(e),a=new Date;return q.isNotNil(null==t?void 0:t.hour)&&a.setHours(t.hour),q.isNotNil(null==t?void 0:t.minute)&&a.setMinutes(t.minute),q.isNotNil(null==t?void 0:t.second)&&a.setSeconds(t.second),1===(null==t?void 0:t.period)&&a.getHours()<12&&a.setHours(a.getHours()+12),a},e.prototype.getTimeResult=function(e){var t=this.regex.exec(e),a=null;return t?(q.isNotNil(this.matchMap.periodNarrow)&&(a=I.getLocaleDayPeriods(this.localeId,I.FormStyle.Format,I.TranslationWidth.Narrow).indexOf(t[this.matchMap.periodNarrow+1])),q.isNotNil(this.matchMap.periodWide)&&(a=I.getLocaleDayPeriods(this.localeId,I.FormStyle.Format,I.TranslationWidth.Wide).indexOf(t[this.matchMap.periodWide+1])),q.isNotNil(this.matchMap.periodAbbreviated)&&(a=I.getLocaleDayPeriods(this.localeId,I.FormStyle.Format,I.TranslationWidth.Abbreviated).indexOf(t[this.matchMap.periodAbbreviated+1])),{hour:q.isNotNil(this.matchMap.hour)?Number.parseInt(t[this.matchMap.hour+1],10):null,minute:q.isNotNil(this.matchMap.minute)?Number.parseInt(t[this.matchMap.minute+1],10):null,second:q.isNotNil(this.matchMap.second)?Number.parseInt(t[this.matchMap.second+1],10):null,period:a}):null},e.prototype.genRegexp=function(){var e=this,t=this.format.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$&"),a=/h{1,2}/i,n=/m{1,2}/,r=/s{1,2}/,i=/aaaaa/,o=/aaaa/,s=/a{1,3}/,d=a.exec(this.format),u=n.exec(this.format),f=r.exec(this.format),c=i.exec(this.format),l=null,h=null;c||(l=o.exec(this.format)),l||c||(h=s.exec(this.format)),[d,u,f,c,l,h].filter((function(e){return!!e})).sort((function(e,t){return e.index-t.index})).forEach((function(p,m){switch(p){case d:e.matchMap.hour=m,t=t.replace(a,"(\\d{1,2})");break;case u:e.matchMap.minute=m,t=t.replace(n,"(\\d{1,2})");break;case f:e.matchMap.second=m,t=t.replace(r,"(\\d{1,2})");break;case c:e.matchMap.periodNarrow=m;var y=I.getLocaleDayPeriods(e.localeId,I.FormStyle.Format,I.TranslationWidth.Narrow).join("|");t=t.replace(i,"("+y+")");break;case l:e.matchMap.periodWide=m;var D=I.getLocaleDayPeriods(e.localeId,I.FormStyle.Format,I.TranslationWidth.Wide).join("|");t=t.replace(o,"("+D+")");break;case h:e.matchMap.periodAbbreviated=m;var g=I.getLocaleDayPeriods(e.localeId,I.FormStyle.Format,I.TranslationWidth.Abbreviated).join("|");t=t.replace(s,"("+g+")")}})),this.regex=new RegExp(t)},e}();e.CandyDate=X,e.cloneDate=function(e){return Array.isArray(e)?e.map((function(e){return e instanceof X?e.clone():null})):e instanceof X?e.clone():null},e.normalizeRangeValue=function(e,t,a,n){void 0===a&&(a="month"),void 0===n&&(n="left");var r=Q(e,2),i=r[0],o=r[1],s=i||new X,d=o||(t?s:s.add(1,a));return i&&!o?(s=i,d=t?i:i.add(1,a)):!i&&o?(s=t?o:o.add(-1,a),d=o):i&&o&&!t&&("left"===n?d=s.add(1,a):s=d.add(-1,a)),[s,d]},e.timeUnits=[["Y",31536e6],["M",2592e6],["D",864e5],["H",36e5],["m",6e4],["s",1e3],["S",1]],e.wrongSortOrder=function(e){var t=Q(e,2),a=t[0],n=t[1];return!!a&&!!n&&n.isBeforeDay(a)},e.ɵNgTimeParser=Z,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=ng-zorro-antd-core-time.umd.min.js.map