chore: rename date ranges export
This commit is contained in:
parent
f435ca99f4
commit
60be8b428e
3 changed files with 6 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
||||||
export const dateRanges = {
|
export const DATE_RANGES = {
|
||||||
// Format:
|
// Format:
|
||||||
// Key is the title, as a translation string, the first entry of the value array
|
// Key is the title, as a translation string, the first entry of the value array
|
||||||
// is the "from" date, the second one is the "to" date.
|
// is the "from" date, the second one is the "to" date.
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
{{ $t('misc.custom') }}
|
{{ $t('misc.custom') }}
|
||||||
</BaseButton>
|
</BaseButton>
|
||||||
<BaseButton
|
<BaseButton
|
||||||
v-for="(value, text) in dateRanges"
|
v-for="(value, text) in DATE_RANGES"
|
||||||
:key="text"
|
:key="text"
|
||||||
@click="setDateRange(value)"
|
@click="setDateRange(value)"
|
||||||
:class="{'is-active': from === value[0] && to === value[1]}">
|
:class="{'is-active': from === value[0] && to === value[1]}">
|
||||||
|
@ -78,7 +78,7 @@ import flatPickr from 'vue-flatpickr-component'
|
||||||
import 'flatpickr/dist/flatpickr.css'
|
import 'flatpickr/dist/flatpickr.css'
|
||||||
|
|
||||||
import Popup from '@/components/misc/popup.vue'
|
import Popup from '@/components/misc/popup.vue'
|
||||||
import {dateRanges} from '@/components/date/dateRanges'
|
import {DATE_RANGES} 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'
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ function setDateRange(range: string[] | null) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const customRangeActive = computed<Boolean>(() => {
|
const customRangeActive = computed<Boolean>(() => {
|
||||||
return !Object.values(dateRanges).some(el => from.value === el[0] && to.value === el[1])
|
return !Object.values(DateRanges).some(el => from.value === el[0] && to.value === el[1])
|
||||||
})
|
})
|
||||||
|
|
||||||
const buttonText = computed<string>(() => {
|
const buttonText = computed<string>(() => {
|
||||||
|
|
|
@ -45,7 +45,6 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {dateRanges} from '@/components/date/dateRanges'
|
|
||||||
import SingleTaskInList from '@/components/tasks/partials/singleTaskInList.vue'
|
import SingleTaskInList from '@/components/tasks/partials/singleTaskInList.vue'
|
||||||
import {parseDateOrString} from '@/helpers/time/parseDateOrString'
|
import {parseDateOrString} from '@/helpers/time/parseDateOrString'
|
||||||
import {mapState, useStore} from 'vuex'
|
import {mapState, useStore} from 'vuex'
|
||||||
|
@ -61,6 +60,7 @@ import {useRoute, useRouter} from 'vue-router'
|
||||||
import {formatDate} from '@/helpers/time/formatDate'
|
import {formatDate} from '@/helpers/time/formatDate'
|
||||||
import {useI18n} from 'vue-i18n'
|
import {useI18n} from 'vue-i18n'
|
||||||
import {setTitle} from '@/helpers/setTitle'
|
import {setTitle} from '@/helpers/setTitle'
|
||||||
|
import {DATE_RANGES} from '@/components/date/dateRanges'
|
||||||
|
|
||||||
function getNextWeekDate() {
|
function getNextWeekDate() {
|
||||||
return new Date((new Date()).getTime() + 7 * 24 * 60 * 60 * 1000)
|
return new Date((new Date()).getTime() + 7 * 24 * 60 * 60 * 1000)
|
||||||
|
@ -89,7 +89,7 @@ const pageTitle = computed(() => {
|
||||||
|
|
||||||
// We need to define "key" because it is the first parameter in the array and we need the second
|
// 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
|
// eslint-disable-next-line no-unused-vars
|
||||||
const predefinedRange = Object.entries(dateRanges).find(([key, value]) => dateFrom.value === value[0] && dateTo.value === value[1])
|
const predefinedRange = Object.entries(DATE_RANGES).find(([key, value]) => dateFrom.value === value[0] && dateTo.value === value[1])
|
||||||
if (typeof predefinedRange !== 'undefined') {
|
if (typeof predefinedRange !== 'undefined') {
|
||||||
title = t(`input.datepickerRange.ranges.${predefinedRange[0]}`)
|
title = t(`input.datepickerRange.ranges.${predefinedRange[0]}`)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue