Bootstrap datetimepicker startDate不禁用过去的日期 [英] Bootstrap datetimepicker startDate does not disable past dates

查看:475
本文介绍了Bootstrap datetimepicker startDate不禁用过去的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用引导程序datetimepicker,我想禁用过去的日子,但是 startDate 选项不起作用:

I use bootstrap datetimepicker and I want to disable the past days but startDate option did not work:

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
});


推荐答案

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

You probably need to use the minDate option of the datetimepicker:

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

这篇关于Bootstrap datetimepicker startDate不禁用过去的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