jquery-uidatepicker

Set maxDate on jquery ui datepicker to certain date


I want to set the maxDate of jQuery UI to 18/02/2013 but upon trying, it only lets me update it to today's date.

How can I go about doing this?

$("#datepicker'.$row['id'].'").datepicker({
    minDate: -0, 
    dateFormat: \'dd/mm/yy\',
    maxDate: 18/02/2013
});

Solution

  • Try this:

    $("#datepicker").datepicker({ minDate: -0, maxDate: new Date(2013, 1, 18) });
    

    If you want use hard coded date, use the new Date(2013, 1, 18) pattern.

    If you want to use generic pattern, use "+1D +1M +1Y".

    Reference link: http://jsfiddle.net/pradkumar_n/wQe8c/