isWednesday.mjs 710 B

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