Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: date picker jumps to max date when navigating to next year #25708

Closed
4 of 7 tasks
daniel-zero opened this issue Aug 3, 2022 · 7 comments · Fixed by #26125
Closed
4 of 7 tasks

bug: date picker jumps to max date when navigating to next year #25708

daniel-zero opened this issue Aug 3, 2022 · 7 comments · Fixed by #26125
Labels
package: core @ionic/core package type: bug a confirmed bug report

Comments

@daniel-zero
Copy link

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x
  • Nightly

Current Behavior

When the max date property is used and the user moves from December 2022 to January 2023 the datepicker will switch to the given max date instead of moving to January

Expected Behavior

The datepicker should switch to January

Steps to Reproduce

  <ion-datetime
    locale="de-DE"
    presentation="date"
    [min]="'2022-08-03'"
    [max]="'2023-07-29'"
    showDefaultButtons="true"
    firstDayOfWeek="1"
  ></ion-datetime>

Code Reproduction URL

No response

Ionic Info

Ionic:

Ionic CLI : 6.20.1 (/Users/danielsogl/.nvm/versions/node/v16.16.0/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 6.2.0
@angular-devkit/build-angular : 14.1.0
@angular-devkit/schematics : 14.1.0
@angular/cli : 14.1.0
@ionic/angular-toolkit : 6.1.0

Capacitor:

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

Utility:

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

System:

NodeJS : v16.16.0 (/Users/danielsogl/.nvm/versions/node/v16.16.0/bin/node)
npm : 8.15.1
OS : macOS

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Aug 3, 2022
@daniel-zero daniel-zero changed the title bug: Datepicker jumps to max date when navigating to next year bug: date picker jumps to max date when navigating to next year Aug 3, 2022
@daniel-zero
Copy link
Author

One thing to note, there looks like there is an Angular 14 issue. Our app with the latest Ionic version and Angular 13 has no issues.

@liamdebeasi
Copy link
Member

liamdebeasi commented Aug 3, 2022

Thanks for the issue. Can you provide a minimal GitHub repo for the issue?

Never mind, I can reproduce the issue now. Let me take a closer look.

@liamdebeasi liamdebeasi added the needs: reply the issue needs a response from the user label Aug 3, 2022
@ionitron-bot ionitron-bot bot removed the triage label Aug 3, 2022
@liamdebeasi liamdebeasi removed the needs: reply the issue needs a response from the user label Aug 3, 2022
@liamdebeasi liamdebeasi self-assigned this Aug 3, 2022
@liamdebeasi
Copy link
Member

The issue here is that when switching from Dec 2022 --> Jan 2023, the months column in the month/year picker changes from having data for August through December to having data for January through August. To preserve scrolling stability, the picker attempts to select the nearest item: https://github.com/ionic-team/ionic-framework/blob/main/core/src/components/picker-column-internal/picker-column-internal.tsx#L97

This causes ionChange to fire, resulting in the datetime picker jumping the view forward to August 2023.

@liamdebeasi liamdebeasi added package: core @ionic/core package type: bug a confirmed bug report labels Aug 12, 2022
@liamdebeasi liamdebeasi removed their assignment Aug 12, 2022
@ionitron-bot ionitron-bot bot removed the triage label Aug 12, 2022
@liamdebeasi
Copy link
Member

liamdebeasi commented Sep 1, 2022

This also impacts setting min and navigating to the previous year. (#25870)

@liamdebeasi
Copy link
Member

liamdebeasi commented Oct 13, 2022

Hi there,

Can you try the following dev build and let me know if it resolves the issue?

npm install @ionic/angular@6.3.2-dev.11665758579.10f7db03

@liamdebeasi
Copy link
Member

Thanks for the issue. This has been resolved via #26125, and a fix will be available in an upcoming release of Ionic Framework. Please feel free to continue testing the dev build, and let me know if there are any issues.

@ionitron-bot
Copy link

ionitron-bot bot commented Nov 16, 2022

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.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: core @ionic/core package type: bug a confirmed bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants