Forum Documentation Showcase Pricing Learn more

When Bubble Saves A Date, Is The TimeZone Of The User/Date Collected and Saved?

When Bubble Saves A Date, Is The TimeZone Of The User/Date Collected and Saved?

I’m trying to determine the time zone ID of the user who saved the date as a unix time stamp, but perhaps i’m not understanding yet how bubble saves dates and times.

When I manipulate the date after the fact, i’m trying to set the manipulation time zone ID relative to some fixed value so that it’s not all wrong when displayed to the user.

Dates are times. They describe a unique moment in time. Time zones only relate to “how does this date look to me if I’m in [certain location] at that time?”

Now… further to this: How do we know what Timezone ID a date was created in? We generally can’t, unless we capture that at date creation time.

You’d think you could get this from Bubble’s copious date manipulation functions, but you cannot.

That’s one reason for my (free) Browser Locale and Timezone plug-in. Using this, you can know the browser Timezone ID.

My commercial plugin, Calendar Grid Pro, is a datepicker that incorporates the same feature (and much more)…

1 Like

One of the hurdles I’m facing is I’m sending a date/time for a booking system from a mobile application, and I get wierd things happening based on the device timezone setting and I’m not sure how do ‘fix’ the time to a known time zone.

i.e. I have a departure locale and a destination local with those timezones saved in the database.

But then I have a user who is travelling all over the place using their mobile device from different timezones creating dates in the database that are supposed to relate to the date at the departure airport location.

No matter where they are in the world, the departure time/date should always look the same:

Here’s an example:

A few minutes ago, I created this output from a mobile device in EST timezone:

Current device time:

Aug 15, 2019 12:19 am

1565828380440

Using a date picker, I selected the following date: August 15th 06:30 am

Aug 15, 2019 10:30 am

1565865000000

Then a few minutes later, I changed my mobile device to PST timezone:

Current time:

Aug 15, 2019 12:23 am

1565828582674

Using a date picker, I selected the following date: August 15th 06:30 am

Date of travel:

Aug 15, 2019 1:30 pm

1565875800000

Is there a way to use the current time (which seems to be unix time regardless of locale based on the output above) and backtrack to figure out the timezone of the users device?

Or am I totally lost with how to preserve a date/time? To my understanding I need a way to figure out the timezone at which the date/time was constructed in the first place.

I will then need to add travel time to the date to create an arrival time (which could also be in a different timezone :cry:)