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
Toggle duration displaying with and without days
Oliver Günther373525b0edfa
diff --git a/frontend/src/app/shared/components/datepicker/datepicker.modal.html b/frontend/src/app/shared/components/datepicker/datepicker.modal.htmlindex b749490779f..8d8ffc9ac5c 100644--- a/frontend/src/app/shared/components/datepicker/datepicker.modal.html+++ b/frontend/src/app/shared/components/datepicker/datepicker.modal.html@@ -121,7 +121,8 @@data-qa-selector="op-datepicker-modal--duration-field"class="op-datepicker-modal--date-field"[ngClass]="{'op-datepicker-modal--date-field_current' : showFieldAsActive('duration')}"- [(ngModel)]="formattedDuration"+ [ngModel]="displayedDuration"+ (ngModelChange)="updateDuration($event)"[disabled]="!isSchedulable"(focusin)="handleDurationFocusIn()"(focusout)="handleDurationFocusOut()"diff --git a/frontend/src/app/shared/components/datepicker/datepicker.modal.ts b/frontend/src/app/shared/components/datepicker/datepicker.modal.tsindex 195e43b7f9a..1b3fdb1c28d 100644--- a/frontend/src/app/shared/components/datepicker/datepicker.modal.ts+++ b/frontend/src/app/shared/components/datepicker/datepicker.modal.ts@@ -98,6 +98,7 @@ export class DatePickerModalComponent extends OpModalComponent implements AfterVincludeNonWorkingDays: this.I18n.t('js.work_packages.datepicker_modal.include_non_working_days'),placeholder: this.I18n.t('js.placeholders.default'),today: this.I18n.t('js.label_today'),+ days: (count:number) => this.I18n.t('js.units.day', { count }),};onDataUpdated = new EventEmitter<string>();@@ -110,7 +111,7 @@ export class DatePickerModalComponent extends OpModalComponent implements AfterVduration:number;- formattedDuration:string;+ displayedDuration:string;htmlId = '';@@ -142,8 +143,10 @@ export class DatePickerModalComponent extends OpModalComponent implements AfterVthis.singleDate = this.changeset.isWritable('date');this.scheduleManually = !!this.changeset.value('scheduleManually');this.includeNonWorkingDays = !!this.changeset.value('ignoreNonWorkingDays');- this.duration = this.changeset.value('duration') as number;- this.formattedDuration = this.timezoneService.formattedDuration(this.duration.toString(), 'days');++ const durationDays = this.timezoneService.toDays(this.changeset.value('duration'));+ this.updateDuration(durationDays);+ this.showDurationWithDays();if (this.singleDate) {this.dates.date = this.changeset.value('date') as string;@@ -279,12 +282,20 @@ export class DatePickerModalComponent extends OpModalComponent implements AfterVhandleDurationFocusIn():void {this.datepickerService.setCurrentActivatedField('duration');- this.formattedDuration = this.timezoneService.toDays(this.duration.toString()).toString();+ this.displayedDuration = this.duration.toString(10);}handleDurationFocusOut():void {this.datepickerService.setCurrentActivatedField('start');- this.formattedDuration = this.timezoneService.formattedDuration(this.duration.toString(), 'days');+ this.showDurationWithDays();+ }++ updateDuration(value:string|number):void {+ this.duration = typeof value === 'string' ? parseInt(value, 10) : value;+ }++ private showDurationWithDays() {+ this.displayedDuration = this.text.days(this.duration);}private initializeDatepicker(minimalDate?:Date|null) {