Date column not formatting right.

7 posts, 0 answers
  1. Brady
    Brady avatar
    34 posts
    Member since:
    Mar 2009

    Posted 17 Apr 2012 Link to this post

    I have a date column in my grid defined as below:

    LastLoginTime: { editable: false, type: "date" } // in the data source model
    { field: "LastLoginTime", title: "Last Login", filterable: false, format: "{0:dd/MMMM/yyyy}" } // in the columns collection of the grid


    The date in the column displaysThe date in the column always displays as '/Date(1334652996959)/', the json value that comes back from the server. What's up here?
  2. Rosen
    Admin
    Rosen avatar
    3253 posts

    Posted 17 Apr 2012 Link to this post

    Hello Brady,

    Could you verify that you have correctly declared a schema and date type for the field in question. This way the DataSource will try to convert the field value to JavaScript  Date object. You may refer to this online demo which uses the DataSource scheme option.

    All the best,
    Rosen
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. James
    James avatar
    14 posts
    Member since:
    Feb 2012

    Posted 17 Apr 2012 Link to this post

    I have the same issue. I'm already using the same example above. Any ideas? Code is exactly the same as the sample i my vs2010 web page with 1 exception. I'm referring to jquery this way: 
      <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
  4. Rosen
    Admin
    Rosen avatar
    3253 posts

    Posted 18 Apr 2012 Link to this post

    Hi James,

    You should make sure that you are using Q1 2012 or later release of KendoUI.

    Regards,
    Rosen
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  5. James
    James avatar
    14 posts
    Member since:
    Feb 2012

    Posted 18 Apr 2012 Link to this post

    Hey Thanks Rosen. That did the trick. I had not downloaded the new version. Keep those new versions coming!!
  6. Ruben
    Ruben avatar
    2 posts
    Member since:
    Jun 2015

    Posted 09 Dec 2016 Link to this post

    How I wold know if my field on the datasource properly setted to the type I want(date) because I set it as Brady and it still didn't work
  7. Rosen
    Admin
    Rosen avatar
    3253 posts

    Posted 12 Dec 2016 Link to this post

    Hello Ruben,

    I'm not sure I understood your question. If you have set the type via the field declaration it should be set. However, the automatic parsing of the string value, if such is used, does not support all of the possible custom date formats. If the date is not parsed and is still shown as a string, then maybe you need to set a custom parse function via the field declaration in which to convert the input string to a Date instance.

    If you continue to experience difficulties please open a separate support request in which to provide as much information about the issue and your setup as possible. A small runnable sample will be appreciated.

    Regards,
    Rosen
    Telerik by Progress
    Kendo UI is ready for Visual Studio 2017 RC! Learn more.
Back to Top