kekeh / angular-mydatepicker

Angular datepicker and date range picker :date:
https://kekeh.github.io/angular-mydatepicker/
MIT License
1 stars 11 forks source link

Disable Until Month Repaint #86

Closed GusK7 closed 3 years ago

GusK7 commented 3 years ago

I Am using "angular-mydatepicker": "^0.11.3", with "@angular/cli": "^9.0.4",

I have two instances of calendar for a booking component. When I select a date from next month from the current the second instance disables the dates of the of first calendar selection but month does not getting updated to next month.

onDateChanged(event: IMyDateModel) { const d: Date = new Date(event.singleDate.jsDate); d.setDate(d.getDate()); const copy1: IAngularMyDpOptions = this.getCopyOfOptions1(); copy1.disableUntil = { year: d.getFullYear(), month: d.getMonth() + 1, day: d.getDate() }; this.myOptions2 = copy1; const copy2: IAngularMyDpOptions = this.getCopyOfOptions2(); copy2.disableUntil = { year: d.getFullYear(), month: d.getMonth() + 1, day: d.getDate() }; this.myOptions1 = copy2;

}

image

kekeh commented 3 years ago

Hi @GusK7

You can use the defaultMonth attribute on the second calendar to open the specific month and year.

Here is an example on how to use the defaultMonth attribute. Value of the defaultMonth attribute can be changed dynamically.

kekeh commented 3 years ago

Also if you need to select a start and end date you can set the datepicker to date range mode and use only one datepicker (date range picker).

GusK7 commented 3 years ago

Thanks a bunch for the fast reply defaultMonth work like a charm.

I would suggest putting this into your documentation for two instances of the calendar. I did some search before posting here and I seen a few posts asking about this issue.

Again, thanks alot.