mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-25 16:19:00 +01:00
Calendar: Clean up next/previous for yearly planner to always jump by 1 month
This commit is contained in:
parent
0ff219fab9
commit
b911da6eb8
@ -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));
|
||||
}
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user