1 | import { constructFrom } from "./constructFrom.js";
|
2 | import { constructNow } from "./constructNow.js";
|
3 |
|
4 | /**
|
5 | * The {@link startOfTomorrow} function options.
|
6 | */
|
7 |
|
8 | /**
|
9 | * @name startOfTomorrow
|
10 | * @category Day Helpers
|
11 | * @summary Return the start of tomorrow.
|
12 | * @pure false
|
13 | *
|
14 | * @typeParam ContextDate - The `Date` type of the context function.
|
15 | *
|
16 | * @param options - An object with options
|
17 | *
|
18 | * @returns The start of tomorrow
|
19 | *
|
20 | * @description
|
21 | * Return the start of tomorrow.
|
22 | *
|
23 | * @example
|
24 | * // If today is 6 October 2014:
|
25 | * const result = startOfTomorrow()
|
26 | * //=> Tue Oct 7 2014 00:00:00
|
27 | */
|
28 | export function startOfTomorrow(options) {
|
29 | const now = constructNow(options?.in);
|
30 | const year = now.getFullYear();
|
31 | const month = now.getMonth();
|
32 | const day = now.getDate();
|
33 |
|
34 | const date = constructFrom(options?.in, 0);
|
35 | date.setFullYear(year, month, day + 1);
|
36 | date.setHours(0, 0, 0, 0);
|
37 | return date;
|
38 | }
|
39 |
|
40 | // Fallback for modularized imports:
|
41 | export default startOfTomorrow;
|