Date.prototype.getYear() Doesn't Work

Here's an example of the getYear function:

The getYear function in action

We instantiated a Date object and then called the getYear function which returned the value 115. Not quite the result that would be expected.

A good explanation of this function can be found here:

MDN getYear Documentation

Among other things, it states getYear returns the current year minus 1900. So, 2015 - 1900 = 115. The getYear function was never designed to return full years (95 instead of 1995) which is throwback to the year 2000 problem.

The Mozilla documentation also points-out the getFullYear function replaces getYear. So, here's an example of the getFullYear function:

Similar to the first example, we instantiated a Date object but then called the getFullYear function which returned the value 2015. This is more in line with what would be expected.

A good explanation of this function can be found here:

MDN getFullYear Documentation

So, Date.prototype.getYear() doesn't work. It has been replaced with Date.prototype.getFullYear().