How do you store time zones without burning API calls?

Hey everyone,

I noticed my app is making a ton of calls to the Google Time Zone API and need to figure out how to minimize it. I have a platform for users to create events with registrations where the event has a date/time and an address. From what I assume, the Google TimeZone API is being called anytime I reference an event’s date/time as follows, using the event’s address as the place to find the time zone ID:

What I’m thinking of changing to:

  • When an event director sets or edits the event address, I call the API once and save the timeZoneId (like America/Chicago) as text on the Event.

  • Then, anywhere I show the event’s time/date, I just use that saved value instead of Bubble’s built-in location time zone field.

What I’m proposing:

Questions:

  • Is this the right approach?

  • Does saving the timezone as text actually stop Bubble from auto-calling Google?

  • When I test this, it does correctly show the time change from timezone to timezone, but is it still calling the API to find the UTC offset to display this properly?

  • Will my method be negatively effected with daylight savings, etc?

Would love to hear what’s worked best for others.

Yes, that’s the right approach. The result in the end will be the same (time formatted as a specific time zone, e.g. America/Chicago), just without the extra api calls.

Thank you! So is Bubble internally doing the conversion to the Time Zone ID I save as text when I display a date with the new method we’re discussing? Just confirming 100% that it’s not pulling from the Time Zone API somehow still…

Yes, when it has the time zone as a text, it can do it internally without having to call the Time Zone API.

The Time Zone API call is only needed when you have an address and are trying to get the time zone for that address.

This topic was automatically closed after 70 days. New replies are no longer allowed.