在https://github.com/dalelotts/angular-bootstrap-datetimepicker的文档中,我找不到设置最小日期的配置。我需要禁用所有过去的日期。
答案 0 :(得分:0)
尝试以下代码。
import {DateButton} from 'angular-bootstrap-datetimepicker';
import * as _moment from 'moment';
import {unitOfTime} from 'moment';
private startDatePickerFilter(dateButton: DateButton, viewName: string): boolean {
return dateButton.value >= moment().startOf(viewName as unitOfTime.StartOf).valueOf();
}
参考:https://dalelotts.github.io/angular-bootstrap-datetimepicker/components/DlDateTimePickerComponent.html#selectFilter和https://stackblitz.com/github/dalelotts/angular-bootstrap-datetimepicker-demo