kendo-labs / angular-kendo

A project to create a robust set of Angular.js bindings for Kendo UI widgets
474 stars 209 forks source link

Date Format incorrect after select date #407

Open israelsaraiva opened 8 years ago

israelsaraiva commented 8 years ago

Hi guys!

I'm using (k-format = "dd/MM/yyyy") to set date formate of kendo-date-picker, so, after date selected the format was not respected. I tried to use (k-options ="dateTimePickerOptions") making

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

it worked, but before sending data to the server, i checked out the data on scope and the console.log returned "Invalid Date".

this is my complete code:

input name="data" kendo-date-picker ng-model="item.Data" k-ng-model="dateObject" style="width: 100%;" placeholder="Select a date" k-options ="dateTimePickerOptions" k-parse-formats ="['yyyy-MM-ddTHH:mm:sszzz']" required />

Can anyone help me?

pajaydev commented 7 years ago

Use this code and check, its working fine for me

input kendo-date-picker ng-model="dateString" k-ng-model="dateObject" ng-change="change(dateString)" style="width: 100%;" placeholder="Select a date" k-format="'dd/MM/yyyy'" required />

In Controller you can use

$scope.change = function(value){ $scope.data = value; }