如何在datetimepicker引导程序之前禁用日期?

时间:2016-07-21 22:32:18

标签: javascript jquery datetimepicker bootstrap-datetimepicker

演示和完整代码如下:http://fiddle.jshell.net/oscar11/dgb09c5c/5/

我的Javascript代码是这样的:

$('#time-start').datetimepicker({
    format: 'yyyy-mm-dd hh:ii:ss',
    autoclose: true,
    pickerPosition: "bottom-left",
    maxView: 3,
    minuteStep: 1,
    minDate: new Date()
})

如何在今天之前禁用日期?

我添加minDate: new Date(),但它无效

解决我问题的任何解决方案?

1 个答案:

答案 0 :(得分:2)

来自Bootstrap datetime picker documentation

$.fn.datetimepicker.defaults = {
  maskInput: true,           // disables the text input mask
  pickDate: true,            // disables the date picker
  pickTime: true,            // disables de time picker
  pick12HourFormat: false,   // enables the 12-hour format time picker
  pickSeconds: true,         // disables seconds in the time picker
  startDate: -Infinity,      // set a minimum date
  endDate: Infinity          // set a maximum date
};

我修改了你的小提琴。这是你在找什么? http://fiddle.jshell.net/dgb09c5c/6/