• Follow me on:

Tuesday, March 26, 2019

Disable previous dates from jquery date picker

Sometimes you want users to select dates after current day, usually required in appointment or meeting applications. But these date pickers are provided with all dates active.  Following few lines can disable past dates from the current date on a datepicker.


This will set today's date as start date on page load itself and disable all the previous dates.

// Getter
var minDate = $( "#datepicker" ).datepicker( "option", "minDate" );
// Setter
$( "#datepicker" ).datepicker( "option", "minDate", new Date() );

In case you want to disable dates past some specific date in place of new Date(), we can use any string specifying Date in a format specified by us to set current date as minimum date. e.g:


$('#datetimepicker1').data("DateTimePicker").minDate("03/26/2018");

Share your solutions

No comments:

Post a Comment

All Rights Reserved Jaydharphics Click To Mail Me (+91 9564 5592 84)