In javascript, I can not do new Date("10Apr14") in IE, it will give back invalid Date, but the same command works fine in chrome.
Anyone knows how to make it work for all browers?
Thanks
In javascript, I can not do new Date("10Apr14") in IE, it will give back invalid Date, but the same command works fine in chrome.
Anyone knows how to make it work for all browers?
Thanks
The problem is you are using a 2 digit year (see year in RFC 2822). You should use:
new Date('10Apr2014'); // April 10, 2014
Or better yet, don't pass a string into the Date
constructor because that can be error prone and is generally less common. It is much better to use it like this:
new Date(2014, 3, 10); // April 10, 2014
See this: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date