Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Date Format incorrect after select date #407

Open
israelsaraiva opened this issue Mar 17, 2016 · 1 comment
Open

Date Format incorrect after select date #407

israelsaraiva opened this issue Mar 17, 2016 · 1 comment

Comments

@israelsaraiva
Copy link

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
Copy link

pajaydev commented Dec 17, 2016

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;
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants