I want to disable all days except the 'Mondays' or 'Fridays' etc... in ngb-datepicker?
Template:
<input [(ngModel)]="model" ngbDatepicker #d="ngbDatepicker" [markDisabled]="isDisabled"/>
Component:
this.isDisabled = (date: NgbDate) =>(date.day) !== 1;
I realise this is almost a year old, but with that being said, this is how I resolved the same issue in my code.
Inside the component file I specified an object containing the days to be restricted (you can specify to restrict every day as a whole, for example all tuesdays, and you can specify to restrict specific dates).
Inside the constructor, provide an instance to the NgbCalendar and define a method which will check the date provided by the date picker and determine if it should be disabled according to your rules. This method will need to return a boolean (represents whether the date should be restricted).
Then, simply bind that method to the
markDisabledproperty of your input element.This will work even if you pass a minimum and maximum date to your date picker.