1 | ;
|
2 | exports.endOfTomorrow = endOfTomorrow; /**
|
3 | * @name endOfTomorrow
|
4 | * @category Day Helpers
|
5 | * @summary Return the end of tomorrow.
|
6 | * @pure false
|
7 | *
|
8 | * @description
|
9 | * Return the end of tomorrow.
|
10 | *
|
11 | * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
12 | *
|
13 | * @returns The end of tomorrow
|
14 | *
|
15 | * @example
|
16 | * // If today is 6 October 2014:
|
17 | * const result = endOfTomorrow()
|
18 | * //=> Tue Oct 7 2014 23:59:59.999
|
19 | */
|
20 | function endOfTomorrow() {
|
21 | const now = new Date();
|
22 | const year = now.getFullYear();
|
23 | const month = now.getMonth();
|
24 | const day = now.getDate();
|
25 |
|
26 | const date = new Date(0);
|
27 | date.setFullYear(year, month, day + 1);
|
28 | date.setHours(23, 59, 59, 999);
|
29 | return date;
|
30 | }
|