UNPKG

2.46 kBPlain TextView Raw
1import { GenericDateConstructor } from "date-fns";
2import type {
3 FormatOptions as DateFnsFormatOptions,
4 Locale as DateFnsLocale
5} from "date-fns";
6import { addDays } from "date-fns/addDays";
7import { addMonths } from "date-fns/addMonths";
8import { addWeeks } from "date-fns/addWeeks";
9import { addYears } from "date-fns/addYears";
10import { differenceInCalendarDays } from "date-fns/differenceInCalendarDays";
11import { differenceInCalendarMonths } from "date-fns/differenceInCalendarMonths";
12import { endOfISOWeek } from "date-fns/endOfISOWeek";
13import { endOfMonth } from "date-fns/endOfMonth";
14import { endOfWeek } from "date-fns/endOfWeek";
15import { endOfYear } from "date-fns/endOfYear";
16import { format } from "date-fns/format";
17import { getISOWeek } from "date-fns/getISOWeek";
18import { getWeek } from "date-fns/getWeek";
19import { isAfter } from "date-fns/isAfter";
20import { isBefore } from "date-fns/isBefore";
21import { isDate } from "date-fns/isDate";
22import { isSameDay } from "date-fns/isSameDay";
23import { isSameMonth } from "date-fns/isSameMonth";
24import { isSameYear } from "date-fns/isSameYear";
25import { max } from "date-fns/max";
26import { min } from "date-fns/min";
27import { setMonth } from "date-fns/setMonth";
28import { setYear } from "date-fns/setYear";
29import { startOfDay } from "date-fns/startOfDay";
30import { startOfISOWeek } from "date-fns/startOfISOWeek";
31import { startOfMonth } from "date-fns/startOfMonth";
32import { startOfWeek } from "date-fns/startOfWeek";
33import { startOfYear } from "date-fns/startOfYear";
34
35/** The options for the {@link Formatters}. */
36export type FormatOptions = DateFnsFormatOptions;
37
38/** The options for the {@link Labels}. */
39export type LabelOptions = DateFnsFormatOptions;
40
41/** The locale used within DayPicker. */
42export type Locale = DateFnsLocale;
43
44export type { Month as DateFnsMonth } from "date-fns";
45
46/**
47 * The default date library to use with the date picker.
48 *
49 * @private
50 * @internal
51 */
52export const dateLib = {
53 /** The constructor of the date object. */
54 Date: Date as GenericDateConstructor,
55 addDays,
56 addMonths,
57 addWeeks,
58 addYears,
59 differenceInCalendarDays,
60 differenceInCalendarMonths,
61 endOfISOWeek,
62 endOfMonth,
63 endOfWeek,
64 endOfYear,
65 format,
66 getISOWeek,
67 getWeek,
68 isAfter,
69 isBefore,
70 isDate,
71 isSameDay,
72 isSameMonth,
73 isSameYear,
74 max,
75 min,
76 setMonth,
77 setYear,
78 startOfDay,
79 startOfISOWeek,
80 startOfMonth,
81 startOfWeek,
82 startOfYear
83};