Two-digit years interpreted differently in various browsers

I was working with JavaScript Date objects recently, and I’ve found out that browsers treat a date with a two-digit year differently. Basically, a year of “12” is considered as 1912 in Firefox, Internet Explorer, and Opera. Chrome and Safari treat it as 2012. Below are snapshots of executing new Date(“5/10/12”) in the developer tools in the five browsers.

Leave a Reply

Your email address will not be published. Required fields are marked *