Sha256: 78c797aae53dfe0fb07e2bbfc8180098a1d7411cbbdb320a39c765892791f172

Contents?: true

Size: 996 Bytes

Versions: 64

Compression:

Stored size: 996 Bytes

Contents

'use strict';
// 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString()
var fails = require('./_fails');
var getTime = Date.prototype.getTime;
var $toISOString = Date.prototype.toISOString;

var lz = function (num) {
  return num > 9 ? num : '0' + num;
};

// PhantomJS / old WebKit has a broken implementations
module.exports = (fails(function () {
  return $toISOString.call(new Date(-5e13 - 1)) != '0385-07-25T07:06:39.999Z';
}) || !fails(function () {
  $toISOString.call(new Date(NaN));
})) ? function toISOString() {
  if (!isFinite(getTime.call(this))) throw RangeError('Invalid time value');
  var d = this;
  var y = d.getUTCFullYear();
  var m = d.getUTCMilliseconds();
  var 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';
} : $toISOString;

Version data entries

64 entries across 29 versions & 8 rubygems

Version Path
immosquare-cleaner-0.1.51 node_modules/core-js/library/modules/_date-to-iso-string.js
immosquare-cleaner-0.1.51 node_modules/core-js/modules/_date-to-iso-string.js
immosquare-cleaner-0.1.50 node_modules/core-js/modules/_date-to-iso-string.js
immosquare-cleaner-0.1.50 node_modules/core-js/library/modules/_date-to-iso-string.js
immosquare-cleaner-0.1.49 node_modules/core-js/library/modules/_date-to-iso-string.js
immosquare-cleaner-0.1.49 node_modules/core-js/modules/_date-to-iso-string.js
immosquare-cleaner-0.1.48 node_modules/core-js/library/modules/_date-to-iso-string.js
immosquare-cleaner-0.1.48 node_modules/core-js/modules/_date-to-iso-string.js
immosquare-cleaner-0.1.47 node_modules/core-js/library/modules/_date-to-iso-string.js
immosquare-cleaner-0.1.47 node_modules/core-js/modules/_date-to-iso-string.js
immosquare-cleaner-0.1.46 node_modules/core-js/library/modules/_date-to-iso-string.js
immosquare-cleaner-0.1.46 node_modules/core-js/modules/_date-to-iso-string.js
immosquare-cleaner-0.1.45 node_modules/core-js/library/modules/_date-to-iso-string.js
immosquare-cleaner-0.1.45 node_modules/core-js/modules/_date-to-iso-string.js
immosquare-cleaner-0.1.44 node_modules/core-js/library/modules/_date-to-iso-string.js
immosquare-cleaner-0.1.44 node_modules/core-js/modules/_date-to-iso-string.js
immosquare-cleaner-0.1.43 node_modules/core-js/library/modules/_date-to-iso-string.js
immosquare-cleaner-0.1.43 node_modules/core-js/modules/_date-to-iso-string.js
immosquare-cleaner-0.1.42 node_modules/core-js/library/modules/_date-to-iso-string.js
immosquare-cleaner-0.1.42 node_modules/core-js/modules/_date-to-iso-string.js