2024-01-01 21:11:32 +00:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2023-03-18 12:36:00 +00:00
|
|
|
// This module is browser compatible.
|
|
|
|
|
2022-12-19 10:24:48 +00:00
|
|
|
/**
|
|
|
|
* The number of milliseconds in a second.
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* ```ts
|
2024-04-29 02:57:30 +00:00
|
|
|
* import { SECOND } from "@std/datetime/constants";
|
2022-12-19 10:24:48 +00:00
|
|
|
*
|
2024-03-26 10:53:58 +00:00
|
|
|
* SECOND; // 1_000
|
2022-12-19 10:24:48 +00:00
|
|
|
* ```
|
|
|
|
*/
|
|
|
|
export const SECOND = 1e3;
|
|
|
|
/**
|
|
|
|
* The number of milliseconds in a minute.
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* ```ts
|
2024-04-29 02:57:30 +00:00
|
|
|
* import { MINUTE } from "@std/datetime/constants";
|
2022-12-19 10:24:48 +00:00
|
|
|
*
|
2024-03-26 10:53:58 +00:00
|
|
|
* MINUTE; // 60_000
|
2022-12-19 10:24:48 +00:00
|
|
|
* ```
|
|
|
|
*/
|
2023-12-19 00:26:13 +00:00
|
|
|
export const MINUTE: number = SECOND * 60;
|
2022-12-19 10:24:48 +00:00
|
|
|
/**
|
|
|
|
* The number of milliseconds in an hour.
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* ```ts
|
2024-04-29 02:57:30 +00:00
|
|
|
* import { HOUR } from "@std/datetime/constants";
|
2022-12-19 10:24:48 +00:00
|
|
|
*
|
2024-03-26 10:53:58 +00:00
|
|
|
* HOUR; // 3_600_000
|
2022-12-19 10:24:48 +00:00
|
|
|
* ```
|
|
|
|
*/
|
2023-12-19 00:26:13 +00:00
|
|
|
export const HOUR: number = MINUTE * 60;
|
2022-12-19 10:24:48 +00:00
|
|
|
/**
|
|
|
|
* The number of milliseconds in a day.
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* ```ts
|
2024-04-29 02:57:30 +00:00
|
|
|
* import { DAY } from "@std/datetime/constants";
|
2022-12-19 10:24:48 +00:00
|
|
|
*
|
2024-03-26 10:53:58 +00:00
|
|
|
* DAY; // 86_400_000
|
2022-12-19 10:24:48 +00:00
|
|
|
* ```
|
|
|
|
*/
|
2023-12-19 00:26:13 +00:00
|
|
|
export const DAY: number = HOUR * 24;
|
2022-12-19 10:24:48 +00:00
|
|
|
/**
|
|
|
|
* The number of milliseconds in a week.
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* ```ts
|
2024-04-29 02:57:30 +00:00
|
|
|
* import { WEEK } from "@std/datetime/constants";
|
2022-12-19 10:24:48 +00:00
|
|
|
*
|
2024-03-26 10:53:58 +00:00
|
|
|
* WEEK; // 604_800_000
|
2022-12-19 10:24:48 +00:00
|
|
|
* ```
|
|
|
|
*/
|
2023-12-19 00:26:13 +00:00
|
|
|
export const WEEK: number = DAY * 7;
|