Why is the value of eady day (month - 1)?

5 posts, 0 answers
  1. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 12 Oct 2012 Link to this post

    December 18th has a data-value of 18-11-12 instead of 18-12-12, why is that?
  2. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 15 Oct 2012 Link to this post

    kendo.parseDate also seems to not adjust for the 0 index...
  3. Kendo UI is VS 2017 Ready
  4. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 16 Oct 2012 Link to this post

    Hello Steve,

    We don't understand what you mean. Any example?

    Kind regards,
    Atanas Korchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  5. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 16 Oct 2012 Link to this post

    Sure,
      http://demos.kendoui.com/web/calendar/index.html

    Inspect the data-value of any date in the calendar

    <a title="Tuesday, October 16, 2012" data-value="2012/9/16" href="#" class="k-link">16</a>

    Should be 2012/10/16 not 2012/9/16

    So I was hoping your date helpers in kendo would adjust it back, but no?
  6. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 16 Oct 2012 Link to this post

    Hello Steve,

     
    The value of the data attribute:

    data-value="2012/9/16"
    is zero based. We split the value by "/" separator and create Date object from the values:
    var value = link.attr(kendo.attr(VALUE)).split("/");
     
    //Safari cannot create correct date from "1/1/2090"
    value = new DATE(value[0], value[1], value[2]);
    I believe that the comment in the code snippet is expressive enough.

    The kendo.parseDate expects string value, which has non zero based month. The Date.parse method works in the same way. If you need to use data-value of the cell, then you can use the above code snippet.

    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!
Back to Top
Kendo UI is VS 2017 Ready