hugoWebsite/node_modules/date-fns/esm/isTuesday/index.js

24 lines
617 B
JavaScript
Raw Normal View History

2022-10-29 00:20:35 +02:00
import toDate from "../toDate/index.js";
import requiredArgs from "../_lib/requiredArgs/index.js";
/**
* @name isTuesday
* @category Weekday Helpers
* @summary Is the given date Tuesday?
*
* @description
* Is the given date Tuesday?
*
* @param {Date|Number} date - the date to check
* @returns {Boolean} the date is Tuesday
* @throws {TypeError} 1 argument required
*
* @example
* // Is 23 September 2014 Tuesday?
* const result = isTuesday(new Date(2014, 8, 23))
* //=> true
*/
export default function isTuesday(dirtyDate) {
requiredArgs(1, arguments);
return toDate(dirtyDate).getDay() === 2;
}