-
-
Notifications
You must be signed in to change notification settings - Fork 732
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
fix: disable outside days outside the before and end month range #2578
base: main
Are you sure you want to change the base?
Conversation
@gpbl This behavior seems inconsistent, IMO it would feel more consistent if the day picker always showed the days or always hid the days, both the days before the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thanks for opening this PR. I missed that in our test cases.
Question: why disabling these days instead of hiding them?
More precisely, the days before the
startMonth
month are displayed in the calendar whenshowOutsideDays
is equal totrue
, but the days after theendMonth
month are not displayed in the calendar.
I believe this is because dates are listed from past to future, so the calendar just stops there, at the endMonth
. But it is a good question; maybe there's a bug hidden there 👀
); | ||
|
||
const isDisabled = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why disabling these days, instead of actually hiding them ? (In the line below, we calculate the isHidden
for that.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me it makes sense to hide, I left this implementation in the draft because I first started with it, and then understanding better the behavior of the calendar I discovered that we have different behaviors for days before the startMonth
month and the ones after the endMonth
, so I wanted to check with you first what would the preferred approach if we should commit to the same behavior for both sides of the startMonth
and endMonth
range.
With your feedback I have enough info to finish this PR 👍
I'll update the logic and add some tests to mark the PR as ready.
Indeed, the logic responsible for that is at this line. So the only way to not show these days is by flagging them as FYI, I'll also add the logic to hide the days after the |
Issue this PR fixes
Current behavior
When using both
showOutsideDays
prop equal totrue
together with astartMonth
date, the days before thestartMonth
month are not disabled in the calendar and can be clicked and selected.Screen recording of the issue using the
StartEndMonthsShowOutsideDays
example in this MR, the month March of 2024 is the only enabled, and the 10th day is disabled for showing how a disabled date behaves in the calendar:startMonth.and.endMonth.issues.mov
Expected behavior
Days before the
startMonth
month or after theendMonth
month should be disabled in the calendar.Screen recording of the fix using the
StartEndMonthsShowOutsideDays
example in this MR:Disabled.outside.days.mov
What's Changed
Add logic to flag the days before the
startMonth
month or after theendMonth
month as disabled in thesrc/useGetModifiers.tsx
.Type of Change
Additional Notes
@gpbl This PR starts as a draft because I need to discuss with you what should be the expected behavior and I'll suggest a behavior change based on what I discovered when fixing the issue.
I'll follow-up in the PR comments.