|
Partners
|
Y2K and your date scriptsWhile this tutorial may no longer be relevant in today's time, it's still useful to understand the problem and solution that once plagued JavaScript in certain browsers that is the Y2K bug. A pre millennium survey revealed that over 50% of people secretly hoped for a small disaster to occur on Millennium day (hmmmm). Well, to the disappointment of billions, then, Y2K came without a hitch, and life went on as usual- for the most part, that is. Around the world, minor glitches were reported, and among them, a JavaScript-related one. Apparently, a good number of legacy Netscape browsers contain a Y2K bug that causes dates rendered by JavaScript to be displayed incorrectly after the cross over. The bug also plagued Internet Explorer, though only in older versions (IE 2). Here's the problem.
Date.getYear(), JavaScript's method to retrieve the year, is
defective in certain browsers, and resets
to "100" on year 2000. Calling it now (year 2000) returns 100", year 2001
returns "101", and so on. This problematic behavior with Date.getYear() is
manifested in the following browsers:
|