diff --git a/calendar/js/View.js b/calendar/js/View.js index bb9b227c76..12dd8cb8ec 100644 --- a/calendar/js/View.js +++ b/calendar/js/View.js @@ -335,11 +335,12 @@ var planner = /** @class */ (function (_super_1) { return (check.indexOf(egw.preference('planner_show_empty_rows', 'calendar') + '') === -1); }; planner.scroll = function (delta) { - if (app.calendar.state.planner_view) { + if (app.calendar.state.planner_view && !isNaN(delta) && app.calendar.state.sortby !== "month") { return app.classes.calendar.views[app.calendar.state.planner_view].scroll(delta); } var d = new Date(app.calendar.state.date); var days = 1; + delta = parseInt(delta) || 0; // Yearly view, grouped by month - scroll 1 month if (app.calendar.state.sortby === 'month') { d.setUTCMonth(d.getUTCMonth() + delta); @@ -351,6 +352,7 @@ var planner = /** @class */ (function (_super_1) { // Need to set the day count, or auto date ranging takes over and // makes things buggy if (app.calendar.state.first && app.calendar.state.last) { + //@ts-ignore var diff = new Date(app.calendar.state.last) - new Date(app.calendar.state.first); days = Math.round(diff / (1000 * 3600 * 24)); } diff --git a/calendar/js/View.ts b/calendar/js/View.ts index 4fc7a5ad34..5bb58a6f23 100644 --- a/calendar/js/View.ts +++ b/calendar/js/View.ts @@ -380,12 +380,13 @@ export class planner extends View static scroll(delta) { - if(app.calendar.state.planner_view) + if(app.calendar.state.planner_view && !isNaN(delta) && app.calendar.state.sortby !== "month") { return app.classes.calendar.views[app.calendar.state.planner_view].scroll(delta); } - var d = new Date(app.calendar.state.date); - var days = 1; + let d = new Date(app.calendar.state.date); + let days = 1; + delta = parseInt(delta) || 0; // Yearly view, grouped by month - scroll 1 month if(app.calendar.state.sortby === 'month') @@ -400,7 +401,8 @@ export class planner extends View // makes things buggy if(app.calendar.state.first && app.calendar.state.last) { - var diff = new Date(app.calendar.state.last) - new Date(app.calendar.state.first); + //@ts-ignore + let diff = new Date(app.calendar.state.last) - new Date(app.calendar.state.first); days = Math.round(diff / (1000 * 3600 * 24)); } d.setUTCDate(d.getUTCDate() + (days * delta));