1 | import { addDays } from "date-fns/addDays";
|
2 | import { addHours } from "date-fns/addHours";
|
3 | import { addMinutes } from "date-fns/addMinutes";
|
4 | import { addMonths } from "date-fns/addMonths";
|
5 | import { addQuarters } from "date-fns/addQuarters";
|
6 | import { addSeconds } from "date-fns/addSeconds";
|
7 | import { addWeeks } from "date-fns/addWeeks";
|
8 | import { addYears } from "date-fns/addYears";
|
9 | import { getDate } from "date-fns/getDate";
|
10 | import { getDay } from "date-fns/getDay";
|
11 | import { getHours } from "date-fns/getHours";
|
12 | import { getMinutes } from "date-fns/getMinutes";
|
13 | import { getMonth } from "date-fns/getMonth";
|
14 | import { getQuarter } from "date-fns/getQuarter";
|
15 | import { getSeconds } from "date-fns/getSeconds";
|
16 | import { getTime } from "date-fns/getTime";
|
17 | import { getYear } from "date-fns/getYear";
|
18 | import { isAfter } from "date-fns/isAfter";
|
19 | import { isBefore } from "date-fns/isBefore";
|
20 | import { isDate } from "date-fns/isDate";
|
21 | import { set } from "date-fns/set";
|
22 | import { setHours } from "date-fns/setHours";
|
23 | import { setMinutes } from "date-fns/setMinutes";
|
24 | import { setMonth } from "date-fns/setMonth";
|
25 | import { setQuarter } from "date-fns/setQuarter";
|
26 | import { setYear } from "date-fns/setYear";
|
27 | import { subDays } from "date-fns/subDays";
|
28 | import { subMonths } from "date-fns/subMonths";
|
29 | import { subQuarters } from "date-fns/subQuarters";
|
30 | import { subWeeks } from "date-fns/subWeeks";
|
31 | import { subYears } from "date-fns/subYears";
|
32 | import type { Day, Locale as DateFnsLocale } from "date-fns";
|
33 | export type DateNumberType = Day;
|
34 | interface LocaleObj extends Pick<DateFnsLocale, "options" | "formatLong" | "localize" | "match"> {
|
35 | }
|
36 | export type Locale = string | LocaleObj;
|
37 | export declare enum KeyType {
|
38 | ArrowUp = "ArrowUp",
|
39 | ArrowDown = "ArrowDown",
|
40 | ArrowLeft = "ArrowLeft",
|
41 | ArrowRight = "ArrowRight",
|
42 | PageUp = "PageUp",
|
43 | PageDown = "PageDown",
|
44 | Home = "Home",
|
45 | End = "End",
|
46 | Enter = "Enter",
|
47 | Space = " ",
|
48 | Tab = "Tab",
|
49 | Escape = "Escape",
|
50 | Backspace = "Backspace",
|
51 | X = "x"
|
52 | }
|
53 | export declare const DEFAULT_YEAR_ITEM_NUMBER = 12;
|
54 | export declare function newDate(value?: string | Date | number | null): Date;
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 | export declare function parseDate(value: string, dateFormat: string | string[], locale: Locale | undefined, strictParsing: boolean, minDate?: Date): Date | null;
|
66 | export { isDate, set };
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 | export declare function isValid(date: Date, minDate?: Date): boolean;
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 | export declare function formatDate(date: Date, formatStr: string, locale?: Locale): string;
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 | export declare function safeDateFormat(date: Date | null | undefined, { dateFormat, locale }: {
|
91 | dateFormat: string | string[];
|
92 | locale?: Locale;
|
93 | }): string;
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 | export declare function safeDateRangeFormat(startDate: Date | null | undefined, endDate: Date | null | undefined, props: {
|
103 | dateFormat: string | string[];
|
104 | locale?: Locale;
|
105 | }): string;
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 | export declare function safeMultipleDatesFormat(dates: Date[], props: {
|
114 | dateFormat: string | string[];
|
115 | locale?: Locale;
|
116 | }): string;
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 | export declare function setTime(date: Date, { hour, minute, second }: {
|
125 | hour?: number | undefined;
|
126 | minute?: number | undefined;
|
127 | second?: number | undefined;
|
128 | }): Date;
|
129 | export { setMinutes, setHours, setMonth, setQuarter, setYear };
|
130 | export { getSeconds, getMinutes, getHours, getMonth, getQuarter, getYear, getDay, getDate, getTime, };
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 | export declare function getWeek(date: Date): number;
|
138 |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 |
|
144 |
|
145 | export declare function getDayOfWeekCode(day: Date, locale?: Locale): string;
|
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 | export declare function getStartOfDay(date: Date): Date;
|
153 |
|
154 |
|
155 |
|
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 | export declare function getStartOfWeek(date: Date, locale?: Locale, calendarStartDay?: Day): Date;
|
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 | export declare function getStartOfMonth(date: Date): Date;
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 |
|
175 | export declare function getStartOfYear(date: Date): Date;
|
176 |
|
177 |
|
178 |
|
179 |
|
180 |
|
181 |
|
182 | export declare function getStartOfQuarter(date: Date): Date;
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 | export declare function getStartOfToday(): Date;
|
189 |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 |
|
195 | export declare function getEndOfDay(date: Date): Date;
|
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 | export declare function getEndOfWeek(date: Date): Date;
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 | export declare function getEndOfMonth(date: Date): Date;
|
210 | export { addSeconds, addMinutes, addDays, addWeeks, addMonths, addQuarters, addYears, };
|
211 | export { addHours, subDays, subWeeks, subMonths, subQuarters, subYears };
|
212 | export { isBefore, isAfter };
|
213 |
|
214 |
|
215 |
|
216 |
|
217 |
|
218 |
|
219 |
|
220 | export declare function isSameYear(date1: Date | null, date2: Date | null): boolean;
|
221 |
|
222 |
|
223 |
|
224 |
|
225 |
|
226 |
|
227 |
|
228 | export declare function isSameMonth(date1: Date | null, date2?: Date | null): boolean;
|
229 |
|
230 |
|
231 |
|
232 |
|
233 |
|
234 |
|
235 |
|
236 | export declare function isSameQuarter(date1: Date | null, date2: Date | null): boolean;
|
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 |
|
243 |
|
244 | export declare function isSameDay(date1?: Date | null, date2?: Date | null): boolean;
|
245 |
|
246 |
|
247 |
|
248 |
|
249 |
|
250 |
|
251 |
|
252 | export declare function isEqual(date1: Date | null | undefined, date2: Date | null | undefined): boolean;
|
253 |
|
254 |
|
255 |
|
256 |
|
257 |
|
258 |
|
259 |
|
260 |
|
261 | export declare function isDayInRange(day: Date, startDate: Date, endDate: Date): boolean;
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 |
|
268 |
|
269 | export declare function getDaysDiff(date1: Date, date2: Date): number;
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 |
|
276 | export declare function registerLocale(localeName: string, localeData: LocaleObj): void;
|
277 |
|
278 |
|
279 |
|
280 |
|
281 |
|
282 | export declare function setDefaultLocale(localeName?: string): void;
|
283 |
|
284 |
|
285 |
|
286 |
|
287 |
|
288 | export declare function getDefaultLocale(): string | undefined;
|
289 |
|
290 |
|
291 |
|
292 |
|
293 |
|
294 |
|
295 | export declare function getLocaleObject(localeSpec?: Locale): LocaleObj | undefined;
|
296 |
|
297 |
|
298 |
|
299 |
|
300 |
|
301 |
|
302 |
|
303 |
|
304 | export declare function getFormattedWeekdayInLocale(date: Date, formatFunc: (date: string) => string, locale?: Locale): string;
|
305 |
|
306 |
|
307 |
|
308 |
|
309 |
|
310 |
|
311 |
|
312 | export declare function getWeekdayMinInLocale(date: Date, locale?: Locale): string;
|
313 |
|
314 |
|
315 |
|
316 |
|
317 |
|
318 |
|
319 |
|
320 | export declare function getWeekdayShortInLocale(date: Date, locale?: Locale): string;
|
321 |
|
322 |
|
323 |
|
324 |
|
325 |
|
326 |
|
327 |
|
328 | export declare function getMonthInLocale(month: number, locale?: Locale): string;
|
329 |
|
330 |
|
331 |
|
332 |
|
333 |
|
334 |
|
335 |
|
336 | export declare function getMonthShortInLocale(month: number, locale?: Locale): string;
|
337 |
|
338 |
|
339 |
|
340 |
|
341 |
|
342 |
|
343 |
|
344 | export declare function getQuarterShortInLocale(quarter: number, locale?: Locale): string;
|
345 | export interface DateFilterOptions {
|
346 | minDate?: Date;
|
347 | maxDate?: Date;
|
348 | excludeDates?: {
|
349 | date: Date;
|
350 | message?: string;
|
351 | }[] | Date[];
|
352 | excludeDateIntervals?: {
|
353 | start: Date;
|
354 | end: Date;
|
355 | }[];
|
356 | includeDates?: Date[];
|
357 | includeDateIntervals?: {
|
358 | start: Date;
|
359 | end: Date;
|
360 | }[];
|
361 | filterDate?: (date: Date) => boolean;
|
362 | yearItemNumber?: number;
|
363 | }
|
364 |
|
365 |
|
366 |
|
367 |
|
368 |
|
369 |
|
370 |
|
371 | export declare function isDayDisabled(day: Date, { minDate, maxDate, excludeDates, excludeDateIntervals, includeDates, includeDateIntervals, filterDate, }?: DateFilterOptions): boolean;
|
372 |
|
373 |
|
374 |
|
375 |
|
376 |
|
377 |
|
378 |
|
379 | export declare function isDayExcluded(day: Date, { excludeDates, excludeDateIntervals, }?: Pick<DateFilterOptions, "excludeDates" | "excludeDateIntervals">): boolean;
|
380 | export declare function isMonthDisabled(month: Date, { minDate, maxDate, excludeDates, includeDates, filterDate, }?: Pick<DateFilterOptions, "minDate" | "maxDate" | "excludeDates" | "includeDates" | "filterDate">): boolean;
|
381 | export declare function isMonthInRange(startDate: Date, endDate: Date, m: number, day: Date): boolean;
|
382 |
|
383 |
|
384 |
|
385 |
|
386 |
|
387 | export declare function isMonthYearDisabled(date: Date, { minDate, maxDate, excludeDates, includeDates, }?: Pick<DateFilterOptions, "minDate" | "maxDate" | "excludeDates" | "includeDates">): boolean;
|
388 | export declare function isQuarterDisabled(quarter: Date, { minDate, maxDate, excludeDates, includeDates, filterDate, }?: Pick<DateFilterOptions, "minDate" | "maxDate" | "excludeDates" | "includeDates" | "filterDate">): boolean;
|
389 | export declare function isYearInRange(year: number, start?: Date | null, end?: Date | null): boolean;
|
390 | export declare function isYearDisabled(year: number, { minDate, maxDate, excludeDates, includeDates, filterDate, }?: Pick<DateFilterOptions, "minDate" | "maxDate" | "excludeDates" | "includeDates" | "filterDate">): boolean;
|
391 | export declare function isQuarterInRange(startDate: Date, endDate: Date, q: number, day: Date): boolean;
|
392 | export declare function isOutOfBounds(day: Date, { minDate, maxDate }?: Pick<DateFilterOptions, "minDate" | "maxDate">): boolean;
|
393 | export declare function isTimeInList(time: Date, times: Date[]): boolean;
|
394 | export interface TimeFilterOptions {
|
395 | minTime?: Date;
|
396 | maxTime?: Date;
|
397 | excludeTimes?: Date[];
|
398 | includeTimes?: Date[];
|
399 | filterTime?: (time: Date) => boolean;
|
400 | }
|
401 | export declare function isTimeDisabled(time: Date, { excludeTimes, includeTimes, filterTime, }?: Pick<TimeFilterOptions, "excludeTimes" | "includeTimes" | "filterTime">): boolean;
|
402 | export declare function isTimeInDisabledRange(time: Date, { minTime, maxTime }: Pick<TimeFilterOptions, "minTime" | "maxTime">): boolean;
|
403 | export declare function monthDisabledBefore(day: Date, { minDate, includeDates, }?: Pick<DateFilterOptions, "minDate" | "includeDates">): boolean;
|
404 | export declare function monthDisabledAfter(day: Date, { maxDate, includeDates, }?: Pick<DateFilterOptions, "maxDate" | "includeDates">): boolean;
|
405 | export declare function quarterDisabledBefore(date: Date, { minDate, includeDates, }?: Pick<DateFilterOptions, "minDate" | "includeDates">): boolean;
|
406 | export declare function quarterDisabledAfter(date: Date, { maxDate, includeDates, }?: Pick<DateFilterOptions, "maxDate" | "includeDates">): boolean;
|
407 | export declare function yearDisabledBefore(day: Date, { minDate, includeDates, }?: Pick<DateFilterOptions, "minDate" | "includeDates">): boolean;
|
408 | export declare function yearsDisabledBefore(day: Date, { minDate, yearItemNumber, }?: Pick<DateFilterOptions, "minDate" | "yearItemNumber">): boolean;
|
409 | export declare function yearDisabledAfter(day: Date, { maxDate, includeDates, }?: Pick<DateFilterOptions, "maxDate" | "includeDates">): boolean;
|
410 | export declare function yearsDisabledAfter(day: Date, { maxDate, yearItemNumber, }?: Pick<DateFilterOptions, "maxDate" | "yearItemNumber">): boolean;
|
411 | export declare function getEffectiveMinDate({ minDate, includeDates, }: Pick<DateFilterOptions, "minDate" | "includeDates">): Date | undefined;
|
412 | export declare function getEffectiveMaxDate({ maxDate, includeDates, }: Pick<DateFilterOptions, "maxDate" | "includeDates">): Date | undefined;
|
413 | export interface HighlightDate {
|
414 | [className: string]: Date[];
|
415 | }
|
416 |
|
417 |
|
418 |
|
419 |
|
420 |
|
421 |
|
422 | export declare function getHighLightDaysMap(highlightDates?: (Date | HighlightDate)[], defaultClassName?: string): Map<string, string[]>;
|
423 |
|
424 |
|
425 |
|
426 |
|
427 |
|
428 |
|
429 | export declare function arraysAreEqual<T>(array1: T[], array2: T[]): boolean;
|
430 | export interface HolidayItem {
|
431 | date: Date;
|
432 | holidayName: string;
|
433 | }
|
434 | interface ClassNamesObj {
|
435 | className: string;
|
436 | holidayNames: string[];
|
437 | }
|
438 | export type HolidaysMap = Map<string, ClassNamesObj>;
|
439 |
|
440 |
|
441 |
|
442 |
|
443 |
|
444 |
|
445 | export declare function getHolidaysMap(holidayDates?: HolidayItem[], defaultClassName?: string): HolidaysMap;
|
446 |
|
447 |
|
448 |
|
449 |
|
450 |
|
451 |
|
452 |
|
453 |
|
454 |
|
455 | export declare function timesToInjectAfter(startOfDay: Date, currentTime: Date, currentMultiplier: number, intervals: number, injectedTimes: Date[]): Date[];
|
456 |
|
457 |
|
458 |
|
459 |
|
460 |
|
461 | export declare function addZero(i: number): string;
|
462 |
|
463 |
|
464 |
|
465 |
|
466 |
|
467 |
|
468 | export declare function getYearsPeriod(date: Date, yearItemNumber?: number): {
|
469 | startPeriod: number;
|
470 | endPeriod: number;
|
471 | };
|
472 |
|
473 |
|
474 |
|
475 |
|
476 |
|
477 | export declare function getHoursInDay(d: Date): number;
|
478 |
|
479 |
|
480 |
|
481 |
|
482 |
|
483 |
|
484 |
|
485 |
|
486 |
|
487 |
|
488 |
|
489 |
|
490 | export declare function startOfMinute(d: Date): Date;
|
491 |
|
492 |
|
493 |
|
494 |
|
495 |
|
496 |
|
497 |
|
498 |
|
499 |
|
500 | export declare function isSameMinute(d1: Date, d2: Date): boolean;
|
501 |
|
502 |
|
503 |
|
504 |
|
505 |
|
506 | export declare function getMidnightDate(date: Date): Date;
|
507 |
|
508 |
|
509 |
|
510 |
|
511 |
|
512 |
|
513 |
|
514 |
|
515 |
|
516 |
|
517 | export declare function isDateBefore(date: Date, dateToCompare: Date): boolean;
|
518 |
|
519 |
|
520 |
|
521 |
|
522 |
|
523 |
|
524 | export declare function isSpaceKeyDown(event: React.KeyboardEvent<HTMLDivElement>): boolean;
|