fjordtools / Errors / Invalid Date (JavaScript)

Invalid Date

JavaScript created a Date object but could not read the text you gave it, so its time value is NaN and it prints as Invalid Date. Only the ISO format such as 2026-12-31 or 2026-12-31T12:00:00Z is guaranteed to work. Day-first dates like 31/12/2026 and words the parser does not know fail.

Fjordtools team · Seen in Chrome and Node (V8) · Published · 1 min read

How browsers word it

Chrome and Node (V8)Invalid Date
FirefoxInvalid Date
SafariInvalid Date

Common causes

  1. A day-first date

    31/12/2026 is read as month 31, which does not exist. Slash dates are not part of the standard, and engines read them as month first.

    Input

    31/12/2026

    Timestamp Converter says

    Not a timestamp or date
  2. A month or day that does not exist

    Month 13 or day 45 cannot be a date.

    Input

    2026-13-45

    Timestamp Converter says

    Not a timestamp or date
  3. A date that is not on the calendar

    Some engines silently roll 2026-02-30 over to 2 March, others report Invalid Date. This tool refuses it, so you do not get a wrong date.

    Input

    2026-02-30

    Timestamp Converter says

    Not a timestamp or date
  4. Text that is not a date

    undefined, null or a word gives Invalid Date. Check the value before you build the Date.

    Input

    hello

    Timestamp Converter says

    Not a timestamp or date
  5. The ISO format works

    Year, month and day in that order, with dashes, is always read the same way.

    Input

    2026-12-31

    Timestamp Converter says

    1798675200 seconds, 2026-12-31T00:00:00Z

How to fix it

  1. Write dates as ISO 8601: 2026-12-31 or 2026-12-31T12:00:00Z.
  2. For day-first input, split the text and build the date from numbers: new Date(2026, 11, 31).
  3. Check isNaN(date.getTime()) before you use a Date from outside your code.
  4. Paste the text into the timestamp converter to see whether it is a real date.

Related tool

More error explainers are coming

See all errors.