简体   繁体   English

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

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

I m using 'ngx-bootstrap bsdatepicker' in angular 8 application.我在 angular 8 应用程序中使用“ngx-bootstrap bsdatepicker” i need to disable all weekends(Sat and Sunday) and national holidays.is there any possible way to do?我需要禁用所有周末(周六和周日)和国定假日。有什么办法吗?

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更多文档可在https://valor-software.com/ngx-bootstrap/#/datepicker找到

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM