themesberg / themesberg/flowbite-react
Datepicker middle navigation button disabled for minDate Month
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.1k
- Forks
- 506
- PR merge metrics
- No merged PRs in 30d
Description
- I have searched the Issues to see if this bug has already been reported
- I have tested the latest version
Steps to reproduce
- Go to the Datepicker component and set minDate={new Date()} as the current date. The maxDate can be any date in the following month.
- If your minDate is set to any day other than the first of the month, when you switch to the month view, the month containing your minDate will be disabled.
The issue seems to stem from the isDateInRange() function, which considers newDate as the first day of the month. This function should be split into two: one for days and another for months, years, and decades. While the current function works fine for day selection, it should be slightly modified for months, years, and decades to allow navigation and selection even if minDate or maxDate falls within the same month.
Current behavior
When minDate is set to any day other than the first of the month, the month button is disabled when navigating back to that month.
Expected behavior
The header button should allow navigation to the month containing the minDate.
Context
The desired functionality is to enable navigation to the month where minDate is set, even if it isn't the first of the month. Additionally, if both minDate and maxDate are within the same month, the button should still allow navigation to that month. Currently, when using the change view button, the month becomes disabled, and the user is forced to shift to the next month if maxDate is in the future.
Here is a short video of me on Flowbite Storybook's Datepicker story, showing the issue when trying to click the button with no response:
https://github.com/user-attachments/assets/08e3e153-24bc-4853-a35d-5503c392045d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Datepicker component and its isDateInRange() function, then reproduce the behavior in the Flowbite Storybook Datepicker story. Done means the header button permits navigation to a month containing minDate or maxDate, including when both bounds fall within the same month.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100