All files / datetime / constants.ts

100.00% Branches 0/0
100.00% Lines 24/24
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
 
 
 
 
 
 
 
 
 
 
 
 
 
x34
 
 
 
 
 
 
 
 
 
 
x34
 
 
 
 
 
 
 
 
 
 
x34
 
 
 
 
 
 
 
 
 
 
x34
 
 
 
 
 
 
 
 
 
 
x34
 
 
 
 
 
 
 
 
 
 
x34
 
 
 
 
 
 
 
 
 
 
x34
 
 
 
 
 
 
 
 
 
 
x34
 
 
 
 
 
 
 
 
 
 
x34
 
 
 
 
 
 
 
 
 
 
x34
 
 
 
 
 
 
 
 
 
 
x34
 
 
 
 
 
 
 
 
 
 
x34
 
 
 
 
 
 
 
 
 
 
x34
 
 
 
 
 
 
 
 
 
 
x34
 
 
 
 
 
 
 
 
 
 
x34
 
 
 
 
 
 
 
 
 
 
x34
 
 
 
 
 
 
 
 
 
 
x34
 
 
 
 
 
 
 
 
 
 
x34
 
 
 
 
 
 
 
 
 
 
x34
 
 
 
 
 
 
 
 
 
 
x34
 
 
 
 
 
 
 
 
 
 
x34
 
 
 
 
 
 
 
 
 
 
x34
 
 
 
 
 
 
 
 
 
 
x34
 
 
 
 
 
 
 
 
 
 
x34









































































































































































































































































// Copyright 2018-2026 the Deno authors. MIT license.
// This module is browser compatible.

/**
 * The number of milliseconds in a second.
 *
 * @example
 * ```ts
 * import { SECOND } from "@std/datetime/constants";
 *
 * SECOND; // 1_000
 * ```
 */
export const SECOND = 1e3;
/**
 * The number of milliseconds in a minute.
 *
 * @example
 * ```ts
 * import { MINUTE } from "@std/datetime/constants";
 *
 * MINUTE; // 60_000
 * ```
 */
export const MINUTE: number = SECOND * 60;
/**
 * The number of milliseconds in an hour.
 *
 * @example
 * ```ts
 * import { HOUR } from "@std/datetime/constants";
 *
 * HOUR; // 3_600_000
 * ```
 */
export const HOUR: number = MINUTE * 60;
/**
 * The number of milliseconds in a day.
 *
 * @example
 * ```ts
 * import { DAY } from "@std/datetime/constants";
 *
 * DAY; // 86_400_000
 * ```
 */
export const DAY: number = HOUR * 24;
/**
 * The number of milliseconds in a week.
 *
 * @example
 * ```ts
 * import { WEEK } from "@std/datetime/constants";
 *
 * WEEK; // 604_800_000
 * ```
 */
export const WEEK: number = DAY * 7;
/**
 * The month index for January.
 *
 * @example
 * ```ts
 * import { JANUARY } from "@std/datetime/constants";
 *
 * new Date(2025, JANUARY, 1); // 2025-01-01
 * ```
 */
export const JANUARY = 0;
/**
 * The month index for February.
 *
 * @example
 * ```ts
 * import { FEBRUARY } from "@std/datetime/constants";
 *
 * new Date(2025, FEBRUARY, 1); // 2025-02-01
 * ```
 */
export const FEBRUARY = 1;
/**
 * The month index for March.
 *
 * @example
 * ```ts
 * import { MARCH } from "@std/datetime/constants";
 *
 * new Date(2025, MARCH, 1); // 2025-03-01
 * ```
 */
export const MARCH = 2;
/**
 * The month index for April.
 *
 * @example
 * ```ts
 * import { APRIL } from "@std/datetime/constants";
 *
 * new Date(2025, APRIL, 1); // 2025-04-01
 * ```
 */
export const APRIL = 3;
/**
 * The month index for May.
 *
 * @example
 * ```ts
 * import { MAY } from "@std/datetime/constants";
 *
 * new Date(2025, MAY, 1); // 2025-05-01
 * ```
 */
