This commit is contained in:
szabomarton
2025-01-28 11:38:27 +01:00
parent 9c5ca86086
commit 7f4a15b9c3
36841 changed files with 4032468 additions and 1 deletions

View File

@@ -0,0 +1,26 @@
'use strict';
var $TypeError = require('es-errors/type');
var ToIntegerOrInfinity = require('./ToIntegerOrInfinity');
var isNaN = require('math-intrinsics/isNaN');
// https://262.ecma-international.org/15.0/#sec-makefullyear
module.exports = function MakeFullYear(year) {
if (typeof year !== 'number') {
throw new $TypeError('Assertion failed: `year` must be a Number');
}
if (isNaN(year)) {
return NaN; // step 1
}
var truncated = ToIntegerOrInfinity(year); // step 2
if (0 <= truncated && truncated <= 99) {
return 1900 + truncated; // step 3
}
return truncated; // step 4
};