feat: dynamically set default date

This commit is contained in:
kolaente 2022-07-20 18:44:02 +02:00
parent 5e3e79c01b
commit 3f4509a6f9
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -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. // 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. // A computed won't work directly.
function mapGanttBars() { function mapGanttBars() {
const defaultStartDate = '2022-07-19 12:00' const defaultStartDate = format(new Date(), dateFormat)
const defaultEndDate = '2022-07-25 12:00' const defaultEndDate = format(new Date((new Date()).setDate((new Date()).getDate() + 7)), dateFormat)
tasks.value.forEach(t => ganttBars.value.push([{ tasks.value.forEach(t => ganttBars.value.push([{
startDate: t.startDate ? format(t.startDate, dateFormat) : defaultStartDate, startDate: t.startDate ? format(t.startDate, dateFormat) : defaultStartDate,