export const MAY = 4;
/**
 * The month index for June.
 *
 * @example
 * ```ts
 * import { JUNE } from "@std/datetime/constants";
 *
 * new Date(2025, JUNE, 1); // 2025-06-01
 * ```
 */
export const JUNE = 5;
/**
 * The month index for July.
 *
 * @example
 * ```ts
 * import { JULY } from "@std/datetime/constants";
 *
 * new Date(2025, JULY, 1); // 2025-07-01
 * ```
 */
export const JULY = 6;
/**
 * The month index for August.
 *
 * @example
 * ```ts
 * import { AUGUST } from "@std/datetime/constants";
 *
 * new Date(2025, AUGUST, 1); // 2025-08-01
 * ```
 */
export const AUGUST = 7;
/**
 * The month index for September.
 *
 * @example
 * ```ts
 * import { SEPTEMBER } from "@std/datetime/constants";
 *
 * new Date(2025, SEPTEMBER, 1); // 2025-09-01
 * ```
 */
export const SEPTEMBER = 8;
/**
 * The month index for October.
 *
 * @example
 * ```ts
 * import { OCTOBER } from "@std/datetime/constants";
 *
 * new Date(2025, OCTOBER, 1); // 2025-10-01
 * ```
 */
export const OCTOBER = 9;
/**
 * The month index for November.
 *
 * @example
 * ```ts
 * import { NOVEMBER } from "@std/datetime/constants";
 *
 * new Date(2025, NOVEMBER, 1); // 2025-11-01
 * ```
 */
export const NOVEMBER = 10;
/**
 * The month index for December.
 *
 * @example
 * ```ts
 * import { DECEMBER } from "@std/datetime/constants";
 *
 * new Date(2025, DECEMBER, 1); // 2025-12-01
 * ```
 */
export const DECEMBER = 11;
/**
 * The day of week index for Sunday.
 *
 * @example
 * ```ts
 * import { JANUARY, SUNDAY } from "@std/datetime/constants";
 *
 * new Date(2025, JANUARY, 5).getDay() === SUNDAY; // true
 * ```
 */
export const SUNDAY = 0;
/**
 * The day of week index for Monday.
 *
 * @example
 * ```ts
 * import { JANUARY, MONDAY } from "@std/datetime/constants";
 *
 * new Date(2025, JANUARY, 6).getDay() === MONDAY; // true
 * ```
 */
export const MONDAY = 1;
/**
 * The day of week index for Tuesday.
 *
 * @example
 * ```ts
 * import { JANUARY, TUESDAY } from "@std/datetime/constants";
 *
 * new Date(2025, JANUARY, 7).getDay() === TUESDAY; // true
 * ```
 */
export const TUESDAY = 2;
/**
 * The day of week index for Wednesday.
 *
 * @example
 * ```ts
 * import { JANUARY, WEDNESDAY } from "@std/datetime/constants";
 *
 * new Date(2025, JANUARY, 1).getDay() === WEDNESDAY; // true
 * ```
 */
export const WEDNESDAY = 3;
/**
 * The day of week index for Thursday.
 *
 * @example
 * ```ts
 * import { JANUARY, THURSDAY } from "@std/datetime/constants";
 *
 * new Date(2025, JANUARY, 2).getDay() === THURSDAY; // true
 * ```
 */
export const THURSDAY = 4;
/**
 * The day of week index for Friday.
 *
 * @example
 * ```ts
 * import { JANUARY, FRIDAY } from "@std/datetime/constants";
 *
 * new Date(2025, JANUARY, 3).getDay() === FRIDAY; // true
 * ```
 */
export const FRIDAY = 5;
/**
 * The day of week index for Saturday.
 *
 * @example
 * ```ts
 * import { JANUARY, SATURDAY } from "@std/datetime/constants";
 *
 * new Date(2025, JANUARY, 4).getDay() === SATURDAY; // true
 * ```
 */
export const SATURDAY = 6;