My question is very simple:
How do I get the current date range of the Kendo Scheduler?
I have checked out the example that's in the API Reference, but that one doesn't work for me.
Code:
function getCurrentDateRange(){
try{
var view = this.view();
console.log(view);
return "?startdate=" + kendo.toString(view.startDate(), "yyyy-MM-dd")
+ "&enddate=" + kendo.toString(view.endDate(), "yyyy-MM-dd");
}
catch(error){ console.log("Scheduler: Could not get schedulers daterange \n Error: " + error)}
//Default value
return "?startdate=" + kendo.toString(new Date().addDays(-30), "yyyy-MM-dd")
+ "&enddate=" + kendo.toString(new Date().addDays(30), "yyyy-MM-dd");
}
The solution for me was to reference the scheduler directly.
try{
var view = $("#schedulerViewScheduler").data("kendoScheduler").view();
console.log(view);
return "&startdate=" + kendo.toString(view.startDate(), "yyyy-MM-dd")
+ "&enddate=" + kendo.toString(view.endDate(), "yyyy-MM-dd");
}
catch(error){ console.log("Scheduler: Could not get schedulers daterange \n Error: " + error)}
return "&startdate=" + kendo.toString(new Date().addDays(-30), "yyyy-MM-dd")
+ "&enddate=" + kendo.toString(new Date().addDays(30), "yyyy-MM-dd");