angular / angular/components

feat(MatDatePicker): DateRange should implement min/max duration

Đang mở
#20,780 3 bình luận 5 reaction 0 người được giao Xem trên GitHub
area: material/datepicker feature P3
Ngôn ngữ chính
TypeScript
Star
25k
Fork
6.8k
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
91

Mô tả

#### Feature Description

I would like to use date picker to allow a user to pick any number of days from 1-7, but no more than 7.

This could be implemented by adding a minimum (default: 1) and maximum (default: unlimited) duration values to the DateRange type.

If the minimum duration is not default:
- create greyed-out preview overlay of end values less than the minimum duration but not before the start value. Selecting a value within the minimum duration or before the start date should reset the start date to new date.

If the maximum duration is not default:
- create a preview up to the maximum duration. Selecting value beyond the maximum duration becomes new start date.

Example with (min 3 days, max 7 days) might look like something this:

(this is only to illustrate, I'm not a UI designer or anything)

#### Use Case

Currently, I must have the user use a dropdown to pick their duration first (which informs a MatDateRangeSelectionStrategy), and then use the date picker to select a start date.

Would very much like to get rid of the dropdown.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách đọc hành vi phạm vi ngày của MatDatePicker và MatDateRangeSelectionStrategy được mô tả trong issue. Xác định và kiểm tra hành vi của thời lượng tối thiểu và tối đa, bao gồm các overlay xem trước và việc đặt lại ngày bắt đầu khi một lựa chọn nằm ngoài phạm vi được phép.

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

Đánh giá

Công nghệ
angular, typescript
Lĩnh vực
frontend
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
25/100

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.