Is the result of Date.prototype.getYear() a feature or a bug?
When entering a date string as a parameter on the Date object the result that we get from applying the getYear() to this object is interesting. For dates of format YY in the range from 50 to 99 it appears to work fine. But when entering 0 to 49 the getYear() method shows three digit number instead of two. Is this a bug or should leave it at that because these are the limitations of this method? Here is a sample code:
const moonLanding = new Date('July 20, 99 00:20:18');
console.log(moonLanding.getYear());// shows 99
const moonLanding = new Date('July 20, 20 00:20:18');
console.log(moonLanding.getYear());// shows 120
According to the w3schools reference below, `getYear` method is deprecated and developers are encouraged to use `getFullYear` method instead.
As I understand it, a deprecated method is kept for backward compatibility reasons, but there is a chance that it will be removed in the future. And it is possible that the team no longer maintain the method, which probably explains the reason for the unexpected behaviour of `getYear`.