I’m working on a scheduler which skips weekends in “day” and “timeline” view.
I have the following code for my scheduler:
//why this is not working
scheduler.date.add_day = function(date, inc) {
if ((date.getDay() == 5 && inc > 0) || (date.getDay() == 1 && inc < 0)) { //friday / monday
return scheduler.date.add(date, inc * 3, “day”);
} else {
return scheduler.date.add(date, inc * 1, “day”);
}
}
scheduler.ignore_day = function(date) {
if (date.getDay() == 6 || date.getDay() == 0) //hides Saturdays and Sundays
return true;
};
scheduler.date.add_timeline = function(date, inc) {
if ((date.getDay() == 5 && inc > 0) || (date.getDay() == 1 && inc < 0)) { //friday / monday
return scheduler.date.add(date, inc * 3, "day");
} else {
return scheduler.date.add(date, inc * 1, "day");
}
}
While my scheduler.date.add_timeline got called when I navigate, scheduler.date.add_day did not get called at all. And scheduler.ignore_day works well. This makes me so confused. Is this intended or something wrong with my code?
for scheduler.date.add_{view name} see:
docs.dhtmlx.com/scheduler/custom_views.html - 5