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

Datepicker middle navigation button disabled for minDate Month #1494

Open
2 tasks done
jankovulovic opened this issue Sep 27, 2024 · 0 comments
Open
2 tasks done

Datepicker middle navigation button disabled for minDate Month #1494

jankovulovic opened this issue Sep 27, 2024 · 0 comments

Comments

@jankovulovic
Copy link

  • I have searched the Issues to see if this bug has already been reported
  • I have tested the latest version

Steps to reproduce

  1. Go to the Datepicker component and set minDate={new Date()} as the current date. The maxDate can be any date in the following month.
  2. 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:

Components._.Datepicker.-.Default.Storybook.-.Google.Chrome.2024-09-27.16-49-26.mp4
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