adopted-ember-addons / adopted-ember-addons/ember-pikaday

Setting minDate and maxDate after date is selected clears selection

Đang mở
#530 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
156
Fork
164
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I have two date pickers that work together, the end date and the start date.

I want to set the minDate of the end date to the selection of the start date (because it cannot end before it starts) and vice versa.

This is how I am doing it:

```
onInputDateTo(date) {
...
const dateEndOfDay = new Date(date)
dateEndOfDay.setHours(23, 59, 59, 999)
this.maxDateFromAllowed = dateEndOfDay;
...
```

Notice how I use setHours to change to the end of the day to allow the selection of the same day.

No matter which day is selected, setting the `maxDateFromAllowed` will clear the selection of the start date.

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

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

Đánh giá

Issue này chưa được đánh giá.

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.