Skip to content

Commit

Permalink
fix(core): bug where you cannot open the datetime picker a 2nd time
Browse files Browse the repository at this point in the history
  • Loading branch information
mikerodonnell89 committed Nov 28, 2023
1 parent f420e48 commit c954694
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions libs/core/src/lib/datetime-picker/datetime-picker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,10 @@ export class DatetimePickerComponent<D>
/** @hidden Reference to the inner calendar component. */
@ViewChild(CalendarComponent, { static: false })
private set _calendarCmp(calendar: CalendarComponent<D>) {
if (!this.isOpen) {
return;
}

calendar?.setCurrentlyDisplayed(this._calendarPendingDate);
calendar?.initialFocus();
setTimeout(() => {
calendar?.setCurrentlyDisplayed(this._calendarPendingDate);
calendar?.initialFocus();
});
this._calendarComponent = calendar;
}

Expand Down Expand Up @@ -570,8 +568,10 @@ export class DatetimePickerComponent<D>
}
this.onClose.emit();
this.isOpen = false;
this._changeDetRef.detectChanges();
this._onOpenStateChanged(this.isOpen);
this.handleOnTouched();
this._showPopoverContents = false;
}

/** @hidden */
Expand Down Expand Up @@ -734,6 +734,10 @@ export class DatetimePickerComponent<D>
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 */
Expand Down

0 comments on commit c954694

Please sign in to comment.