feat(filters): add date values
This commit is contained in:
parent
c22daab28c
commit
992d108bfa
@ -19,3 +19,28 @@ export const DATE_RANGES = {
|
|||||||
'thisYear': ['now/y', 'now/y+1y'],
|
'thisYear': ['now/y', 'now/y+1y'],
|
||||||
'restOfThisYear': ['now', 'now/y+1y'],
|
'restOfThisYear': ['now', 'now/y+1y'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const DATE_VALUES = {
|
||||||
|
'now': 'now',
|
||||||
|
'startOfToday': 'now/d',
|
||||||
|
'endOfToday': 'now/d+1d',
|
||||||
|
|
||||||
|
'beginningOflastWeek': 'now/w-1w',
|
||||||
|
'endOfLastWeek': 'now/w-2w',
|
||||||
|
'beginningOfThisWeek': 'now/w',
|
||||||
|
'endOfThisWeek': 'now/w+1w',
|
||||||
|
'startOfNextWeek': 'now/w+1w',
|
||||||
|
'endOfNextWeek': 'now/w+2w',
|
||||||
|
'in7Days': 'now+7d',
|
||||||
|
|
||||||
|
'beginningOfLastMonth': 'now/M-1M',
|
||||||
|
'endOfLastMonth': 'now/M-2M',
|
||||||
|
'startOfThisMonth': 'now/M',
|
||||||
|
'endOfThisMonth': 'now/M+1M',
|
||||||
|
'startOfNextMonth': 'now/M+1M',
|
||||||
|
'endOfNextMonth': 'now/M+2M',
|
||||||
|
'in30Days': 'now+30d',
|
||||||
|
|
||||||
|
'startOfThisYear': 'now/y',
|
||||||
|
'endOfThisYear': 'now/y+1y',
|
||||||
|
}
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
{{ $t('misc.custom') }}
|
{{ $t('misc.custom') }}
|
||||||
</BaseButton>
|
</BaseButton>
|
||||||
<BaseButton
|
<BaseButton
|
||||||
v-for="(value, text) in DATE_RANGES"
|
v-for="(value, text) in DATE_VALUES"
|
||||||
:key="text"
|
:key="text"
|
||||||
:class="{'is-active': date === value[0]}"
|
:class="{'is-active': date === value}"
|
||||||
@click="setDate(value[0])"
|
@click="setDate(value)"
|
||||||
>
|
>
|
||||||
{{ $t(`input.datepickerRange.ranges.${text}`) }}
|
{{ $t(`input.datepickerRange.values.${text}`) }}
|
||||||
</BaseButton>
|
</BaseButton>
|
||||||
</div>
|
</div>
|
||||||
<div class="flatpickr-container input-group">
|
<div class="flatpickr-container input-group">
|
||||||
@ -86,7 +86,7 @@ import 'flatpickr/dist/flatpickr.css'
|
|||||||
import {parseDateOrString} from '@/helpers/time/parseDateOrString'
|
import {parseDateOrString} from '@/helpers/time/parseDateOrString'
|
||||||
|
|
||||||
import Popup from '@/components/misc/popup.vue'
|
import Popup from '@/components/misc/popup.vue'
|
||||||
import {DATE_RANGES} from '@/components/date/dateRanges'
|
import {DATE_VALUES} from '@/components/date/dateRanges'
|
||||||
import BaseButton from '@/components/base/BaseButton.vue'
|
import BaseButton from '@/components/base/BaseButton.vue'
|
||||||
import DatemathHelp from '@/components/date/datemathHelp.vue'
|
import DatemathHelp from '@/components/date/datemathHelp.vue'
|
||||||
import {getFlatpickrLanguage} from '@/helpers/flatpickrLanguage'
|
import {getFlatpickrLanguage} from '@/helpers/flatpickrLanguage'
|
||||||
@ -162,7 +162,7 @@ function setDate(range: string | null) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const customRangeActive = computed<boolean>(() => {
|
const customRangeActive = computed<boolean>(() => {
|
||||||
return !Object.values(DATE_RANGES).some(d => date.value === d)
|
return !Object.values(DATE_VALUES).some(d => date.value === d)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -588,6 +588,7 @@
|
|||||||
"to": "To",
|
"to": "To",
|
||||||
"from": "From",
|
"from": "From",
|
||||||
"fromto": "{from} to {to}",
|
"fromto": "{from} to {to}",
|
||||||
|
"date": "Date",
|
||||||
"ranges": {
|
"ranges": {
|
||||||
"today": "Today",
|
"today": "Today",
|
||||||
|
|
||||||
@ -605,6 +606,30 @@
|
|||||||
|
|
||||||
"thisYear": "This Year",
|
"thisYear": "This Year",
|
||||||
"restOfThisYear": "The Rest of This Year"
|
"restOfThisYear": "The Rest of This Year"
|
||||||
|
},
|
||||||
|
"values": {
|
||||||
|
"now": "Now",
|
||||||
|
"startOfToday": "Start of today",
|
||||||
|
"endOfToday": "End of today",
|
||||||
|
|
||||||
|
"beginningOflastWeek": "Beginning of last week",
|
||||||
|
"endOfLastWeek": "End of last week",
|
||||||
|
"beginningOfThisWeek": "Beginning of this week",
|
||||||
|
"endOfThisWeek": "End of this week",
|
||||||
|
"startOfNextWeek": "Start of next week",
|
||||||
|
"endOfNextWeek": "End of next week",
|
||||||
|
"in7Days": "In 7 days",
|
||||||
|
|
||||||
|
"beginningOfLastMonth": "Beginning of last month",
|
||||||
|
"endOfLastMonth": "End of last month",
|
||||||
|
"startOfThisMonth": "Start of this month",
|
||||||
|
"endOfThisMonth": "End of this month",
|
||||||
|
"startOfNextMonth": "Start of next month",
|
||||||
|
"endOfNextMonth": "End of next month",
|
||||||
|
"in30Days": "In 30 days",
|
||||||
|
|
||||||
|
"startOfThisYear": "Beginning of this year",
|
||||||
|
"endOfThisYear": "End of this year"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"datemathHelp": {
|
"datemathHelp": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user