-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Description
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:
4.1.1: https://jsfiddle.net/simonhaenisch/ma8qb1ur/- Latest: https://jsfiddle.net/simonhaenisch/zqbj3osm/
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).