I’m trying to setup a feature on my site which is a search box connected to the Google Maps API. The ideal scenario is that the user enters their current location, the Google Maps Timezone API would then convert this to their current timezone and display this value on the site. I had hoped this might be possible to do with the generic search box element set to Geographic places but I can’t seem to get any functionality out of this at all?
Would anybody have any ideas on how to implement this?
If you’re looking to do this solely for the current user based on their current location, you can use the “Current geographic position” expression. (Here’s a quick walkthrough of how to access it.
Note: the user needs to allow location access for your app. (If they haven’t done so, they’ll see a popup in the browser asking for permission). It may take a few seconds to populate at first.
Dan (creator of LearnTo - 100+ really useful Bubble tutorials)
Would it be possible to do this without the current users location, but rather a location determined by the value entered in a search box?
i.e. the user would enter “Denmark”. As the user started typing, the search box would auto-suggest from the Google maps API, and then then the rest of the process as outlined in the video you linked to would take place to work out the timezone. Could that work?
Amazing! Thanks so much for the video. I didn’t realise it would be so simple!
Unfortunately, I can’t get the search box working. Thinking it’s something to do with the API keys I’ve set as both the maps API key and the Geocode key are the exact same as this is what it’s showing me in my Google Cloud console. Should this be the case? Seems strange.
Typically when the search box isn’t displaying results, it’s because some of the relevant Google Maps APIs weren’t enabled when you created your API keys. (Another) video walkthrough below.
Amazing! Thanks so much for your help. Got it working now. Strangely, the option to display “offset from UTC” doesn’t work, although the other options i.e. “timezone ID” etc. all work. Would you have any ideas how I can get that working?
I believe the result that you get is formatted in minutes, so you need to “convert” it to hours by dividing by 60. (Then, manually add in the text for UTC).