I have a date (see dateValue variable) returned from the ajax response. Parsing that value works in chrome but not in IE 9.
Am I missing anything? Any help / suggestion is appreciated.
var dateValue = "2015-08-12T16:31:51.68"; $('#result').text(Date.parse(dateValue));
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <label id="result"></label>
ISO-8601 date parsing was added in ES5, so not all browsers support it.
Check this github project for an implementation that might work for you.
Or you could use a library like moment.js for better cross browser capability.
var dateValue = "2015-08-12T16:31:51.68"; $('#result').text(moment(dateValue););
IE9 is in quirks mode, and you want it in standards mode.
To learn how to force standards mode, see this answer: How do I force Internet Explorer to render in Standards Mode and NOT in Quirks?
To check if you are in quirks mode, run this JS:
alert('You are in ' + (document.compatMode==='CSS1Compat'?'Standards':'Quirks') + ' mode.')
©2020 All rights reserved.