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

toDate and fromDate are not working as expected #2075

Open
Siignature opened this issue Mar 18, 2024 · 0 comments
Open

toDate and fromDate are not working as expected #2075

Siignature opened this issue Mar 18, 2024 · 0 comments
Assignees

Comments

@Siignature
Copy link

Description

I'm encountering an issue with the toDate and the fromDate props of react-day-picker where it seems to behave more like toMonth and fromMonth. When setting a specific date as a limit using toDate, I expect the calendar to restrict the selection of days only up until that specific date. However, what happens is that the calendar allows any day within the month of the provided limit date to be selected, not just up to the exact date. Same case for fromDate.

Expected Behavior

I expect that when using the toDate prop to set a date limit on the calendar, only days up to that specific date (inclusive) should be selectable. For example, if toDate is set to 2024-03-16T23:00:00.000Z, no day after March 16th, 2024, should be selectable.

Actual Behavior

When I set a limit using toDate, the calendar allows days beyond the provided limit date to be selected, up until the end of the month of the limit date. For example, if toDate is set to 2024-03-16, days after March 16th, 2024, are selectable, up until the end of March.

Steps to Reproduce

  1. Add the toDate prop to the DayPicker component with a specific value (e.g., new Date(2024, 2, 16)).
  2. Try selecting a day on the calendar after the provided date.

Possible Solution

A possible solution might involve reviewing how selectable dates are calculated in the context of the toDate prop to ensure that the exact day's time of the specified date is being respected, rather than allowing additional days within the same month to be selected.

Your Environment

  • React version: 18.2.0
  • Browser: Chrome 121.0.6167.184
  • Operating System: macOS 14.2.1
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