Last change
on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
527 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 | var $ = require('../internals/export');
|
---|
3 | var toInteger = require('../internals/to-integer');
|
---|
4 |
|
---|
5 | var getTime = Date.prototype.getTime;
|
---|
6 | var setFullYear = Date.prototype.setFullYear;
|
---|
7 |
|
---|
8 | // `Date.prototype.setYear` method
|
---|
9 | // https://tc39.es/ecma262/#sec-date.prototype.setyear
|
---|
10 | $({ target: 'Date', proto: true }, {
|
---|
11 | setYear: function setYear(year) {
|
---|
12 | // validate
|
---|
13 | getTime.call(this);
|
---|
14 | var yi = toInteger(year);
|
---|
15 | var yyyy = 0 <= yi && yi <= 99 ? yi + 1900 : yi;
|
---|
16 | return setFullYear.call(this, yyyy);
|
---|
17 | }
|
---|
18 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.