From dd17bb0386ec2a1473e6eccd5584cf5d1343ef3f Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 31 Oct 2019 13:18:29 +0100 Subject: [PATCH] Descuadre de meses componente calendar #1733 --- front/core/components/calendar/index.js | 7 +++---- modules/agency/front/location/calendar.js | 7 +++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/front/core/components/calendar/index.js b/front/core/components/calendar/index.js index 23c0450fa4..fd92522420 100644 --- a/front/core/components/calendar/index.js +++ b/front/core/components/calendar/index.js @@ -260,9 +260,9 @@ export default class Calendar extends Component { */ moveNext(skip = 1) { let next = this.defaultDate.getMonth() + skip; - this.defaultDate.setMonth(next); this.defaultDate.setHours(0, 0, 0, 0); this.defaultDate.setDate(1); + this.defaultDate.setMonth(next); this.repaint(); this.emit('moveNext'); @@ -275,11 +275,10 @@ export default class Calendar extends Component { */ movePrevious(skip = 1) { let previous = this.defaultDate.getMonth() - skip; - this.defaultDate.setMonth(previous); this.defaultDate.setHours(0, 0, 0, 0); + this.defaultDate.setDate(1); + this.defaultDate.setMonth(previous); - const lastDate = this.lastDay(this.defaultDate); - this.defaultDate.setDate(lastDate.getDate()); this.repaint(); this.emit('movePrevious'); diff --git a/modules/agency/front/location/calendar.js b/modules/agency/front/location/calendar.js index d9226c2210..6867badaa4 100644 --- a/modules/agency/front/location/calendar.js +++ b/modules/agency/front/location/calendar.js @@ -7,8 +7,11 @@ class Controller { this.$scope = $scope; this.$http = $http; this.stMonthDate = new Date(); - this.ndMonthDate = new Date(); - this.ndMonthDate.setMonth(this.ndMonthDate.getMonth() + 1); + const ndMonth = new Date(); + ndMonth.setDate(1); + ndMonth.setMonth(ndMonth.getMonth() + 1); + + this.ndMonthDate = ndMonth; } $postLink() {