Javascript data parsing in IE vs other browsers... It seems kinda screwed up. What's the deal?
- by Carter
Firstly, when I say other browsers I really only mean Firefox because that's all I tested in.
Internet Explorer can parse a date followed by a single character as a proper date. Whereas Firefox behaves as I'd expect.
For example...
var dateString = new Date("1/1/2010f");
alert(dateString);
In IE it will alert...
Thu Dec 31 21:00:00 UTC-0900 2009
Whereas in FF is will spit out...
"Invalid Date"
I first noticed this using the jquery validation plug in.
http://docs.jquery.com/Plugins/Validation/Methods/date
It seems like it just subtracts some amount of hours off the actual date in IE when a character is appended. I've tested in IE6 and IE8.
Am I missing something?