/
constants.ts
56 lines (56 loc) · 1.3 KB
/
constants.ts
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
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
/**
* The number of milliseconds in a second.
*
* @example
* ```ts
* import { SECOND } from "https://deno.land/std@$STD_VERSION/datetime/constants.ts";
*
* console.log(SECOND); // => 1000
* ```
*/
export const SECOND = 1e3;
/**
* The number of milliseconds in a minute.
*
* @example
* ```ts
* import { MINUTE } from "https://deno.land/std@$STD_VERSION/datetime/constants.ts";
*
* console.log(MINUTE); // => 60000 (60 * 1000)
* ```
*/
export const MINUTE = SECOND * 60;
/**
* The number of milliseconds in an hour.
*
* @example
* ```ts
* import { HOUR } from "https://deno.land/std@$STD_VERSION/datetime/constants.ts";
*
* console.log(HOUR); // => 3600000 (60 * 60 * 1000)
* ```
*/
export const HOUR = MINUTE * 60;
/**
* The number of milliseconds in a day.
*
* @example
* ```ts
* import { DAY } from "https://deno.land/std@$STD_VERSION/datetime/constants.ts";
*
* console.log(DAY); // => 86400000 (24 * 60 * 60 * 1000)
* ```
*/
export const DAY = HOUR * 24;
/**
* The number of milliseconds in a week.
*
* @example
* ```ts
* import { WEEK } from "https://deno.land/std@$STD_VERSION/datetime/constants.ts";
*
* console.log(WEEK); // => 604800000 (7 * 24 * 60 * 60 * 1000)
* ```
*/
export const WEEK = DAY * 7;