Timezone issue between supabase and weweb

Hi everyone!

I have an issue with the timezone while I bind data from supabase on weweb.

Here is the data I get from the form that I submit to supabase :

(6:00 am to 07:30am)

And the result I get when I bind the data in my item card is 08:00 am to 09:30am.
It seems like weweb automatically add +2hours.

Do you know a solution to display the corresponding hour depending the browser timezone of the user ?

For info, my data flow is : form up weweb with start date+time and end date+time in weweb that create a record on supabase from which I bind the data in my card.

Thank you so much!
Thomas

Don’t use the Supabase timestamp() automatic function on your columns. Always use weweb’s now() or something similar from the Date Plugin. You can manipulate time zones there, and everything.
So basically my suggestion is, use frontend made time (WeWeb), not backend made time (Supabase), as the server in Supabase might not be in the same time zone I think?

Your time zone is, I bet CEST. That’s 2 hours ahead of GMT. WHen you look at that 6:00 to 7:30, note the +00 at the end - that means the time in supabase is stored in GMT. I bet you’re submitting something like “6:00 am” and then supabase is translating that naively as if you meant 6am in Greenwich, England, rather than where you are.

Reasonable approaches are make sure the form you send is time zone aware, or you do a manipulation on the backend to insert the timestamp. The former is the best solution, because the browser is aware of the user’s time zone so you don’t have to worry about conventions, user data entry or anything like that. This client-side trick is how, say, Google Calendar knows to update times for your meetings when you travel east-west.

If the data in supabase is “true”, everything else becomes easier. The most straightforward test fo whatever solution you apply is to look at the database view after you implement a change you want to try. You want the data in supabase to show either 6:00:00+0200, or 4:00:00+00. These mean the same thing.

Time zones blow up everyone! This can feel frustrating, so patience carries the day. Take your time (har), and let us know how it works out for you!

1 Like

Thanks a lot for your answer!

Even if I understand the need to input the timezone directly in the weweb form, I struggle to understand how to figure it out in practice.

I don’t know how to input the timezone in my start date + start time concatenation

My first idea was to put at the end of the concatenation a formula to calculate and input the browser timezone, but unfortunately I tried a lot of things from the date plugin but I miss some logic basics.

Thanks again for your time, and yes time zones just burnt my brain :sweat_smile:

Hi, you can convert your date to include the timezone you want.

Instead of getBrowserTimezone() you can also specify a defined timezone as a string so the same timezone is enforced for everyone even if they are not in the same one.

2 Likes