Wrong format

4 posts, 1 answers
  1. Serkan
    Serkan avatar
    3 posts
    Member since:
    Jun 2012

    Posted 08 Jun 2012 Link to this post

    Although i set the culture to germany [ kendo.culture("de-DE") ] the format of the datetime is not correct, it is still default "en-US".
    I have to set additionally the format like this

    [Javascript]
    jQuery(function(){jQuery("\#start").kendoDateTimePicker({format:kendo.culture().calendar.patterns.g,min:new Date(1899,11,31,0,0,0,0),max:new Date(2100,0,1,0,0,0,0),interval:30});});

    or this

    [Razor]
    @(Html.Kendo().DateTimePicker()
                .Name("start")
                .Format("dd.MM.yyyy HH:mm")
                .Value(DateTime.Now)
                 
        )


    The format/values of date and time in both dropdowns of the datetimepicker are correct, only the format in the input field is wrong.


    But the format of time-values in the dropdownlist of a normal timepicker is not correct too,  it is not like the format of the current culture, it is still default "en-US" but without "AM" & "PM".

    List of format failure:
    Culture set to "de-DE"

    DateTimePicker:
     format of values (date&time) in the inputfield: wrong
     format of date in dropdown: correct
     format of time in dropdown: correct

    TimePicker:
     format of values in the inputfield: wrong
     format of time in dropdown: wrong

    DatePicker:
     format of values in the inputfield: wrong
     format of date in dropdown: correct

  2. Answer
    Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 11 Jun 2012 Link to this post

    Hi Serkan,

     
    Setting the culture info with kendo.culture("de-DE") does not change the culture on the server. Here is a simple Razor view, which shows how to achieve your goal:

    @section HeadContent {
        <script src="@Url.Content("~/Scripts/cultures/kendo.culture.de-DE.js")"></script>
    }
     
    <script type="text/javascript">
        //set culture of the Kendo UI
        kendo.culture("de-DE");
    </script>
     
    @{
        Culture = "de-DE";
    }
     
    @(Html.Kendo().DateTimePicker()
          .Name("datetimepicker")
          .Value(DateTime.Now)
    )


    Regards,
    Georgi Krustev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Chanaka
    Chanaka avatar
    14 posts
    Member since:
    Jan 2012

    Posted 30 Aug 2012 Link to this post

    It is a Simple  Answer No need to specify the culture  Use parameterMap and column format

    parameterMap: function (options, operation) {
                                if (operation != "read") {
                                    var d = new Date(options.Date);
                                    options.Date = d.toString("yyyy-MM-dd");                            
                                    return options;
                                }
                            }

    { field: "Date", title: "Date ", type: "date", format: "{0:dd/MM/yyyy}" }

    result : 30/08/2012

    Hope this will help all of you all  
  5. Serkan
    Serkan avatar
    3 posts
    Member since:
    Jun 2012

    Posted 30 Aug 2012 Link to this post

    hey @all,

    first, I must thank you for your answers!

    @Georgi: The server culture was already set like you said and I don´t know why, but the problem was solved after reinstalling the razor engine and the .net 4 framework (reason: some other different problems)... anyway Thanks

    @Chanaka: I would prefer to use the culture settings first, because of maintenance issue if you have to define a lot of paramaterMaps for all localizations, but I will use your hint to program special wishes of customers which are not solvable with the normal culture settings, so I thank you.

    Nice regards
    Serkan M.
Back to Top
UI for ASP.NET MVC is VS 2017 Ready