We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE

Our volunteers haven't translated this article into Bahasa Indonesia yet. Join us and help get the job done!
You can also read the article in English (US).


RangeError: invalid date (Firefox)
RangeError: invalid time value (Chrome)
RangeError: Provided date is not in valid range (Chrome)

Error type


What went wrong?

A string leading to an invalid date has been provided to Date or Date.parse().


Invalid cases

Unrecognizable strings or dates containing illegal element values in ISO formatted strings usually return NaN. However, depending on the implementation, non–conforming ISO format strings, may also throw RangeError: invalid date, like the following cases in Firefox:

new Date('foo-bar 2014');
new Date('2014-25-23').toISOString();
new Date('foo-bar 2014').toString();

This, however, returns NaN in Firefox:

Date.parse('foo-bar 2014'); // NaN

For more details, see the Date.parse() documentation.

Valid cases

new Date('05 October 2011 14:48 UTC');

See also

Tag Dokumen dan Kontributor

 Kontributor untuk laman ini: fscholz
 Terakhir diperbarui oleh: fscholz,