UNPKG

955 BTypeScriptView Raw
1/**
2 * @name differenceInMilliseconds
3 * @category Millisecond Helpers
4 * @summary Get the number of milliseconds between the given dates.
5 *
6 * @description
7 * Get the number of milliseconds between the given dates.
8 *
9 * @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).
10 *
11 * @param dateLeft - The later date
12 * @param dateRight - The earlier date
13 *
14 * @returns The number of milliseconds
15 *
16 * @example
17 * // How many milliseconds are between
18 * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?
19 * const result = differenceInMilliseconds(
20 * new Date(2014, 6, 2, 12, 30, 21, 700),
21 * new Date(2014, 6, 2, 12, 30, 20, 600)
22 * )
23 * //=> 1100
24 */
25export declare function differenceInMilliseconds<DateType extends Date>(
26 dateLeft: DateType | number | string,
27 dateRight: DateType | number | string,
28): number;