What is wrong with the code below?
Maybe it would be simpler to just compare date and not time. I am not sure how to do this either, and I searched, but I couldn\'t
You can use some arithmetic with the total of ms.
var date = new Date(date1);
date.setHours(0, 0, 0, 0);
var diff = date2.getTime() - date.getTime();
return diff >= 0 && diff < 86400000;
I like this because no updates to the original dates are made and perfom faster than string split and compare.
Hope this help!