Skip to content

bug: date value is not finite in DateTimeFormat format() when presentation='year' on ios device #27797

Description

@heodien

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

We try to show a ion-datetime with presentation="year" in ion-modal. And we got this bug on ios device. On android. it worked well.

When using ion-datetime with presentation='year'. I got error: "date value is not finite in DateTimeFormat format()"
image

I see it happen in getNormalizedDate funtion when we try to new Date() with refParts that have some undefined propertise
image

On chrome browser, it work well:
image

Result: we dont see the year number.

Expected Behavior

No more error

Steps to Reproduce

  • Implement ion-datetime with presentation='year'
  • value = 2023;
    <ion-datetime presentation="year" size="cover" width="100%" [min]="2019" [max]="2030" [(value)]="value" id="datetime"></ion-datetime>
  • View it on ios device

Code Reproduction URL

No response

Ionic Info

Ionic:

Ionic CLI : 7.1.1 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 7.1.2
@angular-devkit/build-angular : 15.2.9
@angular-devkit/schematics : 15.2.9
@angular/cli : 15.2.9
@ionic/angular-toolkit : 9.0.0

Cordova:

Cordova CLI : 12.0.0 (cordova-lib@12.0.1)
Cordova Platforms : android 12.0.0, ios 6.3.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 33 other plugins)

Utility:

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

System:

ios-sim : 8.0.2
NodeJS : v18.16.0 (/usr/local/bin/node)
npm : 9.5.1
OS : macOS Unknown
Xcode : Xcode 14.3 Build version 14E222b

Additional Information

No response

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