index.js 793 B

12345678910111213141516171819202122232425262728
  1. import toDate from "../toDate/index.js";
  2. import requiredArgs from "../_lib/requiredArgs/index.js";
  3. /**
  4. * @name isTuesday
  5. * @category Weekday Helpers
  6. * @summary Is the given date Tuesday?
  7. *
  8. * @description
  9. * Is the given date Tuesday?
  10. *
  11. * ### v2.0.0 breaking changes:
  12. *
  13. * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
  14. *
  15. * @param {Date|Number} date - the date to check
  16. * @returns {Boolean} the date is Tuesday
  17. * @throws {TypeError} 1 argument required
  18. *
  19. * @example
  20. * // Is 23 September 2014 Tuesday?
  21. * var result = isTuesday(new Date(2014, 8, 23))
  22. * //=> true
  23. */
  24. export default function isTuesday(dirtyDate) {
  25. requiredArgs(1, arguments);
  26. return toDate(dirtyDate).getDay() === 2;
  27. }