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

Daylight savings time and problem with event rendering

4 Answers 154 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Boris
Top achievements
Rank 1
Boris asked on 22 Mar 2017, 12:49 PM

Hello,

I am from the Czech Republic and we use daylight savings time. Time is changing on 26th March, 2:00 AM. When I create an event in Scheduler and the event crosses the moment when the time is changing, e.g. event lasting from 25th March 5:00 PM to 26th March 5:00 PM, events in the Scheduler renders incorrectly and I get an exception:

Object doesn't support the method innerRect.

The exception is from _positionEvent function.

Interestingly, this problem occurs only when the event lasts exactly 24 hours. When it crosses the changing time moment, but lasts 25 or 23 hours, Scheduler works as expected.

 

Thanks for replies,

Boris

4 Answers, 1 is accepted

Sort by
0
Tyler
Top achievements
Rank 1
answered on 23 Mar 2017, 01:55 PM
Do you have all necessary javascript files included? Like kendo.timezones.min.js and kendo.all.min.js or the kendo js for the widgets you are using and jquery is only included once?
0
Veselin Tsvetanov
Telerik team
answered on 24 Mar 2017, 09:14 AM
Hello Boris,

Thank you for the detailed explanation provided. As you correctly noted, the observed is a bug in the Scheduler functionality, that is related to the daylight saving change. Therefore, we have included that in our backlog.

Here you will find the GitHub issue, where you could track the bug status.

As a small token of gratitude for reporting to us this bug, I have updated your Telerik points.

Regards,
Veselin Tsvetanov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Boris
Top achievements
Rank 1
answered on 24 Mar 2017, 12:12 PM

Hello Veselin,

thank you for adding Telerik points to my account. I'm glad that I can participate to make the Scheduler better :-)

 

I've been reading Scheduler source codes and made other observations. It can be helpful in fixing the bug:

The problem occurs only in Day view and Week view. These views have all-day slots on the top of the Scheduler. So I think that the Scheduler is confused about the duration of the event and doesn't know whether to render the event in all-day slot.

 

Observations made by reading source code:

_positionEvent() is called from _renderEvents().

In _renderEvents() there is a line:

ranges = group.slotRanges(event);

 

In slotRanges() there is this piece of code:

if (isDay) {
    return this.daySlotRanges(startTime, endTime, event.isAllDay);
}
return this.timeSlotRanges(startTime, endTime);

isDay is computed by means of event.isMultiDay() method:

isMultiDay: function() {
            return this.isAllDay || this.duration() >= kendo.date.MS_PER_DAY;
        }
duration: function() {
            var offset = (end.getTimezoneOffset() - start.getTimezoneOffset()) * kendo.date.MS_PER_MINUTE;
            return end - start - offset;
        }

 

Because of using getTimeZoneOffset, the event lasts 24 hours and isDay is true.
This means that return this.daySlotRanges(startTime, endTime, event.isAllDay); is executed. It returns objects of type DaySlotRange. These objects don't have innerRect() method.

If isDay would have been false, return this.timeSlotRanges(startTime, endTime); would have been executed. This method returns TimeSlotRange objects, which have innerRect() method.

In _renderEvents() there is also a line:

var isMultiDayEvent = event.isAllDay || event.end.getTime() - event.start.getTime() >= MS_PER_DAY;

The difference between end and start time is in this case 23 hours, so isMultiDayEvent is set to false.

Then there is a condition using isMultiDayEvent:

if (!isMultiDayEvent) {
  //this branch is used - this._positionEvent(occurrence, element, range); is in this branch
} else {
  //this branch is not used - this._positionAllDayEvent(element, ranges[0]); is in this branch
}


So, in my opinion the problem is in different computation of event duration - once it uses getTimezoneOffset() and the result is 24 hours, once it doesn't use it and the result is 23 hours.

If isMultiDayEvent would be computed with getTimeZoneOffset, the else branch would be used and _positionAllDayEvent() would be called instead of _positionEvent(), which might solve the problem.

 

Boris

0
Veselin Tsvetanov
Telerik team
answered on 28 Mar 2017, 06:37 AM
Hello Boris,

Your observations are correct. The issue is caused by the fact, that an AllDay event in this case would have a duration of less than 24 hours. I have also referenced this forum thread in the GitHub issue, so the information provided will be available at the time of fixing the bug.

Again, I have updated your Telerik points because of the effort you put to troubleshoot the case.

Regards,
Veselin Tsvetanov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Scheduler
Asked by
Boris
Top achievements
Rank 1
Answers by
Tyler
Top achievements
Rank 1
Veselin Tsvetanov
Telerik team
Boris
Top achievements
Rank 1
Share this question
or