UNPKG

1.08 kBTypeScriptView Raw
1import type { Duration } from "./types.js";
2/**
3 * @name milliseconds
4 * @category Millisecond Helpers
5 * @summary
6 * Returns the number of milliseconds in the specified, years, months, weeks, days, hours, minutes and seconds.
7 *
8 * @description
9 * Returns the number of milliseconds in the specified, years, months, weeks, days, hours, minutes and seconds.
10 *
11 * One years equals 365.2425 days according to the formula:
12 *
13 * > Leap year occures every 4 years, except for years that are divisable by 100 and not divisable by 400.
14 * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days
15 *
16 * One month is a year divided by 12.
17 *
18 * @param duration - The object with years, months, weeks, days, hours, minutes and seconds to be added.
19 *
20 * @returns The milliseconds
21 *
22 * @example
23 * // 1 year in milliseconds
24 * milliseconds({ years: 1 })
25 * //=> 31556952000
26 *
27 * // 3 months in milliseconds
28 * milliseconds({ months: 3 })
29 * //=> 7889238000
30 */
31export declare function milliseconds({
32 years,
33 months,
34 weeks,
35 days,
36 hours,
37 minutes,
38 seconds,
39}: Duration): number;