mat-date 1.5.83 → 1.7.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,6 +24,9 @@ export declare class MDateUtil {
24
24
  cpy(): MDateUtil;
25
25
  setCode(code: string): this;
26
26
  seperator(): string;
27
+ zone(): string;
28
+ zones(code?: string): string[];
29
+ region(code?: string): string;
27
30
  year(): number;
28
31
  month(): number;
29
32
  monthUtc(): number;
@@ -53,6 +56,7 @@ export declare class MDateUtil {
53
56
  setTime(value: number): this;
54
57
  setDate(value: Date): this;
55
58
  setDateInputValue(value: string): this;
59
+ setVal(value: MDateUtil | Date | number | string): MDateUtil;
56
60
  toIsoDate(): string;
57
61
  toTime(): number;
58
62
  toDate(): Date;
@@ -82,6 +86,11 @@ export declare class MDateUtil {
82
86
  cpyByStartOfMonth(): MDateUtil;
83
87
  endOfMonth(): this;
84
88
  cpyByEndOfMonth(): MDateUtil;
89
+ eq(value: MDateUtil | Date | number | string): boolean;
90
+ gt(value: MDateUtil | Date | number | string): boolean;
91
+ gte(value: MDateUtil | Date | number | string): boolean;
92
+ lt(value: MDateUtil | Date | number | string): boolean;
93
+ lte(value: MDateUtil | Date | number | string): boolean;
85
94
  static diffDays(before: MDateUtil | Date | number | string, after: MDateUtil | Date | number | string, abs?: boolean): number;
86
95
  static diffHours(before: MDateUtil | Date | number | string, after: MDateUtil | Date | number | string, abs?: boolean): number;
87
96
  static diffMins(before: MDateUtil | Date | number | string, after: MDateUtil | Date | number | string, abs?: boolean): number;
package/dist/DateUtil.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MDateUtil=void 0;const padItem=(t,e=2)=>t.toString().padStart(e,"0");class MDateUtil{val=new Date;static glCode=void 0;code=void 0;get localCode(){return this.code}static new(){return(new MDateUtil).setCode(MDateUtil.glCode)}static setCode(t){return MDateUtil.glCode=t,this}static seperator(){return(new Date).toLocaleDateString(MDateUtil.glCode).replace(/\d/g,"").split("")[0]}cpy(){return MDateUtil.new().setTime(this.toTime())}setCode(t){return this.code=t,this}seperator(){return(new Date).toLocaleDateString(this.code).replace(/\d/g,"").split("")[0]}year(){return this.val.getFullYear()}month(){return this.val.getMonth()+1}monthUtc(){return this.val.getMonth()}day(){return this.val.getDate()}hours(){return this.val.getHours()}min(){return this.val.getMinutes()}sec(){return this.val.getSeconds()}dayOfWeek(){var t=this.val.getDay();return t||7}dayOfWeekUtc(){return this.val.getDay()}setYear(t){return this.val.setFullYear(t),this}setMonth(t){return this.val.setMonth(t-1),this}setMonthUtc(t){return this.val.setMonth(t),this}setDay(t){return this.val.setDate(t),this}setHour(t){return this.val.setHours(t),this}startOfHours(){return this.setHour(0),this.setMin(0),this.setSeconds(0),this.setMilliseconds(0),this}endOfHours(){return this.setHour(23),this.setMin(59),this.setSeconds(59),this.setMilliseconds(999),this}setMin(t){return this.val.setMinutes(t),this}startOfMin(){return this.setMin(0),this.setSeconds(0),this.setMilliseconds(0),this}endOfMin(){return this.setMin(59),this.setSeconds(59),this.setMilliseconds(999),this}setSeconds(t){return this.val.setSeconds(t),this}startOfSeconds(){return this.setSeconds(0),this.setMilliseconds(0),this}endOfSeconds(){return this.setSeconds(59),this.setMilliseconds(999),this}setMilliseconds(t){return this.val.setMilliseconds(t),this}startOfMilliseconds(){return this.setMilliseconds(0),this}endOfMilliseconds(){return this.setMilliseconds(999),this}setIsoDate(t){return this.val=new Date(t),this}setTime(t){return this.val=new Date(t),this}setDate(t){return this.val=new Date(t),this}setDateInputValue(t){return this.val=new Date(t?.replace("T"," ")),this}toIsoDate(){return this.val.toISOString()}toTime(){return this.val.getTime()}toDate(){return this.val}toDateMounthInput(){return this.year()+"-"+padItem(this.month())}toDateInput(){return`${this.year()}-${padItem(this.month())}-`+padItem(this.day())}toTimeInput(t=!0){var e=[];return e.push(padItem(this.hours())),e.push(padItem(this.min())),t&&e.push(padItem(this.sec())),e.join(":")}toDateTimeInput(t=!0){return this.toDateInput()+"T"+this.toTimeInput(t)}strDate(){return this.val.toLocaleDateString(this.code,{month:"2-digit",day:"2-digit",year:"numeric"})}strDateLocal(t){return this.val.toLocaleDateString(this.code,t)}strTime(){return`${padItem(this.hours())}:${padItem(this.min())}:`+padItem(this.sec())}strTimeLocale(t){return this.val.toLocaleTimeString(this.code,t)}strHHmm(){return padItem(this.hours())+":"+padItem(this.min())}str(){return this.strDate()+" "+this.strTime()}strLocal(t){return this.val.toLocaleString(this.code,t)}addDay(t){return this.val=new Date(this.val.setHours(this.val.getHours()+24*t)),this}addHours(t){return this.val=new Date(this.val.setHours(this.val.getHours()+t)),this}addMins(t){return this.val=new Date(this.val.setMinutes(this.val.getMinutes()+t)),this}startOfDay(){return this.startOfHours(),this}cpyByStartOfDay(){return this.cpy().startOfDay()}endOfDay(){return this.endOfHours(),this}cpyByEndOfDay(){return this.cpy().endOfDay()}startOfWeek(){return this.addDay(1-this.dayOfWeek())}cpyStartOfWeek(){return this.cpy().addDay(1-this.dayOfWeek())}endOfWeek(){return this.startOfWeek().addDay(6)}cpyEndOfWeek(){return this.cpyStartOfWeek().addDay(6)}startOfMonth(){return this.setDay(1),this.startOfDay(),this}cpyByStartOfMonth(){return this.cpy().startOfMonth()}endOfMonth(){return this.setDate(this.val).startOfMonth().setMonth(this.month()+1).startOfMonth().addDay(-1).endOfDay(),this}cpyByEndOfMonth(){return this.cpy().endOfMonth()}static diffDays(t,e,s){try{var r=parse(t),i=parse(e);return s?Math.abs(r-i)/36e5/24:(r-i)/36e5/24}catch(t){throw new Error("UNKNOWN")}}static diffHours(t,e,s){try{var r=parse(t),i=parse(e);return s?Math.abs(r-i)/36e5:(r-i)/36e5}catch(t){throw new Error("UNKNOWN")}}static diffMins(t,e,s){try{var r=parse(t),i=parse(e);return s?Math.abs(r-i)/1e3/60:(r-i)/1e3/60}catch(t){throw new Error("UNKNOWN")}}static diffSecs(t,e,s){try{var r=parse(t),i=parse(e);return s?Math.abs(r-i)/1e3:(r-i)/1e3}catch(t){throw new Error("UNKNOWN")}}}function parse(t){try{return t instanceof MDateUtil?t.toTime():t instanceof Date?t.getTime():"number"==typeof t?t:"string"==typeof t?new Date(t).getTime():0}catch(t){throw new Error("ERROR")}}exports.MDateUtil=MDateUtil;
1
+ 'use strict';const a0_0x2f5aa1={};a0_0x2f5aa1['value']=!![],Object['defineProperty'](exports,'__esModule',a0_0x2f5aa1),exports['MDateUtil']=void 0x0;const a0_0x17e88f=(_0x10e717,_0xc0f573=0x2)=>_0x10e717['toString']()['padStart'](_0xc0f573,'0');class a0_0x15ec60{['val']=new Date();static ['glCode']=undefined;['code']=undefined;get['localCode'](){return this['code'];}static['new'](){return new a0_0x15ec60()['setCode'](a0_0x15ec60['glCode']);}static['setCode'](_0x1ae41d){return a0_0x15ec60['glCode']=_0x1ae41d,this;}static['seperator'](){return new Date()['toLocaleDateString'](a0_0x15ec60['glCode'])['replace'](/\d/g,'')['split']('')[0x0];}['cpy'](){return a0_0x15ec60['new']()['setTime'](this['toTime']());}['setCode'](_0x1a2f0a){return this['code']=_0x1a2f0a,this;}['seperator'](){return new Date()['toLocaleDateString'](this['code'])['replace'](/\d/g,'')['split']('')[0x0];}['zone'](){return a0_0x41e6dc(()=>{return Intl['DateTimeFormat']()?.['resolvedOptions']()?.['timeZone'];},null);}['zones'](_0x571bf1=this['code']){return a0_0x41e6dc(()=>{return new Intl['Locale'](_0x571bf1)?.['timeZones']||[];},null);}['region'](_0x1c761c=this['code']){return a0_0x41e6dc(()=>{return new Intl['Locale'](_0x1c761c)['region'];},null);}['year'](){return this['val']['getFullYear']();}['month'](){return this['val']['getMonth']()+0x1;}['monthUtc'](){return this['val']['getMonth']();}['day'](){return this['val']['getDate']();}['hours'](){return this['val']['getHours']();}['min'](){return this['val']['getMinutes']();}['sec'](){return this['val']['getSeconds']();}['dayOfWeek'](){const _0x425793=this['val']['getDay']();return _0x425793?_0x425793:0x7;}['dayOfWeekUtc'](){return this['val']['getDay']();}['setYear'](_0x3b0578){return this['val']['setFullYear'](_0x3b0578),this;}['setMonth'](_0x3e03e1){return this['val']['setMonth'](_0x3e03e1-0x1),this;}['setMonthUtc'](_0x4c05c8){return this['val']['setMonth'](_0x4c05c8),this;}['setDay'](_0x16a28d){return this['val']['setDate'](_0x16a28d),this;}['setHour'](_0x1bda69){return this['val']['setHours'](_0x1bda69),this;}['startOfHours'](){return this['setHour'](0x0),this['setMin'](0x0),this['setSeconds'](0x0),this['setMilliseconds'](0x0),this;}['endOfHours'](){return this['setHour'](0x17),this['setMin'](0x3b),this['setSeconds'](0x3b),this['setMilliseconds'](0x3e7),this;}['setMin'](_0x283101){return this['val']['setMinutes'](_0x283101),this;}['startOfMin'](){return this['setMin'](0x0),this['setSeconds'](0x0),this['setMilliseconds'](0x0),this;}['endOfMin'](){return this['setMin'](0x3b),this['setSeconds'](0x3b),this['setMilliseconds'](0x3e7),this;}['setSeconds'](_0x39cfef){return this['val']['setSeconds'](_0x39cfef),this;}['startOfSeconds'](){return this['setSeconds'](0x0),this['setMilliseconds'](0x0),this;}['endOfSeconds'](){return this['setSeconds'](0x3b),this['setMilliseconds'](0x3e7),this;}['setMilliseconds'](_0x13020c){return this['val']['setMilliseconds'](_0x13020c),this;}['startOfMilliseconds'](){return this['setMilliseconds'](0x0),this;}['endOfMilliseconds'](){return this['setMilliseconds'](0x3e7),this;}['setIsoDate'](_0x5bf09d){return this['val']=new Date(_0x5bf09d),this;}['setTime'](_0x165fd1){return this['val']=new Date(_0x165fd1),this;}['setDate'](_0xf84e5e){return this['val']=new Date(_0xf84e5e),this;}['setDateInputValue'](_0x5efa9d){return this['val']=new Date(_0x5efa9d?.['replace']('T','\x20')),this;}['setVal'](_0x3346ba){return a0_0x41e6dc(()=>{return a0_0x15ec60['new']()['setTime'](a0_0x12f807(_0x3346ba));});}['toIsoDate'](){return this['val']['toISOString']();}['toTime'](){return this['val']['getTime']();}['toDate'](){return this['val'];}['toDateMounthInput'](){return this['year']()+'-'+a0_0x17e88f(this['month']());}['toDateInput'](){return this['year']()+'-'+a0_0x17e88f(this['month']())+'-'+a0_0x17e88f(this['day']());}['toTimeInput'](_0x504faa=!![]){const _0x35e67e=[];return _0x35e67e['push'](a0_0x17e88f(this['hours']())),_0x35e67e['push'](a0_0x17e88f(this['min']())),_0x504faa&&_0x35e67e['push'](a0_0x17e88f(this['sec']())),_0x35e67e['join'](':');}['toDateTimeInput'](_0xa3798c=!![]){return this['toDateInput']()+'T'+this['toTimeInput'](_0xa3798c);}['strDate'](){const _0x2a3cbd={};return _0x2a3cbd['month']='2-digit',_0x2a3cbd['day']='2-digit',_0x2a3cbd['year']='numeric',this['val']['toLocaleDateString'](this['code'],_0x2a3cbd);}['strDateLocal'](_0x1f73e7){return this['val']['toLocaleDateString'](this['code'],_0x1f73e7);}['strTime'](){return a0_0x17e88f(this['hours']())+':'+a0_0x17e88f(this['min']())+':'+a0_0x17e88f(this['sec']());}['strTimeLocale'](_0x1d1fc7){return this['val']['toLocaleTimeString'](this['code'],_0x1d1fc7);}['strHHmm'](){return a0_0x17e88f(this['hours']())+':'+a0_0x17e88f(this['min']());}['str'](){return this['strDate']()+'\x20'+this['strTime']();}['strLocal'](_0x17629c){return this['val']['toLocaleString'](this['code'],_0x17629c);}['addDay'](_0x29e2be){return this['val']=new Date(this['val']['setHours'](this['val']['getHours']()+_0x29e2be*0x18)),this;}['addHours'](_0x20232c){return this['val']=new Date(this['val']['setHours'](this['val']['getHours']()+_0x20232c)),this;}['addMins'](_0x5ce330){return this['val']=new Date(this['val']['setMinutes'](this['val']['getMinutes']()+_0x5ce330)),this;}['startOfDay'](){return this['startOfHours'](),this;}['cpyByStartOfDay'](){return this['cpy']()['startOfDay']();}['endOfDay'](){return this['endOfHours'](),this;}['cpyByEndOfDay'](){return this['cpy']()['endOfDay']();}['startOfWeek'](){return this['addDay'](-this['dayOfWeek']()+0x1);}['cpyStartOfWeek'](){return this['cpy']()['addDay'](-this['dayOfWeek']()+0x1);}['endOfWeek'](){return this['startOfWeek']()['addDay'](0x6);}['cpyEndOfWeek'](){return this['cpyStartOfWeek']()['addDay'](0x6);}['startOfMonth'](){return this['setDay'](0x1),this['startOfDay'](),this;}['cpyByStartOfMonth'](){return this['cpy']()['startOfMonth']();}['endOfMonth'](){return this['setDate'](this['val'])['startOfMonth']()['setMonth'](this['month']()+0x1)['startOfMonth']()['addDay'](-0x1)['endOfDay'](),this;}['cpyByEndOfMonth'](){return this['cpy']()['endOfMonth']();}['eq'](_0x356599){return a0_0x41e6dc(()=>{return this['cpy']()['toTime']()===a0_0x12f807(_0x356599);});}['gt'](_0x2bcb52){return a0_0x41e6dc(()=>{return this['cpy']()['toTime']()>a0_0x12f807(_0x2bcb52);});}['gte'](_0x5e3711){return a0_0x41e6dc(()=>{return this['cpy']()['toTime']()>=a0_0x12f807(_0x5e3711);});}['lt'](_0xd36030){return a0_0x41e6dc(()=>{return this['cpy']()['toTime']()<a0_0x12f807(_0xd36030);});}['lte'](_0x517648){return a0_0x41e6dc(()=>{return this['cpy']()['toTime']()<=a0_0x12f807(_0x517648);});}static['diffDays'](_0x27ecce,_0x1a4494,_0x4cc8de){return a0_0x41e6dc(()=>{const _0x4bffc9=a0_0x12f807(_0x27ecce),_0x22cfa0=a0_0x12f807(_0x1a4494);return _0x4cc8de?Math['abs'](_0x4bffc9-_0x22cfa0)/0x36ee80/0x18:(_0x4bffc9-_0x22cfa0)/0x36ee80/0x18;});}static['diffHours'](_0x559639,_0x575324,_0xef24a){return a0_0x41e6dc(()=>{const _0x50d06d=a0_0x12f807(_0x559639),_0x3f038e=a0_0x12f807(_0x575324);return _0xef24a?Math['abs'](_0x50d06d-_0x3f038e)/0x36ee80:(_0x50d06d-_0x3f038e)/0x36ee80;});}static['diffMins'](_0x2b239e,_0x511263,_0x5f3b06){return a0_0x41e6dc(()=>{const _0x1e7d0e=a0_0x12f807(_0x2b239e),_0x434690=a0_0x12f807(_0x511263);return _0x5f3b06?Math['abs'](_0x1e7d0e-_0x434690)/0x3e8/0x3c:(_0x1e7d0e-_0x434690)/0x3e8/0x3c;});}static['diffSecs'](_0x533107,_0x4f378b,_0x182afc){return a0_0x41e6dc(()=>{const _0x9a7bd2=a0_0x12f807(_0x533107),_0x195b68=a0_0x12f807(_0x4f378b);return _0x182afc?Math['abs'](_0x9a7bd2-_0x195b68)/0x3e8:(_0x9a7bd2-_0x195b68)/0x3e8;});}}exports['MDateUtil']=a0_0x15ec60;function a0_0x41e6dc(_0x26ec46,_0x54e350){try{return _0x26ec46();}catch(_0x4bf87a){if(_0x54e350)return _0x54e350;throw new Error('UNKNOWN');}}function a0_0x12f807(_0x281bb5){try{if(_0x281bb5 instanceof a0_0x15ec60)return _0x281bb5['toTime']();if(_0x281bb5 instanceof Date)return _0x281bb5['getTime']();if(typeof _0x281bb5==='number')return _0x281bb5;if(typeof _0x281bb5==='string')return new Date(_0x281bb5)['getTime']();return 0x0;}catch(_0x14f330){throw new Error('ERROR');}}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&("get"in n?t.__esModule:!n.writable&&!n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){e[i=void 0===i?r:i]=t[r]}),__exportStar=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||__createBinding(t,e,r)};Object.defineProperty(exports,"__esModule",{value:!0}),__exportStar(require("./DateUtil"),exports);
1
+ 'use strict';var a0_0xd7f396=this&&this['__createBinding']||(Object['create']?function(_0x5494ae,_0x11bbb3,_0x3d75f0,_0xb834b1){if(_0xb834b1===undefined)_0xb834b1=_0x3d75f0;var _0x45ca08=Object['getOwnPropertyDescriptor'](_0x11bbb3,_0x3d75f0);if(!_0x45ca08||('get'in _0x45ca08?!_0x11bbb3['__esModule']:_0x45ca08['writable']||_0x45ca08['configurable'])){var _0x306135={};_0x306135['enumerable']=!![],_0x306135['get']=function(){return _0x11bbb3[_0x3d75f0];},_0x45ca08=_0x306135;}Object['defineProperty'](_0x5494ae,_0xb834b1,_0x45ca08);}:function(_0x1ed7a0,_0x56d570,_0x34bf83,_0x3bb541){if(_0x3bb541===undefined)_0x3bb541=_0x34bf83;_0x1ed7a0[_0x3bb541]=_0x56d570[_0x34bf83];}),a0_0x189a83=this&&this['__exportStar']||function(_0x1ccc13,_0x3161ff){for(var _0x4bf0da in _0x1ccc13)if(_0x4bf0da!=='default'&&!Object['prototype']['hasOwnProperty']['call'](_0x3161ff,_0x4bf0da))a0_0xd7f396(_0x3161ff,_0x1ccc13,_0x4bf0da);},a0_0x314d49={};a0_0x314d49['value']=!![],Object['defineProperty'](exports,'__esModule',a0_0x314d49),a0_0x189a83(require('./DateUtil'),exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mat-date",
3
- "version": "1.5.83",
3
+ "version": "1.7.11",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",