diff --git a/src/i18n/lang/en.json b/src/i18n/lang/en.json index d2034c27..a81d77f7 100644 --- a/src/i18n/lang/en.json +++ b/src/i18n/lang/en.json @@ -286,8 +286,7 @@ "month": "Month", "day": "Day", "hour": "Hour", - "from": "From", - "to": "To", + "range": "Range", "noDates": "This task has no dates set." }, "table": { diff --git a/src/views/list/ListGantt.vue b/src/views/list/ListGantt.vue index 04ed632c..b43886c0 100644 --- a/src/views/list/ListGantt.vue +++ b/src/views/list/ListGantt.vue @@ -16,26 +16,14 @@
- +
-
-
-
- -
-
@@ -87,8 +75,13 @@ const showTaskswithoutDates = ref(false) const precision = ref('day') const now = ref(new Date()) -const dateFrom = ref(format(new Date((new Date()).setDate(now.value.getDate() - 15)), 'yyyy-LL-dd')) -const dateTo = ref(format(new Date((new Date()).setDate(now.value.getDate() + 30)), 'yyyy-LL-dd')) +const defaultFrom = format(new Date((new Date()).setDate(now.value.getDate() - 15)), 'yyyy-LL-dd') +const defaultTo = format(new Date((new Date()).setDate(now.value.getDate() + 30)), 'yyyy-LL-dd') +const range = ref(`${defaultFrom} to ${defaultTo}`) + +// TODO: only update once both dates are available (maybe use a watcher + refs instead?) +const dateFrom = computed(() => range.value?.split(' to ')[0] ?? defaultFrom) +const dateTo = computed(() => range.value?.split(' to ')[1] ?? defaultTo) const {t} = useI18n({useScope: 'global'}) const store = useStore() @@ -97,6 +90,7 @@ const flatPickerConfig = computed(() => ({ altInput: true, dateFormat: 'Y-m-d', enableTime: false, + mode: 'range', locale: { firstDayOfWeek: store.state.auth.settings.weekStart, },