2016-10-10 03:43:44 +02:00
|
|
|
var DateProto = Date.prototype
|
|
|
|
, INVALID_DATE = 'Invalid Date'
|
|
|
|
, TO_STRING = 'toString'
|
2017-04-20 03:09:25 +02:00
|
|
|
, $toString = DateProto[TO_STRING];
|
2016-10-10 03:43:44 +02:00
|
|
|
if(new Date(NaN) + '' != INVALID_DATE){
|
2017-04-20 03:09:25 +02:00
|
|
|
require('./$.redefine')(DateProto, TO_STRING, function toString(){
|
|
|
|
var value = +this;
|
2016-10-10 03:43:44 +02:00
|
|
|
return value === value ? $toString.call(this) : INVALID_DATE;
|
|
|
|
});
|
|
|
|
}
|