Reputation: 41
I'm using jquery datepicker and my problem is that i want to disable all past dates and up to future date 13 march 2016.After 13 march 2016 user can select date.i tried with following
$(function() {
$( "#pickup_date" ).datepicker({ minDate: 0,
beforeShowDay: function(date) { return [date.getDay() == 3, ""];}
});
});
Upvotes: 0
Views: 600
Reputation: 1423
Use the minDate
option, like this.
$("#pickup_date").datepicker({ minDate: new Date(2016, 2, 13) });
A snippet from the docs:
The minimum selectable date. When set to
null
, there is no minimum.
You were close, just that setting minDate
to 0
does not help at all.
Upvotes: 0
Reputation: 15154
you use minDate
as @JiaJain stated WITHOUT a maxDate
. setting maxDate
to new Date
would not allow user to enter a future date more than today.
$(function() {
$( "#pickup_date" ).datepicker({
minDate: new Date(2016, 2, 14)
});
});
Using 14
will set the minimum date to 14th of March, After 13 march 2016.
Upvotes: 1