Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using max date and typing future dates defaults back to unexpected dates #5031

Open
Drethic opened this issue Aug 7, 2024 · 1 comment
Open

Comments

@Drethic
Copy link

Drethic commented Aug 7, 2024

Describe the bug
When a maxDate is set in the date picker, typing in certain future dates causes the picker to change to unexpected dates instead of the configured maxDate.

To Reproduce
Steps to reproduce the behavior:

  1. Go to React Datepicker Max Date Example
  2. Click on the date entry field
  3. If the current date is between 01 and 09, i.e. 08/01/2024 -> 08/09/2024, update the day to 20 or 30 and press enter. For example, if the current date is 08/07/2024, update the value to read 08/20/2024 and press enter.
  4. After pressing enter, the date will update to a date before the maxDate value, but not the maxDate. Using the previous example, the date updates to read 08/02/2024.
  5. Another example is with the current date of 08/07/2024, updating the value to 09/30/2025 and pressing enter updates to read 08/03/2024.

Expected behavior
I would expect the date to read the maxDate if the given date is greater than the configured date.

Screenshots
Starting point:
image

Changed date before pressing enter:
image

Date after pressing enter:
image

Desktop (please complete the following information):

  • OS: Mac OS 14.1.1
  • Browser Chrome
  • Version 126.0.6478.62

Smartphone (please complete the following information):
N/A

Additional context
N/A

@balajis-qb
Copy link

I think currently if the date entered is greater than the maxDate, we'll restore it back to the previously selected date. I think that behaviour is okay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants