Skip to content

fix: clamp month navigation to min/max to prevent snap-back (#6290)#6291

Open
GauravDhuri wants to merge 1 commit into
Hacker0x01:mainfrom
GauravDhuri:bugfix-month-snapback-6290
Open

fix: clamp month navigation to min/max to prevent snap-back (#6290)#6291
GauravDhuri wants to merge 1 commit into
Hacker0x01:mainfrom
GauravDhuri:bugfix-month-snapback-6290

Conversation

@GauravDhuri

@GauravDhuri GauravDhuri commented Jun 15, 2026

Copy link
Copy Markdown

name: Pull Request
about: Create a pull request to improve this repository
title: ""
labels: ""
assignees: ""

Description

Linked issue: #6290

Problem
When we pick a month from the month dropdown, the calendar sometimes jumps to that month for a moment and then snaps back to the month we were already on.

Changes

  • Clamp the navigated date into [minDate, maxDate] before passing it to handleCustomMonthChange/setPreSelection. This keeps the target date selectable, so the view stays n the picked month and onMonthChange fires exactly once with the correct math.
  • Regression test covering navigation to a month with no selectable day near the maxDate boundary.

Screenshots

Datepicker.month.snapback.-.Fix.mov

To reviewers

Contribution checklist

  • I have followed the contributing guidelines.
  • I have added sufficient test coverage for my changes.
  • I have formatted my code with Prettier and checked for linting issues with ESLint for code readability.

@GauravDhuri GauravDhuri marked this pull request as ready for review June 15, 2026 21:05
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.

1 participant