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

[#49680] Today button missing when selecting "Between specific dates" in baseline comparison

Dombi Attiladaccef3bb1c5
diff --git a/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.html b/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.html
index 86ac7f81b73..396a2b50616 100644
--- a/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.html
+++ b/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.html
@@ -107,6 +107,13 @@
(input)="dateChange([$event.target.value, selectedDates[1] || ''])"
type="text"
class="op-baseline--date-input"/>
+ <button
+ slot="action"
+ type="button"
+ class="spot-link"
+ (click)="setToday('from')"
+ [textContent]="text.today">
+ </button>
</spot-form-field>
<spot-form-field
@@ -120,6 +127,13 @@
(input)="dateChange([selectedDates[0] || '', $event.target.value])"
type="text"
class="op-baseline--date-input"/>
+ <button
+ slot="action"
+ type="button"
+ class="spot-link"
+ (click)="setToday('to')"
+ [textContent]="text.today">
+ </button>
</spot-form-field>
<spot-form-field
diff --git a/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.ts b/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.ts
index 2e0b92dcbc1..55055f32b26 100644
--- a/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.ts
@@ -112,6 +112,7 @@ export class OpBaselineComponent extends UntilDestroyedMixin implements OnInit {
to: this.I18n.t('js.baseline.to'),
date: this.I18n.t('js.label_date'),
time: this.I18n.t('js.baseline.time'),
+ today: this.I18n.t('js.label_today'),
moreInfoLink: enterpriseDocsUrl.website,
more_info_text: this.I18n.t('js.admin.enterprise.upsale.more_info'),
help_description: this.I18n.t('js.baseline.help_description'),
@@ -211,6 +212,17 @@ export class OpBaselineComponent extends UntilDestroyedMixin implements OnInit {
this.selectedOffsets = [this.userOffset, this.userOffset];
}
+ public setToday(key:string):void {
+ const today = moment().format('YYYY-MM-DD');
+ // When setting the "from" date to today, the "to" date must also be set to today,
+ // because we do not allow future dates, meaning "to" cannot be anything else but today.
+ if (key === 'from') {
+ this.selectedDates[0] = today;
+ }
+
+ this.selectedDates[1] = today;
+ }
+
public onSubmit(e:Event):void {
e.preventDefault();
this.onSave();