1 |
3a515b92
|
cagy
|
'use strict';
|
2 |
|
|
|
3 |
|
|
var GetIntrinsic = require('../GetIntrinsic');
|
4 |
|
|
|
5 |
|
|
var $Date = GetIntrinsic('%Date%');
|
6 |
|
|
var $Number = GetIntrinsic('%Number%');
|
7 |
|
|
var $abs = GetIntrinsic('%Math.abs%');
|
8 |
|
|
|
9 |
|
|
var $isFinite = require('../helpers/isFinite');
|
10 |
|
|
|
11 |
|
|
var ToNumber = require('./ToNumber');
|
12 |
|
|
|
13 |
|
|
// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.14
|
14 |
|
|
|
15 |
|
|
module.exports = function TimeClip(time) {
|
16 |
|
|
if (!$isFinite(time) || $abs(time) > 8.64e15) {
|
17 |
|
|
return NaN;
|
18 |
|
|
}
|
19 |
|
|
return $Number(new $Date(ToNumber(time)));
|
20 |
|
|
};
|