user2075328 user2075328 - 20 days ago 6
Javascript Question

how to set minimum and maximum value of date picker in jquery?

I am using jquery date picker .I want to set max and minimum value of calendar ? how to set this value
Example minimum value is 1990 and maximum is 2050

$( "#inputBirthDate" ).datepicker({
changeMonth: true,
changeYear: true
});

<input class="span6 date_h nativedatepicker" id="inputBirthDate" type="text" style="pointer-event:none; width:240px;" readonly>

Answer

You need to use min-date and max-date option to set the min and max selectable date.

$("#inputBirthDate").datepicker({
    changeMonth: true,
    changeYear: true,
    minDate: new Date(2007, 1 - 1, 1),
    maxDate: new Date(2012, 1 - 1, 1),
});