This is a migrated thread and some comments may be shown as answers.

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

4 Answers 34 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 12 Oct 2012, 03:12 PM
December 18th has a data-value of 18-11-12 instead of 18-12-12, why is that?

4 Answers, 1 is accepted

Sort by
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 15 Oct 2012, 07:44 PM
kendo.parseDate also seems to not adjust for the 0 index...
0
Atanas Korchev
Telerik team
answered on 16 Oct 2012, 07:26 AM
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!
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 16 Oct 2012, 12:15 PM
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?
0
Georgi Krustev
Telerik team
answered on 16 Oct 2012, 01:35 PM
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!
Tags
Calendar
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Atanas Korchev
Telerik team
Georgi Krustev
Telerik team
Share this question
or