有没有一种方法可以在angular-bootstrap-datetimepicker中配置最小日期

时间:2019-08-06 11:20:39

标签: angular bootstrap-4 datepicker accessibility

https://github.com/dalelotts/angular-bootstrap-datetimepicker的文档中,我找不到设置最小日期的配置。我需要禁用所有过去的日期。

1 个答案:

答案 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#selectFilterhttps://stackblitz.com/github/dalelotts/angular-bootstrap-datetimepicker-demo