File size: 3,096 Bytes
45721da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
bug: date value is not finite in DateTimeFormat format() when presentation='year' on ios device
### Prerequisites

- [X] I have read the [Contributing Guidelines](https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#creating-an-issue).
- [X] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [X] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/issues) that already report this problem, without success.

### 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](assets/ionic-team__ionic-framework-27816/001.png)

I see it happen in getNormalizedDate funtion when we try to new Date() with refParts that have some undefined propertise
![image](assets/ionic-team__ionic-framework-27816/002.png)

On chrome browser, it work well:
![image](assets/ionic-team__ionic-framework-27816/003.png)

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_

## Relevant pre-fix discussion

### Issue #27797

#### Comment at 2023-07-18T05:00:24Z

Hi Liamdebeasi,
This is the repo, you need to replace the app id by your own:
https://github.com/heodien/sample-date-time-button
The ion-datetime-button dont show the year value on ios device. On browser, it's worked well.
On browser:
![Screenshot 2023-07-18 at 11 56 19](assets/ionic-team__ionic-framework-27816/004.png)
On device:
![photo_2023-07-18_11-58-46](assets/ionic-team__ionic-framework-27816/005.jpg)
![Screenshot 2023-07-18 at 11 57 50](assets/ionic-team__ionic-framework-27816/006.png)