From 68f67f12d7c0a61cec1c045e2d24d395636c5033 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 31 May 2019 13:28:28 +0200 Subject: [PATCH] moveNext() movePrevious() moves now to day 1 to prevent a month jump --- front/core/components/calendar/index.js | 2 ++ modules/worker/front/calendar/index.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/front/core/components/calendar/index.js b/front/core/components/calendar/index.js index 46f25bf85..ada238d67 100644 --- a/front/core/components/calendar/index.js +++ b/front/core/components/calendar/index.js @@ -225,6 +225,7 @@ export default class Calendar extends Component { */ moveNext(skip = 1) { let next = this.defaultDate.getMonth() + skip; + this.defaultDate.setDate(1); this.defaultDate.setMonth(next); this.repaint(); @@ -238,6 +239,7 @@ export default class Calendar extends Component { */ movePrevious(skip = 1) { let previous = this.defaultDate.getMonth() - skip; + this.defaultDate.setDate(1); this.defaultDate.setMonth(previous); this.repaint(); diff --git a/modules/worker/front/calendar/index.js b/modules/worker/front/calendar/index.js index d855d97b6..312d7e6a2 100644 --- a/modules/worker/front/calendar/index.js +++ b/modules/worker/front/calendar/index.js @@ -98,8 +98,8 @@ class Controller { for (let i = 0; i < months.length; i++) { const now = new Date(); now.setHours(0, 0, 0, 0); - now.setMonth(i); now.setDate(1); + now.setMonth(i); months[i] = now; }