feat(gantt): update drag/resize to handle partial-date task updates

This commit is contained in:
kolaente 2026-02-18 21:48:32 +01:00
parent 29e77b44e1
commit 65f92ac8d3
1 changed files with 16 additions and 4 deletions

View File

@ -253,11 +253,23 @@ watch(
)
function updateGanttTask(id: string, newStart: Date, newEnd: Date) {
emit('update:task', {
const task = tasks.value.get(Number(id))
if (!task) return
const update: ITaskPartialWithId = {
id: Number(id),
startDate: roundToNaturalDayBoundary(newStart, true),
endDate: roundToNaturalDayBoundary(newEnd),
})
}
// Always set the dates that were dragged/resized
update.startDate = roundToNaturalDayBoundary(newStart, true)
update.endDate = roundToNaturalDayBoundary(newEnd)
// If the task originally only had dueDate (no endDate), also update dueDate
if (!task.endDate && task.dueDate) {
update.dueDate = roundToNaturalDayBoundary(newEnd)
}
emit('update:task', update)
}
function openTask(bar: GanttBarModel) {