diff --git a/core/src/components/datetime/datetime.tsx b/core/src/components/datetime/datetime.tsx index dc68c86a071..6420b48d689 100644 --- a/core/src/components/datetime/datetime.tsx +++ b/core/src/components/datetime/datetime.tsx @@ -561,7 +561,7 @@ export class Datetime implements ComponentInterface { * "activePartsClone" and then falling back to * today's DatetimeParts if no active date is selected. */ - private getDefaultPart = () => { + private getDefaultPart = (): DatetimeParts => { const { activePartsClone, todayParts } = this; const firstPart = Array.isArray(activePartsClone) ? activePartsClone[0] : activePartsClone; @@ -1393,7 +1393,9 @@ export class Datetime implements ComponentInterface { } private renderCombinedDatePickerColumn() { - const { activeParts, workingParts, locale, minParts, maxParts, todayParts, isDateEnabled } = this; + const { workingParts, locale, minParts, maxParts, todayParts, isDateEnabled } = this; + + const activePart = this.getDefaultPart(); /** * By default, generate a range of 3 months: @@ -1489,12 +1491,10 @@ export class Datetime implements ComponentInterface { ...findPart, }); - if (!Array.isArray(activeParts)) { - this.setActiveParts({ - ...activeParts, - ...findPart, - }); - } + this.setActiveParts({ + ...activePart, + ...findPart, + }); // We can re-attach the scroll listener after // the working parts have been updated. @@ -1583,7 +1583,9 @@ export class Datetime implements ComponentInterface { return []; } - const { activeParts, workingParts } = this; + const { workingParts } = this; + + const activePart = this.getDefaultPart(); return (