From 6f276099fc083ec7d36d4cf7981a4482772ca9ff Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Thu, 10 Aug 2023 17:09:57 -0500 Subject: [PATCH] fix(datetime): cancel resets internal state of datetime --- core/src/components/datetime/datetime.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/src/components/datetime/datetime.tsx b/core/src/components/datetime/datetime.tsx index b2f4e30d78..fb5f5dc533 100644 --- a/core/src/components/datetime/datetime.tsx +++ b/core/src/components/datetime/datetime.tsx @@ -550,15 +550,17 @@ export class Datetime implements ComponentInterface { } /** - * Emits the ionCancel event and - * optionally closes the popover - * or modal that the datetime was - * presented in. + * The cancel method performs the following actions: + * 1. Emits the ionCancel event + * 2. Resets the internal state of the datetime + * 3. Closes the parent popover or modal if "closeOverlay" is true. */ @Method() async cancel(closeOverlay = false) { this.ionCancel.emit(); + this.reset(); + if (closeOverlay) { this.closeParentOverlay(); }