Mobile app renders date in local timezone?

Mobile app renders date in local timezone?

  

Hi,

In our mobile app in local storage table we have two fields with date time value. One is "DateTime" type and other is "text". When I try to display data on screen the value from text field is displayed as is, but value from date time field is changed to match current timezone... if I change local timezone on settings os operating system the time from 'date time' field changes accordingly... Is that proper behavior and I should just change field type to text?

Thank you

Hi Mykola,

Local storage stores date times in utc/zulu time, as you can see when you inspect it via Chrome devtools when running in the emulator. When retrieving from the database, it is converted. That is indeed the current behaviour, so I assume it's intentional, but it's something I've wondered about as well, as I noticed some peculiarities with it, which I haven't investigated further.

I'm not sure there's a clean way to retrieve the days times as-is. Note however that individual dates can be converted easily, as your browser knows its timezone, so you can write a JavaScript conversion routine.


Solution

Hi Killian. 

The workaround I've used so far is to store date in text field on local db. So proper time calculation is made on server. I've found out that it is a standard behavior for JS date object , but as the "under the hood" logic of OS is suppose to be hidden it would be great to have mention of this additional conversion at least on client-side time/date related function descriptions.

Solution