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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[44907] Impossible to delete the Estimated time entry (#12110)
Behrokh Satarnejad9196c26c5c09
diff --git a/frontend/src/app/shared/components/fields/edit/field-types/hours-duration-edit-field.component.ts b/frontend/src/app/shared/components/fields/edit/field-types/hours-duration-edit-field.component.tsindex 0080c7f8a61..06d18fce0b7 100644--- a/frontend/src/app/shared/components/fields/edit/field-types/hours-duration-edit-field.component.ts+++ b/frontend/src/app/shared/components/fields/edit/field-types/hours-duration-edit-field.component.ts@@ -27,7 +27,7 @@//++import * as moment from 'moment';-import { Component } from '@angular/core';+import { ChangeDetectionStrategy, Component } from '@angular/core';import { EditFieldComponent } from 'core-app/shared/components/fields/edit/edit-field.component';import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decorator';import { TimezoneService } from 'core-app/core/datetime/timezone.service';@@ -46,11 +46,14 @@ import { TimezoneService } from 'core-app/core/datetime/timezone.service';[disabled]="inFlight"[id]="handler.htmlId" />`,+ changeDetection: ChangeDetectionStrategy.OnPush,})export class HoursDurationEditFieldComponent extends EditFieldComponent {@InjectField() TimezoneService:TimezoneService;- public parser(value:any, input:any) {+ inputValue:null|string;++ public parser(value:null|string, input:HTMLInputElement):moment.Duration {// Managing decimal separators in a multi-language app is a complex topic:// https://www.ctrl.blog/entry/html5-input-number-localization.html// Depending on the locale of the OS, the browser or the app itself,@@ -63,20 +66,27 @@ export class HoursDurationEditFieldComponent extends EditFieldComponent {// context, we check the validity of the input and, if it's not valid, we// default to the previous value, emulating the way the browsers work with// valid separators (e.g: introducing 1. would set 1 as a value).- if (value == null && !input.validity.valid) {- value = this.value || 0;+ this.inputValue = input.value;+ if (!input.validity.valid) {+ if (value === null || input.value === '') {+ value = null;+ } else {+ value = this.value as string;+ }}-return moment.duration(value, 'hours');}- public formatter(value:any) {+ public formatter(value:null|string):number|null {+ if (value === null) {+ return null;+ }return Number(moment.duration(value).asHours().toFixed(2));}protected parseValue(val:moment.Moment | null) {- if (val === null) {- return val;+ if (val === null || this.inputValue === '') {+ return null;}let parsedValue;