Forum Academy Marketplace Showcase Pricing Features

Saving a future date - does bubble/Javascript account for Daylight savings changes?

I’m building a web app which deals with managing bookings, across different countries. I’ve got Google Timezones API connected to get all the UTC offsets and daylight savings adjustments. The way the app works is:

  • User selects in a time picker the date & time of the event. Also they specify a geographic location in an input field.
  • When the event is saved, the adjustments are made to account for any difference between the current computer timezone and the timezone of the future event’s location. Eg ‘save this event as 9am local time to the event’s address on 11th november’
  • when a user opens up a previously made event, the time pickers take the database value and do the reverse of the above, so that is shows 9am 11th Nov correctly on their screen

This works really well, except for daylight savings. Can someone help me understand how daylight savings works based on this example:

  • the current date is 28th October 2021 and currently the UK is in daylight savings (BST)
  • I create and save an event based in the UK for November 11th 9am (when the UK will not be in daylight savings, and hence be in GMT)
  • Up till now I have believed that when i save 11th November 9am to the database, Bubble will save 11th November 9am BST to the database (BST doesn’t exist on 11th November, but that is my current computer’s timezone), and hence I will have to manually make the 1hr adjustment when i save the time to my database. But is this an incorrect assumption? Does the daylight saving adjustment automatically happen and is this the case for all countries with daylight savings?

I’ve been doing some tests and it looks like i’ve been over complicating things… and now i’m thinking i dont need to account for daylight savings manually myself?

Thanks
Ryan

Thanks for posting! Daylight savings should be automatically accounted for with the Google Timezones API.

This topic was automatically closed after 70 days. New replies are no longer allowed.