Merge pull request #1003 from 30-seconds/simplify-isWeekday
Update isWeekday.md
This commit is contained in:
@ -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;
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user