Datepicker middle navigation button disabled for minDate Month

Đang mở
#1,494 0 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
react, typescript
Lĩnh vực
frontend

Hướng nghiên cứu

Bắt đầu với component Datepicker và hàm isDateInRange(), sau đó tái hiện hành vi trong story Datepicker của Flowbite Storybook. Hoàn thành có nghĩa là nút trong header cho phép điều hướng đến một tháng chứa minDate hoặc maxDate, kể cả khi cả hai giới hạn đều nằm trong cùng một tháng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

  • 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:

https://github.com/user-attachments/assets/08e3e153-24bc-4853-a35d-5503c392045d

Ngôn ngữ chính
TypeScript
Star
2.2k
Fork
504
Merge trung bình
19 giờ 16 phút
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của themesberg/flowbite-react

Tất cả issue của themesberg/flowbite-react

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.