-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Description
HeroUI Version
"@heroui/react": "^2.7.8"
Describe the bug
When using the DatePicker component with locale="th-TH", typing a Buddhist Era year (e.g., 2544) causes unexpected behavior:
- When the user starts typing the year (e.g., enters 2), the onChange event immediately fires with an incorrect value:
{
"calendar": { "identifier": "gregory" },
"era": "BC",
"year": 542,
"month": 8,
"day": 1
}
- At the same time, the input field is cleared, leaving only the partial year instead of the full typed value.
This makes it impossible for users to enter Buddhist Era years correctly.
Your Example Website or App
No response
Steps to Reproduce the Bug or Issue
- on HeroUiProvider wrapper render
<HeroUIProvider locale="th-TH">
- Render the component:
<DatePicker onChange={(v) => console.log(v)} />
- Focus the input field.
- Type 01 → 08 → 2544.
- Notice that after typing the first digits of the year (2), the onChange fires with era: "BC" and the input value resets.
Expected behavior
- The component should wait until the year is fully typed before parsing.
- Input should not be cleared prematurely.
- Buddhist Era years (e.g., 2544) should map correctly to Gregorian years.
Actual Behavior
- Partial input is interpreted as BC year.
- Input is cleared unexpectedly.
- Users cannot type Buddhist Era years properly.
Screenshots or Videos
reproduce.mov
Operating System Version
mac OS
Browser
Chrome