Bootstrap datepicker disabling past dates without current date

前端 未结 20 2231
[愿得一人]
[愿得一人] 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:40

    To disable past dates & highlight today's date:

    $(function () {
        $('.input-daterange').datepicker({
            startDate : new Date(),
            todayHighlight : true
        });
    });
    

    To disable future dates & highlight today's date:

    $(function () {
        $('.input-daterange').datepicker({
            endDate : new Date(),
            todayHighlight : true
        });
    });
    

    For more details check this out https://bootstrap-datepicker.readthedocs.io/en/latest/options.html?highlight=startdate#quick-reference

提交回复
热议问题