Skip to content

bug: ion-datetime When the [max] is set and [preferWheel], the number of days in the month does not change for the first time #29701

Closed as not planned
@Archi-Od

Description

@Archi-Od

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

When the [max] is set and [preferWheel], and you change month, the number of days in the month does not change for the first time
For example, if you set the max date 16 years ago and today is July 10, then when you change a month back to June, the number of days remains 10 and not 30 (but if you change the month again, it is already drawn normally)

Expected Behavior

When the month changes, the number of days automatically changes

Steps to Reproduce

  1. In ion-dateTime set [preferWheel]="true"
  2. set [max]='maxDate' for example
    maxDate = sub(new Date(), { years: 16 }).toISOString();
    or without date-fns
    const today = new Date();
    const maxYear = today.getFullYear() - 16;
    const maxMonth = today.getMonth();
    const maxDay = today.getDate();
    this.maxDate = new Date(maxYear, maxMonth, maxDay).toISOString().split('T')[0];
  3. Change month

Code Reproduction URL

https://stackblitz.com/run?file=src%2Fapp%2Fexample.component.ts,src%2Fapp%2Fexample.component.html

Ionic Info

Ionic Framework : @ionic/angular 7.8.6
@angular-devkit/build-angular : 16.2.14
@angular-devkit/schematics : 16.2.14
@angular/cli : 16.2.14
@ionic/angular-toolkit : 9.0.0

Capacitor:

Capacitor CLI : 5.7.6
@capacitor/android : 5.7.6
@capacitor/core : 5.7.6
@capacitor/ios : 5.7.6

Utility:

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

System:

NodeJS : v18.20.1
npm : 10.5.0
OS : Windows 10

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions