index.js 640 B

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