isSaturday.js 635 B

123456789101112131415161718192021222324252627282930
  1. import { toDate } from "./toDate.js";
  2. /**
  3. * The {@link isSaturday} function options.
  4. */
  5. /**
  6. * @name isSaturday
  7. * @category Weekday Helpers
  8. * @summary Is the given date Saturday?
  9. *
  10. * @description
  11. * Is the given date Saturday?
  12. *
  13. * @param date - The date to check
  14. * @param options - An object with options
  15. *
  16. * @returns The date is Saturday
  17. *
  18. * @example
  19. * // Is 27 September 2014 Saturday?
  20. * const result = isSaturday(new Date(2014, 8, 27))
  21. * //=> true
  22. */
  23. export function isSaturday(date, options) {
  24. return toDate(date, options?.in).getDay() === 6;
  25. }
  26. // Fallback for modularized imports:
  27. export default isSaturday;