title: How to set maxDate in jquery datepicker based on certain value
body: <p>I am trying to set <strong>maxDate</strong> based on user selection of given input date, suppose if user select today date then the <strong>maxDate</strong> should be set to 3 or 4 days from today or even a week upto max.But i am using the following logic to set <strong>minDate</strong> automatically based on user input selection</p>
  
  <pre><code> $(checkIn).datepicker(
             {
                  changeMonth:false,
                  changeYear:false,
                  dateFormat: 'dd/mm/yy',
                  minDate:0
             });
             var temp;
             $(checkIn).on("change",function()
             {
                 var select = $(this).datepicker("getDate");
                 temp=select;
                 $(checkOut).datepicker('option','minDate',temp)
  
             })
  </code></pre>
  
  <p>This logic work fines here but when i am trying to set maxDate based on this logic i am getting certain error here is the code </p>
  
  <pre><code>$(checkOut).datepicker({
                 changeMonth:false,
                  changeYear:false,
                  dateFormat: 'dd/mm/yy',
                  maxDate: new Date($(checkIn).val()) + "1w"
      })
  </code></pre>
  
  <p>When i run this code what happen is if i select today's date for instance it gives correct <strong>maxDate</strong> till upto 7 days but if i again change the date in <strong><em>checkIn</em></strong> input the maxDate is one day less and thus as i keep selecting forward date ahead from current date a point will come where all the date in <strong><em>checkOut</em></strong> input are disabled and i cant select any of it.</p>