diff --git a/snippets/isWeekday.md b/snippets/isWeekday.md index bb2d3138f..8a56323bc 100644 --- a/snippets/isWeekday.md +++ b/snippets/isWeekday.md @@ -3,11 +3,11 @@ Results in a boolean representation of a specific date. Pass the specific date object firstly. -Use `Date.getDay()` to check weekday then return a boolean. +Use `Date.getDay()` to check weekday by using a modulo operator and then returning a boolean. ```js const isWeekday = (t = new Date()) => { - return t.getDay() >= 1 && t.getDay() <= 5; + return t.getDay() % 6 !== 0; }; ```