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
Unset due_date and duration when new start_date > due_date
Oliver Günther332cee671e1a
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.tsindex 7ce6a0dac62..f264f411bf4 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@@ -73,6 +73,7 @@ import {setDates,validDate,} from 'core-app/shared/components/datepicker/helpers/date-modal.helpers';+import { DateOption } from 'flatpickr/dist/types/options';export type DateKeys = 'start'|'end';export type DateFields = DateKeys|'duration';@@ -154,8 +155,6 @@ export class MultiDateModalComponent extends OpModalComponent implements AfterViduration:number|null;- displayedDuration:string;-currentlyActivatedDateField:DateFields;htmlId = '';@@ -392,12 +391,22 @@ export class MultiDateModalComponent extends OpModalComponent implements AfterVihandleDurationFocusIn():void {this.setCurrentActivatedField('duration');- this.displayedDuration = this.duration ? this.duration.toString(10) : '';+ }++ get displayedDuration():string {+ if (!this.duration) {+ return '';+ }++ if (this.isStateOfCurrentActivatedField('duration')) {+ return this.duration.toString(10);+ }++ return this.text.days(this.duration);}handleDurationFocusOut():void {this.setCurrentActivatedField('start');- this.showDurationWithDays();if (this.dates.start) {this.dateUpdates$.next({@@ -428,14 +437,6 @@ export class MultiDateModalComponent extends OpModalComponent implements AfterVireturn null;}- private showDurationWithDays() {- if (this.duration) {- this.displayedDuration = this.text.days(this.duration);- } else {- this.displayedDuration = '';- }- }-private initializeDatepicker(minimalDate?:Date|null) {this.datePickerInstance?.destroy();this.datePickerInstance = new DatePicker(@@ -501,7 +502,7 @@ export class MultiDateModalComponent extends OpModalComponent implements AfterViswitch (dates.length) {case 1: {const selectedDate = dates[0];- if (this.dates.start !== '' && this.dates.end !== '') {+ if (this.dates.start && this.dates.end) {/**Overwrite flatpickr default behavior by not starting a new date range everytime but preserving either start or end date.There are three cases to cover.@@ -521,7 +522,10 @@ export class MultiDateModalComponent extends OpModalComponent implements AfterViif (this.isStateOfCurrentActivatedField('end')) {this.overwriteDatePickerWithNewDates([parsedStartDate, selectedDate]);} else {- this.overwriteDatePickerWithNewDates([selectedDate, selectedDate]);+ // Reset duration and end+ this.dates.end = null;+ this.duration = null;+ this.overwriteDatePickerWithNewDates([selectedDate]);this.toggleCurrentActivatedField();}} else if (areDatesEqual(selectedDate, parsedStartDate) || areDatesEqual(selectedDate, parsedEndDate)) {@@ -620,6 +624,5 @@ export class MultiDateModalComponent extends OpModalComponent implements AfterViprivate setDurationDaysFromUpstream(value:string) {const durationDays = this.timezoneService.toDays(value);this.updateDuration(durationDays);- this.showDurationWithDays();}}