How to disable past dates from the current date on a datetimepicker? I tried few posts for similar question but was unable to achieve it, Below is what I tried
If you want to set date on page load then use this:
$('#datetimepicker1').datetimepicker({
minDate: new Date()
});
This will set today's date as start date on page load itself and disable all the previous dates.
But if you want to set date on click of particular text-box instead of setting it on page load then use this:
$('#datetimepicker1').datetimepicker();
$("#datetimepicker1").on("click", function (e) {
$('#datetimepicker1').data("DateTimePicker").minDate(new Date());
});
In place of new Date(), we can use any string specifying Date in a format specified by us if we don't want to set current date as minimum date. e.g:
$('#datetimepicker1').data("DateTimePicker").minDate("10/15/2018");