main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
686 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 | var $ = require('../internals/export');
|
---|
3 | var uncurryThis = require('../internals/function-uncurry-this');
|
---|
4 | var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
|
---|
5 |
|
---|
6 | var DatePrototype = Date.prototype;
|
---|
7 | var thisTimeValue = uncurryThis(DatePrototype.getTime);
|
---|
8 | var setFullYear = uncurryThis(DatePrototype.setFullYear);
|
---|
9 |
|
---|
10 | // `Date.prototype.setYear` method
|
---|
11 | // https://tc39.es/ecma262/#sec-date.prototype.setyear
|
---|
12 | $({ target: 'Date', proto: true }, {
|
---|
13 | setYear: function setYear(year) {
|
---|
14 | // validate
|
---|
15 | thisTimeValue(this);
|
---|
16 | var yi = toIntegerOrInfinity(year);
|
---|
17 | var yyyy = yi >= 0 && yi <= 99 ? yi + 1900 : yi;
|
---|
18 | return setFullYear(this, yyyy);
|
---|
19 | }
|
---|
20 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.