X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=node_modules%2Fcore-js%2Flibrary%2Fmodules%2Fes6.date.to-iso-string.js;fp=node_modules%2Fcore-js%2Flibrary%2Fmodules%2Fes6.date.to-iso-string.js;h=2426c589801eb326c26e745453ef94567f56ba88;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/node_modules/core-js/library/modules/es6.date.to-iso-string.js b/node_modules/core-js/library/modules/es6.date.to-iso-string.js new file mode 100644 index 000000000..2426c5898 --- /dev/null +++ b/node_modules/core-js/library/modules/es6.date.to-iso-string.js @@ -0,0 +1,28 @@ +'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; +}; + +// 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