isThursday.mjs 702 B

123456789101112131415161718192021222324252627
  1. import { toDate } from "./toDate.mjs";
  2. /**
  3. * @name isThursday
  4. * @category Weekday Helpers
  5. * @summary Is the given date Thursday?
  6. *
  7. * @description
  8. * Is the given date Thursday?
  9. *
  10. * @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).
  11. *
  12. * @param date - The date to check
  13. *
  14. * @returns The date is Thursday
  15. *
  16. * @example
  17. * // Is 25 September 2014 Thursday?
  18. * const result = isThursday(new Date(2014, 8, 25))
  19. * //=> true
  20. */
  21. export function isThursday(date) {
  22. return toDate(date).getDay() === 4;
  23. }
  24. // Fallback for modularized imports:
  25. export default isThursday;