While working on a application, we generally need to disable past dates in bootstrap datetime picker or only bootstrap date picker. Because we can not give option to select prevoius date for date field which has to be filled with upcoming dates only.

We also can say that we should validate date or datetime field. Which is must an an important feature of date picker. By which we could store only valuable data not junk in our database.

Here, i will present an example where we will disable past dates in bootstrap datetime picker.

Actually the logic behind this is bootstrap date picker or date time picker provides an option for start date. If we initialize start date from today’s date the all previous dates will be automatically disabled.

$(function () {

    $('#datetimepicker').datetimepicker({

        minDate:new Date()

    });

});

#javascript #disable past dates #bootstrap

How to disable past dates in datetime picker with example
7.65 GEEK