I am looking for a function that can disable weekends on my datepicker. I know that I can use isDayDisabledCallback to disable dates but how can I only disable weekends.
JavaScript
x
2
1
<dp-date-picker [(ngModel)]="selectedDate" [config]="datePickerConfig"></dp-date-picker>
2
Advertisement
Answer
In the configuration you can set the callback isDayDisabledCallback like that for exclude Saturday and Sunday.
JavaScript
1
4
1
config = {
2
isDayDisabledCallback: (date) => [0, 6].includes(date.day())
3
};
4