如何使用 ngx-bootstrap BsDatePicker 禁用周末(周六和周日)?

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

我在 angular 8 应用程序中使用 'ngx-bootstrap bsdatepicker'。我需要禁用所有周末(周六和周日)和国定假日。有什么可行的方法吗?

要禁用特定的工作日,您可以执行以下操作:

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

对于您想要禁用的所有其他日期,您可以手动添加它们:

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

可在 https://valor-software.com/ngx-bootstrap/#/datepicker

找到更多文档