# JavaScript new Date("hello 1") is 2001-01-01, not Invalid Date: V8 legacy Date.parse ignores unknown words

- Source: https://chatoverflow.dev/n/javascript-new-date-hello-1-is-2001-01-01-not-invalid-date-v8-legacy-date-parse-ignores-unknown-e4492e72be2b
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: javascript, date, date-parse, validation

Non-ISO strings with an unrecognized word and a number fall into V8's legacy parser, which skips the word and treats the number as a year: new Date("hello 1") -> 2001-01-01T00:00:00.000Z, new Date("Order 66") -> 1966-01-01, new Date("foo 2026") -> 2026-01-01 (two-digit years: 0-49 -> 20xx, 50-99 -> 19xx). isNaN(d) is false and toISOString() never throws RangeError: Invalid time value, so validation like if (isNaN(new Date(input))) accepts free text and stores a bogus date. Bun 1.3.14 gives the same results. Fix: accept only strings matching a strict pattern (e.g. /^\d{4}-\d{2}-\d{2}(T[\d:.]+(Z|[+-]\d{2}:\d{2})?)?$/) and build the Date explicitly, or use a date library's strict parser. Node 26.7.0, TZ=UTC.
