Update isWeekday.md

We should probably make this and the isWeekend snippet have the same description...
This commit is contained in:
Robert Mennell
2019-07-19 15:47:09 -07:00
committed by GitHub
parent f47b1fa5b7
commit 4633605dc6

View File

@ -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 as then returning a boolean.
```js
const isWeekday = (t = new Date()) => {
return t.getDay() >= 1 && t.getDay() <= 5;
return t.getDay() % 6 !== 0;
};
```