如何在jquery数据表中禁用当前日期选择。
$('.datetimepicker1').datetimepicker({
format: 'MM/DD/YYYY',
useCurrent: false,
minDate: moment().millisecond(0).second(0).minute(0).hour(0)
});
答案 0 :(得分:0)
$(document).ready(function() {
$('#Date').datepicker({
onSelect: function(dateText, inst) {
//Get today's date at midnight
var today = new Date();
today = Date.parse(today.getMonth()+1+'/'+today.getDate()+'/'+today.getFullYear());
var selDate = Date.parse(dateText);
if(selDate <= today) {
//If the selected date was
$('#Date').val('');
$(inst).datepicker('show');
}
}
});
});
这是bin。添加一个类似的逻辑来检查selected datetime and current datetime
是否进行选择。
答案 1 :(得分:0)
答案 2 :(得分:0)
是的,我刚才解决了这个问题,
$('.datetimepicker1').datetimepicker({
format: 'MM/DD/YYYY',
useCurrent: false,
minDate: new Date(date.getFullYear(), date.getMonth(), date.getDate()+1)
});
感谢快速回复人员