index.js 661 B

1234567891011121314151617181920212223
  1. import nextDay from "../nextDay/index.js";
  2. import requiredArgs from "../_lib/requiredArgs/index.js";
  3. /**
  4. * @name nextWednesday
  5. * @category Weekday Helpers
  6. * @summary When is the next Wednesday?
  7. *
  8. * @description
  9. * When is the next Wednesday?
  10. *
  11. * @param {Date | number} date - the date to start counting from
  12. * @returns {Date} the next Wednesday
  13. * @throws {TypeError} 1 argument required
  14. *
  15. * @example
  16. * // When is the next Wednesday after Mar, 22, 2020?
  17. * const result = nextWednesday(new Date(2020, 2, 22))
  18. * //=> Wed Mar 25 2020 00:00:00
  19. */
  20. export default function nextWednesday(date) {
  21. requiredArgs(1, arguments);
  22. return nextDay(date, 3);
  23. }