UNPKG

969 BTypeScriptView Raw
1import type { DateArg, RoundingOptions } from "./types.js";
2/**
3 * The {@link differenceInSeconds} function options.
4 */
5export 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 * @param laterDate - The later date
15 * @param earlierDate - The earlier date
16 * @param options - An object with options.
17 *
18 * @returns The number of seconds
19 *
20 * @example
21 * // How many seconds are between
22 * // 2 July 2014 12:30:07.999 and 2 July 2014 12:30:20.000?
23 * const result = differenceInSeconds(
24 * new Date(2014, 6, 2, 12, 30, 20, 0),
25 * new Date(2014, 6, 2, 12, 30, 7, 999)
26 * )
27 * //=> 12
28 */
29export declare function differenceInSeconds(
30 laterDate: DateArg<Date> & {},
31 earlierDate: DateArg<Date> & {},
32 options?: DifferenceInSecondsOptions,
33): number;