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