@midseelee/date-fns-buddhist-adapter 1.0.0
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/.claude/settings.local.json +9 -0
- package/LICENSE +22 -0
- package/README.md +49 -0
- package/dist/index.d.ts +86 -0
- package/dist/index.js +465 -0
- package/dist/models/adapters.d.ts +718 -0
- package/dist/models/adapters.js +2 -0
- package/dist/models/fields.d.ts +229 -0
- package/dist/models/fields.js +2 -0
- package/dist/models/index.d.ts +3 -0
- package/dist/models/index.js +4 -0
- package/dist/models/timezone.d.ts +1 -0
- package/dist/models/timezone.js +2 -0
- package/jest.config.ts +15 -0
- package/package.json +67 -0
|
@@ -0,0 +1,718 @@
|
|
|
1
|
+
import type { FieldSectionContentType, FieldSectionType } from './fields';
|
|
2
|
+
import type { PickersTimezone } from './timezone';
|
|
3
|
+
export interface AdapterFormats {
|
|
4
|
+
/**
|
|
5
|
+
* The 4-digit year.
|
|
6
|
+
* @example "2019"
|
|
7
|
+
*/
|
|
8
|
+
year: string;
|
|
9
|
+
/**
|
|
10
|
+
* The full month name.
|
|
11
|
+
* @example "January"
|
|
12
|
+
*/
|
|
13
|
+
month: string;
|
|
14
|
+
/**
|
|
15
|
+
* The abbreviated month name.
|
|
16
|
+
* @example "Jan"
|
|
17
|
+
*/
|
|
18
|
+
monthShort: string;
|
|
19
|
+
/**
|
|
20
|
+
* The day of the month.
|
|
21
|
+
* @example "1"
|
|
22
|
+
*/
|
|
23
|
+
dayOfMonth: string;
|
|
24
|
+
/**
|
|
25
|
+
* The name of the day of the week.
|
|
26
|
+
* @example "Wednesday"
|
|
27
|
+
*/
|
|
28
|
+
weekday: string;
|
|
29
|
+
/**
|
|
30
|
+
* The abbreviated name of the day of the week.
|
|
31
|
+
* @example "Wed"
|
|
32
|
+
* */
|
|
33
|
+
weekdayShort: string;
|
|
34
|
+
/**
|
|
35
|
+
* The hours, 24-hour clock.
|
|
36
|
+
* @example "23"
|
|
37
|
+
*/
|
|
38
|
+
hours24h: string;
|
|
39
|
+
/**
|
|
40
|
+
* The hours, 12-hour clock.
|
|
41
|
+
* @example "11"
|
|
42
|
+
*/
|
|
43
|
+
hours12h: string;
|
|
44
|
+
/**
|
|
45
|
+
* The meridiem.
|
|
46
|
+
* @example "AM"
|
|
47
|
+
*/
|
|
48
|
+
meridiem: string;
|
|
49
|
+
/**
|
|
50
|
+
* The minutes.
|
|
51
|
+
* @example "44"
|
|
52
|
+
*/
|
|
53
|
+
minutes: string;
|
|
54
|
+
/**
|
|
55
|
+
* The seconds.
|
|
56
|
+
* @example "00"
|
|
57
|
+
*/
|
|
58
|
+
seconds: string;
|
|
59
|
+
/** The localized full date.
|
|
60
|
+
* Used for the aria-label of the opening button of the `DatePicker`.
|
|
61
|
+
* @example "Jan 1, 2019"
|
|
62
|
+
*/
|
|
63
|
+
fullDate: string;
|
|
64
|
+
/**
|
|
65
|
+
* The partially localized full date with weekday, useful for text-to-speech accessibility.
|
|
66
|
+
* @example "Tuesday, January 1, 2019"
|
|
67
|
+
* @deprecated Never used internally.
|
|
68
|
+
*/
|
|
69
|
+
fullDateWithWeekday: string;
|
|
70
|
+
/**
|
|
71
|
+
* A keyboard input friendly date format.
|
|
72
|
+
* Used in the date fields.
|
|
73
|
+
* @example "02/13/2020
|
|
74
|
+
*/
|
|
75
|
+
keyboardDate: string;
|
|
76
|
+
/**
|
|
77
|
+
* The abbreviated month name and the day of the month.
|
|
78
|
+
* Used in the `DateRangePicker` toolbar.
|
|
79
|
+
* @example "Jan 1"
|
|
80
|
+
*/
|
|
81
|
+
shortDate: string;
|
|
82
|
+
/**
|
|
83
|
+
* The month name and the day of the month.
|
|
84
|
+
* Used in the `DatePicker` toolbar for non-english locales.
|
|
85
|
+
* @example "1 January"
|
|
86
|
+
*/
|
|
87
|
+
normalDate: string;
|
|
88
|
+
/**
|
|
89
|
+
* The month name, the day of the week and the day of the month.
|
|
90
|
+
* Used in the `DatePicker` toolbar for english locales.
|
|
91
|
+
* @example "Sun, Jan 1"
|
|
92
|
+
*/
|
|
93
|
+
normalDateWithWeekday: string;
|
|
94
|
+
/**
|
|
95
|
+
* The month name and the 4-digit year.
|
|
96
|
+
* @example "January 2018"
|
|
97
|
+
* @deprecated Use `${adapter.formats.month} ${adapter.formats.year}`
|
|
98
|
+
*/
|
|
99
|
+
monthAndYear: string;
|
|
100
|
+
/**
|
|
101
|
+
* The month name and the day of the month.
|
|
102
|
+
* @example "January 1"
|
|
103
|
+
* @deprecated Use `${adapter.formats.month} ${adapter.formats.dayOfMonth}`
|
|
104
|
+
*/
|
|
105
|
+
monthAndDate: string;
|
|
106
|
+
/**
|
|
107
|
+
* The hours and the minutes.
|
|
108
|
+
* Used for the aria-label of the opening button of the `TimePicker`.
|
|
109
|
+
* @example "11:44 PM" for locales with meridiem, "23:44" for locales without meridiem.
|
|
110
|
+
*/
|
|
111
|
+
fullTime: string;
|
|
112
|
+
/**
|
|
113
|
+
* The hours with the meridiem and minutes.
|
|
114
|
+
* @example "11:44 PM"
|
|
115
|
+
*/
|
|
116
|
+
fullTime12h: string;
|
|
117
|
+
/**
|
|
118
|
+
* The hours without the meridiem and minutes.
|
|
119
|
+
* @example "23:44"
|
|
120
|
+
*/
|
|
121
|
+
fullTime24h: string;
|
|
122
|
+
/**
|
|
123
|
+
* The combination of `fullDate` and `fullTime` formats.
|
|
124
|
+
* @example "Jan 1, 2018 11:44 PM"
|
|
125
|
+
* @deprecated Use `${adapter.formats.fullDate} ${adapter.formats.fullTime}`
|
|
126
|
+
*/
|
|
127
|
+
fullDateTime: string;
|
|
128
|
+
/**
|
|
129
|
+
* The combination of `fullDate` and `fullTime12h` formats.
|
|
130
|
+
* @example "Jan 1, 2018 11:44 PM"
|
|
131
|
+
* @deprecated Use `${adapter.formats.fullDate} ${adapter.formats.fullTime12h}`
|
|
132
|
+
*/
|
|
133
|
+
fullDateTime12h: string;
|
|
134
|
+
/**
|
|
135
|
+
* The combination of `fullDate` and `fullTime24h` formats.
|
|
136
|
+
* @example "Jan 1, 2018 23:44"
|
|
137
|
+
* @deprecated Use `${adapter.formats.fullDate} ${adapter.formats.fullTime24h}`
|
|
138
|
+
*/
|
|
139
|
+
fullDateTime24h: string;
|
|
140
|
+
/**
|
|
141
|
+
* A keyboard input friendly time format.
|
|
142
|
+
* Used in the date-time fields.
|
|
143
|
+
* @example "02/13/2020 11:44 PM" for locales with meridiem, "02/13/2020 23:44" for locales without meridiem.
|
|
144
|
+
*/
|
|
145
|
+
keyboardDateTime: string;
|
|
146
|
+
/**
|
|
147
|
+
* A keyboard input friendly time format for 12-hour clock.
|
|
148
|
+
* Used in the date-time fields.
|
|
149
|
+
* @example "02/13/2020 11:44 PM"
|
|
150
|
+
*/
|
|
151
|
+
keyboardDateTime12h: string;
|
|
152
|
+
/**
|
|
153
|
+
* A keyboard input friendly time format for 24-hour clock.
|
|
154
|
+
* Used in the date-time fields.
|
|
155
|
+
* @example "02/13/2020 23:44"
|
|
156
|
+
*/
|
|
157
|
+
keyboardDateTime24h: string;
|
|
158
|
+
}
|
|
159
|
+
export type AdapterUnits = 'years' | 'quarters' | 'months' | 'weeks' | 'days' | 'hours' | 'minutes' | 'seconds' | 'milliseconds';
|
|
160
|
+
export interface FieldFormatTokenMap {
|
|
161
|
+
[formatToken: string]: FieldSectionType | {
|
|
162
|
+
sectionType: FieldSectionType;
|
|
163
|
+
contentType: FieldSectionContentType;
|
|
164
|
+
maxLength?: number;
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
type PropertyIfNotNever<PName extends string, PType> = [PType] extends [never] ? Record<string, never> : {
|
|
168
|
+
[P in PName]?: PType;
|
|
169
|
+
};
|
|
170
|
+
export type AdapterOptions<TLocale, TInstance> = {
|
|
171
|
+
formats?: Partial<AdapterFormats>;
|
|
172
|
+
locale?: TLocale;
|
|
173
|
+
} & PropertyIfNotNever<'instance', TInstance>;
|
|
174
|
+
export interface MuiPickersAdapter<TDate, TLocale = any> {
|
|
175
|
+
/**
|
|
176
|
+
* A boolean confirming that the adapter used is an MUI adapter.
|
|
177
|
+
*/
|
|
178
|
+
isMUIAdapter: boolean;
|
|
179
|
+
isTimezoneCompatible: boolean;
|
|
180
|
+
formats: AdapterFormats;
|
|
181
|
+
locale?: TLocale;
|
|
182
|
+
/**
|
|
183
|
+
* Name of the library that is used right now
|
|
184
|
+
*/
|
|
185
|
+
lib: string;
|
|
186
|
+
/**
|
|
187
|
+
* The characters used to escape a string inside a format.
|
|
188
|
+
*/
|
|
189
|
+
escapedCharacters: {
|
|
190
|
+
start: string;
|
|
191
|
+
end: string;
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* A map containing all the format that the field components can understand.
|
|
195
|
+
*/
|
|
196
|
+
formatTokenMap: FieldFormatTokenMap;
|
|
197
|
+
/**
|
|
198
|
+
* Create a date in the date library format.
|
|
199
|
+
* If no `value` parameter is provided, creates a date with the current timestamp.
|
|
200
|
+
* If a `value` parameter is provided, pass it to the date library to try to parse it.
|
|
201
|
+
* @template TDate
|
|
202
|
+
* @param {any} value The optional value to parse.
|
|
203
|
+
* @returns {TDate | null} The parsed date.
|
|
204
|
+
*/
|
|
205
|
+
date(value?: any): TDate | null;
|
|
206
|
+
/**
|
|
207
|
+
* Create a date in the date library format.
|
|
208
|
+
* If no `value` parameter is provided, creates a date with the current timestamp.
|
|
209
|
+
* If a `value` parameter is provided, pass it to the date library to try to parse it.
|
|
210
|
+
* @template TDate
|
|
211
|
+
* @param {string | null | undefined} value The optional value to parse.
|
|
212
|
+
* @param {string} timezone The timezone of the date.
|
|
213
|
+
* @returns {TDate | null} The parsed date.
|
|
214
|
+
*/
|
|
215
|
+
dateWithTimezone(value: string | null | undefined, timezone: PickersTimezone): TDate | null;
|
|
216
|
+
/**
|
|
217
|
+
* Extracts the timezone from a date.
|
|
218
|
+
* @template TDate
|
|
219
|
+
* @param {TDate} value The date from which we want to get the timezone.
|
|
220
|
+
*/
|
|
221
|
+
getTimezone(value: TDate | null): string;
|
|
222
|
+
/**
|
|
223
|
+
* Convert a date to another timezone.
|
|
224
|
+
* @template TDate
|
|
225
|
+
* @param {TDate} value The date to convert.
|
|
226
|
+
* @param {string} timezone The timezone to convert the date to.
|
|
227
|
+
* @returns {TDate} The converted date.
|
|
228
|
+
*/
|
|
229
|
+
setTimezone(value: TDate, timezone: PickersTimezone): TDate;
|
|
230
|
+
/**
|
|
231
|
+
* Convert a date in the library format into a JavaScript `Date` object.
|
|
232
|
+
* @template TDate
|
|
233
|
+
* @param {TDate} value The value to convert.
|
|
234
|
+
* @returns {Date} the JavaScript date.
|
|
235
|
+
*/
|
|
236
|
+
toJsDate(value: TDate): Date;
|
|
237
|
+
/**
|
|
238
|
+
* Parse an iso string into a date in the date library format.
|
|
239
|
+
* @deprecate Will be removed in v7.
|
|
240
|
+
* @template TDate
|
|
241
|
+
* @param {string} isoString The iso string to parse.
|
|
242
|
+
* @returns {TDate} the parsed date.
|
|
243
|
+
*/
|
|
244
|
+
parseISO(isoString: string): TDate;
|
|
245
|
+
/**
|
|
246
|
+
* Stringify a date in the date library format into an ISO string.
|
|
247
|
+
* @deprecate Will be removed in v7.
|
|
248
|
+
* @template TDate
|
|
249
|
+
* @param {TDate} value The date to stringify.
|
|
250
|
+
* @returns {string} the iso string representing the date.
|
|
251
|
+
*/
|
|
252
|
+
toISO(value: TDate): string;
|
|
253
|
+
/**
|
|
254
|
+
* Parse a string date in a specific format.
|
|
255
|
+
* @template TDate
|
|
256
|
+
* @param {string} value The string date to parse.
|
|
257
|
+
* @param {string} format The format in which the string date is.
|
|
258
|
+
* @returns {TDate | null} The parsed date.
|
|
259
|
+
*/
|
|
260
|
+
parse(value: string, format: string): TDate | null;
|
|
261
|
+
/**
|
|
262
|
+
* Get the code of the locale currently used by the adapter.
|
|
263
|
+
* @returns {string} The code of the locale.
|
|
264
|
+
*/
|
|
265
|
+
getCurrentLocaleCode(): string;
|
|
266
|
+
/**
|
|
267
|
+
* Check if the current locale is using 12 hours cycle (i.e: time with meridiem).
|
|
268
|
+
* @returns {boolean} `true` if the current locale is using 12 hours cycle.
|
|
269
|
+
*/
|
|
270
|
+
is12HourCycleInCurrentLocale(): boolean;
|
|
271
|
+
/**
|
|
272
|
+
* Create a format with no meta-token (e.g: `LLL` or `PP`).
|
|
273
|
+
* @param {string} format The format to expand.
|
|
274
|
+
* @returns {string} The expanded format.
|
|
275
|
+
*/
|
|
276
|
+
expandFormat(format: string): string;
|
|
277
|
+
/**
|
|
278
|
+
* Create a user readable format (taking into account localized format tokens), useful to render helper text for input (e.g. placeholder).
|
|
279
|
+
* @deprecated Will be removed in v7.
|
|
280
|
+
* @param {string} format The format to analyze.
|
|
281
|
+
* @returns {string} The helper text of the given format.
|
|
282
|
+
*/
|
|
283
|
+
getFormatHelperText(format: string): string;
|
|
284
|
+
/**
|
|
285
|
+
* Check if the date is null.
|
|
286
|
+
* @deprecated Will be removed in v7.
|
|
287
|
+
* @template TDate
|
|
288
|
+
* @param {TDate | null} value The date to test.
|
|
289
|
+
* @returns {boolean} `true` if the date is null.
|
|
290
|
+
*/
|
|
291
|
+
isNull(value: TDate | null): boolean;
|
|
292
|
+
/**
|
|
293
|
+
* Check if the date is valid.
|
|
294
|
+
* @param {any} value The value to test.
|
|
295
|
+
* @returns {boolean} `true` if the value is valid.
|
|
296
|
+
*/
|
|
297
|
+
isValid(value: any): boolean;
|
|
298
|
+
/**
|
|
299
|
+
* Format a date using an adapter format string (see the `AdapterFormats` interface)
|
|
300
|
+
* @template TDate
|
|
301
|
+
* @param {TDate} value The date to format.
|
|
302
|
+
* @param {keyof AdapterFormats} formatKey The formatKey to use.
|
|
303
|
+
* @returns {string} The stringify date.
|
|
304
|
+
*/
|
|
305
|
+
format(value: TDate, formatKey: keyof AdapterFormats): string;
|
|
306
|
+
/**
|
|
307
|
+
* Format a date using a format of the date library.
|
|
308
|
+
* @template TDate
|
|
309
|
+
* @param {TDate} value The date to format.
|
|
310
|
+
* @param {string} formatString The format to use.
|
|
311
|
+
* @returns {string} The stringify date.
|
|
312
|
+
*/
|
|
313
|
+
formatByString(value: TDate, formatString: string): string;
|
|
314
|
+
/**
|
|
315
|
+
* Format a number to be rendered in the clock.
|
|
316
|
+
* Is being used in hijri and jalali adapters.
|
|
317
|
+
* @param {string} numberToFormat The number to format.
|
|
318
|
+
* @returns {string} The formatted number.
|
|
319
|
+
*/
|
|
320
|
+
formatNumber(numberToFormat: string): string;
|
|
321
|
+
/**
|
|
322
|
+
* Compute the difference between the two dates in the unit provided.
|
|
323
|
+
* @deprecated Will be removed in v7.
|
|
324
|
+
* @template TDate
|
|
325
|
+
* @param {TDate} value The reference date.
|
|
326
|
+
* @param {TDate | string} comparing The date to compare with the reference date.
|
|
327
|
+
* @param {AdapterUnits} unit The unit in which we want to the result to be.
|
|
328
|
+
* @returns {number} The diff between the two dates.
|
|
329
|
+
*/
|
|
330
|
+
getDiff(value: TDate, comparing: TDate | string, unit?: AdapterUnits): number;
|
|
331
|
+
/**
|
|
332
|
+
* Check if the two dates are equal (e.g: they represent the same timestamp).
|
|
333
|
+
* @param {any} value The reference date.
|
|
334
|
+
* @param {any} comparing The date to compare with the reference date.
|
|
335
|
+
* @returns {boolean} `true` if the two dates are equal.
|
|
336
|
+
*/
|
|
337
|
+
isEqual(value: any, comparing: any): boolean;
|
|
338
|
+
/**
|
|
339
|
+
* Check if the two dates are in the same year (using the timezone of the reference date).
|
|
340
|
+
* @template TDate
|
|
341
|
+
* @param {TDate} value The reference date.
|
|
342
|
+
* @param {TDate} comparing The date to compare with the reference date.
|
|
343
|
+
* @returns {boolean} `true` if the two dates are in the same year.
|
|
344
|
+
*/
|
|
345
|
+
isSameYear(value: TDate, comparing: TDate): boolean;
|
|
346
|
+
/**
|
|
347
|
+
* Check if the two dates are in the same month (using the timezone of the reference date).
|
|
348
|
+
* @template TDate
|
|
349
|
+
* @param {TDate} value The reference date.
|
|
350
|
+
* @param {TDate} comparing The date to compare with the reference date.
|
|
351
|
+
* @returns {boolean} `true` if the two dates are in the same month.
|
|
352
|
+
*/
|
|
353
|
+
isSameMonth(value: TDate, comparing: TDate): boolean;
|
|
354
|
+
/**
|
|
355
|
+
* Check if the two dates are in the same day (using the timezone of the reference date).
|
|
356
|
+
* @template TDate
|
|
357
|
+
* @param {TDate} value The reference date.
|
|
358
|
+
* @param {TDate} comparing The date to compare with the reference date.
|
|
359
|
+
* @returns {boolean} `true` if the two dates are in the same day.
|
|
360
|
+
*/
|
|
361
|
+
isSameDay(value: TDate, comparing: TDate): boolean;
|
|
362
|
+
/**
|
|
363
|
+
* Check if the two dates are at the same hour (using the timezone of the reference date).
|
|
364
|
+
* @template TDate
|
|
365
|
+
* @param {TDate} value The reference date.
|
|
366
|
+
* @param {TDate} comparing The date to compare with the reference date.
|
|
367
|
+
* @returns {boolean} `true` if the two dates are in the same hour.
|
|
368
|
+
*/
|
|
369
|
+
isSameHour(value: TDate, comparing: TDate): boolean;
|
|
370
|
+
/**
|
|
371
|
+
* Check if the reference date is after the second date.
|
|
372
|
+
* @template TDate
|
|
373
|
+
* @param {TDate} value The reference date.
|
|
374
|
+
* @param {TDate} comparing The date to compare with the reference date.
|
|
375
|
+
* @returns {boolean} `true` if the reference date is after the second date.
|
|
376
|
+
*/
|
|
377
|
+
isAfter(value: TDate, comparing: TDate): boolean;
|
|
378
|
+
/**
|
|
379
|
+
* Check if the year of the reference date is after the year of the second date (using the timezone of the reference date).
|
|
380
|
+
* @template TDate
|
|
381
|
+
* @param {TDate} value The reference date.
|
|
382
|
+
* @param {TDate} comparing The date to compare with the reference date.
|
|
383
|
+
* @returns {boolean} `true` if the year of the reference date is after the year of the second date.
|
|
384
|
+
*/
|
|
385
|
+
isAfterYear(value: TDate, comparing: TDate): boolean;
|
|
386
|
+
/**
|
|
387
|
+
* Check if the day of the reference date is after the day of the second date (using the timezone of the reference date).
|
|
388
|
+
* @template TDate
|
|
389
|
+
* @param {TDate} value The reference date.
|
|
390
|
+
* @param {TDate} comparing The date to compare with the reference date.
|
|
391
|
+
* @returns {boolean} `true` if the day of the reference date is after the day of the second date.
|
|
392
|
+
*/
|
|
393
|
+
isAfterDay(value: TDate, comparing: TDate): boolean;
|
|
394
|
+
/**
|
|
395
|
+
* Check if the reference date is before the second date.
|
|
396
|
+
* @template TDate
|
|
397
|
+
* @param {TDate} value The reference date.
|
|
398
|
+
* @param {TDate} comparing The date to compare with the reference date.
|
|
399
|
+
* @returns {boolean} `true` if the reference date is before the second date.
|
|
400
|
+
*/
|
|
401
|
+
isBefore(value: TDate, comparing: TDate): boolean;
|
|
402
|
+
/**
|
|
403
|
+
* Check if the year of the reference date is before the year of the second date (using the timezone of the reference date).
|
|
404
|
+
* @template TDate
|
|
405
|
+
* @param {TDate} value The reference date.
|
|
406
|
+
* @param {TDate} comparing The date to compare with the reference date.
|
|
407
|
+
* @returns {boolean} `true` if the year of the reference date is before the year of the second date.
|
|
408
|
+
*/
|
|
409
|
+
isBeforeYear(value: TDate, comparing: TDate): boolean;
|
|
410
|
+
/**
|
|
411
|
+
* Check if the day of the reference date is before the day of the second date (using the timezone of the reference date).
|
|
412
|
+
* @template TDate
|
|
413
|
+
* @param {TDate} value The reference date.
|
|
414
|
+
* @param {TDate} comparing The date to compare with the reference date.
|
|
415
|
+
* @returns {boolean} `true` if the day of the reference date is before the day of the second date.
|
|
416
|
+
*/
|
|
417
|
+
isBeforeDay(value: TDate, comparing: TDate): boolean;
|
|
418
|
+
/**
|
|
419
|
+
* Check if the value is withing the provided range.
|
|
420
|
+
* @template TDate
|
|
421
|
+
* @param {TDate} value The value to test.
|
|
422
|
+
* @param {[TDate, TDate]} range The range in which the value should be.
|
|
423
|
+
* @returns {boolean} `true` if the value is within the provided range.
|
|
424
|
+
*/
|
|
425
|
+
isWithinRange(value: TDate, range: [TDate, TDate]): boolean;
|
|
426
|
+
/**
|
|
427
|
+
* Return the start of the year for the given date.
|
|
428
|
+
* @template TDate
|
|
429
|
+
* @param {TDate} value The original date.
|
|
430
|
+
* @returns {TDate} The start of the year of the given date.
|
|
431
|
+
*/
|
|
432
|
+
startOfYear(value: TDate): TDate;
|
|
433
|
+
/**
|
|
434
|
+
* Return the start of the month for the given date.
|
|
435
|
+
* @template TDate
|
|
436
|
+
* @param {TDate} value The original date.
|
|
437
|
+
* @returns {TDate} The start of the month of the given date.
|
|
438
|
+
*/
|
|
439
|
+
startOfMonth(value: TDate): TDate;
|
|
440
|
+
/**
|
|
441
|
+
* Return the start of the week for the given date.
|
|
442
|
+
* @template TDate
|
|
443
|
+
* @param {TDate} value The original date.
|
|
444
|
+
* @returns {TDate} The start of the week of the given date.
|
|
445
|
+
*/
|
|
446
|
+
startOfWeek(value: TDate): TDate;
|
|
447
|
+
/**
|
|
448
|
+
* Return the start of the day for the given date.
|
|
449
|
+
* @template TDate
|
|
450
|
+
* @param {TDate} value The original date.
|
|
451
|
+
* @returns {TDate} The start of the day of the given date.
|
|
452
|
+
*/
|
|
453
|
+
startOfDay(value: TDate): TDate;
|
|
454
|
+
/**
|
|
455
|
+
* Return the end of the year for the given date.
|
|
456
|
+
* @template TDate
|
|
457
|
+
* @param {TDate} value The original date.
|
|
458
|
+
* @returns {TDate} The end of the year of the given date.
|
|
459
|
+
*/
|
|
460
|
+
endOfYear(value: TDate): TDate;
|
|
461
|
+
/**
|
|
462
|
+
* Return the end of the month for the given date.
|
|
463
|
+
* @template TDate
|
|
464
|
+
* @param {TDate} value The original date.
|
|
465
|
+
* @returns {TDate} The end of the month of the given date.
|
|
466
|
+
*/
|
|
467
|
+
endOfMonth(value: TDate): TDate;
|
|
468
|
+
/**
|
|
469
|
+
* Return the end of the week for the given date.
|
|
470
|
+
* @template TDate
|
|
471
|
+
* @param {TDate} value The original date.
|
|
472
|
+
* @returns {TDate} The end of the week of the given date.
|
|
473
|
+
*/
|
|
474
|
+
endOfWeek(value: TDate): TDate;
|
|
475
|
+
/**
|
|
476
|
+
* Return the end of the day for the given date.
|
|
477
|
+
* @template TDate
|
|
478
|
+
* @param {TDate} value The original date.
|
|
479
|
+
* @returns {TDate} The end of the day of the given date.
|
|
480
|
+
*/
|
|
481
|
+
endOfDay(value: TDate): TDate;
|
|
482
|
+
/**
|
|
483
|
+
* Add the specified number of years to the given date.
|
|
484
|
+
* @template TDate
|
|
485
|
+
* @param {TDate} value The date to be changed.
|
|
486
|
+
* @param {number} amount The amount of years to be added.
|
|
487
|
+
* @returns {TDate} The new date with the years added.
|
|
488
|
+
*/
|
|
489
|
+
addYears(value: TDate, amount: number): TDate;
|
|
490
|
+
/**
|
|
491
|
+
* Add the specified number of months to the given date.
|
|
492
|
+
* @template TDate
|
|
493
|
+
* @param {TDate} value The date to be changed.
|
|
494
|
+
* @param {number} amount The amount of months to be added.
|
|
495
|
+
* @returns {TDate} The new date with the months added.
|
|
496
|
+
*/
|
|
497
|
+
addMonths(value: TDate, amount: number): TDate;
|
|
498
|
+
/**
|
|
499
|
+
* Add the specified number of weeks to the given date.
|
|
500
|
+
* @template TDate
|
|
501
|
+
* @param {TDate} value The date to be changed.
|
|
502
|
+
* @param {number} amount The amount of weeks to be added.
|
|
503
|
+
* @returns {TDate} The new date with the weeks added.
|
|
504
|
+
*/
|
|
505
|
+
addWeeks(value: TDate, amount: number): TDate;
|
|
506
|
+
/**
|
|
507
|
+
* Add the specified number of days to the given date.
|
|
508
|
+
* @template TDate
|
|
509
|
+
* @param {TDate} value The date to be changed.
|
|
510
|
+
* @param {number} amount The amount of days to be added.
|
|
511
|
+
* @returns {TDate} The new date with the days added.
|
|
512
|
+
*/
|
|
513
|
+
addDays(value: TDate, amount: number): TDate;
|
|
514
|
+
/**
|
|
515
|
+
* Add the specified number of hours to the given date.
|
|
516
|
+
* @template TDate
|
|
517
|
+
* @param {TDate} value The date to be changed.
|
|
518
|
+
* @param {number} amount The amount of hours to be added.
|
|
519
|
+
* @returns {TDate} The new date with the hours added.
|
|
520
|
+
*/
|
|
521
|
+
addHours(value: TDate, amount: number): TDate;
|
|
522
|
+
/**
|
|
523
|
+
* Add the specified number of minutes to the given date.
|
|
524
|
+
* @template TDate
|
|
525
|
+
* @param {TDate} value The date to be changed.
|
|
526
|
+
* @param {number} amount The amount of minutes to be added.
|
|
527
|
+
* @returns {TDate} The new date with the minutes added.
|
|
528
|
+
*/
|
|
529
|
+
addMinutes(value: TDate, amount: number): TDate;
|
|
530
|
+
/**
|
|
531
|
+
* Add the specified number of seconds to the given date.
|
|
532
|
+
* @template TDate
|
|
533
|
+
* @param {TDate} value The date to be changed.
|
|
534
|
+
* @param {number} amount The amount of seconds to be added.
|
|
535
|
+
* @returns {TDate} The new date with the seconds added.
|
|
536
|
+
*/
|
|
537
|
+
addSeconds(value: TDate, amount: number): TDate;
|
|
538
|
+
/**
|
|
539
|
+
* Get the year of the given date.
|
|
540
|
+
* @template TDate
|
|
541
|
+
* @param {TDate} value The given date.
|
|
542
|
+
* @returns {number} The year of the given date.
|
|
543
|
+
*/
|
|
544
|
+
getYear(value: TDate): number;
|
|
545
|
+
/**
|
|
546
|
+
* Get the month of the given date.
|
|
547
|
+
* The value is 0-based, in the Gregorian calendar January = 0, February = 1, ...
|
|
548
|
+
* @template TDate
|
|
549
|
+
* @param {TDate} value The given date.
|
|
550
|
+
* @returns {number} The month of the given date.
|
|
551
|
+
*/
|
|
552
|
+
getMonth(value: TDate): number;
|
|
553
|
+
/**
|
|
554
|
+
* Get the date (e.g: the day in the month) of the given date.
|
|
555
|
+
* @template TDate
|
|
556
|
+
* @param {TDate} value The given date.
|
|
557
|
+
* @returns {number} The date of the given date.
|
|
558
|
+
*/
|
|
559
|
+
getDate(value: TDate): number;
|
|
560
|
+
/**
|
|
561
|
+
* Get the hours of the given date.
|
|
562
|
+
* @template TDate
|
|
563
|
+
* @param {TDate} value The given date.
|
|
564
|
+
* @returns {number} The hours of the given date.
|
|
565
|
+
*/
|
|
566
|
+
getHours(value: TDate): number;
|
|
567
|
+
/**
|
|
568
|
+
* Get the minutes of the given date.
|
|
569
|
+
* @template TDate
|
|
570
|
+
* @param {TDate} value The given date.
|
|
571
|
+
* @returns {number} The minutes of the given date.
|
|
572
|
+
*/
|
|
573
|
+
getMinutes(value: TDate): number;
|
|
574
|
+
/**
|
|
575
|
+
* Get the seconds of the given date.
|
|
576
|
+
* @template TDate
|
|
577
|
+
* @param {TDate} value The given date.
|
|
578
|
+
* @returns {number} The seconds of the given date.
|
|
579
|
+
*/
|
|
580
|
+
getSeconds(value: TDate): number;
|
|
581
|
+
/**
|
|
582
|
+
* Get the milliseconds of the given date.
|
|
583
|
+
* @template TDate
|
|
584
|
+
* @param {TDate} value The given date.
|
|
585
|
+
* @returns {number} The milliseconds of the given date.
|
|
586
|
+
*/
|
|
587
|
+
getMilliseconds(value: TDate): number;
|
|
588
|
+
/**
|
|
589
|
+
* Set the year to the given date.
|
|
590
|
+
* @template TDate
|
|
591
|
+
* @param {TDate} value The date to be changed.
|
|
592
|
+
* @param {number} year The year of the new date.
|
|
593
|
+
* @returns {TDate} The new date with the year set.
|
|
594
|
+
*/
|
|
595
|
+
setYear(value: TDate, year: number): TDate;
|
|
596
|
+
/**
|
|
597
|
+
* Set the month to the given date.
|
|
598
|
+
* @template TDate
|
|
599
|
+
* @param {TDate} value The date to be changed.
|
|
600
|
+
* @param {number} month The month of the new date.
|
|
601
|
+
* @returns {TDate} The new date with the month set.
|
|
602
|
+
*/
|
|
603
|
+
setMonth(value: TDate, month: number): TDate;
|
|
604
|
+
/**
|
|
605
|
+
* Set the date (e.g: the day in the month) to the given date.
|
|
606
|
+
* @template TDate
|
|
607
|
+
* @param {TDate} value The date to be changed.
|
|
608
|
+
* @param {number} date The date of the new date.
|
|
609
|
+
* @returns {TDate} The new date with the date set.
|
|
610
|
+
*/
|
|
611
|
+
setDate(value: TDate, date: number): TDate;
|
|
612
|
+
/**
|
|
613
|
+
* Set the hours to the given date.
|
|
614
|
+
* @template TDate
|
|
615
|
+
* @param {TDate} value The date to be changed.
|
|
616
|
+
* @param {number} hours The hours of the new date.
|
|
617
|
+
* @returns {TDate} The new date with the hours set.
|
|
618
|
+
*/
|
|
619
|
+
setHours(value: TDate, hours: number): TDate;
|
|
620
|
+
/**
|
|
621
|
+
* Set the minutes to the given date.
|
|
622
|
+
* @template TDate
|
|
623
|
+
* @param {TDate} value The date to be changed.
|
|
624
|
+
* @param {number} minutes The minutes of the new date.
|
|
625
|
+
* @returns {TDate} The new date with the minutes set.
|
|
626
|
+
*/
|
|
627
|
+
setMinutes(value: TDate, minutes: number): TDate;
|
|
628
|
+
/**
|
|
629
|
+
* Set the seconds to the given date.
|
|
630
|
+
* @template TDate
|
|
631
|
+
* @param {TDate} value The date to be changed.
|
|
632
|
+
* @param {number} seconds The seconds of the new date.
|
|
633
|
+
* @returns {TDate} The new date with the seconds set.
|
|
634
|
+
*/
|
|
635
|
+
setSeconds(value: TDate, seconds: number): TDate;
|
|
636
|
+
/**
|
|
637
|
+
* Set the milliseconds to the given date.
|
|
638
|
+
* @template TDate
|
|
639
|
+
* @param {TDate} value The date to be changed.
|
|
640
|
+
* @param {number} milliseconds The milliseconds of the new date.
|
|
641
|
+
* @returns {TDate} The new date with the milliseconds set.
|
|
642
|
+
*/
|
|
643
|
+
setMilliseconds(value: TDate, milliseconds: number): TDate;
|
|
644
|
+
/**
|
|
645
|
+
* Get the number of days in a month of the given date.
|
|
646
|
+
* @template TDate
|
|
647
|
+
* @param {TDate} value The given date.
|
|
648
|
+
* @returns {number} The number of days in the month
|
|
649
|
+
*/
|
|
650
|
+
getDaysInMonth(value: TDate): number;
|
|
651
|
+
/**
|
|
652
|
+
* Add one month to the given date.
|
|
653
|
+
* @deprecated Use `addMonths(value, 1)`
|
|
654
|
+
* @template TDate
|
|
655
|
+
* @param {TDate} value The given date.
|
|
656
|
+
* @returns {TDate} The new date with one month added.
|
|
657
|
+
*/
|
|
658
|
+
getNextMonth(value: TDate): TDate;
|
|
659
|
+
/**
|
|
660
|
+
* Subtract one month from the given date.
|
|
661
|
+
* @deprecated Use `addMonths(value, -1)`
|
|
662
|
+
* @template TDate
|
|
663
|
+
* @param {TDate} value The given date.
|
|
664
|
+
* @returns {TDate} The new date with one month subtracted.
|
|
665
|
+
*/
|
|
666
|
+
getPreviousMonth(value: TDate): TDate;
|
|
667
|
+
/**
|
|
668
|
+
* Get an array with all the months in the year of the given date.
|
|
669
|
+
* @deprecated Will be removed in v7.
|
|
670
|
+
* @template TDate
|
|
671
|
+
* @param {TDate} value The given date.
|
|
672
|
+
* @returns {TDate[]} All the months in the year of the given date.
|
|
673
|
+
*/
|
|
674
|
+
getMonthArray(value: TDate): TDate[];
|
|
675
|
+
/**
|
|
676
|
+
* Create a date with the date of the first param and the time of the second param.
|
|
677
|
+
* @deprecated Use `adapter.setHours`, `adapter.setMinutes` and `adapter.setSeconds`.
|
|
678
|
+
* @template TDate
|
|
679
|
+
* @param {TDate} dateParam Param from which we want to get the date.
|
|
680
|
+
* @param {TDate} timeParam Param from which we want to get the time.
|
|
681
|
+
* @returns Date with the date of the first param and the time of the second param.
|
|
682
|
+
*/
|
|
683
|
+
mergeDateAndTime(dateParam: TDate, timeParam: TDate): TDate;
|
|
684
|
+
/**
|
|
685
|
+
* Get the label of each day of a week.
|
|
686
|
+
* @returns {string[]} The label of each day of a week.
|
|
687
|
+
*/
|
|
688
|
+
getWeekdays(): string[];
|
|
689
|
+
/**
|
|
690
|
+
* Create a nested list with all the days of the month of the given date grouped by week.
|
|
691
|
+
* @template TDate
|
|
692
|
+
* @param {TDate} value The given date.
|
|
693
|
+
* @returns {TDate[][]} A nested list with all the days of the month grouped by week.
|
|
694
|
+
*/
|
|
695
|
+
getWeekArray(value: TDate): TDate[][];
|
|
696
|
+
/**
|
|
697
|
+
* Get the number of the week of the given date.
|
|
698
|
+
* @template TDate
|
|
699
|
+
* @param {TDate} value The given date.
|
|
700
|
+
* @returns {number} The number of the week of the given date.
|
|
701
|
+
*/
|
|
702
|
+
getWeekNumber(value: TDate): number;
|
|
703
|
+
/**
|
|
704
|
+
* Create a list with all the years between the start end the end date.
|
|
705
|
+
* @template TDate
|
|
706
|
+
* @param {TDate} start The start of the range.
|
|
707
|
+
* @param {TDate} end The end of the range.
|
|
708
|
+
* @returns {TDate[]} List of all the years between the start end the end date.
|
|
709
|
+
*/
|
|
710
|
+
getYearRange(start: TDate, end: TDate): TDate[];
|
|
711
|
+
/**
|
|
712
|
+
* Allow to customize how the "am"` and "pm" strings are rendered.
|
|
713
|
+
* @param {"am" | "pm"} meridiem The string to render.
|
|
714
|
+
* @return {string} The formatted string.
|
|
715
|
+
*/
|
|
716
|
+
getMeridiemText(meridiem: 'am' | 'pm'): string;
|
|
717
|
+
}
|
|
718
|
+
export {};
|