question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: ion datetime forces to local time without options for backwards compatibility

See original GitHub issue

Bug Report

[x] 4.9.1

Current behavior: With the more recent releases of ionic, ion datetime now always converts the date to the system’s timezone. This is not backwards compatible with previous behaviour and there is no option for configurability.

Expected behavior: Ion datetime needs to be enhanced so that backwards compatibility is supported.

Steps to reproduce: N/A Just want backwards compatibility (ie there should be an option to allow datetime to behave as it did before all the changes with respecting timezones).

Related code:

i
            /**
             * Prevent convertDataToISO from doing any
             * kind of transformation based on timezone
             * This cancels out any change it attempts to make
             *
             * Important: Take the timezone offset based on
             * the date that is currently selected, otherwise
             * there can be 1 hr difference when dealing w/ DST
             */
            const date = new Date(convertDataToISO(this.datetimeValue));
            this.datetimeValue.tzOffset = date.getTimezoneOffset() * -1;

Other information:

Ionic info:


Ionic:

   ionic (Ionic CLI)             : 4.9.0 (/Users/mustaqeemk/.nvm/versions/node/v11.6.0/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.9.1
   @angular-devkit/build-angular : 0.803.2
   @angular-devkit/schematics    : 8.3.2
   @angular/cli                  : 8.3.2
   @ionic/angular-toolkit        : 2.0.0

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.1.4, ios 5.0.1
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 30 other plugins)

System:

   Android SDK Tools : 26.1.1 (/Users/mustaqeemk/Library/Android/sdk)
   ios-deploy        : 1.9.4
   ios-sim           : 8.0.2
   NodeJS            : v11.6.0 (/Users/mustaqeemk/.nvm/versions/node/v11.6.0/bin/node)
   npm               : 6.10.2
   OS                : macOS Mojave
   Xcode             : Xcode 10.2.1 Build version 10E1001

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

6reactions
liamdebeasicommented, Oct 1, 2019

Thanks for the feature request. @daem0ndev’s approach sounds good. I imagine it would look something like this:

@Prop() displayTimezone?: string;

If timezone is undefined, the date options will be displayed relative to the user’s timezone (current behavior).

Example of forcing all values to be displayed in UTC:

<ion-datetime value="2019-10-01T15:43:40.394Z" display-timezone="utc"></ion-datetime>

edit: spoke with @daem0ndev offline, and we decided displayTimezone would be better to keep it consistent with the other props. Updated my example.

3reactions
daem0ndevcommented, Oct 1, 2019

PR coming in soon! thanks ionic team!!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

bug: ion datetime forces to local time without options for ...
This is not backwards compatible with previous behaviour and there is no option for configurability. Expected behavior: Ion datetime needs to be ...
Read more >
Ionic 6 ion-datetime issue when using zoned time (time zone)
We are trying to use local time in new ion-datetime (Ionic 6). ... from Ionic's documentation on how to convert from UTC to...
Read more >
1.1.7 (core) / 0.17.7 (libraries)
Fixed a bug where the re-execute button on runs of asset jobs would incorrectly show warning icon, indicating that the pipeline code may...
Read more >
Fix List for Db2 Version 11.5 for Linux, UNIX and Windows
DT147361 2 IT40335: HADR STANDBY IS SHUTDOWN DUE TO NOT FINDING A LOG FIL... DT148449 2 IT40091: DB2CKBKP FAILS TO VALIDATE REMOTE BACKUP DT147546 2...
Read more >
Changelog
Check out the changelog for Highcharts, Highcharts Stock, Highcharts Maps, and Highcharts Gantt. Learn all about old and new releases, features and options...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found