main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
772 bytes
|
Rev | Line | |
---|
[79a0317] | 1 | 'use strict';
|
---|
| 2 | // TODO: Remove from `core-js@4`
|
---|
| 3 | var uncurryThis = require('../internals/function-uncurry-this');
|
---|
| 4 | var defineBuiltIn = require('../internals/define-built-in');
|
---|
| 5 |
|
---|
| 6 | var DatePrototype = Date.prototype;
|
---|
| 7 | var INVALID_DATE = 'Invalid Date';
|
---|
| 8 | var TO_STRING = 'toString';
|
---|
| 9 | var nativeDateToString = uncurryThis(DatePrototype[TO_STRING]);
|
---|
| 10 | var thisTimeValue = uncurryThis(DatePrototype.getTime);
|
---|
| 11 |
|
---|
| 12 | // `Date.prototype.toString` method
|
---|
| 13 | // https://tc39.es/ecma262/#sec-date.prototype.tostring
|
---|
| 14 | if (String(new Date(NaN)) !== INVALID_DATE) {
|
---|
| 15 | defineBuiltIn(DatePrototype, TO_STRING, function toString() {
|
---|
| 16 | var value = thisTimeValue(this);
|
---|
| 17 | // eslint-disable-next-line no-self-compare -- NaN check
|
---|
| 18 | return value === value ? nativeDateToString(this) : INVALID_DATE;
|
---|
| 19 | });
|
---|
| 20 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.