Scheduler server filtering example: (index):35 Uncaught TypeError: scheduler.view(...).startTime is not a function
bdongus opened this issue · 1 comments
bdongus commented
This error occurs after selecting the month view.
pepinho24 commented
It is also reproduced in the Agenda view.
Here is a workaround which checks if the startTime and endTime methods exist for the current view:
function getAdditionalData() {
var startTime = 0,
endTime = 0;
var scheduler = $("#scheduler").data("kendoScheduler");
var timezone = scheduler.options.timezone;
var startDate = kendo.timezone.convert(scheduler.view().startDate(), timezone, "Etc/UTC");
var endDate = kendo.timezone.convert(scheduler.view().endDate(), timezone, "Etc/UTC");
//optionally add startTime / endTime of the view. Note that the month and agenda views do not have startTime and endTime methods.
if (scheduler.view().startTime) {
startTime = kendo.date.getMilliseconds(scheduler.view().startTime());
endTime = kendo.date.getMilliseconds(scheduler.view().endTime());
endTime = endTime == 0 ? kendo.date.MS_PER_DAY : endTime;
}
var result = {
Start: new Date(startDate.getTime() - (startDate.getTimezoneOffset() * kendo.date.MS_PER_MINUTE) + startTime),
End: new Date(endDate.getTime() - (endDate.getTimezoneOffset() * kendo.date.MS_PER_MINUTE) + endTime)
}
return result;
}