UNPKG

960 BTypeScriptView Raw
1import type { ContextOptions, DateArg, RoundingOptions } from "./types.js";
2/**
3 * The {@link differenceInHours} function options.
4 */
5export interface DifferenceInHoursOptions
6 extends RoundingOptions,
7 ContextOptions<Date> {}
8/**
9 * @name differenceInHours
10 * @category Hour Helpers
11 * @summary Get the number of hours between the given dates.
12 *
13 * @description
14 * Get the number of hours between the given dates.
15 *
16 * @param laterDate - The later date
17 * @param earlierDate - The earlier date
18 * @param options - An object with options.
19 *
20 * @returns The number of hours
21 *
22 * @example
23 * // How many hours are between 2 July 2014 06:50:00 and 2 July 2014 19:00:00?
24 * const result = differenceInHours(
25 * new Date(2014, 6, 2, 19, 0),
26 * new Date(2014, 6, 2, 6, 50)
27 * )
28 * //=> 12
29 */
30export declare function differenceInHours(
31 laterDate: DateArg<Date> & {},
32 earlierDate: DateArg<Date> & {},
33 options?: DifferenceInHoursOptions,
34): number;