Reputation: 789
I'm using date-fns, I can use helpers like isMonday(day) that returns true is if the day is a Monday, or isWithinRange(start, end) to check if a date is within a range, however, is there a way to return true if a date is in an array of dates?
Upvotes: 2
Views: 1284
Reputation: 138257
To easy, just use Array prototype.some
const dateInArray = (date, array) => array.some(d => +d === +date);
Upvotes: 2