Search code examples
javascriptkendo-uitelerikkendo-datepicker

Kendo Datepicker setting value error


Why this code does not set the value to input element?

<input id="datePicker" />
<script>
  $(document).ready(function(){
    $("#datePicker").kendoDatePicker({
      value: new Date(),
      min: new Date()
    })
  });
</script>
<button>SetNewValue</button>
<script>
  $('button').on('click',function(){
    var dp = $("#datePicker").data('kendoDatePicker');
    dp.value(new Date(2016,1,1))
  })
</script>

If I change date to "new Date(2016, 4, 1)" value will be set correctly. The error appears in all browsers.

Link to JSbin example http://jsbin.com/catolumifa/edit?html,output


Solution

  • You are not able to set past date "2016,1,1" because you have set minimum date as current date. so you cannot set older date than today.

    so please remove below code lines from your code.

     min: new Date()