Set date of a datepicker

Posted by Bert Binnenmarsch on 22-May-2017 05:29

Hello,

I have a datepicker that is not connected to a datasource.
How can I set the date in the onShow event so the date is shown when the module is opened?

Best regards,
Bert

All Replies

Posted by Bert Binnenmarsch on 23-May-2017 07:59

As an alternative, I can put a datepicker in a Custom HTML component, how do I convert the following examples:

<input id="dateTimePicker">
<script>
  $(document).ready(function(){
  $("#dateTimePicker").kendoDateTimePicker({
     value: new Date(2017, 4, 23, 0, 0, 0), 
     min: new Date(2017, 4, 1, 0, 0, 0),
     max: new Date(2017, 4, 31, 23, 59, 59),
     format: "dd-MM-yyyy hh:mm" }); 
</script>

or:

<div ng-app="app" ng-controller="MyCtrl">
        <input kendo-date-picker>
</div>
<script>
var app = angular.module("your-angular-app", [ "kendo.directives" ]);
  angular.module("app", ["kendo.directives"]).controller("MyCtrl", function($scope) {
    });
</script> 

Posted by Bert Binnenmarsch on 31-May-2017 09:23

My solution is: angular.element("#datepicker0").data("kendoDatePicker").value(new Date());

This thread is closed