Problem with json dates and globalization

3 posts, 0 answers
  1. Jose
    Jose avatar
    38 posts
    Member since:
    Apr 2009

    Posted 30 May 2012 Link to this post

    I'm working with kendo listview and datasource.
    Dates from Json data are returned as "\/Date(1338364370930)\/".
    This is my current date part template:
    <dt>@FieldNames.CreateDate :</dt>
    <dd>#= (CreateDate == null) ? ' ' : kendo.toString(new Date(parseInt(CreateDate.substr(6))), "d") #</dd>

    I've had to add the "new Date(parseInt(CreateDate.substr(6)))" part in order to show correctly the date.
    Without this code the date appear \/Date(1338364370930)\/ without conversion. This is my first issue. Why kendo datasource or listview cannot process or convert directly json dates?

    My second issue is I'm converting the date to a short format with "d", currently my culture is spanish and the date appears as "5/30/2012" (m/dd/yyyy). This is wrong, in spain it must be "30/5/2012" (dd/m/yyyy). I've checked my internet explorer and the language is set to spanish. Tried with Chrome and with the same result. Any idea? 

  2. Georgi Krustev
    Georgi Krustev avatar
    3747 posts

    Posted 04 Jun 2012 Link to this post

    Hello Jose,

    Straight upto your questions:

    #1: The toString method formats Date, Number objects to string. You can find more information about the method here. In the aforementioned case the passed value is a string ("\/Date(1338364370930)\/") and the toString method just returns it. That is why you need to parse it (like you do) and pass it to the method.

    The KendoUI works with current set culture. By default it is "en-US". If you need to change it, you will need to register the corresponding JS culture file and set the current culture to it. Check this help topic for more information. You can also check this online demo.

    I will suggest you open support tickets for your incedents. Thus our support team can handle the problems faster. We also do not guarantee answers in the forum threads.

    Kind 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. Jayson
    Jayson avatar
    2 posts
    Member since:
    Aug 2012

    Posted 03 Aug 2012 Link to this post

    I have same problem, how can i accomplish this using GridBoundColumnBuilder? Here's my code:

    var colBuilder = columns.Bound(propertyName).Title("Changed Date").Filterable(true);
    The output is always "/Date(1338364370930)/".                       
Back to Top