Skip to content

fix: correct dropdown navigation in multi-month calendars#2977

Merged
gpbl merged 2 commits into
gpbl:mainfrom
hackgray47-eng:fix/incorrect-month-setting-in-day-picker
May 7, 2026
Merged

fix: correct dropdown navigation in multi-month calendars#2977
gpbl merged 2 commits into
gpbl:mainfrom
hackgray47-eng:fix/incorrect-month-setting-in-day-picker

Conversation

@hackgray47-eng

Copy link
Copy Markdown
Contributor

When using captionLayout="dropdown" with numberOfMonths > 1, selecting a month or year from the Nth calendar's dropdown was incorrectly setting firstMonth to the selected value directly, causing the first calendar to jump instead of the intended one. Offset the target by -displayIndex before calling goToMonth so the selected calendar shows the chosen month.

Fixes #2741

@hackgray47-eng hackgray47-eng requested a review from gpbl as a code owner May 2, 2026 04:33
@changeset-bot

changeset-bot Bot commented May 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cd5bd21

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
react-day-picker Patch
@daypicker/react Patch
@daypicker/buddhist Patch
@daypicker/ethiopic Patch
@daypicker/hebrew Patch
@daypicker/hijri Patch
@daypicker/persian Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@gpbl gpbl force-pushed the fix/incorrect-month-setting-in-day-picker branch from e799499 to cd5bd21 Compare May 7, 2026 09:19
@gpbl

gpbl commented May 7, 2026

Copy link
Copy Markdown
Owner

Thanks for the fix @hackgray47-eng.

I added coverage for reverseMonths: it uses the chronological month offset instead of the visual displayIndex.

@gpbl gpbl changed the title Fix issue #2741: correct month dropdown navigation for multi-month calendar fix: correct dropdown navigation in multi-month calendars May 7, 2026
@gpbl gpbl merged commit b55a878 into gpbl:main May 7, 2026
8 checks passed
@hackgray47-eng

Copy link
Copy Markdown
Contributor Author

Thanks for the fix @hackgray47-eng.

I added coverage for reverseMonths: it uses the chronological month offset instead of the visual displayIndex.

Thank you.

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

Successfully merging this pull request may close these issues.

Dropdown should change the month where it is displayed

2 participants