Bootstrap datetimepicker startDate不会禁用过去的日期

jin*_*wei 1 javascript date datetimepicker twitter-bootstrap

我使用bootstrap datetimepicker,我想禁用过去几天,但startDate选项不起作用:

var now = new Date();
var tomorrow = now.getFullYear() + "-" + (now.getMonth() + 1) + "-" + (now.getDate() + 1) + " " + now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds();
$('#end_at').datetimepicker({
    format: 'YYYY-MM-DD hh:mm:ss',
    startDate: tomorrow
});
Run Code Online (Sandbox Code Playgroud)

Sal*_*n A 5

您可能需要使用minDate日期时间选择器的选项:

var tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
$("#end_at").datetimepicker({
    format: 'YYYY-MM-DD HH:mm:ss',
    minDate: tomorrow
});
Run Code Online (Sandbox Code Playgroud)