DateTime Value setter not working when Date Kind is Local

2 posts, 0 answers
  1. Sergi
    Sergi avatar
    34 posts
    Member since:
    Sep 2007

    Posted 12 Aug 2013 Link to this post

    Hello.

    I'm using the Datepicker, but it will not work when the Date has a Kind of type Local.

    It renders as :

    <input data-val="true" data-val-date="The field FechaInicio must be a date." data-val-required="El campo FechaInicio es obligatorio." id="FechaInicio" name="FechaInicio" type="date" value="2013-07-20T15:00:00.000Z" />

    Instead of the proper way which works that is :

    <input data-val="true" data-val-date="The field FechaInicio must be a date." data-val-required="El campo FechaInicio es obligatorio." id="FechaInicio" name="FechaInicio" type="date" value="15/07/2013" />
    I'm using the Kendo UI MVC Wrapper, and I'm getting this weird behaviour when posting the date to the controller from javascript with:
    date.toISOString()
  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 13 Aug 2013 Link to this post

    Hello Sergi,

    Using the toISOstring() returns the date formatted using ISO 8601 specification, which uses the following  format - YYYY-MM-DDTHH:mm:ss.sssZ. If you want to return your data in a different format, please take a look at this section of the documentation showing how to format dates using Kendo UI:

    http://docs.kendoui.com/getting-started/framework/globalization/dateformatting
     
    Regards,
    Kiril Nikolov
    Telerik
    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
Back to Top