How to: Timezone Dropdown with API
In this Bubble tutorial we demonstrate how to use the timezoneDB API to get a list of timezones and display this list in a dropdown for your Bubble app users.
Unlock the power of timezones: Learn how to integrate a dynamic timezone dropdown in your Bubble app!
Master user registration: Discover how to save timezone data crucial for your app's functionality!
Elevate your Bubble skills: Create a seamless user experience with our step-by-step timezone API tutorial!
Adding a Timezone Dropdown with API in Bubble
In this Bubble tutorial video, I'm going to show you how to add a time zone dropdown to a registration flow. This can be very useful if anything in your app requires you to save hard by coding a time zone for a user. But before we get started, did you know you can be a Planet No Code member? We've got over a hundred Bubble tutorial videos. Many of them are member exclusive, they can only be found on our website. And if you like videos like this, it just helps our cause if you can like and subscribe.
Using the TimezoneDB API
So, let's jump in to a time zone API. For that, I'm going to be using the API provided by timezonedb.com. The endpoint is here, I'm going to copy that. I'm going to go into my plugins and add a new API. Name this timezonedb. The authentication is a private key in the URL. And I'm going to use a get call and say get list of time zones. Then I'm going to go and get my API key. Paste it into the key value box.
Testing the API Connection
I think I can test it now. Oh, invalid API key. I think that's because they want key as the parameter name. Let's change that to key. Return to non object and you pick JSON. Okay, I think that is because if I look at the documentation here, I should say format equals JSON in the URL. So, let's do that. We could probably just add it as a parameter. Let's try that. Format JSON.
Understanding the API Response
Cool, here we go. So, we get all of this timezone data back. Tons of data. And one of the advantages of using the API call is that we don't just get the zone name. And that's what I mean by this part here. And that's what is essential for feeding back into dynamic timezone positions in Bubble. If you've gone into settings general and you've enabled timezone overrides, that's the label for the timezone that you'll need. But it also provides you with all of these GMT offsets.
Using the Timezone Data in Bubble
So, that can be again helpful for doing calculations of converting different timezones for your users. But do remember that if countries have got daylight savings or their hours, it shifts by an hour here or there, then the GMT offset is going to change depending on the time of year that you save it from this API call. But anyway, it's still very useful. And so, we can now go in noticing that use as is data. And we can go into design. We can say dynamic choices. And we can say get this of timezone.
Creating a Dynamic Dropdown
And then we get data from external API. This is the timezones. Ooh. I think we need to have timezones timezone zones. Yes, there we go. Current options zone name. Then if I preview. And now I get my list of timezones that I can pick. And again, the advantage of using the API is that we can not only save the zone name, but I can take data out, the extra data that the API provides.
Displaying Additional Timezone Information
So, I can say dropdown timezones value, GMT offset. So then if I go back here and I choose Fiji, that tells me the GMT offset of Fiji. So, there you have it. That is a very quick way of using an excellent API to get a list of timezones which can be very helpful for adding in a timezone dropdown picker to the registration flow of your Bubble app.
Get the Complete Bundle for Just $99
Access 3 courses, 390+ tutorials, and a vibrant community to support every step of your app-building journey.
Start building with total confidence
No more delays. With 30+ hours of expert content, you’ll have the insights needed to build effectively.
Find every solution in one place
No more searching across platforms for tutorials. Our bundle has everything you need, with 390+ videos covering every feature and technique.
Dive deep into every detail
Get beyond the basics with comprehensive, in-depth courses & no code tutorials that empower you to create a feature-rich, professional app.
Save over 70%!
Valued at $80
Valued at $85
Valued at $30
Valued at $110
Valued at $45
Can't find what you're looking for?
Search our 300+ Bubble tutorial videos. Start learning no code today!
Have questions?
We have answers!
Find answers to common questions about our membership plans, programs, and more.
We're here to help you launch your no code SaaS. Reach out to the team and we'll double check our vast library for useful content. We'll advise you on how we'd tackle the same problem and there's a good chance we'll record the video to help the wider community.
As a Planet No Code member, you'll receive a discount on our Bubble coaching sessions. Monthly members receive a 10% discount, while Annual members receive a 17.5% discount. To redeem your discount, simply log into your account and book a coaching session through our platform.
Our 8-week intensive mentorship program is designed to provide personalized guidance and support to help you accelerate your startup journey. You'll be matched with a startup expert who will work with you one-on-one to set goals, overcome challenges, and make rapid progress.
To apply for the Mastery Program, simply click the "Request Invitation" button on our pricing page and fill out the application form. Our team will review your application and schedule a call with you to discuss your goals and determine if the program is a good fit for your needs.
We accept all major credit cards, including Visa, Mastercard, American Express, and Discover.
While we don't offer a free trial, we do provide a 14-day money-back guarantee. If you're not completely satisfied with your membership within the first 14 days, simply contact our support team, and we'll issue a full refund.