You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
393 B
JavaScript
11 lines
393 B
JavaScript
7 years ago
|
var DateProto = Date.prototype
|
||
|
, INVALID_DATE = 'Invalid Date'
|
||
|
, TO_STRING = 'toString'
|
||
|
, $toString = DateProto[TO_STRING]
|
||
|
, getTime = DateProto.getTime;
|
||
|
if(new Date(NaN) + '' != INVALID_DATE){
|
||
|
require('./_redefine')(DateProto, TO_STRING, function toString(){
|
||
|
var value = getTime.call(this);
|
||
|
return value === value ? $toString.call(this) : INVALID_DATE;
|
||
|
});
|
||
|
}
|