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

2 posts, 0 answers
  1. Paul
    Paul avatar
    1 posts
    Member since:
    Mar 2014

    Posted 23 Apr 2014 Link to this post

    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 
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 24 Apr 2014 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
Back to Top