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.

ion-datetime default value is not local

See original GitHub issue

Bug Report

Ionic version:

[x] 4.0.2

Current behavior: ion-datetime currently defaults to todays date if none is selected but does not give an option to apply an offset. Because of this, the time is not local.

Expected behavior:

ion-datetime default value should be local.

Ionic info:

Ionic:

   ionic (Ionic CLI)             : 4.10.3 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.0.2
   @angular-devkit/build-angular : 0.12.4
   @angular-devkit/schematics    : 7.3.1
   @angular/cli                  : 7.3.1
   @ionic/angular-toolkit        : 1.3.0

Cordova:

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

System:

   ios-deploy : 2.0.0
   NodeJS     : v10.15.0 (/usr/local/bin/node)
   npm        : 6.4.1
   OS         : macOS Mojave
   Xcode      : Xcode 10.1 Build version 10B61

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
kiichicommented, Mar 14, 2019

@liamdebeasi updating the dev for @ionic/angular helped.

Here is my steps:

npm i @ionic/angular@dev
+ @ionic/angular@4.1.2-dev.201903131547.be0258c
npm install @ionic/core@dev
+ @ionic/core@4.1.2-dev.201903131547.be0258c

It showed the correct current time with the above sample code. Thank you!

datetime_-_fixed
1reaction
bkarvcommented, Feb 24, 2019

Beat me to it, yes same issue the default time is not local it seems like it is defaulting to the GMT time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ion-datetime default value is not local · Issue #17587 - GitHub
Current behavior: ion-datetime currently defaults to todays date if none is selected but does not give an option to apply an offset. Because...
Read more >
Ionic ion-datetime: how to set default picker value
You using momentJs which already by default use hte local time so there is no need to subtract the offset.
Read more >
ion-datetime - Ionic Framework
Ionic's ion-datetime follows the datetime-local behavior of not manipulating or setting the time zone inside of a datetime control. In other words, a...
Read more >
Ionic 6 ion-datetime | Complete guide - YouTube
Hello Friends, Welcome Back to @CodingTechnyks. In this video, we are going to work with Ionic 6 ion - datetime using​ #ionic #angular...
Read more >
Date picker popup in Ionic 6 | Damir's Corner
Fortunately, there are not too many breaking changes in Ionic 6. The one that impacted the applications that I had to update to...
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