diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:01:11 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:02:09 +0200 |
commit | 363723fc84f7b8477592e0105aeb331ec9a017af (patch) | |
tree | 29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/core-js/modules/es6.date.to-iso-string.js | |
parent | 5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff) |
node_modules
Diffstat (limited to 'node_modules/core-js/modules/es6.date.to-iso-string.js')
-rw-r--r-- | node_modules/core-js/modules/es6.date.to-iso-string.js | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/node_modules/core-js/modules/es6.date.to-iso-string.js b/node_modules/core-js/modules/es6.date.to-iso-string.js index 2426c5898..13b27818c 100644 --- a/node_modules/core-js/modules/es6.date.to-iso-string.js +++ b/node_modules/core-js/modules/es6.date.to-iso-string.js @@ -1,28 +1,8 @@ -'use strict'; // 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString() -var $export = require('./_export') - , fails = require('./_fails') - , getTime = Date.prototype.getTime; - -var lz = function(num){ - return num > 9 ? num : '0' + num; -}; +var $export = require('./_export'); +var toISOString = require('./_date-to-iso-string'); // PhantomJS / old WebKit has a broken implementations -$export($export.P + $export.F * (fails(function(){ - return new Date(-5e13 - 1).toISOString() != '0385-07-25T07:06:39.999Z'; -}) || !fails(function(){ - new Date(NaN).toISOString(); -})), 'Date', { - toISOString: function toISOString(){ - if(!isFinite(getTime.call(this)))throw RangeError('Invalid time value'); - var d = this - , y = d.getUTCFullYear() - , m = d.getUTCMilliseconds() - , s = y < 0 ? '-' : y > 9999 ? '+' : ''; - return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) + - '-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) + - 'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) + - ':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z'; - } -});
\ No newline at end of file +$export($export.P + $export.F * (Date.prototype.toISOString !== toISOString), 'Date', { + toISOString: toISOString +}); |