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');
|
|
|
|
|
|
|
|
// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.14
|
|
|
|
|
|
|
|
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)));
|
|
|
|
};
|
|
|
|
|