How to Disable Weekends (Sat & Sun) using ngx-bootstrap BsDatePicker?

1k views Asked by At

I m using 'ngx-bootstrap bsdatepicker' in angular 8 application. i need to disable all weekends(Sat and Sunday) and national holidays .is there any possible way to do ?

1

There are 1 answers

0
Jelle On BEST ANSWER

To disable specific weekdays you can do the following:

<input class="form-control" placeholder="Daterangepicker" bsDaterangepicker [daysDisabled]="[6,0]">

For all the other days you want to disable you can manually add them with:

    <input type="text"
           placeholder="Datepicker"
           class="form-control"
           bsDatepicker
           [datesDisabled]="disabledDates">
  disabledDates = [
    new Date('2020-02-05'),
    new Date('2020-02-09')
  ];

Further documentation can be found at https://valor-software.com/ngx-bootstrap/#/datepicker