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

Setting minDate and maxDate after date is selected clears selection

Aberta
#530 0 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
JavaScript
Estrelas
156
Forks
164
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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.

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.