UNPKG

1.24 kBTypeScriptView Raw
1import type { DateArg } from "./types.js";
2/**
3 * @name isSameSecond
4 * @category Second Helpers
5 * @summary Are the given dates in the same second (and hour and day)?
6 *
7 * @description
8 * Are the given dates in the same second (and hour and day)?
9 *
10 * @param laterDate - The first date to check
11 * @param earlierDate - The second date to check
12 *
13 * @returns The dates are in the same second (and hour and day)
14 *
15 * @example
16 * // Are 4 September 2014 06:30:15.000 and 4 September 2014 06:30.15.500 in the same second?
17 * const result = isSameSecond(
18 * new Date(2014, 8, 4, 6, 30, 15),
19 * new Date(2014, 8, 4, 6, 30, 15, 500)
20 * )
21 * //=> true
22 *
23 * @example
24 * // Are 4 September 2014 06:00:15.000 and 4 September 2014 06:01.15.000 in the same second?
25 * const result = isSameSecond(
26 * new Date(2014, 8, 4, 6, 0, 15),
27 * new Date(2014, 8, 4, 6, 1, 15)
28 * )
29 * //=> false
30 *
31 * @example
32 * // Are 4 September 2014 06:00:15.000 and 5 September 2014 06:00.15.000 in the same second?
33 * const result = isSameSecond(
34 * new Date(2014, 8, 4, 6, 0, 15),
35 * new Date(2014, 8, 5, 6, 0, 15)
36 * )
37 * //=> false
38 */
39export declare function isSameSecond(
40 laterDate: DateArg<Date> & {},
41 earlierDate: DateArg<Date> & {},
42): boolean;