I tried to compare two date objects in angular 4 but it always returning false
below are my code snippet
CheckForHoliday(d: Date) {
let simpleDate = new Date(d.getFullYear(), d.getMonth(), d.getDay());
let hDate = new Date(2018, 9, 1);
console.log(simpleDate + "==========" + hDate);
console.log(hDate === simpleDate);
return (hDate === simpleDate);
}
The output is as below
Mon Oct 01 2018 00:00:00 GMT+0530 (India Standard Time)==========Mon Oct 01 2018 00:00:00 GMT+0530 (India Standard Time)
false
Any Idea why it returning false when the printed values look same?