diff --git a/src/views/list/ListGantt.vue b/src/views/list/ListGantt.vue index f5278a344..15b11747f 100644 --- a/src/views/list/ListGantt.vue +++ b/src/views/list/ListGantt.vue @@ -68,21 +68,26 @@ import { ref, computed } from 'vue' import flatPickr from 'vue-flatpickr-component' -import { i18n } from '@/i18n' -import { store } from '@/store' +import { useI18n } from 'vue-i18n' +import { useStore } from 'vuex' import ListWrapper from './ListWrapper' import GanttChart from '@/components/tasks/gantt-component' import Fancycheckbox from '@/components/input/fancycheckbox' +const DEFAULT_DAY_COUNT = 35 + const showTaskswithoutDates = ref(false) -const dayWidth = ref(35) -const dateFrom = ref(new Date((new Date()).setDate((new Date()).getDate() - 15))) -const dateTo = ref(new Date((new Date()).setDate((new Date()).getDate() + 30))) +const dayWidth = ref(DEFAULT_DAY_COUNT) +const now = ref(new Date()) +const dateFrom = ref(new Date((new Date()).setDate(now.value.getDate() - 15))) +const dateTo = ref(new Date((new Date()).setDate(now.value.getDate() + 30))) +const {t} = useI18n() +const {store} = useStore() const flatPickerConfig = computed(() => ({ - altFormat: i18n.global.t('date.altFormatShort'), + altFormat: t('date.altFormatShort'), altInput: true, dateFormat: 'Y-m-d', enableTime: false, diff --git a/src/views/tasks/ShowTasks.vue b/src/views/tasks/ShowTasks.vue index d4f06ba33..9b1399840 100644 --- a/src/views/tasks/ShowTasks.vue +++ b/src/views/tasks/ShowTasks.vue @@ -231,23 +231,25 @@ export default { }, setDatesToNextWeek() { - this.cStartDate = new Date() - this.cEndDate = new Date((new Date()).getTime() + 7 * 24 * 60 * 60 * 1000) + const now = new Date() + this.cStartDate = now + this.cEndDate = new Date(now.getTime() + 7 * 24 * 60 * 60 * 1000) this.showOverdue = false this.setDate() }, setDatesToNextMonth() { - this.cStartDate = new Date() - this.cEndDate = new Date((new Date()).setMonth((new Date()).getMonth() + 1)) + const now = new Date() + this.cStartDate = now + this.cEndDate = new Date((new Date()).setMonth(now.getMonth() + 1)) this.showOverdue = false this.setDate() }, showTodaysTasks() { - const d = new Date() - this.cStartDate = new Date() - this.cEndDate = new Date(d.setDate(d.getDate() + 1)) + const now = new Date() + this.cStartDate = now + this.cEndDate = new Date((new Date()).setDate(now.getDate() + 1)) this.showOverdue = true this.setDate() },