Comparing version 1.1.5 to 1.1.6
!function (_Date) { | ||
if (isNaN(_Date.parse('2000-01-01 00:00:00'))) { | ||
function standardizeArgs(args) { | ||
if (args.length === 1 && typeof args[0] === 'string') { | ||
// '2000-01-01 00:00:00' => '2000/01/01 00:00:00' | ||
args[0] = args[0].replace(/-/g, '/') | ||
} | ||
return Array.prototype.slice.call(args) | ||
function standardizeArgs(args) { | ||
if (args.length === 1 && typeof args[0] === 'string' && isNaN(_Date.parse(args[0]))) { | ||
// '2000-01-01 00:00:00' => '2000/01/01 00:00:00' | ||
args[0] = args[0].replace(/-/g, '/') | ||
} | ||
return Array.prototype.slice.call(args) | ||
} | ||
function $Date() { | ||
if (this instanceof $Date) { | ||
// hijack constructor | ||
return new ( | ||
Function.prototype.bind.apply(_Date, [null].concat(standardizeArgs(arguments))) | ||
)() | ||
} | ||
return _Date() | ||
function $Date() { | ||
if (this instanceof $Date) { | ||
// hijack constructor | ||
return new ( | ||
Function.prototype.bind.apply(_Date, [null].concat(standardizeArgs(arguments))) | ||
)() | ||
} | ||
$Date.prototype = _Date.prototype | ||
$Date.now = _Date.now | ||
$Date.UTC = _Date.UTC | ||
$Date.parse = function () { | ||
return _Date.parse.apply(_Date, standardizeArgs(arguments)) | ||
} | ||
return _Date() | ||
} | ||
$Date.prototype = _Date.prototype | ||
$Date.now = _Date.now | ||
$Date.UTC = _Date.UTC | ||
$Date.parse = function () { | ||
return _Date.parse.apply(_Date, standardizeArgs(arguments)) | ||
} | ||
Date = $Date | ||
} | ||
Date = $Date | ||
}(Date); |
@@ -1,1 +0,1 @@ | ||
!function(t){function n(t){return 1===t.length&&"string"==typeof t[0]&&(t[0]=t[0].replace(/-/g,"/")),Array.prototype.slice.call(t)}function e(){return this instanceof e?new(Function.prototype.bind.apply(t,[null].concat(n(arguments)))):t()}isNaN(t.parse("2000-01-01 00:00:00"))&&(e.prototype=t.prototype,e.now=t.now,e.UTC=t.UTC,e.parse=function(){return t.parse.apply(t,n(arguments))},Date=e)}(Date); | ||
!function(t){function n(n){return 1===n.length&&"string"==typeof n[0]&&isNaN(t.parse(n[0]))&&(n[0]=n[0].replace(/-/g,"/")),Array.prototype.slice.call(n)}function e(){return this instanceof e?new(Function.prototype.bind.apply(t,[null].concat(n(arguments)))):t()}e.prototype=t.prototype,e.now=t.now,e.UTC=t.UTC,e.parse=function(){return t.parse.apply(t,n(arguments))},Date=e}(Date); |
{ | ||
"name": "fix-date", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "Solution for `yyyy-MM-dd HH:mm:ss` is `Invalid Date` in Safari, IE, etc", | ||
@@ -5,0 +5,0 @@ "author": "Ken Berkeley <kenberkeley@foxmail.com>", |
2275
25