DEV Community

Discussion on: A React library for Y-M-D dropdown date picker

Collapse
 
whitphx profile image
Yuichiro Tachibana (Tsuchiya)

Hi, thank you for the comment!
I understand your point, and that's what I also had been thinking too.
At that time, I didn't implement it because I thought there would be some UX flaw like the following:

  1. The user wants to input 2022/01/31, for example.
  2. But the user selected 2022/02/31 as a mistake.
  3. Then the day is cleared, so the user will have to select the day again after selecting the correct month.

So I implemented only checking the invalid combinations of Y-M-D and in that case returning null from the hook so that indicating an error can be implemented on the component layer.

Clearing the day selection can also be a good option, but I could not put it in the core code yet.

Implementation of a correct error message is still at a ticket though: github.com/whitphx/react-ymd-date-...