main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
595 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var $TypeError = require('es-errors/type');
|
---|
4 |
|
---|
5 | var ToIntegerOrInfinity = require('./ToIntegerOrInfinity');
|
---|
6 |
|
---|
7 | var isNaN = require('../helpers/isNaN');
|
---|
8 |
|
---|
9 | // https://262.ecma-international.org/15.0/#sec-makefullyear
|
---|
10 |
|
---|
11 | module.exports = function MakeFullYear(year) {
|
---|
12 | if (typeof year !== 'number') {
|
---|
13 | throw new $TypeError('Assertion failed: `year` must be a Number');
|
---|
14 | }
|
---|
15 |
|
---|
16 | if (isNaN(year)) {
|
---|
17 | return NaN; // step 1
|
---|
18 | }
|
---|
19 |
|
---|
20 | var truncated = ToIntegerOrInfinity(year); // step 2
|
---|
21 | if (0 <= truncated && truncated <= 99) {
|
---|
22 | return 1900 + truncated; // step 3
|
---|
23 | }
|
---|
24 |
|
---|
25 | return truncated; // step 4
|
---|
26 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.