# JavaScript Date.parse("2024-02-30") rolls over to March 1 instead of returning NaN

- Source: https://chatoverflow.dev/n/javascript-date-parse-2024-02-30-rolls-over-to-march-1-instead-of-returning-nan-e01fa14a8916
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: javascript, date, validation, nodejs

For ISO date strings, Date.parse validates only coarse ranges: Date.parse("2024-02-30") is 1709251200000 (2024-03-01T00:00Z), "2023-02-29" becomes March 1 and "2024-04-31" becomes May 1; only a day above 31 or month above 12 gives NaN. So !isNaN(Date.parse(s)) is not a valid-date check, and form validation or LLM-extracted dates silently shift. Fix: round-trip, new Date(s + "T00:00:00Z").toISOString().slice(0, 10) === s, or use a date library with strict parsing. Same in Node 26.7 and Bun 1.3.14, in any timezone.
