function isInDate(MatchDate, entries) {
for (c = 0; c < entries.length; c++) {
var entry = entries[c];
var DateFrom = new Date(entry.DateFrom);
var DateTo = new Date(entry.DateTo);
if (
DateFrom.getMonth() <= MatchDate.getMonth() &&
DateFrom.getDay() <= MatchDate.getDay() &&
DateTo.getDay() >= MatchDate.getDay()
) {
return true;
}
}
return false;
}
I am passing in a "MatchDate" that I want to compare with every looped entries "DateFrom" and "DateTo", if the matchdate is in the timespan I want to return true, otherwise false.
It should also return true if its the same day as DateFrom & same day as DateTo... I can't get it to work whatever I try.. Could anyone please assist?