When the addsevendays and minussevendays methods are attached to buttons, they should add or subtract seven days from the date each time they are clicked. However, currently it only performs this action once in either direction. For example, if the date is 2019-09-10, it will only ever move to either 2019-09-17 or 2019-09-03.
Shouldn't it update from the new state?
data: () => ({
today: null,
}),
addSevenDays() {
this.today = moment().add(7, 'days').format("YYYY-MM-DD"));
console.log(this.today);
},
minusSevenDays() {
this.today = moment().subtract(7, 'days').format("YYYY-MM-DD");
console.log(this.today);
}
mounted () {
this.today = moment().format('YYYY-MM-DD');
}