Maybe I missing something obvious but I don't know what I'm doing wrong. Im trying to write a function which returns true if a given date is a UK holiday.
Ive created a small array to test my function:
const holidays = [
new Date(2016, 0, 1), //NewYearsDay
new Date(2016, 2, 25), //GoodFriday
new Date(2016, 2, 27), //Easter
];
Then my function is
function isHoliday(date){
return holidays.some(function(d) {
return (d == date);
});
}
To test it I ran
date = new Date(2016, 0, 1);
var a = isHoliday(date);
alert(a);
But the alert says false ??