It's a Y2K thing, only the years since 1900 are counted.
There are potential compatibility issues now that getYear()
has been deprecated in favour of getFullYear()
- from quirksmode:
To make the matter even more complex, date.getYear() is deprecated nowadays and you should use date.getFullYear(), which, in turn, is not supported by the older browsers. If it works, however, it should always give the full year, ie. 2000 instead of 100.
Your browser gives the following years with these two methods:
* The year according to getYear(): 108
* The year according to getFullYear(): 2008
There are also implementation differences between Internet Explorer and Firefox, as IE's implementation of getYear()
was changed to behave like getFullYear()
- from IBM:
Per the ECMAScript specification, getYear returns the year minus 1900, originally meant to return "98" for 1998. getYear was deprecated in ECMAScript Version 3 and replaced with getFullYear().
Internet Explorer changed getYear() to work like getFullYear() and make it Y2k-compliant, while Mozilla kept the standard behavior.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…