Skip to content

bug: Ion-datetime doesn't always initialize at the selected date #28516

Closed as not planned

Description

@AlexyNau

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

When opening a ion-datetime in a ion-popover, the date doesn't always initialize at the selected date in v-model.

Once popover is opened, sometimes it shows janvier 1923
image

And other times it's fine, it shows juin 2023, the date in v-model.
image

This behavior is only occured with presentation property set to month-year or year.

Expected Behavior

When opening a ion-datetime, with presentation property set to month-year or year, in a ion-popover, the date should always initialize at the date in v-model.

Steps to Reproduce

  1. Create a ion-datetime, set presentation property to month-year
  2. Set a date through v-model, for instance set '2023-06-04T23:00:00.000+02:00'
  3. Add the ion-datetime in a ion-popover content with a trigger (see ionicframework.com/docs/api/popover#triggers)
  4. Open and close multiple times the popover
    The wheel picker position is sometimes aligned to the current date, sometimes to 1 century before (top of the wheel).

Code Reproduction URL

https://stackblitz.com/edit/vitejs-vite-rn9sej

Ionic Info

See stackblitz package.json

Additional Information

No response

Activity

  1. self-assigned this
    on Nov 13, 2023
  2. mapsandapps commented on Nov 13, 2023

    @mapsandapps
    Contributor

    Hi, thank you for the bug report. I'm able to reproduce this. I've created a (more) minimal reproduction on stackblitz. I'm unable to reproduce the bug in Angular, React, or Javascript, although since it's sporadically occurring, it may be present in those as well but just more prominent in Vue.

  3. removed their assignment
    on Nov 13, 2023
  4. mapsandapps commented on Nov 13, 2023

    @mapsandapps
    Contributor

    Upon further reflection, it looks like this is a duplicate of #26234 (even though that one was reproducing only in Angular and this one is now reproducing (for me) only in Vue). As a workaround, you can use keep-contents-mounted on your Popover.

  5. ionitron-bot commented on Dec 13, 2023

    @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.

  6. locked and limited conversation to collaborators on Dec 13, 2023
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

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions