[英]How to disable future dates in bsdatePicker
I am using bsdatepicker in my angular project and i want to disable all future dates in that datePicker for the DOB selection 我在我的有角项目中使用bsdatepicker,我想禁用该datePicker中的所有将来日期以进行DOB选择
import { Component } from '@angular/core';
@Component({
selector: 'demo-datepicker-datesdisabled',
templateUrl: './disable-dates.html'
})
export class DemoDatepickerDatesDisabledComponent {
disabledDates = [
new Date('2019-02-05'),
new Date('2019-02-09')
];
}
<div class="row">
<div class="col-xs-12 col-12 col-md-4 form-group">
<input type="text"
placeholder="Datepicker"
class="form-control"
bsDatepicker
[datesDisabled]="disabledDates">
</div>
<div class="col-xs-12 col-12 col-md-4 form-group">
<input type="text"
placeholder="Daterangepicker"
class="form-control"
bsDaterangepicker
[datesDisabled]="disabledDates">
</div>
</div>
the above code is working but i want to disable future N number of date 上面的代码正常工作,但我想禁用将来的N个日期
Set [maxDate]
to today. 将[maxDate]
设置为今天。
<input type="text"
placeholder="Daterangepicker"
class="form-control"
bsDaterangepicker
[datesDisabled]="disabledDates"
[maxDate]="today"
>
public today = new Date();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.