index.js 900 B

12345678910111213141516171819202122232425262728293031
  1. "use strict";
  2. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
  3. Object.defineProperty(exports, "__esModule", {
  4. value: true
  5. });
  6. exports.default = isSunday;
  7. var _index = _interopRequireDefault(require("../toDate/index.js"));
  8. var _index2 = _interopRequireDefault(require("../_lib/requiredArgs/index.js"));
  9. /**
  10. * @name isSunday
  11. * @category Weekday Helpers
  12. * @summary Is the given date Sunday?
  13. *
  14. * @description
  15. * Is the given date Sunday?
  16. *
  17. * @param {Date|Number} date - the date to check
  18. * @returns {Boolean} the date is Sunday
  19. * @throws {TypeError} 1 argument required
  20. *
  21. * @example
  22. * // Is 21 September 2014 Sunday?
  23. * const result = isSunday(new Date(2014, 8, 21))
  24. * //=> true
  25. */
  26. function isSunday(dirtyDate) {
  27. (0, _index2.default)(1, arguments);
  28. return (0, _index.default)(dirtyDate).getDay() === 0;
  29. }
  30. module.exports = exports.default;