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

DatePicker - french culture, wrong format (16.10.2013 instead of 16/10/2013)

4 Answers 305 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Catalin
Top achievements
Rank 1
Veteran
Catalin asked on 16 Oct 2013, 01:33 PM
Hi,

Iā€™m currently testing KendoUI for a future project and I have a little issue with the DatePicker. Let me explain:
  • New KendoUI application with globalization;
  • Add the fr-FR culture: 
<script src="@Url.Content("~/Scripts/kendo/2013.2.918/cultures/kendo.culture.fr-FR.min.js")"></script>

  • Set the kendo culture in the layout:
   <script type="text/javascript">
       kendo.culture("fr-FR")
   </script>


  • Creating in the Index.cshtml a DatePicker.
When running the app and select a date, the DatePicker displays (for example) 16.10.2013. This value cannot be validated, the system expects ā€œ16/10/2013ā€. The culture of the calendar is OK (french labels everywhere), but the value which is displayed has a wrong format. 

Otherwise, If I choose to set the culture of the DatePicker explicitly:

            @(Html.Kendo().DatePickerFor(m=>m.D)
                .Culture("fr-FR")
            )


Then everything works like a charm.

Did I missed something? 

Thank you,

Catalin




4 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 18 Oct 2013, 09:52 AM
Hello Catalin,

Is the .NET culture set to "fr-FR"? By default the datepicker MVC wrapper uses the current .NET culture to set the format.

Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Catalin
Top achievements
Rank 1
Veteran
answered on 19 Oct 2013, 06:44 AM
Hi Daniel, and thank you for your answer. 

I don't understand what do you mean by ".NET Culture". 

Adding 
@{
    System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr-FR");
}
 won't fix my problem, unfortunately. 

So, how can I use the datePicker without explicitly set it's culture every time I use it? Thank your for your help.
0
Daniel
Telerik team
answered on 23 Oct 2013, 09:14 AM
Hello again,

Besides setting the CurrentUICulture(used for the messages), you should also set the CurrentCulture(determines the formats):

System.Threading.Thread.CurrentThread.CurrentCulture =
    System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr-FR");
Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Catalin
Top achievements
Rank 1
Veteran
answered on 24 Oct 2013, 01:42 PM
Hi, 

Thank you, Daniel, it works !


Tags
Date/Time Pickers
Asked by
Catalin
Top achievements
Rank 1
Veteran
Answers by
Daniel
Telerik team
Catalin
Top achievements
Rank 1
Veteran
Share this question
or