From 3f4509a6f9472b3d2f7d2a041edc88dee33e7c6e Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 20 Jul 2022 18:44:02 +0200 Subject: [PATCH] feat: dynamically set default date --- src/components/tasks/gantt-chart.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/tasks/gantt-chart.vue b/src/components/tasks/gantt-chart.vue index 2aa24e5b..2a548350 100644 --- a/src/components/tasks/gantt-chart.vue +++ b/src/components/tasks/gantt-chart.vue @@ -51,8 +51,8 @@ const ganttBars = ref([]) // We need a "real" ref object for the gantt bars to instantly update the tasks when they are dragged on the chart. // A computed won't work directly. function mapGanttBars() { - const defaultStartDate = '2022-07-19 12:00' - const defaultEndDate = '2022-07-25 12:00' + const defaultStartDate = format(new Date(), dateFormat) + const defaultEndDate = format(new Date((new Date()).setDate((new Date()).getDate() + 7)), dateFormat) tasks.value.forEach(t => ganttBars.value.push([{ startDate: t.startDate ? format(t.startDate, dateFormat) : defaultStartDate,