如何在角度引导日期选择器中阻止未来的日期和时间。我找到了一些例子,但它在4小时之前就被阻止了
我想要的是阻止直到当前小时和当前分钟
有可能吗?
$scope.beforeRender = function($dates) {
/* disable future dates */
for (var i = 0; i < $dates.length; i++) {
if (new Date().getTime() < $dates[i].utcDateValue) {
$dates[i].selectable = false;
}
}
};
<div class="input-group">
<div class="dropdown">
<a class="dropdown-toggle" id="dropdown2" role="button" data-toggle="dropdown">
<div class="input-group">
<div class="form-control" id="selected_date">
{{ formData.dateInput | date:'yyyy-MM-dd HH:mm:ss' }}
</div>
<span class="input-group-addon">
<i class="glyphicon glyphicon-calendar"></i>
</span>
</div>
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
<datetimepicker data-ng-model="formData.dateInput"
data-datetimepicker-config="{ dropdownSelector: '#dropdown2' " />
</ul>
</div>
</div>
答案 0 :(得分:0)
使用结束日期选项
<input type="text" class="form-control" data-date-end-date="0d">
http://bootstrap-datepicker.readthedocs.io/en/latest/options.html#enddate