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

while dragging a week-days-only wp on Gantt chart and droping its end date on a non-working day, the dates are updated to maintain the duration

bsatarnejad985284a128f5
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 271dc2c5e0c..cbeb3cbd6a6 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
@@ -452,7 +452,7 @@ export class TimelineCellRenderer {
}
}
- cursorOrDatesAreNonWorking(evOrDates:MouseEvent|Moment[], renderInfo:RenderInfo):boolean {
+ cursorOrDatesAreNonWorking(evOrDates:MouseEvent|Moment[], renderInfo:RenderInfo, direction?:MouseDirection|null):boolean {
if (renderInfo.workPackage.ignoreNonWorkingDays) {
return false;
}
@@ -461,6 +461,9 @@ export class TimelineCellRenderer {
? [this.cursorDateAndDayOffset(evOrDates, renderInfo)[0]]
: evOrDates;
+ if (!renderInfo.workPackage.ignoreNonWorkingDays && direction === 'both' && this.weekdayService.isNonWorkingDay(dates[dates.length - 1].toDate())) {
+ return false;
+ }
return dates.some((date) => this.weekdayService.isNonWorkingDay(date.toDate()));
}
diff --git a/frontend/src/app/features/work-packages/components/wp-table/timeline/cells/wp-timeline-cell-mouse-handler.ts b/frontend/src/app/features/work-packages/components/wp-table/timeline/cells/wp-timeline-cell-mouse-handler.ts
index 260b1423668..216aa1e7364 100644
--- a/frontend/src/app/features/work-packages/components/wp-table/timeline/cells/wp-timeline-cell-mouse-handler.ts
+++ b/frontend/src/app/features/work-packages/components/wp-table/timeline/cells/wp-timeline-cell-mouse-handler.ts
@@ -225,7 +225,7 @@ export function registerWorkPackageMouseHandler(this:void,
// Cancel changes if the startDate or dueDate are not allowed
const { startDate, dueDate } = change.projectedResource;
- const invalidDates = renderer.cursorOrDatesAreNonWorking([moment(startDate), moment(dueDate)], renderInfo);
+ const invalidDates = renderer.cursorOrDatesAreNonWorking([moment(startDate), moment(dueDate)], renderInfo, direction);
if (cancelled || change.isEmpty() || invalidDates) {
cancelChange();