The JavaScript exception "invalid date" occurs when a string leading to an invalid date has been provided to Date
or Date.parse()
.
The JavaScript exception "invalid date" occurs when a string leading to an invalid date has been provided to Date
or Date.parse()
.
A string leading to an invalid date has been provided to Date
or Date.parse()
.
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:
For more details, see the Date.parse()
documentation.
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Invalid_date