opened
ibagaric
username_0
When I dynamically set max date causes a month switch.

```
  onDateSelection(date: NgbDate) {
    if (!this.fromDate && !this.toDate) {
      this.fromDate = date;
    } else if (this.fromDate && !this.toDate && date && date.after(this.fromDate)) {
      this.toDate = date;
      this.datepicker.close();
    } else {
      this.toDate = null;
      this.fromDate = date;
      this.maxDate = this.calendar.getNext(this.fromDate, 'd', 16);
    }
  }
```

This is the code that I use, setting `maxdate `is just fine, but the calendar does not stay on the `fromDate`,  he switches to the month where was before selected `fromDate`. When I remove `maxdate`, everything works fine.
dynamically set max date couse month swithc
issue
closed
ibagaric
username_0
issue
created
ibagaric
username_0
My datepicker was inside a `div` that had class `hidden `. When I removed it to work properly :)
comment
reopened
ibagaric
username_0
When I dynamically set max date causes a month switch.

```
  onDateSelection(date: NgbDate) {
    if (!this.fromDate && !this.toDate) {
      this.fromDate = date;
    } else if (this.fromDate && !this.toDate && date && date.after(this.fromDate)) {
      this.toDate = date;
      this.datepicker.close();
    } else {
      this.toDate = null;
      this.fromDate = date;
      this.maxDate = this.calendar.getNext(this.fromDate, 'd', 16);
    }
  }
```

This is the code that I use, setting `maxdate `is just fine, but the calendar does not stay on the `fromDate`,  he switches to the month where was before selected `fromDate`. When I remove `maxdate`, everything works fine.
Dynamically set maxdate cause mouth switch
issue
created
ibagaric
username_0
Nope, when set bigger `maxdate`, the issue was again here
comment
closed
ibagaric
username_0
issue
created
ibagaric
username_0
In ngbDatepicker was input `[startDate]="fromDate"`, it seams that dynamic `maxDate `have some problem with it
comment