Bind date value for ng model in angular select kendo date

I have an api that returns a date in this format "014-08-26T15: 10: 45.402Z" I use angular kendo ui. The problem I am facing is that the date is not tied to kendo date picker. Can someone help me.

<input kendo-date-picker ng-model="emp.datestart" k-format="MM/dd/yyyy" /> 
+7
angularjs kendo-ui kendo-asp.net-mvc angular-kendo
source share
2 answers

In order for Kendo DatePicker to work with a string model of date values:

1) Use k-ng-model instead of ng-model .

2) Tell the widget in which the exact format will be processed.

 <input kendo-date-picker k-ng-model="emp.datestart" k-options="datePickerOptions" /> 

Then on your AngularJS controller you will specify a date parsing format, for example:

 $scope.datePickerOptions = { parseFormats: ["yyyy-MM-ddTHH:mm:ss"] }; 
+16
source share

you can use something like this

 <h4>Select date:</h4> <input kendo-date-time-picker k-options="monthSelectorOptions" data-k-ng-model="dateObject" data-ng-model="dateString.startDate" style="width: 100%;" /> var startDate = new Date(); $scope.monthSelectorOptions = { value: startDate, format: "dd/MM/yyyy h:mm tt", parseFormats: ['ddd MMM dd yyyy'], animation: { close: { effects: "fadeOut zoom:out", duration: 300 }, open: { effects: "fadeIn zoom:in", duration: 300 } }, culture: "de-DE", }; 

And here is the complete solution for kendo dojo

+2
source share

All Articles