Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#45536] The finish date slider for a task via the gannt chart is not accurate

Dombi Attila6619f6728650
diff --git a/frontend/src/app/features/work-packages/components/wp-table/timeline/cells/timeline-cell-renderer.ts b/frontend/src/app/features/work-packages/components/wp-table/timeline/cells/timeline-cell-renderer.ts
index 629cb228319..4b1b6b17ef1 100644
--- a/frontend/src/app/features/work-packages/components/wp-table/timeline/cells/timeline-cell-renderer.ts
+++ b/frontend/src/app/features/work-packages/components/wp-table/timeline/cells/timeline-cell-renderer.ts
@@ -144,7 +144,12 @@ export class TimelineCellRenderer {
if (direction === 'left') {
dates.startDate = moment(initialStartDate || initialDueDate).add(delta, 'days');
} else if (direction === 'right') {
- dates.dueDate = moment(initialDueDate || now).add(delta, 'days');
+ // When no due date is present and the start date is in the past,
+ // we assume the task hasn't finished yet, meaning the end date is not in the past.
+ // To cover this case we have to choose the start date, only when it's in the future,
+ // and choose now if the start date is in the past.
+ const calculatedDueDate = initialDueDate || (now > initialStartDate ? now : initialStartDate);
+ dates.dueDate = moment(calculatedDueDate).add(delta, 'days');
} else if (direction === 'both') {
if (initialStartDate) {
dates.startDate = moment(initialStartDate).add(delta, 'days');