diff --git a/front/core/components/calendar/index.js b/front/core/components/calendar/index.js index 23c0450fa..fd9252242 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 d9226c221..6867badaa 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() {