TextToDateTime() issue with Time Zones - Client Actions

Hi,

In the last days i found a issue with the TextToDateTime() function using different UTC time zones.
I test it a little more and this only happens in client actions (Both Reactive and Mobile)

The following test was performed using (UTC +2):


If i use the (UTC) time zone, it will perform the conversion correctly

Greetings,
Pedro Vieira

Solution

Hi Pedro,

That's not really a bug, it's more of a way that date/times are treated in client actions. On Mobile, and apparently also on Reactive Web, local dates are always stored as UTC, regardless of the time zone of the client. When retrieving them from the screen, they are converted to UTC and when showing them on the screen, they are converted back to local time. In the debugger however, always the underlying UTC time is shown. So if you're on UTC+2, and enter 16:45 in an input widget, or perform a conversion like you did, it's converted to UTC which means 14:45, and that's what the debugger shows. However, when you put it in an Expression and show it on the screen, it will show 16:45 again.

Solution

Hi Kilian,

Thanks for the explanation how it exactly works.
Would be nice if that part can be specified on the documentation.

In my case I use it as input of a function to determinate a certain value and that cause me issue when calculating it.
Will adapt the code with above comments to work as desired. Thanks!

Greetings,
Pedro Vieira

Hi Pedro,

You're most welcome! I agree that documentation may be a bit scarce here. Happy coding!