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.
13 lines
435 B
JavaScript
13 lines
435 B
JavaScript
6 years ago
|
var DateProto = Date.prototype;
|
||
|
var INVALID_DATE = 'Invalid Date';
|
||
|
var TO_STRING = 'toString';
|
||
|
var $toString = DateProto[TO_STRING];
|
||
|
var getTime = DateProto.getTime;
|
||
|
if (new Date(NaN) + '' != INVALID_DATE) {
|
||
|
require('./_redefine')(DateProto, TO_STRING, function toString() {
|
||
|
var value = getTime.call(this);
|
||
|
// eslint-disable-next-line no-self-compare
|
||
|
return value === value ? $toString.call(this) : INVALID_DATE;
|
||
|
});
|
||
|
}
|