If you want to compare two dates with JavaScript then compare them using the >, <, <= or >= operators.
If you want to use the ==, !=, ===, and !== operators then it will require you to use date.getTime() see the code below:-
var d1 = new Date();
var d2 = new Date(d1);
var same = d1.getTime() === d2.getTime();
var notSame = d1.getTime() !== d2.getTime();