Skip to content

bug: ion-datetime after canceling and reopening the date shows incorrectly #30777

Closed

Description

@mariossavva

Prerequisites

Ionic Framework Version

v8.x

Current Behavior

After canceling out of a datetime component and reopening the view you see the incorrect date displayed as selected even though the value is the correct one.

Expected Behavior

After canceling out of the datetime view and reopening it the active date should show the actual value and not the canceled one.

Steps to Reproduce

  1. open the datetime view and select a new date and click ok. the button shows correctly
  2. reopen the datetime view and select another date but click on cancel this time. the button still shows correctly.
  3. reopen the datetime view you see the incorrect date displayed as selected even though the button shows the correct one (and the underlying value is the correct one).

Code Reproduction URL

https://stackblitz.com/edit/invgnexq

Ionic Info

Ionic:

Ionic CLI : 7.2.1 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 8.7.9
@angular-devkit/build-angular : 20.3.9
@angular-devkit/schematics : 20.3.9
@angular/cli : 20.3.9
@ionic/angular-toolkit : 12.3.0

Capacitor:

Capacitor CLI : 7.4.4
@capacitor/android : not installed
@capacitor/core : 7.4.4
@capacitor/ios : not installed

Utility:

cordova-res : not installed globally
native-run : 2.0.1

System:

NodeJS : v22.19.0 (/usr/local/bin/node)
npm : 11.6.2
OS : macOS Unknown

Additional Information

No response

Activity

  1. ReneHRich commented on Dec 18, 2025

    @ReneHRich

    For people running into this, I worked around this issue by resetting the value when the dialog is dismissed

    <ion-modal :keepContentsMounted="true" @did-dismiss="onBeginTimeModalDidDismiss">
              <ion-datetime
                id="begintime"
                ref="begintime"
                presentation="date-time"
                :value="begin_time"
              >
            ...
            </ion-modal>
    
    methods: {
        onBeginTimeModalDidDismiss() {
          // Reset the date input when the modal is closed, otherwise the picker retains the value
          this.$refs.begintime.$el.reset(this.begin_time)
        }
    }
    
  2. added
    type: buga confirmed bug report
    and removed on Feb 28, 2026
  3. added a commit that references this issue on Oct 20, 2026
    cecd3af
  4. ShaneK commented on Oct 21, 2026

    @ShaneK
    Member

    Thanks for the report! The fix for this issue was deployed in v9.0.9!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions