title: Start date End date validation in jQuery
body: <p>I have to validate start date is less than end date and end date is greater than start date using jQuery. Application is using HTML 5 + Thymeleaf. </p>
  
  <p>code :</p>
  
  <p>Validation 1:</p>
  
  <pre><code>$('#ValidFrom').removeClass('hasDatepicker').datepicker({ 
      dateFormat: 'dd-M-yy',
      changeMonth: true,
      changeYear: true,
      onSelect : ChangeEndDate
  });
  
  function ChangeEndDate() {
      var d = $("#ValidFrom").datepicker('getDate'); 
      $('#ValidTo').removeClass('hasDatepicker').datepicker({
          minDate : d, 
          dateFormat: 'dd-M-yy',
          changeMonth: true,
          changeYear: true
      });
  }
  </code></pre>
  
  <p>Validation 2:</p>
  
  <pre><code>$('#ValidTo').removeClass('hasDatepicker').datepicker({ 
      dateFormat: 'dd-M-yy',
      changeMonth: true,
      changeYear: true,
      onSelect : ChangeStartDate
  });
  
  function ChangeStartDate() {
      var d = $("#ValidTo").datepicker('getDate');  
      $('#ValidFrom').removeClass('hasDatepicker').datepicker({
          maxDate : d, 
          dateFormat: 'dd-M-yy',
          changeMonth: true,
          changeYear: true
      });
  }
  </code></pre>
  
  <p>If I use either one of the validations it is working fine. But if I use both, only Validation 1 is working. Can anyone help on this issue.</p>
  
  <p>Thanks in advance.</p>