title: how to disable future dates based on some datepicker value in jquery datepicker
body: <p>I am using jquery datepicker and I have 4 dates:start_date,end_date,publishing_date and departure_date.Here based on start_date I want to disable future dates upto start_date and similarly based on end_date I want to disable past dates from end date. I am not able to do so, tried many option as onSelect but I just can't get the required disabling.Here is my jquery code.</p>
  
  <pre><code>var dateToday = new Date();
  var dates = $("#start_date, #end_date").datepicker({
      dateFormat: 'yy-mm-dd',
      minDate: dateToday,
      onSelect: function(selectedDate) {
          var option = this.id == "start_date" ? "minDate" : "maxDate",
          instance = $(this).data("datepicker"),
          date = $.datepicker.parseDate(instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings);
          dates.not(this).datepicker("option", option, date);
      }
  });
  
  $('#departure_date').datepicker({
      dateFormat: 'yy-mm-dd',
      minDate: $('#end_date').datepicker({
          dateFormat: 'dd-mm-yy'
      }).val()
  });
  
  $('#publishing_date').datepicker({
      dateFormat: 'yy-mm-dd',
      maxDate: $('#start_date').datepicker({
          dateFormat: 'dd-mm-yy'
      }).val()
  });
  </code></pre>
  
  <p>Any suggestions/help is welcome.Thanks in advance.</p>
  
  <p>Also tried using as follows but to no avail.</p>
  
  <pre><code>$('#publishing_date').datepicker({
      dateFormat: 'yy-mm-dd',
      maxDate : ($.datepicker.formatDate('yy-mm-dd', $('#start_date').datepicker("getDate")))
  });
  </code></pre>