Mobile input linked to DateTime variable on android problem

Mobile input linked to DateTime variable on android problem

  

Hi,

I have the following:

A P10 mobile application with a form that contains a input linked to a DateTime variable. I'm not using any datetime picker, I'm relying on the native device's picker. The form has a button that saves the form data to a server entity (not using local entities).

From the tests I have performed I don't have to do manual conversions between client (device - local time) and server (UTC). Everything magically happens - which I'm very happy about!


Steps:

1) Tap field to choose date

   Result: native DateTime picker opens with local current date time

2) Select a date and time (local date time)

   Result: input reflects selected date and time (local date time)

3) Tap button to save data to server entity

   Result: server entity DateTime field is saved in UTC time (server time)

When reading the data from the server entity back into the form or a list - again magically the conversion is done (Yay!)


My tests on mobile devices:

On IOS device (iPad - running app in OutSystems Now), everything works as mentioned above.

On an android device (generated APK and installed), I have the following problem:

Step (1), result as mentioned above

Step (2), after selection the value in the input has been changed to UTC value - which is incorrect

Step (3), is doing what it is suppose to do, convert the received value to UTC time, but because it receives the "incorrectly converted value", the value in the server entity is converted twice.


Is this a bug? How can I work around it?


Kind regards,

CJ

Solution

My workaround:

1) Created a client action to check for android device, using code below:

SyntaxEditor Code Snippet

Index(GetUserAgent(), "android", ignoreCase: True) > -1

2) Created another client action to fix the value back to local time (see attachment). Action output is a DateTime parameter. Using (1) to check for Android device.

3) Added an event handler on Input widget's OnChange event. Handler calls (2) and assigns the output parameter to Input widget's linked variable.

Not the most elegant, but it works.


Solution

Hi,


Is that happening to you in any android device? In what models did you try?

The behavior you described in the beginning should work the same way in all devices without you having to workaround it.


Regards,

João Rosado

Hi Joao,


Thanks for your reply.

I just checked on another android, same problem.


The one phone runs Android 5.1.1. and the other one Android 6.0.1

My test application is running on my personal environment which runs Version 10.0.200.2

This behaviour is also on our Enterprise environment running Version 10.0.405.0


Kind regards,

CJ