2016-10-10 03:43:44 +02:00
|
|
|
var DateProto = Date.prototype
|
|
|
|
, INVALID_DATE = 'Invalid Date'
|
|
|
|
, TO_STRING = 'toString'
|
2017-05-27 17:36:13 +02:00
|
|
|
, $toString = DateProto[TO_STRING]
|
|
|
|
, getTime = DateProto.getTime;
|
2016-10-10 03:43:44 +02:00
|
|
|
if(new Date(NaN) + '' != INVALID_DATE){
|
2017-05-27 17:36:13 +02:00
|
|
|
require('./_redefine')(DateProto, TO_STRING, function toString(){
|
|
|
|
var value = getTime.call(this);
|
2016-10-10 03:43:44 +02:00
|
|
|
return value === value ? $toString.call(this) : INVALID_DATE;
|
|
|
|
});
|
|
|
|
}
|