Last active
October 2, 2021 22:03
-
-
Save sayyedhammadali/7f5a0cae881da2e438c45157213a5fd4 to your computer and use it in GitHub Desktop.
Check if the provided day is a weekday
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isWeekday = (date) => date.getDay() % 6 !== 0; | |
console.log(isWeekday(new Date(2021, 0, 11))); | |
// Result: true (Monday) | |
console.log(isWeekday(new Date(2021, 0, 10))); | |
// Result: false (Sunday) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment