Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bug: ion-datetime works wrongly with different timezone offsets since 4.2 #18287

Copy link
Copy link
@simonhaenisch

Description

@simonhaenisch
Issue body actions

Bug Report

Ionic version: >=4.2

Current behavior:

I am currently in timezone +02:00. My app uses the moment-timezone package to have a global timezone setting which is set to +12:00 by default. I use moment().format(), which prints the current time e. g. as 2019-05-16T12:25:59+12:00, to set the value of an ion-datetime:

<ion-datetime
  value="2019-05-16T12:25:59+12:00"
  display-format="DD MMM YY HH:mm"
/>

The ion-datetime now displays that date converted to the timezone I'm currently in:

16 May 19 02:25

Expected behavior:

Prior to 4.2, the ion-datetime would display that date in the timezone that the value is in:

16 May 19 12:25

This is what I expect from it, since I would pass the value with a different timezone info if I wanted the user to see it in that timezone. I. e. if the user switched their in-app timezone to +02:00, then moment().format() would print that same date as 2019-05-16T02:25:59+02:00, and only then would I want the user to see the time as 02:25.

Related code:

Other information:

I tried adding +12:00 to both the display and picker format, but that doesn't actually change how the date is displayed. Since this didn't happen before 4.2, this was most likely introduced by either #17706 or #17815 (/cc @liamdebeasi).

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.