Добавила интервал дат в параметры
This commit is contained in:
@@ -111,15 +111,18 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
previousWeek() {
|
||||
this.dates.from = this.dates.from.clone().subtract(1, "week");
|
||||
this.dates.to = this.dates.to.clone().subtract(1, "week");
|
||||
const diff = this.dates?.to?.diff(this.dates?.from, "days") + 1;
|
||||
this.dates.from = this.dates.from.clone().subtract(diff, "day");
|
||||
this.dates.to = this.dates.to.clone().subtract(diff, "day");
|
||||
},
|
||||
nextWeek() {
|
||||
this.dates.from = this.dates.from.clone().add(1, "week");
|
||||
this.dates.to = this.dates.to.clone().add(1, "week");
|
||||
const diff = this.dates?.to?.diff(this.dates?.from, "days") + 1;
|
||||
this.dates.from = this.dates.from.clone().add(diff, "day");
|
||||
this.dates.to = this.dates.to.clone().add(diff, "day");
|
||||
},
|
||||
...mapActions({
|
||||
changeSelectedDates: "changeSelectedDates",
|
||||
getEvents: "getEvents",
|
||||
}),
|
||||
saveDatesChange() {
|
||||
this.calendarVisibility = false;
|
||||
@@ -142,9 +145,17 @@ export default {
|
||||
this.changeSelectedDates(val);
|
||||
},
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.initializeDates();
|
||||
selectedDates: {
|
||||
deep: true,
|
||||
immediate: true,
|
||||
handler(val) {
|
||||
if (
|
||||
!val?.from.isSame(this.dates?.from) ||
|
||||
!val?.to.isSame(this.dates?.to)
|
||||
)
|
||||
this.initializeDates();
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user