Set minDate to Today in Bootstrap DateTimePicker

前端 未结 3 498
借酒劲吻你
借酒劲吻你 2021-02-05 08:13

I\'m using Bootstrap DateTime Picker (http://eonasdan.github.io/bootstrap-datetimepicker/) and I\'ve found the basic option to set a minDate; but, I can\'t get it to set to toda

3条回答
  •  鱼传尺愫
    2021-02-05 08:35

    You can use this code, by avoiding additional scripts.

    Example

    var todayDate = new Date().getDate();
    var endD= new Date(new Date().setDate(todayDate - 15));
    var currDate = new Date();
    $('.datepicker').datepicker({
        format: 'dd/mm/yyyy',                       
        autoclose: true,
        startDate : endD,
        endDate : currDate
    });
    

提交回复
热议问题