-
Notifications
You must be signed in to change notification settings - Fork 384
Description
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
- Import the
DatePickercomponent fromreact-widgets. - Set the
minprop to a date in the future (at least 2 months in future) (e.g.,new Date(2025, 2, 12)for March 12, 2025). - Open the DatePicker popup.
- 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>
);
}