Skip to content
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

bug: Incorrect time displayed after selection in Datetime #25693

Closed
4 of 7 tasks
pvo13 opened this issue Jul 29, 2022 · 4 comments
Closed
4 of 7 tasks

bug: Incorrect time displayed after selection in Datetime #25693

pvo13 opened this issue Jul 29, 2022 · 4 comments
Assignees
Labels
package: core @ionic/core package type: bug a confirmed bug report

Comments

@pvo13
Copy link

pvo13 commented Jul 29, 2022

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x
  • Nightly

Current Behavior

I use an ion-datetime component to select a date and time.

When I click on the current time to change it, scroll wheels appear and I can change the hour. If I do that, the selected value is being propagated back to the underlying component and displayed, but not the value I have chosen, but a different one. This offset in my case is two, it seems to depend on the browsers timezone. So I choose 22 and the within the component the hour part shows 20
ion-datetime_bug

Expected Behavior

I expect the time that I select to be exactly to be the time I then see in the component.

Steps to Reproduce

Open the ion-datetime description page and use one oft he examples that contain the time part, e.g. https://ionicframework.com/docs/api/datetime#showing-the-default-title

When I click on the current time to change it, scroll wheels appear and I can change the hour. If I do that, the selected value is being propagated back to the underlying component and displayed, but not the value I have chosen, but another one with an offset. The offset in my case is two, it seems to depend on the browsers timezone.

Code Reproduction URL

No response

Ionic Info

Ionic:

Ionic CLI : 6.18.1 (/usr/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 6.2.0
@angular-devkit/build-angular : 14.1.0
@angular-devkit/schematics : 14.1.0
@angular/cli : 14.1.0
@ionic/angular-toolkit : 7.0.0

Utility:

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

System:

NodeJS : v16.16.0 (/usr/bin/node)
npm : 8.11.0
OS : Linux 5.4

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Jul 29, 2022
@sean-perkins sean-perkins self-assigned this Jul 29, 2022
@sean-perkins sean-perkins changed the title bug: setting the time in ion-datetime component doesn't work as expected bug: Incorrect time displayed after selection in Datetime Jul 29, 2022
@sean-perkins sean-perkins added package: core @ionic/core package type: bug a confirmed bug report labels Jul 29, 2022
@sean-perkins
Copy link
Contributor

sean-perkins commented Jul 29, 2022

@pvo13 thanks for reporting this issue! When formatting the text to be displayed, we are not accounting for the timezone offset that toISOString() performs.

Can you test with this dev-build and let me know if you run into any issues?

6.2.1-dev.11659121131.15481a1f

Thanks!

@pvo13
Copy link
Author

pvo13 commented Jul 29, 2022

Can you test with this dev-build and let me know if you run into any issues?

6.2.1-dev.11659121131.15481a1f

I tested it with 6.2.1-dev.11659121131.15481a1f
This build works fine, issue seems to be resolved here. Thank you!

@pvo13 pvo13 closed this as completed Jul 29, 2022
@sean-perkins sean-perkins reopened this Jul 29, 2022
@sean-perkins
Copy link
Contributor

Thanks for confirming! I'm going to keep the issue open until a PR is added to fix this in main. The issue will auto close when it is released in an upcoming patch release.

@ionitron-bot
Copy link

ionitron-bot bot commented Aug 31, 2022

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.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Aug 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: core @ionic/core package type: bug a confirmed bug report
Projects
None yet
Development

No branches or pull requests

2 participants