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

Reinitialize datepicker when switching modes

Oliver Günthere3012d75ae45
diff --git a/frontend/src/app/shared/components/datepicker/sheet/date-picker-sheet.component.ts b/frontend/src/app/shared/components/datepicker/sheet/date-picker-sheet.component.ts
index 0bc66fb7491..b2b021e1f71 100644
--- a/frontend/src/app/shared/components/datepicker/sheet/date-picker-sheet.component.ts
+++ b/frontend/src/app/shared/components/datepicker/sheet/date-picker-sheet.component.ts
@@ -95,7 +95,7 @@ export class OpDatePickerSheetComponent implements AfterViewInit, OnChanges {
}
if (changes.mode && !changes.mode.isFirstChange()) {
- this.datePickerInstance.setOption('mode', changes.mode.currentValue);
+ this.initializeDatepicker();
}
}
@@ -107,7 +107,7 @@ export class OpDatePickerSheetComponent implements AfterViewInit, OnChanges {
this.dates,
{
mode: this.mode,
- showMonths: this.deviceService.isMobile ? 1 : 2,
+ showMonths: (this.deviceService.isMobile || this.mode === 'single') ? 1 : 2,
inline: true,
onChange: (dates:Date[]) => {
const formatted = dates.map((el:Date) => this.timezoneService.formattedISODate(el));