es.date.get-year.js 525 B

123456789101112131415161718
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var uncurryThis = require('../internals/function-uncurry-this');
  4. var fails = require('../internals/fails');
  5. var FORCED = fails(function () {
  6. return new Date(16e11).getYear() !== 120;
  7. });
  8. var getFullYear = uncurryThis(Date.prototype.getFullYear);
  9. // `Date.prototype.getYear` method
  10. // https://tc39.es/ecma262/#sec-date.prototype.getyear
  11. $({ target: 'Date', proto: true, forced: FORCED }, {
  12. getYear: function getYear() {
  13. return getFullYear(this) - 1900;
  14. }
  15. });