index.js 609 B

1234567891011121314151617181920212223
  1. import toDate from "../toDate/index.js";
  2. import requiredArgs from "../_lib/requiredArgs/index.js";
  3. /**
  4. * @name isFriday
  5. * @category Weekday Helpers
  6. * @summary Is the given date Friday?
  7. *
  8. * @description
  9. * Is the given date Friday?
  10. *
  11. * @param {Date|Number} date - the date to check
  12. * @returns {Boolean} the date is Friday
  13. * @throws {TypeError} 1 argument required
  14. *
  15. * @example
  16. * // Is 26 September 2014 Friday?
  17. * const result = isFriday(new Date(2014, 8, 26))
  18. * //=> true
  19. */
  20. export default function isFriday(dirtyDate) {
  21. requiredArgs(1, arguments);
  22. return toDate(dirtyDate).getDay() === 5;
  23. }