Set date of a datepicker - Forum - Kendo UI Builder - Progress Community
 Forum

Set date of a datepicker

This question is not answered

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
  • 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> 
  • My solution is: angular.element("#datepicker0").data("kendoDatePicker").value(new Date());