0

I'm working on Angular and using ng-pick-datetime plugin. I want to disable the dates of every weekend(Saturday & Sunday). I tried to search but couldn't find any solution.

<input [owlDateTime]="dt1" class="form-control" formControlName="currentDate" [owlDateTimeTrigger]="dt1" placeholder="mm/dd/yyyy" />
        
<owl-date-time #dt1 pickerType="calendar"></owl-date-time>
Manoj Rana
  • 3,068
  • 1
  • 24
  • 34

1 Answers1

0

From the docs: https://daniel-projects.firebaseapp.com/owlng/date-time-picker#date-time-validation

<input [owlDateTimeFilter]="myFilter" [owlDateTimeTrigger]="dt" [owlDateTime]="dt">
<owl-date-time #dt></owl-date-time>

export class MyComponent {
  public myFilter = (d: Date): boolean => {
    const day = d.getDay();
    // Prevent Saturday and Sunday from being selected.
    return day !== 0 && day !== 6;
  }
}
Eugene_Kr
  • 109
  • 3