1 | /**
|
2 | * @module constants
|
3 | * @summary Useful constants
|
4 | * @description
|
5 | * Collection of useful date constants.
|
6 | *
|
7 | * The constants could be imported from `date-fns/constants`:
|
8 | *
|
9 | * ```ts
|
10 | * import { maxTime, minTime } from "./constants/date-fns/constants";
|
11 | *
|
12 | * function isAllowedTime(time) {
|
13 | * return time <= maxTime && time >= minTime;
|
14 | * }
|
15 | * ```
|
16 | */
|
17 | /**
|
18 | * @constant
|
19 | * @name daysInWeek
|
20 | * @summary Days in 1 week.
|
21 | */
|
22 | export declare const daysInWeek = 7;
|
23 | /**
|
24 | * @constant
|
25 | * @name daysInYear
|
26 | * @summary Days in 1 year.
|
27 | *
|
28 | * @description
|
29 | * How many days in a year.
|
30 | *
|
31 | * One years equals 365.2425 days according to the formula:
|
32 | *
|
33 | * > Leap year occurs every 4 years, except for years that are divisible by 100 and not divisible by 400.
|
34 | * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days
|
35 | */
|
36 | export declare const daysInYear = 365.2425;
|
37 | /**
|
38 | * @constant
|
39 | * @name maxTime
|
40 | * @summary Maximum allowed time.
|
41 | *
|
42 | * @example
|
43 | * import { maxTime } from "./constants/date-fns/constants";
|
44 | *
|
45 | * const isValid = 8640000000000001 <= maxTime;
|
46 | * //=> false
|
47 | *
|
48 | * new Date(8640000000000001);
|
49 | * //=> Invalid Date
|
50 | */
|
51 | export declare const maxTime: number;
|
52 | /**
|
53 | * @constant
|
54 | * @name minTime
|
55 | * @summary Minimum allowed time.
|
56 | *
|
57 | * @example
|
58 | * import { minTime } from "./constants/date-fns/constants";
|
59 | *
|
60 | * const isValid = -8640000000000001 >= minTime;
|
61 | * //=> false
|
62 | *
|
63 | * new Date(-8640000000000001)
|
64 | * //=> Invalid Date
|
65 | */
|
66 | export declare const minTime: number;
|
67 | /**
|
68 | * @constant
|
69 | * @name millisecondsInWeek
|
70 | * @summary Milliseconds in 1 week.
|
71 | */
|
72 | export declare const millisecondsInWeek = 604800000;
|
73 | /**
|
74 | * @constant
|
75 | * @name millisecondsInDay
|
76 | * @summary Milliseconds in 1 day.
|
77 | */
|
78 | export declare const millisecondsInDay = 86400000;
|
79 | /**
|
80 | * @constant
|
81 | * @name millisecondsInMinute
|
82 | * @summary Milliseconds in 1 minute
|
83 | */
|
84 | export declare const millisecondsInMinute = 60000;
|
85 | /**
|
86 | * @constant
|
87 | * @name millisecondsInHour
|
88 | * @summary Milliseconds in 1 hour
|
89 | */
|
90 | export declare const millisecondsInHour = 3600000;
|
91 | /**
|
92 | * @constant
|
93 | * @name millisecondsInSecond
|
94 | * @summary Milliseconds in 1 second
|
95 | */
|
96 | export declare const millisecondsInSecond = 1000;
|
97 | /**
|
98 | * @constant
|
99 | * @name minutesInYear
|
100 | * @summary Minutes in 1 year.
|
101 | */
|
102 | export declare const minutesInYear = 525600;
|
103 | /**
|
104 | * @constant
|
105 | * @name minutesInMonth
|
106 | * @summary Minutes in 1 month.
|
107 | */
|
108 | export declare const minutesInMonth = 43200;
|
109 | /**
|
110 | * @constant
|
111 | * @name minutesInDay
|
112 | * @summary Minutes in 1 day.
|
113 | */
|
114 | export declare const minutesInDay = 1440;
|
115 | /**
|
116 | * @constant
|
117 | * @name minutesInHour
|
118 | * @summary Minutes in 1 hour.
|
119 | */
|
120 | export declare const minutesInHour = 60;
|
121 | /**
|
122 | * @constant
|
123 | * @name monthsInQuarter
|
124 | * @summary Months in 1 quarter.
|
125 | */
|
126 | export declare const monthsInQuarter = 3;
|
127 | /**
|
128 | * @constant
|
129 | * @name monthsInYear
|
130 | * @summary Months in 1 year.
|
131 | */
|
132 | export declare const monthsInYear = 12;
|
133 | /**
|
134 | * @constant
|
135 | * @name quartersInYear
|
136 | * @summary Quarters in 1 year
|
137 | */
|
138 | export declare const quartersInYear = 4;
|
139 | /**
|
140 | * @constant
|
141 | * @name secondsInHour
|
142 | * @summary Seconds in 1 hour.
|
143 | */
|
144 | export declare const secondsInHour = 3600;
|
145 | /**
|
146 | * @constant
|
147 | * @name secondsInMinute
|
148 | * @summary Seconds in 1 minute.
|
149 | */
|
150 | export declare const secondsInMinute = 60;
|
151 | /**
|
152 | * @constant
|
153 | * @name secondsInDay
|
154 | * @summary Seconds in 1 day.
|
155 | */
|
156 | export declare const secondsInDay: number;
|
157 | /**
|
158 | * @constant
|
159 | * @name secondsInWeek
|
160 | * @summary Seconds in 1 week.
|
161 | */
|
162 | export declare const secondsInWeek: number;
|
163 | /**
|
164 | * @constant
|
165 | * @name secondsInYear
|
166 | * @summary Seconds in 1 year.
|
167 | */
|
168 | export declare const secondsInYear: number;
|
169 | /**
|
170 | * @constant
|
171 | * @name secondsInMonth
|
172 | * @summary Seconds in 1 month
|
173 | */
|
174 | export declare const secondsInMonth: number;
|
175 | /**
|
176 | * @constant
|
177 | * @name secondsInQuarter
|
178 | * @summary Seconds in 1 quarter.
|
179 | */
|
180 | export declare const secondsInQuarter: number;
|
181 | /**
|
182 | * @constant
|
183 | * @name constructFromSymbol
|
184 | * @summary Symbol enabling Date extensions to inherit properties from the reference date.
|
185 | *
|
186 | * The symbol is used to enable the `constructFrom` function to construct a date
|
187 | * using a reference date and a value. It allows to transfer extra properties
|
188 | * from the reference date to the new date. It's useful for extensions like
|
189 | * [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as
|
190 | * a constructor argument.
|
191 | */
|
192 | export declare const constructFromSymbol: unique symbol;
|