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

If the value is an invalid date, do not simply delete the input but keep whatever is written in it

Henriette Darge28b7d3de58c0
diff --git a/frontend/src/app/modules/fields/edit/field-types/duration-edit-field.component.ts b/frontend/src/app/modules/fields/edit/field-types/duration-edit-field.component.ts
index 0034496b46b..5cbf7332cc0 100644
--- a/frontend/src/app/modules/fields/edit/field-types/duration-edit-field.component.ts
+++ b/frontend/src/app/modules/fields/edit/field-types/duration-edit-field.component.ts
@@ -63,7 +63,18 @@ export class DurationEditFieldComponent extends EditFieldComponent {
}
protected parseValue(val:moment.Moment | null) {
- return val === null ? null : val.toISOString();
+ if (val === null) {
+ return val
+ }
+
+ let parsedValue;
+ if (val.isValid()) {
+ parsedValue = val.toISOString();
+ } else {
+ parsedValue = this.resource[this.name];
+ }
+
+ return parsedValue;
}
}