title: How to restrict datepicker end date based on start date in jquery-ui?
body: <p>Im trying to get the the user who chooses a start date in #ftm-field1, and when a date in #ftm-field1 is chosen, <strong>the user cannot choose an end date that is before #ftm-field1</strong>. The end date is chosen in #ftm-field2.</p>
  
  <pre><code>var dateToday = new Date();
  $('#formTaskManagement #ftm-field1').datepicker({
      dateFormat: "yy-mm-dd",
      minDate: null,
      maxDate: dateToday,
  });
  
  $('#formTaskManagement #ftm-field2').datepicker({
      dateFormat: "yy-mm-dd",
      minDate: null,
      maxDate: dateToday,
  });
  </code></pre>
  
  <p>I've tried using</p>
  
  <pre><code>$('#formTaskManagement #ftm-field1').datepicker({
          minDate: null,
          maxDate: dateToday,
          onSelect: function(selected) {
              $('#formTaskManagement #ftm-field2').datepicker({minDate: selected})
          }
      });
  
      $('#formTaskManagement #ftm-field2').datepicker({
          minDate: null,
          maxDate: dateToday,
          onSelect: function(selected) {
              $('#formTaskManagement #ftm-field1').datepicker({maxDate: selected})
          }
      });
  </code></pre>
  
  <p>I've tried this stackoverflow <a href="https://stackoverflow.com/questions/4419804/restrict-date-in-jquery-datepicker-based-on-another-datepicker-or-textbox">post</a> as well but have not been successful.</p>
  
  <p>It just simply doesn't work. Thank you for reading this.</p>