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

Re-derive duration when it was cleared by the user

Oliver Günther797843507f61
diff --git a/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.ts b/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.ts
index 2cdff42237f..5a4f65275cd 100644
--- a/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.ts
+++ b/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.ts
@@ -399,12 +399,19 @@ export class MultiDateModalComponent extends OpModalComponent implements AfterVi
handleDurationFocusOut():void {
this.setCurrentActivatedField('start');
- if (this.dates.start) {
+ // If we cleared duration or left it empty
+ // reset the value to what start and due are, if they too are set
+ if (!this.duration && this.dates.start && this.dates.end) {
+ this.dateUpdates$.next({
+ startDate: this.dates.start,
+ dueDate: this.dates.end,
+ });
+ } else if (this.duration && this.dates.start) {
this.dateUpdates$.next({
startDate: this.dates.start,
duration: this.durationAsIso8601,
});
- } else if (this.dates.end) {
+ } else if (this.duration && this.dates.end) {
this.dateUpdates$.next({
dueDate: this.dates.end,
duration: this.durationAsIso8601,