UNPKG

747 BJavaScriptView Raw
1import { nextDay } from "./nextDay.mjs";
2
3/**
4 * @name nextThursday
5 * @category Weekday Helpers
6 * @summary When is the next Thursday?
7 *
8 * @description
9 * When is the next Thursday?
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 * @param date - The date to start counting from
14 *
15 * @returns The next Thursday
16 *
17 * @example
18 * // When is the next Thursday after Mar, 22, 2020?
19 * const result = nextThursday(new Date(2020, 2, 22))
20 * //=> Thur Mar 26 2020 00:00:00
21 */
22export function nextThursday(date) {
23 return nextDay(date, 4);
24}
25
26// Fallback for modularized imports:
27export default nextThursday;