isTuesday.mjs 694 B

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