From c9546948c4d98c5a89febdddc15231e5b4d870c0 Mon Sep 17 00:00:00 2001 From: Mike O'Donnell Date: Tue, 28 Nov 2023 10:56:08 -0500 Subject: [PATCH] fix(core): bug where you cannot open the datetime picker a 2nd time --- .../datetime-picker/datetime-picker.component.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/libs/core/src/lib/datetime-picker/datetime-picker.component.ts b/libs/core/src/lib/datetime-picker/datetime-picker.component.ts index 28b90a2139e..6eea0725eef 100644 --- a/libs/core/src/lib/datetime-picker/datetime-picker.component.ts +++ b/libs/core/src/lib/datetime-picker/datetime-picker.component.ts @@ -357,12 +357,10 @@ export class DatetimePickerComponent /** @hidden Reference to the inner calendar component. */ @ViewChild(CalendarComponent, { static: false }) private set _calendarCmp(calendar: CalendarComponent) { - if (!this.isOpen) { - return; - } - - calendar?.setCurrentlyDisplayed(this._calendarPendingDate); - calendar?.initialFocus(); + setTimeout(() => { + calendar?.setCurrentlyDisplayed(this._calendarPendingDate); + calendar?.initialFocus(); + }); this._calendarComponent = calendar; } @@ -570,8 +568,10 @@ export class DatetimePickerComponent } this.onClose.emit(); this.isOpen = false; + this._changeDetRef.detectChanges(); this._onOpenStateChanged(this.isOpen); this.handleOnTouched(); + this._showPopoverContents = false; } /** @hidden */ @@ -734,6 +734,10 @@ export class DatetimePickerComponent preventScroll: this.preventScrollOnFocus }); } + if (!isOpen) { + this._showPopoverContents = false; + this._changeDetRef.detectChanges(); + } } /** Method that provides information if model selected date/dates have properly types and are valid */