Home Screen with Local date and time

Hi,
I wanted to display the mobile's date and time in the Commare Home Screen, so do we have any such option to get it displayed ?

Please suggest.

The above option is required because few of he mobile devices are not configured correctly with the local Time Zone, hence wanted to get it displayed after the login.

Thanks and regards,
Gurudayal SAHU

Hi Gurudayal,

Unfortunately we don't have options to show custom widgets in the home screen, but you can add a label to the beginning of your form that displays mobile's date and time using format-date() function.

Thanks, Shivam !

Thanks and regards,
Gurudayal Sahu

If you are seeing phones which have extremely unlikely time settings (like factory resets to previous years, or users filling out forms at 4am), one other option you could possibly consider would be using Form Display Conditions along with calculations from the format-date() function to have a form with a warning title ("WARNING - Your Phone's Time and Date may be wrong!") show up at the top of the first menu anytime the app identifies a very-unlikely date and time. This could provide the user with a warning before they begin doing any work.

Thanks Clayton, it seems to be a great idea !

So, how should we refer the correct date and time to be defined in the form display logic, as format-date(date(/data/my_date), "%e/%n/%y") will refer Mobile's locally configured date only , while we may need to have some of the source from where it can get the correct date and time for the validation to check with the correct date and time.

Please suggest.

Thanks and regards,
Gurudayal Sahu

while we may need to have some of the source from where it can get the correct date and time for the validation to check with the correct date and time.

This is indeed tricky since the mobile app can run offline and it has no way of knowing about the correct time.
You can most probably add a check to see if mobile date is after certain known date. Like let's say you created a form today, so you can add a check to make sure that the device's date is after 16th June 2021. This will prevent all form submissions if the device date is before 16th June. But this won't prevent someone from submitting a form whose device date is in future like 20th June 2025.