Skip to content

Check if a date is a weekday in TypeScript

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

isWeekday(new Date(2022, 2, 10)); // -> true
isWeekday(new Date(2021, 5, 8)); // -> false
See also  Longest Continuous Increasing Subsequence - Leetcode Challenge - Python Solution

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.