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

Navigation Buttons Disabled When min Prop of DatePicker is in the Future #1160

Open
cybersaksham opened this issue Jan 8, 2025 · 1 comment

Comments

@cybersaksham
Copy link

Bug Report: Navigation Buttons Disabled When min Prop of DatePicker is in the Future

Description

When setting the min prop of the DatePicker component to a date in the future, the navigation buttons in the popup become disabled if the min date is outside the current month. This behavior occurs because the DatePicker does not allow navigating to months where all dates are earlier than the min value.

For example, if today's date is January 2025 and the min prop is set to March 12, 2025, the month navigation buttons are disabled. This prevents users from navigating to February, even though March can be reached afterward.

Steps to Reproduce

  1. Import the DatePicker component from react-widgets.
  2. Set the min prop to a date in the future (at least 2 months in future) (e.g., new Date(2025, 2, 12) for March 12, 2025).
  3. Open the DatePicker popup.
  4. Observe that the navigation buttons are disabled and navigation to the next month (February) is not possible.

Expected Behavior

The navigation buttons should remain enabled, allowing users to navigate to future months even if the min value is in the middle or later part of a month. For instance, users should be able to navigate from January to February and then to March, respecting the min date for selection.

Actual Behavior

The navigation buttons are disabled entirely, making it impossible to navigate to months where the min date is valid for selection.

Code Example

import "./styles.css";
import { DatePicker } from "react-widgets";
import "react-widgets/styles.css";

export default function App() {
  return (
    <div>
      <div>Date</div>
      <DatePicker min={new Date(2025, 2, 12)} />
    </div>
  );
}
@cybersaksham
Copy link
Author

Screen.Recording.2025-01-08.at.2.01.46.PM.mov

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

1 participant