Move next week/next month task overview pages into a single "Upcoming" page and allow toggle

This commit is contained in:
kolaente 2020-11-22 18:05:25 +01:00
parent ed40249bb3
commit 5d995a2758
Signed by untrusted user who does not match committer: konrad
GPG key ID: F40E70337AB24C9B
4 changed files with 22 additions and 25 deletions

View file

@ -22,24 +22,15 @@ export default {
}
},
watch: {
// call again the method if the route changes
'$route': 'setDates',
'$route': 'setDatesToNextWeek',
},
created() {
this.setDates()
this.setDatesToNextWeek()
},
methods: {
setDates() {
switch (this.$route.params.type) {
case 'week':
this.startDate = new Date()
this.endDate = new Date((new Date()).getTime() + 7 * 24 * 60 * 60 * 1000)
break
case 'month':
this.startDate = new Date()
this.endDate = new Date((new Date()).setMonth((new Date()).getMonth() + 1))
break
}
setDatesToNextWeek() {
this.startDate = new Date()
this.endDate = new Date((new Date()).getTime() + 7 * 24 * 60 * 60 * 1000)
},
},
}