Question about timezone handling?

Hey, my app relies on people submitting events to my app - the user would set the event start time.

How does Adalo handle this when users are spread across many different time zones? Will it be smart enough to show the local start time?

Thanks,
Christian

According to my understand what you asking for just take a text component & connect with event created time & use the relative time or any other which you like.

If you will use relative time it will show you like 5 min ago (when event is created)

You can see the example in my app Invocial :point_right: https://www.theinvocial.com (at the bottom left corner of list in light grey color)

1 Like

At the moment, no. All times are stored and displayed in a single time zone - there is a feature request to upgrade this to allow users to show local times etc. Vote if you think it will be helpful!

2 Likes

I’ve voted for that feature as it would be very useful. I’m sure I can work around not having this feature.

1 Like

Do you know which timezone is used as default?

I think it’s UTC, though that might only be because I’m in London.

Fair enough, it would be good for one of the Adalo support to confirm this.

Thanks for you help :slight_smile:

1 Like

Dates are displayed in the local timezone of the user, based on their device settings.

5 Likes

Thanks @Ben - is there any plan to allow us to set a timezone in the collection? Use case is a travel app with a flight which has a departure in one time zone and an arrival in another. When the user looks at their app, they cannot tell what time anything is happening.

As another example, when they get to the other end (flying east), their 8pm dinner reservation is showing as being in the middle of the night. We can save the GMT offset in the collection, so we’re nearly there, but it would be great to be able to have another option on date/time fields to offset the time shown so that it is correct when the users are somewhere else in the world.

I’ve made a feature request here: Upgrades to Date/Time | Voters | Adalo

1 Like

If I need to either take action or display a time based on user-entered time, I can’t display it correctly if a) I don’t know the time zone of the date field and b) need to display or take action on the date in another time zone.

I would have to ask the user to enter the time in the other time zone but in local time! For example if the user is EST and the start time for an event is 7pm PST, the user would need to enter 4pm start time. Then if the user moves to PST time zone, they need to use local time zone.

But worse of all, when using APIs (to send scheduled reminders or messages for example) you don’t know what time zone they were in when entering the time!

Is this the only workaround currently (post #3)? Date&Time Error... does Adalo account for Daylight Savings?

I might have figured it out… Need to test

So I think it is impossible to show times correctly in different time zones in Adalo. @Ben @anon78309838 @pford could you please weigh in? Here’s the use case:

  • A user creates and event and can select a time zone. For example, they create an event and select 10pm from date-time picker. This is saved to event record as StartTime.
  • They then select time zone (which is from a collection that has a list of time zones and UTC offsets). e.g. PST UTC-7
  • I also save the UTCoffset when the event was created (using Karimoo’s workaround - which requires updating user record every time they view home page) so I know what time zone the event was created. e.g. EST UTC-4

When I display event times, the time is always shown in user’s local time. So when user is in EST, by default the time is shown as 10pm and if in PST it is shown as 7PM.

So I calculate the correct UTC offset for the event’s timezone and store that in the Event record. I subtract Event Time Zone UTCOffset - User UTCOffset to get the difference between the event and user’s time zones and then add that to the event start time. So in example above, if user is in EST, the calculation is 10:00pm+((-7 - -4)* 0.04166666666) and store that in the event record as DisplayTime. This correctly displays the event time as 7pm (PST).

HOWEVER, if the user then moves to PST, then the start time will show as 4pm (7pm - 3 hours)! if I display the original time it will show 7pm. Adalo will always change any stored time to local time. I don’t seem to have any way to create a date-time in a different time zone and not have it displayed incorrectly if user changes time zone. Is this correct?

Thanks.

Hi @paulh,

As for me it is possible to achieve what you need, though this might not work using the DateTime picker.
The issue is that DateTime picker will always show the date&time according to the user device’s TZ settings. However, when you save the datetime from the DateTime picker to the collection record, it will be saved as an absolute value (which, in turn, will be displayed according to user TZ settings).

So, in your example on the 1st step, user selects 10 AM on some date, say, 01 Dec 2021. (I’ve changed PM to AM not to mess with date change :slight_smile: ). If user is in EST, he will see 10:00 AM, 01 Dec 2021. Inside Adalo it will be stored as 14:00 (2PM) GMT+0, 01 Dec 2021.

When on the 2nd step you’d like to apply timezone adjustment (EST->PST), you need to add 3 hours to the value: 10 AM PST = 1 PM EST (as you told, you can calculate user’s timezone difference in hours so getting 3hrs diff is easy). This operation will change the stored date to 17:00 (5PM) GMT+0, 01 Dec 2021.

The thing is, that when you do perform this operation, for the user in EST the time will be displayed as 1PM (and when he changes the time zone to PST, it’ll become 10 AM).

The only way I know to display local time of the other timezone for the user is to have an additional properties for date and time values alone.

Also, keep in mind the daylight saving time (which is a separate issue).

Hope this helps.

Best regards, Victor.

2 Likes

@Victor I actually figured that out too :smile: But then the problem was showing the correct time without being confusing to user.

So I used a conditional display to decide if to show the original time or the modified time. If user’s timezone is same as event time zone, then I show the raw date-time, otherwise show the modified date-time. Displaying the event’s time time zone should help too,

So here is the final result of my experiment - I did four time entries for local and different time zones, then looked at how they displayed in each actual time zone (man, I had to keep flying back and forth between New York and Los Angeles to test! :sweat_smile:)


But what a pain! I need to update the user record on every visit to Home Screen (the only screen I can be guaranteed the user will visit, I don’t know where else to place the user timezone calculation), and on top of all the conditionals for the list of events, I now need to do conditionals in the list, in addition to other display conditionals. I don’t know how well this will perform in real life…

It’s really silly that Adalo don’t allow control of timezones or date display.

BTW @Victor you really are the best!

1 Like