mat-date 1.3.15 → 1.3.39

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.
package/README.md CHANGED
@@ -1,24 +1 @@
1
- - ANIMATE
2
- - BADGES ( success, danger, info, light, primary, green )
3
- - BEHAVIOR
4
- - BUTTONS
5
- - CHECKBOX
6
- - COLLAPSE
7
- - DATEPICKER
8
- - DIVIDER
9
- - INCORRECT_ENTRY
10
- - INPUT
11
- - INPUT_FIELDS
12
- - MULTISELECT
13
- - NOTES
14
- - NUMERAL
15
- - PAGINATOR
16
- - PHONE
17
- - PROGRESS
18
- - RADIO_INPUT
19
- - RATE
20
- - SELECT
21
- - SPINNER
22
- - SWITCH
23
- - TEXTAREA
24
- - TOOLTIP
1
+ JS DATEUTIL
@@ -1,7 +1,23 @@
1
+ interface IStrOptions {
2
+ localeMatcher?: "best fit" | "lookup" | undefined;
3
+ weekday?: "long" | "short" | "narrow" | undefined;
4
+ era?: "long" | "short" | "narrow" | undefined;
5
+ year?: "numeric" | "2-digit" | undefined;
6
+ month?: "numeric" | "2-digit" | "long" | "short" | "narrow" | undefined;
7
+ day?: "numeric" | "2-digit" | undefined;
8
+ hour?: "numeric" | "2-digit" | undefined;
9
+ minute?: "numeric" | "2-digit" | undefined;
10
+ second?: "numeric" | "2-digit" | undefined;
11
+ timeZoneName?: "short" | "long" | "shortOffset" | "longOffset" | "shortGeneric" | "longGeneric" | undefined;
12
+ formatMatcher?: "best fit" | "basic" | undefined;
13
+ hour12?: boolean | undefined;
14
+ timeZone?: string | undefined;
15
+ }
1
16
  export declare class MDateUtil {
2
17
  private val;
3
18
  private static glCode;
4
19
  private code;
20
+ get localCode(): string;
5
21
  static new(): MDateUtil;
6
22
  static setCode(code: string): typeof MDateUtil;
7
23
  static seperator(): string;
@@ -36,9 +52,12 @@ export declare class MDateUtil {
36
52
  toTimeInput(): string;
37
53
  toDateTimeInput(): string;
38
54
  strDate(): string;
55
+ strDateLocal(options: IStrOptions): string;
39
56
  strTime(): string;
57
+ strTimeLocale(options: IStrOptions): string;
40
58
  strHHmm(): string;
41
59
  str(): string;
60
+ strLocal(options: IStrOptions): string;
42
61
  addDay(value: number): this;
43
62
  addHours(value: number): this;
44
63
  addMins(value: number): this;
@@ -55,3 +74,4 @@ export declare class MDateUtil {
55
74
  static diffMins(before: MDateUtil | Date | number | string, after: MDateUtil | Date | number | string): number;
56
75
  static diffSecs(before: MDateUtil | Date | number | string, after: MDateUtil | Date | number | string): number;
57
76
  }
77
+ export {};
package/dist/DateUtil.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MDateUtil=void 0;const padItem=(value,len=2)=>value.toString().padStart(len,"0");class MDateUtil{val=new Date;static glCode=void 0;code=void 0;static new(){return(new MDateUtil).setCode(MDateUtil.glCode)}static setCode(code){return MDateUtil.glCode=code,this}static seperator(){return(new Date).toLocaleDateString(MDateUtil.glCode).replace(/\d/g,"").split("")[0]}copy(){return MDateUtil.new().setTime(this.toTime())}setCode(code){return this.code=code,this}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 value=this.val.getDay();return value||7}dayOfWeekUtc(){return this.val.getDay()}setYear(value){return this.val.setFullYear(value),this}setMonth(value){return this.val.setMonth(value-1),this}setMonthUtc(value){return this.val.setMonth(value),this}setDay(value){return this.val.setDate(value),this}setHour(value){return this.val.setHours(value),this}setMin(value){return this.val.setMinutes(value),this}setSeconds(value){return this.val.setSeconds(value),this}setMilliseconds(value){return this.val.setMilliseconds(value),this}setIsoDate(value){return this.val=new Date(value),this}setTime(value){return this.val=new Date(value),this}setDate(value){return this.val=new Date(value),this}setDateInputValue(value){return this.val=new Date(value),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(){return this.strTime()}toDateTimeInput(){return this.toDateInput()+" "+this.toTimeInput()}strDate(){return this.val.toLocaleDateString(this.code,{month:"2-digit",day:"2-digit",year:"numeric"})}strTime(){return`${padItem(this.hours())}:${padItem(this.min())}:`+padItem(this.sec())}strHHmm(){return padItem(this.hours())+":"+padItem(this.min())}str(){return this.strDate()+" "+this.strTime()}addDay(value){return this.val.setHours(this.val.getHours()+24*value),this}addHours(value){return this.val.setHours(this.val.getHours()+value),this}addMins(value){return this.val.setMinutes(this.val.getMinutes()+value),this}startOfDay(){return this.setHour(0),this.setMin(0),this.setSeconds(0),this.setMilliseconds(0),this}copyByStartOfDay(){return this.copy().startOfDay()}endOfDay(){return this.setHour(23),this.setMin(59),this.setSeconds(59),this.setMilliseconds(999),this}copyByEndOfDay(){return this.copy().endOfDay()}startOfMonth(){return this.setDay(1),this.startOfDay(),this}copyByStartOfMonth(){return this.copy().startOfMonth()}endOfMonth(){return this.setDate(this.val).setMonth(this.month()+1).startOfMonth().addDay(-1).endOfDay(),this}copyByEndOfMonth(){return this.copy().endOfMonth()}static diffDays(before,after){try{var beforeVal=parse(before),afterVal=parse(after);return Math.abs(beforeVal-afterVal)/36e5/24}catch(error){throw new Error("UNKNOWN")}}static diffHours(before,after){try{var beforeVal=parse(before),afterVal=parse(after);return Math.abs(beforeVal-afterVal)/36e5}catch(error){throw new Error("UNKNOWN")}}static diffMins(before,after){try{var beforeVal=parse(before),afterVal=parse(after);return Math.abs(beforeVal-afterVal)/1e3/60}catch(error){throw new Error("UNKNOWN")}}static diffSecs(before,after){try{var beforeVal=parse(before),afterVal=parse(after);return Math.abs(beforeVal-afterVal)/1e3}catch(error){throw new Error("UNKNOWN")}}}function parse(before){try{return before instanceof MDateUtil?before.toTime():before instanceof Date?before.getTime():"number"==typeof before?before:"string"==typeof before?new Date(before).getTime():0}catch(error){throw new Error("ERROR")}}exports.MDateUtil=MDateUtil;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MDateUtil=void 0;const padItem=(value,len=2)=>value.toString().padStart(len,"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(code){return MDateUtil.glCode=code,this}static seperator(){return(new Date).toLocaleDateString(MDateUtil.glCode).replace(/\d/g,"").split("")[0]}copy(){return MDateUtil.new().setTime(this.toTime())}setCode(code){return this.code=code,this}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 value=this.val.getDay();return value||7}dayOfWeekUtc(){return this.val.getDay()}setYear(value){return this.val.setFullYear(value),this}setMonth(value){return this.val.setMonth(value-1),this}setMonthUtc(value){return this.val.setMonth(value),this}setDay(value){return this.val.setDate(value),this}setHour(value){return this.val.setHours(value),this}setMin(value){return this.val.setMinutes(value),this}setSeconds(value){return this.val.setSeconds(value),this}setMilliseconds(value){return this.val.setMilliseconds(value),this}setIsoDate(value){return this.val=new Date(value),this}setTime(value){return this.val=new Date(value),this}setDate(value){return this.val=new Date(value),this}setDateInputValue(value){return this.val=new Date(value),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(){return this.strTime()}toDateTimeInput(){return this.toDateInput()+" "+this.toTimeInput()}strDate(){return this.val.toLocaleDateString(this.code,{month:"2-digit",day:"2-digit",year:"numeric"})}strDateLocal(options){return this.val.toLocaleDateString(this.code,options)}strTime(){return`${padItem(this.hours())}:${padItem(this.min())}:`+padItem(this.sec())}strTimeLocale(options){return this.val.toLocaleTimeString(this.code,options)}strHHmm(){return padItem(this.hours())+":"+padItem(this.min())}str(){return this.strDate()+" "+this.strTime()}strLocal(options){return this.val.toLocaleString(this.code,options)}addDay(value){return this.val.setHours(this.val.getHours()+24*value),this}addHours(value){return this.val.setHours(this.val.getHours()+value),this}addMins(value){return this.val.setMinutes(this.val.getMinutes()+value),this}startOfDay(){return this.setHour(0),this.setMin(0),this.setSeconds(0),this.setMilliseconds(0),this}copyByStartOfDay(){return this.copy().startOfDay()}endOfDay(){return this.setHour(23),this.setMin(59),this.setSeconds(59),this.setMilliseconds(999),this}copyByEndOfDay(){return this.copy().endOfDay()}startOfMonth(){return this.setDay(1),this.startOfDay(),this}copyByStartOfMonth(){return this.copy().startOfMonth()}endOfMonth(){return this.setDate(this.val).setMonth(this.month()+1).startOfMonth().addDay(-1).endOfDay(),this}copyByEndOfMonth(){return this.copy().endOfMonth()}static diffDays(before,after){try{var beforeVal=parse(before),afterVal=parse(after);return Math.abs(beforeVal-afterVal)/36e5/24}catch(error){throw new Error("UNKNOWN")}}static diffHours(before,after){try{var beforeVal=parse(before),afterVal=parse(after);return Math.abs(beforeVal-afterVal)/36e5}catch(error){throw new Error("UNKNOWN")}}static diffMins(before,after){try{var beforeVal=parse(before),afterVal=parse(after);return Math.abs(beforeVal-afterVal)/1e3/60}catch(error){throw new Error("UNKNOWN")}}static diffSecs(before,after){try{var beforeVal=parse(before),afterVal=parse(after);return Math.abs(beforeVal-afterVal)/1e3}catch(error){throw new Error("UNKNOWN")}}}function parse(before){try{return before instanceof MDateUtil?before.toTime():before instanceof Date?before.getTime():"number"==typeof before?before:"string"==typeof before?new Date(before).getTime():0}catch(error){throw new Error("ERROR")}}exports.MDateUtil=MDateUtil;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mat-date",
3
- "version": "1.3.15",
3
+ "version": "1.3.39",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",