-
Notifications
You must be signed in to change notification settings - Fork 13.5k
bug: Issue with the ion-datetime display #26943
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
Comments
A dirty workaround I did was to apply the timezone offset, so that ionic-datetime would have the proper string
where
|
Thanks for the report. As noted in https://ionicframework.com/docs/api/datetime#time-zones, Here is another example: https://codepen.io/liamdebeasi/pen/JjaMWYw?editors=1010 |
Okay, but then the documentation should perhaps not mention that the date that ion-datetime accept must be given in UTC (with the "Z" at the end) since this is confusing (the fact that we give a datetime in UTC makes user think that the widget will handle local timezone itself), but rather to just say, "give a date in the format YYYY/MM/DD hh:mm:ss and the widget will display this" |
The documentation states that values should be provided in an "ISO 8601 format": https://ionicframework.com/docs/api/datetime#iso-8601-datetime-format-yyyy-mm-ddthhmmz. We do not say that the timezone must be provided, but that section could definitely be more clear that any timezone information is ignored. I'll update the docs. |
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. |
Prerequisites
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 timeExpected 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
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
The text was updated successfully, but these errors were encountered: