isSunday.js 669 B

1234567891011121314151617181920212223242526
  1. "use strict";
  2. exports.isSunday = isSunday;
  3. var _index = require("./toDate.js");
  4. /**
  5. * @name isSunday
  6. * @category Weekday Helpers
  7. * @summary Is the given date Sunday?
  8. *
  9. * @description
  10. * Is the given date Sunday?
  11. *
  12. * @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).
  13. *
  14. * @param date - The date to check
  15. *
  16. * @returns The date is Sunday
  17. *
  18. * @example
  19. * // Is 21 September 2014 Sunday?
  20. * const result = isSunday(new Date(2014, 8, 21))
  21. * //=> true
  22. */
  23. function isSunday(date) {
  24. return (0, _index.toDate)(date).getDay() === 0;
  25. }