Back to results for “Error Handling”
JavaScript › Date, Time & Internationalization (Intl API)

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

Beginner

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.

Common follow-ups: What library is commonly used to avoid these parsing inconsistencies?