Skip to content

Latest commit

 

History

History
19 lines (15 loc) · 372 Bytes

check-if-a-date-is-a-weekend.mdx

File metadata and controls

19 lines (15 loc) · 372 Bytes
category created title updated
Validator
2021-02-25
Check if a date is a weekend
2021-10-13

JavaScript version

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

TypeScript version

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