ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
50.89k stars 13.52k forks source link

bug: Datetime selected day should not change when changing months or years in the wheel picker #29008

Open sean-perkins opened 7 months ago

sean-perkins commented 7 months ago

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

Datetime currently has a confusing user experience where changing either the month or year through the wheel picker interface:

CleanShot 2024-02-09 at 14 48 49

CleanShot 2024-02-09 at 14 49 24

Results in the selected day applying in the working month:

CleanShot 2024-02-09 at 14 49 46

In experiences with multiple selection (as shown) this is even more confusing, as it only applies the first selected day to the new working month/year.

Expected Behavior

Ionic should not be doing this behavior at all. Changing the month or year should have no impact on the selections within the calendar grid.

For example, if you change the month through the arrow navigation:

CleanShot 2024-02-09 at 14 51 11

This behavior does not occur. This is expected.

Steps to Reproduce

  1. Render a datetime and select a day
  2. Change the month or year from the picker interface (clicking the button in the upper-left of the header)
  3. Observe: The selected day is applied to the new month/year you are viewing.

Code Reproduction URL

https://ionicframework.com/docs/api/datetime#multiple-date-selection

Ionic Info

N/A

Additional Information

No response

muhammadalizkhan commented 5 months ago

you need to ensure that selected day remains constant when user changes month or year. This likely involves updating datetime picker component or its configuration to prevent the undesired behavior

luigikc commented 5 months ago

I was able to reproduce this error in Chrome, Safari and Firefox for Windows OS and MacOS, but not in MacOS in a Macbook Pro M2, in any navigator. I disabled the month/year picker as a workaround following a comment in this thread: https://forum.ionicframework.com/t/ion-datetime-v6-disable-month-year-picker/223750 I leave a comment here to follow up on the discussion, hope a fix is coming soon!