-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
I'm having to always recreate the "datepickerOptionsDate". When I change month it assigns to the first day of the month to recharge.
I wish it only changed in the function.
I tried this.datepickerOptionsDate.disableDayFn and it did not work.
Can anybody help me?
Thanks.
ngOnInit() {
this.titleService.setTitle('Agendamento - Portal de Parceiros Peixe Urbano');
moment.locale('pt-br');
this.dateFilter = moment(Date());
this.datepickerOptionsDate = {
displayFormat: 'dddd, DD MMM YYYY',
inputClasses: ['form-control', 'group-left'],
};
this.list();
this.getAvailabilityCalendar(this.dateFilter);
}
getAvailabilityCalendar(dateMoment: Moment) {
let firstDate = dateMoment.format('YYYY-MM-01');
let lastDate = dateMoment.format('YYYY-MM-') + moment().daysInMonth();
this.scheduleService.getAvailabilityCalendar(firstDate, lastDate)
.subscribe(response => {
this.daysUnavailable = response;
this.datepickerOptionsDate = {
showEmptyRow: false,
displayFormat: 'dddd, DD MMM YYYY',
showDayQuickOptions: false,
inputClasses: ['form-control', 'group-left'],
disableDayFn: (dayMomentInstance) => {
let dateMoment = moment(dayMomentInstance).format('YYYY-MM-DD');
return this.daysUnavailable.find(p => moment(p).format('YYYY-MM-DD') === dateMoment);
}
}
},
error => {
this.errors = error;
});
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels