When i try to parse a date in IE 11
, its throwing me NaN, but in chrome/firefox i get the below timestamp 1494559800000
Date.parse("5/12/2017 09:00 AM")
Below is the condition which is failing for me in IE 11. Is there any other library or way i can fix this in IE 11.
tArray
contains ["09:00 AM", "05:00 PM"];
var tArray = timings.toUpperCase().split('-');
var timeString1 = currentDate.toLocaleDateString() + " " + tArray[0];
var timeString2 = currentDate.toLocaleDateString() + " " + tArray[1];
var currentTimeString = currentDate.toLocaleDateString() + " " + currentTime.toUpperCase();
//Below is the condition which is failing.
if (Date.parse(timeString1) < Date.parse(currentTimeString)
&& Date.parse(currentTimeString) < Date.parse(timeString2)) {
I created a dummy fiddle where it fails. https://jsfiddle.net/vwwoa32y/