Bootstrap datepicker disabling past dates without current date

前端 未结 20 2224
[愿得一人]
[愿得一人] 2020-11-27 04:55

I wanted to disable all past date before current date, not with current date. I am trying by bootstrap datepicker library \"bootstrap-datepicker\" and using following code:<

20条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-27 05:37

    Use minDate

    var date = new Date();
    var today = new Date(date.getFullYear(), date.getMonth(), date.getDate());
    
    $('#date').datepicker({ 
        minDate: today
    });
    

提交回复
热议问题