Bootstrap datetimepicker startDate does not disable past dates

后端 未结 3 1106
时光取名叫无心
时光取名叫无心 2021-01-15 13:25

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.g         


        
相关标签:
3条回答
  • 2021-01-15 13:50

    It's been a long time. The option minDate is deprecated. the new one is startDate

    So you can use:

    <script type="text/javascript">
        $(".form_datetime").datetimepicker({
            format: "dd MM yyyy - hh:ii",
            autoclose: true,
            todayBtn: true,
            startDate: "2013-02-14 10:00",
            minuteStep: 10
        });
    </script> 
    
    0 讨论(0)
  • 2021-01-15 14:07

    startDate api will helps to disable past date

    <script type="text/javascript">
         $(function() {
            $(".dates").datepicker({
            format:'dd-mm-yyyy',
            startDate:new Date(),
            autoclose:true
    });
    </script>
    
    0 讨论(0)
  • 2021-01-15 14:08

    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
    });
    
    0 讨论(0)
提交回复
热议问题