nextTuesday.js 1002 B

123456789101112131415161718192021222324252627282930313233
  1. import { nextDay } from "./nextDay.js";
  2. /**
  3. * The {@link nextTuesday} function options.
  4. */
  5. /**
  6. * @name nextTuesday
  7. * @category Weekday Helpers
  8. * @summary When is the next Tuesday?
  9. *
  10. * @description
  11. * When is the next Tuesday?
  12. *
  13. * @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).
  14. * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
  15. *
  16. * @param date - The date to start counting from
  17. * @param options - An object with options
  18. *
  19. * @returns The next Tuesday
  20. *
  21. * @example
  22. * // When is the next Tuesday after Mar, 22, 2020?
  23. * const result = nextTuesday(new Date(2020, 2, 22))
  24. * //=> Tue Mar 24 2020 00:00:00
  25. */
  26. export function nextTuesday(date, options) {
  27. return nextDay(date, 2, options);
  28. }
  29. // Fallback for modularized imports:
  30. export default nextTuesday;