diff --git a/src/datepicker/datepicker-inner.component.ts b/src/datepicker/datepicker-inner.component.ts index faf5b48094..92cc7f513a 100644 --- a/src/datepicker/datepicker-inner.component.ts +++ b/src/datepicker/datepicker-inner.component.ts @@ -62,6 +62,7 @@ export class DatePickerInnerComponent implements OnInit, OnChanges { @Input() monthColLimit: number; @Input() yearColLimit: number; @Input() dateDisabled: { date: Date; mode: string }[]; + @Input() dayDisabled: number[]; @Input() initDate: Date; @Output() selectionDone: EventEmitter = new EventEmitter(undefined); @@ -380,6 +381,12 @@ export class DatePickerInnerComponent implements OnInit, OnChanges { ); } + if (this.dayDisabled) { + isDateDisabled = + isDateDisabled || + this.dayDisabled.indexOf(date.getDay()) > -1; + } + return ( isDateDisabled || (this.minDate && this.compare(date, this.minDate) < 0) || diff --git a/src/datepicker/datepicker.component.ts b/src/datepicker/datepicker.component.ts index 3ba0c2633f..e1414ad2ae 100644 --- a/src/datepicker/datepicker.component.ts +++ b/src/datepicker/datepicker.component.ts @@ -41,6 +41,7 @@ export const DATEPICKER_CONTROL_VALUE_ACCESSOR: any = { [yearRange]="yearRange" [customClass]="customClass" [dateDisabled]="dateDisabled" + [dayDisabled]="dayDisabled" [onlyCurrentMonth]="onlyCurrentMonth" [shortcutPropagation]="shortcutPropagation" [monthColLimit]="monthColLimit" @@ -98,6 +99,8 @@ export class DatePickerComponent implements ControlValueAccessor { @Input() customClass: { date: Date; mode: string; clazz: string }[]; /** array of disabled dates */ @Input() dateDisabled: { date: Date; mode: string }[]; + /** disabled days of the week from 0-6 (0=Sunday, ..., 6=Saturday) */ + @Input() dayDisabled: number[]; /** currently active date */ @Input()