Whenever I attempt to parse a date in Internet Explorer 11
, it throws NaN at me. However, in Chrome and Firefox, I get the timestamp 1494559800000
.
Date.parse("5/12/2017 09:00 AM")
The condition below is where things go wrong for me in IE 11. Is there an alternative library or method that can help me resolve this issue in IE 11?
tArray
includes ["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();
//The problematic condition resides here.
if (Date.parse(timeString1) < Date.parse(currentTimeString)
&& Date.parse(currentTimeString) < Date.parse(timeString2)) {
I have set up a sample fiddle to demonstrate where it fails. https://jsfiddle.net/vwwoa32y/