Hacker0x01 / react-datepicker

A simple and reusable datepicker component for React
https://reactdatepicker.com/
MIT License
8.12k stars 2.24k forks source link

Typing bug with dateformat #5175

Open dmaggiore-sorint opened 1 month ago

dmaggiore-sorint commented 1 month ago

Describe the bug When typing a date without zeros and with a 2digit year, when the day is smaller than 13, it invert the day and the month even though the dateFormat is "dd/MM/yyyy"

To Reproduce

  1. react-datepicker with dateFormat="dd/MM/yyyy"
  2. type a date like '4/8/24" (4 August 2024)

Expected behavior I expect to see the date 4th of August 2024 in the Datepicker (and also as value) and not 8th of April 2024

balajis-qb commented 1 month ago

In the above example instead of typing 4/8/24, if you type 4/8/2024 it's correctly parsing or if you change the date format to dd/MM/yy it's working.

dmaggiore-sorint commented 1 month ago

Ok it works with "dd/MM/yy" but then it doesn't work if the user tyèes 4/8/2024 thinking about 4th August instead of 8th of April.

We need to keep the dateFormat in the "dd/MM/yyyy" way and make 4/8/24 work aswell

balajis-qb commented 1 month ago

Hi @martijnrusschen, do you have any thoughts on this issue? I feel as the date format mentioned is not insync with the entered date value, this case is an expected. Let me know if this issue need to be fixed.

dmaggiore-sorint commented 3 days ago

any update on this issue?