feat: make sure showTasks can handle dynamic dates
This commit is contained in:
parent
6a62fdd963
commit
6ed80df297
|
@ -47,6 +47,18 @@ import {LOADING, LOADING_MODULE} from '@/store/mutation-types'
|
|||
import LlamaCool from '@/assets/llama-cool.svg?component'
|
||||
import DatepickerWithRange from '@/components/date/datepickerWithRange'
|
||||
|
||||
function parseDate(query, fallback) {
|
||||
if (typeof query === 'undefined') {
|
||||
return fallback
|
||||
}
|
||||
|
||||
const d = new Date(query)
|
||||
|
||||
return !isNaN(d)
|
||||
? d
|
||||
: query
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'ShowTasks',
|
||||
components: {
|
||||
|
@ -80,18 +92,10 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
dateFrom() {
|
||||
const d = new Date(Number(this.$route.query.from))
|
||||
|
||||
return !isNaN(d)
|
||||
? d
|
||||
: this.startDate
|
||||
return parseDate(this.$route.query.from, this.startDate)
|
||||
},
|
||||
dateTo() {
|
||||
const d = new Date(Number(this.$route.query.to))
|
||||
|
||||
return !isNaN(d)
|
||||
? d
|
||||
: this.endDate
|
||||
return parseDate(this.$route.query.to, this.endDate)
|
||||
},
|
||||
showNulls() {
|
||||
return this.$route.query.showNulls === 'true'
|
||||
|
@ -136,8 +140,8 @@ export default {
|
|||
this.$router.push({
|
||||
name: this.$route.name,
|
||||
query: {
|
||||
from: +new Date(dateFrom ?? this.dateFrom),
|
||||
to: +new Date(dateTo ?? this.dateTo),
|
||||
from: dateFrom ?? this.dateFrom,
|
||||
to: dateTo ?? this.dateTo,
|
||||
showOverdue: this.showOverdue,
|
||||
showNulls: this.showNulls,
|
||||
},
|
||||
|
|
Reference in New Issue