Friday, September 5, 2025
HomeLanguagesJavascriptJavaScript RangeError – Invalid date

JavaScript RangeError – Invalid date

This JavaScript exception invalid date occurs if the string that has been provided to Date or Date.parse() is not valid.

Message:

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

Error Type:

RangeError

Cause of the Error: An invalid date string is provided to Date or Date.parse() method in the code.

Example 1: In this example, the invalid string is provided, so the error has occurred.

Javascript




new Date('2014-55-26').toISOString();


Output(In console):

RangeError: invalid time value

Example 2: In this example, the invalid string is provided, so the error has occurred.

Javascript




let date = new Date('2020-57-16'); // Error here
date.toISOString();


Output(In console):

RangeError: invalid time value
RELATED ARTICLES

Most Popular

Dominic
32269 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6638 POSTS0 COMMENTS
Nicole Veronica
11802 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11866 POSTS0 COMMENTS
Shaida Kate Naidoo
6752 POSTS0 COMMENTS
Ted Musemwa
7027 POSTS0 COMMENTS
Thapelo Manthata
6704 POSTS0 COMMENTS
Umr Jansen
6721 POSTS0 COMMENTS