Ahron M. Galitzky
Ahron M. Galitzky

Reputation: 2261

When using kendo-datetimepicker is there a way to overwrite the default time

I'm using Kendo UI for Angular's DateTimePicker.

<kendo-datetimepicker [(value)]="dateValue" (valueChange)="dateChanged()"></kendo-datetimepicker>

When I open the overlay to select a date the default time is set to 12:00 AM Default Time is 12:00 AM

Is there a way I can change the default time to 1:30 PM? meaning, when I open the date time picker popup it should show me 1:30 PM instead of 12:00 AM

Upvotes: 0

Views: 742

Answers (1)

hossein vatankhah
hossein vatankhah

Reputation: 214

you can use:

  public formatTime: FormatSettings = {
    displayFormat: "dd/MM/yy HH:ss",
    inputFormat: "dd/MM/yy HH:ss",
  };

  public value: Date = new Date(2022, 5, 1, 13, 30);

  constructor() {
  }

  ngOnInit() {
  }

  onchange (date) {
    console.log(date)
  }
<link href="http://cdn.kendostatic.com/2013.2.716/styles/kendo.common.min.css" rel="stylesheet" />
<link href="http://cdn.kendostatic.com/2013.2.716/styles/kendo.default.min.css" rel="stylesheet" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.3/angular.min.js"></script>
<script src="http://cdn.kendostatic.com/2013.2.716/js/kendo.all.min.js"></script>

 <kendo-datetimepicker
      [format]="formatTime"
      [value]="value"
      required
      (valueChange)="onchange($event)"
></kendo-datetimepicker>

Upvotes: 0

Related Questions