1
0

fix: now correctly showing the title of predefined ranges

This commit is contained in:
kolaente
2022-01-09 14:21:33 +01:00
parent 4d23fae9ad
commit 6c55411f71
3 changed files with 28 additions and 19 deletions

View File

@ -0,0 +1,10 @@
// TODO: more ranges!
export const dateRanges = {
'task.show.today': ['now/d', 'now/d+1d'],
'task.show.thisWeek': ['now/w', 'now/w+1w'],
'task.show.nextWeek': ['now/w+1w', 'now/w+2w'],
'task.show.next7Days': ['now', 'now+7d'],
'task.show.thisMonth': ['now/M', 'now/M+1M'],
'task.show.nextMonth': ['now/M+1M', 'now/M+2M'],
'task.show.next30Days': ['now', 'now+30d'],
}

View File

@ -59,11 +59,12 @@
<script lang="ts" setup>
import flatPickr from 'vue-flatpickr-component'
import 'flatpickr/dist/flatpickr.css'
import {computed, Ref, ref, watch} from 'vue'
import {computed, ref, watch} from 'vue'
import {useI18n} from 'vue-i18n'
import {store} from '@/store'
import {format} from 'date-fns'
import Popup from '@/components/misc/popup'
import Popup from '@/components/misc/popup.vue'
import {dateRanges} from '@/components/date/dateRanges'
const {t} = useI18n()
@ -135,16 +136,6 @@ function setDateRange(range: string[] | null) {
inputChanged()
}
const dateRanges = {
'task.show.today': ['now/d', 'now/d+1d'],
'task.show.thisWeek': ['now/w', 'now/w+1w'],
'task.show.nextWeek': ['now/w+1w', 'now/w+2w'],
'task.show.next7Days': ['now', 'now+7d'],
'task.show.thisMonth': ['now/M', 'now/M+1M'],
'task.show.nextMonth': ['now/M+1M', 'now/M+2M'],
'task.show.next30Days': ['now', 'now+30d'],
}
const customRangeActive = computed<Boolean>(() => {
return !Object.values(dateRanges).some(el => from.value === el[0] && to.value === el[1])
})