Advertisement
Beginner JavaScript, Date, Time & Internationalization (Intl API)

Why is Date.parse() considered unreliable for parsing date strings?

Short answer

Date.parse() (and new Date(string)) behavior for non-ISO formats is implementation-defined, so the same string can parse differently across browsers. Only the ISO 8601 format (e.g. '2026-08-08') is guaranteed to parse consistently.

Save JavaScript mock interview
Advertisement
AModel answer
Date.parse() (and new Date(string)) behavior for non-ISO formats is implementation-defined, so the same string can parse differently across browsers. Only the ISO 8601 format (e.g. '2026-08-08') is guaranteed to parse consistently.
new Date('2026-08-08');        // reliable, ISO format
new Date('08/08/2026');        // ambiguous across locales/engines
Real-world example
A bug where a date string parsed fine in Chrome but produced Invalid Date in Safari.
Likely follow-ups
  • What library is commonly used to avoid these parsing inconsistencies?
Related topics