nextFriday.js 714 B

1234567891011121314151617181920212223242526
  1. "use strict";
  2. exports.nextFriday = nextFriday;
  3. var _index = require("./nextDay.js");
  4. /**
  5. * @name nextFriday
  6. * @category Weekday Helpers
  7. * @summary When is the next Friday?
  8. *
  9. * @description
  10. * When is the next Friday?
  11. *
  12. * @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).
  13. *
  14. * @param date - The date to start counting from
  15. *
  16. * @returns The next Friday
  17. *
  18. * @example
  19. * // When is the next Friday after Mar, 22, 2020?
  20. * const result = nextFriday(new Date(2020, 2, 22))
  21. * //=> Fri Mar 27 2020 00:00:00
  22. */
  23. function nextFriday(date) {
  24. return (0, _index.nextDay)(date, 5);
  25. }