Parsing Iso-8601 Format Date Not Working In Ie 9
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 appreci
Solution 1:
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?
When in quirks mode, javascript only works if it was supported in IE6. Date.parse
was not a JS feature in IE until version 9
To check if you are in quirks mode, run this JS:
alert('You are in ' + (document.compatMode==='CSS1Compat'?'Standards':'Quirks') + ' mode.')
Solution 2:
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););
Post a Comment for "Parsing Iso-8601 Format Date Not Working In Ie 9"