nextMonday.mjs 730 B

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