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: ion-datetime not listing all possible years (v6) #23615

Closed
martinmitteregger opened this issue Jul 13, 2021 · 3 comments · Fixed by #23616
Closed

bug: ion-datetime not listing all possible years (v6) #23615

martinmitteregger opened this issue Jul 13, 2021 · 3 comments · Fixed by #23616
Labels
package: core @ionic/core package type: bug a confirmed bug report v6 issues specific to Framework v6
Milestone

Comments

@martinmitteregger
Copy link

Bug Report

Ionic version:

[ ] 4.x
[ ] 5.x
[x ] 6.x

Current behavior:

Datepicker shows only 40 years when listing all possible years. Initially 2041 to 2001 are listed even though max is set to today and min to today minus 100 years (or 1900 which changes nothing).

Expected behavior:

List all years between min and max. Years after max should not be displayed in my opinion.

Related code:

<ion-datetime
    presentation="date"
    [min]="1900"
    [max]="2022"></ion-datetime>

image
image

Ionic info:

Ionic:

   Ionic CLI                     : 6.12.3 (C:\Users\xxx\AppData\Roaming\npm\node_modules\@ionic\cli)
   Ionic Framework               : @ionic/angular 6.0.0-beta.1
   @angular-devkit/build-angular : 12.0.5
   @angular-devkit/schematics    : 12.1.0
   @angular/cli                  : 12.0.5
   @ionic/angular-toolkit        : 4.0.0

Capacitor:

   Capacitor CLI   : 3.0.2
   @capacitor/core : 3.0.2

Utility:

   cordova-res (update available: 0.15.2) : 0.15.1
   native-run                             : 1.4.0

System:

   NodeJS : v16.3.0 (C:\Program Files\nodejs\node.exe)
   npm    : 7.17.0
   OS     : Windows 10

@ionitron-bot ionitron-bot bot added the triage label Jul 13, 2021
@liamdebeasi
Copy link
Contributor

liamdebeasi commented Jul 13, 2021

Thanks for the issue. There are a couple things going on here:

  1. When using max/min dates, the out of bound years are shown as disabled buttons in MD mode.

The spec does not really define what to do here, but the Flutter implementation is to show out of bound dates: https://material.io/components/date-pickers/flutter#date-pickers

However, looking at this again I don't really see the value in showing the out of bound years, especially where datetime in ios mode hides them. I can change this so the behavior is consistent.

  1. By default, the datetime picker will only show a total of 40 years for performance reasons. The 40 value here is a bit arbitrary, and I am open to increasing that. That being said, if you explicitly set the max/min values, the years rendered should match those bounds. Datetime does not currently do this, so this is a bug we should fix.

@liamdebeasi liamdebeasi added package: core @ionic/core package type: bug a confirmed bug report labels Jul 13, 2021
@liamdebeasi liamdebeasi added this to the 6.0.0 milestone Jul 13, 2021
@ionitron-bot ionitron-bot bot removed the triage label Jul 13, 2021
@liamdebeasi liamdebeasi added the v6 issues specific to Framework v6 label Jul 13, 2021
liamdebeasi added a commit that referenced this issue Jul 15, 2021
…max and min are now accounted for in MD mode (#23616)

resolves #23615
@liamdebeasi
Copy link
Contributor

Thanks for the issue. This has been resolved via #23616, and a fix will be available in v6 beta 2.

@liamdebeasi liamdebeasi modified the milestones: 6.0.0, 6.0.0-beta.2 Jul 19, 2021
@ionitron-bot
Copy link

ionitron-bot bot commented Aug 18, 2021

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 Aug 18, 2021
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 v6 issues specific to Framework v6
Projects
None yet
2 participants