This is a migrated thread and some comments may be shown as answers.

Setting culture on date picker with data-role and data-bind

1 Answer 258 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 24 Apr 2014, 12:14 AM
Hi there,

I created a data bound date picker using the data-role attribute as follows: 

         <input id="startDatepicker" name="startDatepicker" class="datePicker" data-role="datepicker" data-bind="value: settings.startDate" data-format="yyyy-MM-dd" />

when I try to change the data-format to 'dd-MM-yyyy' the value wont show up, I think its because the default culture is en-US and therefore the date value becomes invalid. is there a way to specify the culture of the control to say en-NZ so that I can specify the format to dd/MM/yyyy correctly?

There are quite a few examples with setting date format as follows:

$("#datepicker").kendoDatePicker({
culture: "de-DE"
});

but does say how to do data binding if I am doing it this way

Any suggestions around either approach is greatly appreciated. 

Thanks
Paul 

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 24 Apr 2014, 12:18 PM
Hello Paul,

In general, you can define the culture option the same way you've done it with the format:
data-culture="en-NZ"
Once the correct culture is set, you can use one of the predefined date formats, which are culture related. Here is a simple Kendo Scratchpad demo showing how to accomplish this.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Date/Time Pickers
Asked by
Paul
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or