Description
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
v6.x
Current Behavior
The documentation mentions that ion-datetime accepts a date in ISO format, but when using new Date().toISOString()
in a location with a non-null UTC-offset, it seems that the date displayed by the ion-datetime is actually the UTC time and not the local time
Expected Behavior
I would expect that given a value=iso_datetime
, the value actually displayed in the widget is the time in the local timezone (with UTC offset applied)
Steps to Reproduce
<ion-datetime-button datetime="curTimestamp" />
<ion-modal :keep-contents-mounted="true">
<ion-datetime
id="curTimestamp"
:value="new Date(curTimestamp * 1000).toISOString()"
:show-default-buttons="true"
@ion-change="(event) => setCurTimestamp(event)"
></ion-datetime>
</ion-modal>
this results in the datetime component showing "16:52" although it's "17:52" at my local timezone (GMT+1)
Code Reproduction URL
No response
Ionic Info
Ionic:
Ionic CLI : 6.20.4
Utility:
cordova-res (update available: 0.15.4) : 0.15.3
native-run (update available: 1.7.1) : 1.5.0
System:
NodeJS : v16.18.0
npm : 9.1.2
OS : macOS
Additional Information
No response