UNPKG

ol-plus

Version:
7 lines 2.6 kB
((function () { var a, b, c, d, e, f; d = function (a, b) { var c; b == null && (b = 2), c = a.toString(); while (c.length < b) c = "0" + c; return c; }, f = (typeof Date.parse == "function" ? Date.parse("2011-06-11T23:20:45.456-0700") : void 0) === 1307859645456, Date.prototype.toISO8601String = function (a, b, c) { var e, f, g, h, i; a == null && (a = !1), b == null && (b = !0), c == null && (c = !0), h = this.getTime(); if (h !== h) throw new RangeError("Invalid date"); return e = b ? "-" : "", g = b ? ":" : "", f = a ? this.getFullYear().toString() + e + d(this.getMonth() + 1) + e + d(this.getDate()) + "T" + d(this.getHours()) + g + d(this.getMinutes()) + g + d(this.getSeconds()) : this.getUTCFullYear().toString() + e + d(this.getUTCMonth() + 1) + e + d(this.getUTCDate()) + "T" + d(this.getUTCHours()) + g + d(this.getUTCMinutes()) + g + d(this.getUTCSeconds()), c && (f += "." + d(a ? this.getMilliseconds() : this.getUTCMilliseconds(), 3)), a ? (i = this.getTimezoneOffset(), i >= 0 ? f += "-" : (f += "+", i *= -1), f + d(i / 60) + g + d(i % 60)) : f + "Z"; }, Date.prototype.toISOString || (Date.prototype.toISOString = Date.prototype.toISO8601String), Date.prototype.toJSON || (Date.prototype.toJSON = function (a) { return isFinite(this.valueOf()) ? this.toISOString() : null; }), b = /(\d\d\d\d)(-)?(\d\d)(-)?(\d\d)(T)?(\d\d)(:)?(\d\d)?(:)?(\d\d)?([\.,]\d+)?($|Z|([+-])(\d\d)(:)?(\d\d)?)/i, a = String(1.5).charAt(1), e = function (c) { var d, e, f, g, h, i, j, k, l, m, n; m = Object.prototype.toString.call(c); if (m === "[object Date]") return c; if (m !== "[object String]") return; if (f = c.match(b)) return n = parseInt(f[1], 10), i = parseInt(f[3], 10) - 1, d = parseInt(f[5], 10), e = parseInt(f[7], 10), h = f[9] ? parseInt(f[9], 10) : 0, l = f[11] ? parseInt(f[11], 10) : 0, g = f[12] ? parseFloat(a + f[12].slice(1)) * 1e3 : 0, k = Date.UTC(n, i, d, e, h, l, g), f[13] && f[14] && (j = f[15] * 60, f[17] && (j += parseInt(f[17], 10)), j *= f[14] === "-" ? -1 : 1, k -= j * 60 * 1e3), new Date(k); }, f ? Date.parseISO8601 = function (a, b) { return b == null && (b = !0), b ? new Date(a) : e(a); } : Date.parseISO8601 = e, Object.prototype.toString.call(Date.parse) !== "[object Function]" ? Date.parse = function (a) { var b; return (b = e(a)) != null ? b.getTime() : void 0; } : f || (c = Date.parse, Date.parse = function (a) { var b, d; return b = (d = e(a)) != null ? d.getTime() : void 0, !b && c && (b = c(a)), b; }), Date.now || (Date.now = function () { return (new Date).getTime(); }); })).call(this); //# sourceMappingURL=iso8601.js.map