UNPKG

1.11 kBTypeScriptView Raw
1import type { ContextOptions, DateArg } from "./types.js";
2/**
3 * The {@link isSameHour} function options.
4 */
5export interface IsSameHourOptions extends ContextOptions<Date> {}
6/**
7 * @name isSameHour
8 * @category Hour Helpers
9 * @summary Are the given dates in the same hour (and same day)?
10 *
11 * @description
12 * Are the given dates in the same hour (and same day)?
13 *
14 * @param dateLeft - The first date to check
15 * @param dateRight - The second date to check
16 * @param options - An object with options
17 *
18 * @returns The dates are in the same hour (and same day)
19 *
20 * @example
21 * // Are 4 September 2014 06:00:00 and 4 September 06:30:00 in the same hour?
22 * const result = isSameHour(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 4, 6, 30))
23 * //=> true
24 *
25 * @example
26 * // Are 4 September 2014 06:00:00 and 5 September 06:00:00 in the same hour?
27 * const result = isSameHour(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 5, 6, 0))
28 * //=> false
29 */
30export declare function isSameHour(
31 dateLeft: DateArg<Date> & {},
32 dateRight: DateArg<Date> & {},
33 options?: IsSameHourOptions | undefined,
34): boolean;