Skip to content

Conversation

@tejas-fullstack
Copy link


name: Pull Request
about: Create a pull request to improve this repository
title: "Fix: Calendar displays startDate as first month #5939"
labels: "bug"
assignees: ""

Description

Linked issue: #5939

Problem
The calendar in react-datepicker does not display the startDate as the first month when a date range is selected or when a preselected date is set. Users expected the calendar to open showing the startDate as the first visible month.

Changes

  • Added handling for selectsRange and monthSelectedIn state to ensure the calendar opens at the startDate.
  • Updated componentDidUpdate to reset monthSelectedIn when selectsRange is true.
  • Added relevant tests to confirm calendar behavior for startDate selection.

Screen Recorder

fix-5939.mp4

To reviewers

  • Verify that the calendar opens with the startDate as the first visible month.
  • Check that no regression occurs for single-date selection.

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.

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