You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] DateInput, DateTimeInput: typing a numeric date fires onChange with month-first dates on the way #8958
Typing a numeric date into DateInput or DateTimeInput sends wrong dates to onChange on the way, and a two-digit year is read month-first whatever the locale.
parseDateInput reads a numeric date in the provider locale's order only when it has a four-digit year (dateParser.ts:111-127). Anything else that isn't bare digits falls through to new Date(trimmed) (dateParser.ts:142), which in V8 and other engines reads a/b/c as month/day/year and accepts a one- to three-digit year. The input's change handler fires onChange for every text that parses (DateInput.tsx:736-744; the same in DateTimeInput.tsx:1059-1067).
In en-GB (day first), typing 12/01/2026 one character at a time calls onChange with:
Text
onChange
12/0
2001-12-01
12/01
2026-01-12
12/01/
2001-12-01
12/01/2
2002-12-01
12/01/20
2020-12-01
12/01/202
0202-12-01
12/01/2026
2026-01-12
Only the last value is what the person typed. A caller that saves, filters or fetches on onChange acts on six wrong dates, and the open calendar jumps between December 2001, 2002, 2020 and 0202. A finished 12/01/90 commits 1990-12-01 (1 December), not 12 January 1990, in a day-first locale.
Expected: a partial numeric date (a trailing separator, or a year shorter than the locale's form) is not a date yet and fires nothing, and a two-digit year, if accepted, is read in the locale's order with a defined century rule. The native Date fallback should not read numeric input at all, since its order is fixed month-first.
Activity
fix(dateParser): in day-first locales, numeric text never takes the n…
feat(DateInput, DateTimeInput, DateRangeInput): type, pick and show d…