1 | export interface DateIOFormats<TLibFormatToken = string> {
|
2 |
|
3 | fullDate: TLibFormatToken;
|
4 |
|
5 | fullDateWithWeekday: TLibFormatToken;
|
6 |
|
7 | normalDate: TLibFormatToken;
|
8 |
|
9 | normalDateWithWeekday: TLibFormatToken;
|
10 |
|
11 | shortDate: TLibFormatToken;
|
12 |
|
13 | year: TLibFormatToken;
|
14 |
|
15 | month: TLibFormatToken;
|
16 |
|
17 | monthShort: TLibFormatToken;
|
18 |
|
19 | monthAndYear: TLibFormatToken;
|
20 |
|
21 | monthAndDate: TLibFormatToken;
|
22 |
|
23 | weekday: TLibFormatToken;
|
24 |
|
25 | weekdayShort: TLibFormatToken;
|
26 |
|
27 | dayOfMonth: TLibFormatToken;
|
28 |
|
29 | hours12h: TLibFormatToken;
|
30 |
|
31 | hours24h: TLibFormatToken;
|
32 |
|
33 | minutes: TLibFormatToken;
|
34 |
|
35 | seconds: TLibFormatToken;
|
36 |
|
37 | fullTime: TLibFormatToken;
|
38 |
|
39 | fullTime12h: TLibFormatToken;
|
40 |
|
41 | fullTime24h: TLibFormatToken;
|
42 |
|
43 | fullDateTime: TLibFormatToken;
|
44 |
|
45 | fullDateTime12h: TLibFormatToken;
|
46 |
|
47 | fullDateTime24h: TLibFormatToken;
|
48 |
|
49 | keyboardDate: TLibFormatToken;
|
50 |
|
51 | keyboardDateTime: TLibFormatToken;
|
52 |
|
53 | keyboardDateTime12h: TLibFormatToken;
|
54 |
|
55 | keyboardDateTime24h: TLibFormatToken;
|
56 | }
|
57 |
|
58 | export type Unit =
|
59 | | "years"
|
60 | | "quarters"
|
61 | | "months"
|
62 | | "weeks"
|
63 | | "days"
|
64 | | "hours"
|
65 | | "minutes"
|
66 | | "seconds"
|
67 | | "milliseconds";
|
68 |
|
69 | export interface ExtendableDateType {}
|
70 |
|
71 | export interface IUtils<TDate extends ExtendableDateType> {
|
72 | formats: DateIOFormats<any>;
|
73 | locale?: any;
|
74 | moment?: any;
|
75 | dayjs?: any;
|
76 |
|
77 | lib: string;
|
78 |
|
79 |
|
80 |
|
81 | date(value?: any): TDate | null;
|
82 | toJsDate(value: TDate): Date;
|
83 | parseISO(isString: string): TDate;
|
84 | toISO(value: TDate): string;
|
85 | parse(value: string, format: string): TDate | null;
|
86 |
|
87 | getCurrentLocaleCode(): string;
|
88 | is12HourCycleInCurrentLocale(): boolean;
|
89 | |
90 |
|
91 |
|
92 |
|
93 | getFormatHelperText(format: string): string;
|
94 |
|
95 | isNull(value: TDate | null): boolean;
|
96 | isValid(value: any): boolean;
|
97 | getDiff(value: TDate, comparing: TDate | string, unit?: Unit): number;
|
98 | isEqual(value: any, comparing: any): boolean;
|
99 |
|
100 | isSameDay(value: TDate, comparing: TDate): boolean;
|
101 | isSameMonth(value: TDate, comparing: TDate): boolean;
|
102 | isSameYear(value: TDate, comparing: TDate): boolean;
|
103 | isSameHour(value: TDate, comparing: TDate): boolean;
|
104 |
|
105 | isAfter(value: TDate, comparing: TDate): boolean;
|
106 | isAfterDay(value: TDate, comparing: TDate): boolean;
|
107 | isAfterMonth(value: TDate, comparing: TDate): boolean;
|
108 | isAfterYear(value: TDate, comparing: TDate): boolean;
|
109 |
|
110 | isBefore(value: TDate, comparing: TDate): boolean;
|
111 | isBeforeDay(value: TDate, comparing: TDate): boolean;
|
112 | isBeforeMonth(value: TDate, comparing: TDate): boolean;
|
113 | isBeforeYear(value: TDate, comparing: TDate): boolean;
|
114 |
|
115 | isWithinRange(value: TDate, range: [TDate, TDate]): boolean;
|
116 |
|
117 | startOfYear(value: TDate): TDate;
|
118 | endOfYear(value: TDate): TDate;
|
119 | startOfMonth(value: TDate): TDate;
|
120 | endOfMonth(value: TDate): TDate;
|
121 | startOfWeek(value: TDate): TDate;
|
122 | endOfWeek(value: TDate): TDate;
|
123 |
|
124 | addSeconds(value: TDate, count: number): TDate;
|
125 | addMinutes(value: TDate, count: number): TDate;
|
126 | addHours(value: TDate, count: number): TDate;
|
127 | addDays(value: TDate, count: number): TDate;
|
128 | addWeeks(value: TDate, count: number): TDate;
|
129 | addMonths(value: TDate, count: number): TDate;
|
130 | addYears(value: TDate, count: number): TDate;
|
131 |
|
132 | startOfDay(value: TDate): TDate;
|
133 | endOfDay(value: TDate): TDate;
|
134 |
|
135 | format(value: TDate, formatKey: keyof DateIOFormats): string;
|
136 | formatByString(value: TDate, formatString: string): string;
|
137 | formatNumber(numberToFormat: string): string;
|
138 |
|
139 | getHours(value: TDate): number;
|
140 | setHours(value: TDate, count: number): TDate;
|
141 |
|
142 | getMinutes(value: TDate): number;
|
143 | setMinutes(value: TDate, count: number): TDate;
|
144 |
|
145 | getSeconds(value: TDate): number;
|
146 | setSeconds(value: TDate, count: number): TDate;
|
147 |
|
148 | getDate(value: TDate): number;
|
149 | setDate(value: TDate, count: number): TDate;
|
150 |
|
151 | getMonth(value: TDate): number;
|
152 | getDaysInMonth(value: TDate): number;
|
153 | setMonth(value: TDate, count: number): TDate;
|
154 | getNextMonth(value: TDate): TDate;
|
155 | getPreviousMonth(value: TDate): TDate;
|
156 |
|
157 | getMonthArray(value: TDate): TDate[];
|
158 |
|
159 | getYear(value: TDate): number;
|
160 | setYear(value: TDate, count: number): TDate;
|
161 |
|
162 | mergeDateAndTime(date: TDate, time: TDate): TDate;
|
163 |
|
164 | getWeekdays(): string[];
|
165 | getWeekArray(date: TDate): TDate[][];
|
166 | getYearRange(start: TDate, end: TDate): TDate[];
|
167 |
|
168 |
|
169 | getMeridiemText(ampm: "am" | "pm"): string;
|
170 | }
|