feat: add date math for filters #1342
|
@ -94,9 +94,11 @@ const pageTitle = computed(() => {
|
|||
|
||||
// We need to define "key" because it is the first parameter in the array and we need the second
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const predefinedRange = Object.entries(DATE_RANGES).find(([key, value]) => dateFrom === value[0] && dateTo === value[1])
|
||||
const predefinedRange = Object.entries(DATE_RANGES)
|
||||
konrad marked this conversation as resolved
Outdated
|
||||
.find(([key, value]) => dateFrom === value[0] && dateTo === value[1])
|
||||
konrad marked this conversation as resolved
Outdated
dpschen
commented
Remove title var and return directly:
Remove title var and return directly:
```js
if (typeof predefinedRange !== 'undefined') {
return t(`input.datepickerRange.ranges.${predefinedRangeKey}`)
} else {
return showAll
? t('task.show.titleCurrent')
: t('task.show.fromuntil', {
from: formatDate(dateFrom, 'PPP'),
until: formatDate(dateTo, 'PPP'),
})
}
konrad
commented
Done. Done.
|
||||
?.[0]
|
||||
if (typeof predefinedRange !== 'undefined') {
|
||||
title = t(`input.datepickerRange.ranges.${predefinedRange[0]}`)
|
||||
title = t(`input.datepickerRange.ranges.${predefinedRange}`)
|
||||
} else {
|
||||
title = showAll
|
||||
? t('task.show.titleCurrent')
|
||||
|
|
Reference in New Issue
Block a user
Unsure: I think eslint doesn't complain here if you use underscore (
_
) to spread the unused variable.Add
?.[0]
so we return the key, which is what we actually want to use and adjust variable name.Nope, does not seem to have an effect.
Done.
Interesting!