1 | var redefine = require('../internals/redefine');
|
2 |
|
3 | var DatePrototype = Date.prototype;
|
4 | var INVALID_DATE = 'Invalid Date';
|
5 | var TO_STRING = 'toString';
|
6 | var nativeDateToString = DatePrototype[TO_STRING];
|
7 | var getTime = DatePrototype.getTime;
|
8 |
|
9 | // `Date.prototype.toString` method
|
10 | // https://tc39.github.io/ecma262/#sec-date.prototype.tostring
|
11 | if (new Date(NaN) + '' != INVALID_DATE) {
|
12 | redefine(DatePrototype, TO_STRING, function toString() {
|
13 | var value = getTime.call(this);
|
14 | // eslint-disable-next-line no-self-compare
|
15 | return value === value ? nativeDateToString.call(this) : INVALID_DATE;
|
16 | });
|
17 | }
|