1 | import { addDays } from "./addDays.js";
|
2 | import { constructNow } from "./constructNow.js";
|
3 | import { isSameDay } from "./isSameDay.js";
|
4 |
|
5 | /**
|
6 | * The {@link isTomorrow} function options.
|
7 | */
|
8 |
|
9 | /**
|
10 | * @name isTomorrow
|
11 | * @category Day Helpers
|
12 | * @summary Is the given date tomorrow?
|
13 | * @pure false
|
14 | *
|
15 | * @description
|
16 | * Is the given date tomorrow?
|
17 | *
|
18 | * @param date - The date to check
|
19 | * @param options - An object with options
|
20 | *
|
21 | * @returns The date is tomorrow
|
22 | *
|
23 | * @example
|
24 | * // If today is 6 October 2014, is 7 October 14:00:00 tomorrow?
|
25 | * const result = isTomorrow(new Date(2014, 9, 7, 14, 0))
|
26 | * //=> true
|
27 | */
|
28 | export function isTomorrow(date, options) {
|
29 | return isSameDay(
|
30 | date,
|
31 | addDays(constructNow(options?.in || date), 1),
|
32 | options,
|
33 | );
|
34 | }
|
35 |
|
36 | // Fallback for modularized imports:
|
37 | export default isTomorrow;
|