ionic-framework
ionic-framework copied to clipboard
bug: datetime should not report the timezone in ionChange
Prerequisites
- [X] I have read the Contributing Guidelines.
- [X] I agree to follow the Code of Conduct.
- [X] I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
- [ ] v4.x
- [ ] v5.x
- [X] v6.x
- [ ] Nightly
Current Behavior
Documentation explain that ion-datetime dont take care about timezone.
However it's not totaly true...
If we initialize the ion-datetime value with an UTC datetime:
2022-07-06T03:16:00Z
The picker properly show the expected time without trying to convert it to local timezone (as expected) (in other word: time is 03:16).
However, when we click on done, the datime picker add a timezone information to the current value:
2022-07-06T03:16:00+02:00
Expected Behavior
The picker should not change TZ as it is not supposed to manage the timezone.
If we try to display the picker date into an ion-input using Angular date pipe, then the value change...
Steps to Reproduce
<ion-item>
<ion-label>Start</ion-label>
<ion-input #startPicker id="pickerStartTime" value="{{ pickerStartTime | date 'long' }}"></ion-input>
<ion-popover trigger="pickerStartTime" class="popover-datetime">
<ng-template>
<ion-datetime [(ngModel)]="pickerStartTime" name="pickerStartTime" presentation="date-time" [showDefaultButtons]="true">
<span slot="title">Select a start time</span>
</ion-datetime>
</ng-template>
</ion-popover>
</ion-item>
Code Reproduction URL
No response
Ionic Info
Ionic:
Ionic CLI : 6.17.1 (/home/joran/.nvm/versions/node/v14.17.3/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 6.1.12
@angular-devkit/build-angular : 14.0.4
@angular-devkit/schematics : 14.0.4
@angular/cli : 14.0.4
@ionic/angular-toolkit : 6.1.0
Capacitor:
Capacitor CLI : 3.6.0
@capacitor/android : 3.6.0
@capacitor/core : 3.6.0
@capacitor/ios : 3.6.0
Cordova:
Cordova CLI : not installed
Cordova Platforms : not available
Cordova Plugins : not available
Utility:
cordova-res : not installed globally
native-run : 1.6.0
System:
NodeJS : v14.17.3 (/home/joran/.nvm/versions/node/v14.17.3/bin/node)
npm : 7.24.2
OS : Linux 5.15
─────────────────────────────────────────────────
Ionic CLI update available: 6.17.1 → 6.20.1
Run npm i -g @ionic/cli to update
─────────────────────────────────────────────────
Additional Information
No response
Thanks for the issue. Yes, we should be following the datetime-local implementation and not return the timezone information. The control is meant to represent a local date and time, but not necessarily the user's local date and time.
This is an issue for me too. Would be happy to see a fix in an upcoming version soon.
Hi everyone,
Here is a dev build that resolves the issue if anyone would like to test:
6.3.3-dev.11666899838.1025cbb3
Please note that we consider this fix a breaking change in behavior, so the fix is scheduled to ship in an upcoming major release of Ionic. As a result, this dev build is subject to Ionic 7 Breaking Changes.
Thanks for the issue. This has been resolved via https://github.com/ionic-team/ionic-framework/pull/26183, and a fix will be available in an upcoming major release of Ionic Framework. Please feel free to continue testing the dev build, and let me know if you run into any issues.
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.