title: How to validate datepicker range using AngularJS?
body: <p>I am trying to validate date,so in below html End date should always be greater than start date, I used  k-min and k-rebind that is working for user its disabling start date numbers, but with that implementation user can go back and select higher start date so here i implement AngularJS custom validation if end date is less than start date throw validation error but its not wokring with below code...</p>
  
  <p>main.html</p>
  
  <pre><code>&lt;div class="form-group col-md-6 fieldHeight"&gt;
      &lt;label for="cycleStart" class="col-md-4 required"&gt;Cycle Start&lt;/label&gt;
      &lt;div class="col-md-8"&gt;
          &lt;input kendo-date-picker
          type="text" class="form-control" id="cycleStart"
          name="cycleStart"
          ng-model="rcsaCycleDTO.cycStartDate" 
          k-ng-model="cycleStrtObj"
          onkeydown="return false;"
          ng-change="validateDate()"
          required data-required-msg="Cycle start is required"&gt;
          &lt;p class="text-danger" ng-show="createRcsaCycleForm.cycleStart.$touched &amp;&amp; createRcsaCycleForm.cycleStart.$error.required"&gt;Cycle Start is required field&lt;/p&gt;                                
      &lt;/div&gt;
  &lt;div class="form-group col-md-6 fieldHeight"&gt;
      &lt;label for="cycleEnd" class="col-md-4 required"&gt;Cycle end (due date)&lt;/label&gt;
      &lt;div class="col-md-8"&gt;
          &lt;input 
          kendo-date-picker
          type="text" class="form-control" id="cycleEnd"
          name="cycleEnd"
          ng-model="rcsaCycleDTO.cycEndDate"
          k-min="cycleStrtObj" 
          k-rebind="cycleStrtObj"
          onkeydown="return false;"
          ng-change="validateDate()"
          required&gt;
          &lt;p class="text-danger" ng-show="createRcsaCycleForm.cycleEnd.$touched &amp;&amp; createRcsaCycleForm.cycleEnd.$error.required"&gt;Cycle End is required field&lt;/p&gt;
          &lt;p class="text-danger" ng-show="createRcsaCycleForm.cycleEnd.$error.valid"&gt; Name already existed&lt;/p&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>main.js</p>
  
  <pre><code>$scope.validateDate = function(){
            var startDate = $scope.rcsaCycleDTO.cycStartDate;
            var endDate = $scope.rcsaCycleDTO.cycEndDate;
            if (endDate &lt;= startDate) {
              $scope.createRcsaCycleForm.cycleEnd.$setValidity('valid',false);
            }
          }
  </code></pre>