1 | import type { RoundingOptions } from "./types.js";
|
2 | /**
|
3 | * The {@link differenceInSeconds} function options.
|
4 | */
|
5 | export interface DifferenceInSecondsOptions extends RoundingOptions {}
|
6 | /**
|
7 | * @name differenceInSeconds
|
8 | * @category Second Helpers
|
9 | * @summary Get the number of seconds between the given dates.
|
10 | *
|
11 | * @description
|
12 | * Get the number of seconds between the given dates.
|
13 | *
|
14 | * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
15 | *
|
16 | * @param dateLeft - The later date
|
17 | * @param dateRight - The earlier date
|
18 | * @param options - An object with options.
|
19 | *
|
20 | * @returns The number of seconds
|
21 | *
|
22 | * @example
|
23 | * // How many seconds are between
|
24 | * // 2 July 2014 12:30:07.999 and 2 July 2014 12:30:20.000?
|
25 | * const result = differenceInSeconds(
|
26 | * new Date(2014, 6, 2, 12, 30, 20, 0),
|
27 | * new Date(2014, 6, 2, 12, 30, 7, 999)
|
28 | * )
|
29 | * //=> 12
|
30 | */
|
31 | export declare function differenceInSeconds<DateType extends Date>(
|
32 | dateLeft: DateType | number | string,
|
33 | dateRight: DateType | number | string,
|
34 | options?: DifferenceInSecondsOptions,
|
35 | ): number;
|