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

pull/8335/head
Henriette Darge 5 years ago
parent c07965e98f
commit 28b7d3de58
  1. 13
      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;
}
}

Loading…
Cancel
Save