Skip to main content

Check if a date is a weekday

JavaScript version

// `date` is a Date object
const isWeekday = (date = new Date()) => date.getDay() % 6 !== 0;

TypeScript version

const isWeekday = (date = new Date()): boolean => date.getDay() % 6 !== 0;

Comments