I am using Javascript Date.parse()
to check if a start time is after an end time.
The time in question is like this:
Date.parse("12:0
You can not just pass a time to Date.parse()
, as it is expecting a datestring. If you flip the >
in your code to a <
, you'll notice it still returns false
. This is because Date.parse()
is returning NaN
.
Try this:
var a = new Date("January 1, 1970 12:00:00");
var b = new Date("January 1, 1970 21:30:00");
if (a > b) { alert(true); } else { alert(false); }
if (a < b) { alert(true); } else { alert(false); }