How to default kendo datetimepicker 12:00AM value

1 Answer 1612 Views
Date/Time Pickers
Frank
Top achievements
Rank 1
Frank asked on 13 Jan 2017, 08:05 PM

I have a datetimepicker. 

 

<div class="EditLabel">
                                                <label for="DueDate" class="control-label">Due Date</label>
                                                <input kendo-date-time-picker k-onkeyup="'yyyy-MM-dd hh:mmtt'" k-format="'yyyy-MM-dd hh:mmtt'" k-options="dateTimePickerOptions"
                                                       id="picker" ng-bind="DueDate" k-ng-model="DueDate" ng-model="MarketingItem.DueDate" class="form-control input-sm" />
</div>

 $scope.dateTimePickerOptions = {
        format: "MM/dd/yyyy hh:mmtt"
    }

when user selects a date, i want to default the time to be 5:00PM instead of 12:00AM. if the user selects a different time, i want the value to be set accordingly. 

Can you please tell me how i can accomplish that? I am using angular 1. thanks.

 

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 17 Jan 2017, 11:37 AM
Hello Frank,

The desired result can be achieved using a custom approach the change event to check if a new date is selected and then set the time to 05:00 PM.

I can suggest using the open event of the widget to take the current value than on the change event to check if the date is changed. If the date is changed, manually set the time to 05:00 PM using the value method:

http://docs.telerik.com/kendo-ui/api/javascript/ui/datetimepicker#events-open

http://docs.telerik.com/kendo-ui/api/javascript/ui/datetimepicker#events-change

http://docs.telerik.com/kendo-ui/api/javascript/ui/datetimepicker#methods-value

I hope this will help to achieve the desired result.

Regards,
Stefan
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data (charts) and form elements.
Tags
Date/Time Pickers
Asked by
Frank
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or