[X]

The Year 19100

time and date 1999 still works

The JavaScript Y2K bug. getYear() returned 99 in 1999, so pages printed the century themselves. Then the year 100 arrived.

In 2026: Still works, which is the joke: getYear() survives in the compatibility annex of the JavaScript spec and still returns the year minus 1900, so the demo below glues 19 in front of that number and prints a four digit year wrong by a century. On the first of January 2000, half the web's footers read 19100. getFullYear() had already shipped two years earlier, in browsers nobody had upgraded.

Where it came from: JavaScript 1.0 Date.getYear, Netscape 2, 1996. The fix, getFullYear, shipped in 1998 and plenty of pages ignored it. MDN

<script language="JavaScript">
var today = new Date();
// getYear() returns the year minus 1900. In 1998 that was "98",
// so everyone just glued "19" in front of it.
document.write("Copyright 19" + today.getYear() + ". All rights reserved.");
</script>
sandboxed demo · breaks nothing but itselfrestart

More in time and date

all 6 in time and date › · the whole library ›