Timezone API. Is there one available?

2 Likes

Isn’t there just. Sometimes it is a little too open, and there are lots of ways to do things, but it allows so many things to be done.

1 Like

Will check out the example you just posted. Thanks Nigel

Working great Nigel. Thanks so much!

Quick Q Nigel.

How would I stop the modal ‘XYZ wants to use your location’?

Would prefer the user to add their location into the search field only?

Curious how you displayed the UTC offset, Current time etc…?

Many thanks

Just remove the default geo position from the search box, and it won’t ask for permission.

The UTC offset is available as a standard data element. Divide by 60 to get it in hours.

image

With that you can then calculate their time by using the timezoneID in the time display function’s Dynamic Time Zone.

2 Likes

Works great. Thanks again Nigel.

Can I ask how you extracted the country to display in Country/Zone (ie; United Kingdom, United States, Japan etc…)?

Many thanks

How to achieve this? Have tried a few different ways and struggling to get it to work

Many thanks

You can use the “:extract” function to pull out elements from the geo. address field.

1 Like

Got ya! Loving the extract feature :+1:

1 Like

As in the example, you can get the UTC Offset straight from the geo.search input.

This is in minutes, so divide by 60.

1 Like

Sorry Nigel. Got it. Many thanks

One last thing. I noticed the time does not refresh? Is that due to my app being in Dev mode or something else?

Many thanks

Time does not flow on a web page :slight_smile:

You need to set up a loop to update time in a state.

1 Like

That’s a very valid point :grinning:

I’ve got States figured out (one thing I can tick off my Bubble Bucket List), so will go ahead and implement what you’ve mentioned Nigel.

How do I add my users selection (ie; they chose London, UK in the search) to the User DB data type (ie; ‘Current Location’ field?) The option in the Workflow is greyed out currently? I’m guessing it’s not so simple with it being pulled in from a 3rd party i guess?

Well all that bravado about knowing States, and I couldn’t get it to work Nigel!

I got so far…

But no time change :frowning:

Thanks Keith. How would I add the location they chose (ie; London, UK) to a field in the User Data Type? So this will always show the correct timezone, time etc… on the front-end

I have set up a Search Box with Geographic places, but in my Workflow when I try to make changes to a User, the Search Box is greyed out with the text ‘Incompatible type’?

Many thanks

Hi @marc2,

I use a standard text input (set to address type) and a map for visual feedback. This is THE way to collect locations in Bubble in my opinion.

Don’t use the search box. It doesn’t help.

This project shows pretty much exactly (UI-wise) how I collect addresses in my own apps. Examine the project (editor is “everyone can view”):

Editor: https://bubble.io/page?name=index&id=timezone-api-bug&tab=tabs-1

Best regards,
Keith

3 Likes

Any pointers, great appreciated @NigelG

The field on the user will need to be Geo Address.

image

have updated the app above showing this.

1 Like

Thanks Nigel. You’ve been awesome!