2020-08-26 01:57:08 +02:00
|
|
|
'use strict';
|
|
|
|
|
2021-02-26 04:58:33 +01:00
|
|
|
var GetIntrinsic = require('get-intrinsic');
|
2020-08-26 01:57:08 +02:00
|
|
|
|
|
|
|
var $Date = GetIntrinsic('%Date%');
|
|
|
|
var $Number = GetIntrinsic('%Number%');
|
|
|
|
|
|
|
|
var $isFinite = require('../helpers/isFinite');
|
|
|
|
|
2021-02-26 04:58:33 +01:00
|
|
|
var abs = require('./abs');
|
2020-08-26 01:57:08 +02:00
|
|
|
var ToNumber = require('./ToNumber');
|
|
|
|
|
|
|
|
// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.14
|
|
|
|
|
|
|
|
module.exports = function TimeClip(time) {
|
2021-02-26 04:58:33 +01:00
|
|
|
if (!$isFinite(time) || abs(time) > 8.64e15) {
|
2020-08-26 01:57:08 +02:00
|
|
|
return NaN;
|
|
|
|
}
|
|
|
|
return $Number(new $Date(ToNumber(time)));
|
|
|
|
};
|
|
|
|
|