nextTuesday.mjs 738 B

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