nextui icon indicating copy to clipboard operation
nextui copied to clipboard

[BUG] - DateInput component prevents typing incomplete dates (e.g., inputting 31 becomes 01 automatically if month is not filled)

Open MartaBento opened this issue 2 years ago β€’ 2 comments

NextUI Version

2.4.8

Describe the bug

When using the DateInput component, inputting certain dates, such as β€œ31” for the day, is impossible, unless the month field is filled out already.

This restriction creates a frustrating user experience, particularly for fields like β€œDate of Birth,” where users might want to input the day before the month or year.

Steps to Reproduce the Bug or Issue

  1. Add a DateInput component to a form;
  2. Focus on the date input field and attempt to type 31 as the day before filling in the month or year;
  3. Observe that the input automatically fills out 01, instead of 31.

Expected behavior

Users should be able to type day, month, and year in any order, including incomplete values (e.g., entering the day without specifying the month or year yet). The component should:

  • Allow partial input temporarily.
  • Validate only when all parts of the date are filled.

Screenshots or Videos

https://github.com/user-attachments/assets/84cdbd19-32be-45c3-a00e-a58d91cd0a0a

Operating System Version

macOS

Browser

Chrome

MartaBento avatar Nov 15 '24 11:11 MartaBento

see https://github.com/nextui-org/nextui/issues/2913#issuecomment-2085363909

wingkwong avatar Nov 15 '24 13:11 wingkwong