Skip to content

bug: Datetime active day does not clear when pressing cancel and re-opening #27975

Closed

Description

@ShehryarSaleem

Describe the Bug

On pressing default Cancel Button in ion-datetime with ion-datetime-button and opening the ion-datetime again the date that was canceled is preselected.

Expected Behavior

on pressing the cancel button and opening the ion-datetime again should select the date that wasn't the one that was selected on cancel

Steps to Reproduce

  <ion-datetime-button datetime="datetime"></ion-datetime-button>

  <ion-modal [keepContentsMounted]="true">
    <ng-template>
      <ion-datetime id="datetime"[showDefaultButtons]="true"></ion-datetime>
    </ng-template>
  </ion-modal>

use this and click the button and select a date and then press the cancel button
now click on the button again, the date selected will be one selected when we pressed cancel not the one that is in ion-daretime-button

Reproduction: https://stackblitz.com/edit/angular-h94fr8?file=src%2Fapp%2Fexample.component.html

Screenshots

No response

Operating System

macOS

Browser

Chrome

Version

115.0.5790.170

Additional Information

No response

Activity

  1. sean-perkins commented on Aug 10, 2023

    @sean-perkins
    Contributor

    Hello 👋 thanks for reporting this issue!

    I agree this behavior is confusing. When the cancel button is selected, we should be clearing all activated data from the datetime and returning it to it's initial state, prior to it being presented.

  2. changed the title [-]bug: [/-] [+]bug: Datetime active day does not clear when pressing cancel and re-opening[/+] on Aug 10, 2023
  3. added
    package: core
    type: bug
    on Aug 10, 2023
  4. added
    type: bug
    and removed
    type: bug
    on Aug 10, 2023
  5. liamdebeasi commented on Aug 10, 2023

    @liamdebeasi
    Contributor

    Thanks for the report. Here is a dev build with a proposed fix if you are interested in testing:

    npm install @ionic/[email protected]
    

    You might need to test this in a local project as StackBlitz sometimes has trouble installing these builds.

  6. liamdebeasi commented on Aug 22, 2023

    @liamdebeasi
    Contributor

    Hey there,

    I am going to re-open this until the fix can be merged.

  7. added a commit that references this issue on Oct 20, 2026
    cecd3af
  8. ShaneK commented on Oct 21, 2026

    @ShaneK
    Member

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

  9. ionitron-bot commented on Nov 20, 2026

    @ionitron-bot

    Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

  10. locked and limited conversation to collaborators on Nov 20, 2026
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

    package: coretype: bug

    Type

    Fields

    Stage

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions