As I’ve mentioned before… Dates and time zones are one of the most confusing and complicated things in all of web development… and lots of people get this wrong (it’s one of the most common causes of errors in apps that I have to fix).
For a booking app like this, when you display a date in Bubble, you should format it however you want it to be displayed and select UTC as the timezone.
Basically, you store all dates in UTC and also display all dates in UTC (so local time doesn’t come into it).
It’s more complicated than that though… here a a few things to consider…
When defining a date, it should be defined in UTC time.
If using the Bubble data picker for this, it’s simple - just set UTC as the timezone.
Assuming no Time is set in the date picker, any date selected will default to 00:00 (UTC) on the selected date.
Then just ensure you always use UTC through the app whenever manipulating that date, using it for search, or displaying it.
If you’re doing something like ‘current Date time: rounded down to Day’ its more complicate though, and easy to get wrong.
It’s tempting to think you can just use Current Date; rounded to Day (in UTC), but this is NOT correct, and will cause errors.
i.e. as of typing this reply, the Current Date in UTC is 10:15am 10th October
However, The current Date/time in The Baker Islands (GMT-12) is 10:15pm 9th October.
That means that a User there, who used current date/time: rounded to Day (in UTC) would have the Date set as 00:00 10th October - which would be incorrect by a whole day (it’s actually 9th October there).
What you actually need to do is round the current Date/Time to Day in the User’s Local Time zone (00:00 9th October) and then convert that to the same date/time in UTC . So the eventual defined Date is 00:00 10th October). This is the bit I see a lot of apps get caught out on, and end up with mismatched dates.
Unfortunately, there is no native way in Bubble to convert a date from one timezone to another (although if you know the UTC offset you can modify it that way)
But it’s easier to use a plugin or some custom code to do the conversion (I usually use Luxon for this).
But in any case, as the Bubble database only has one type of field for storing Dates (which is a timestamp), if you need consistency in Dates/Times (which, for a booking app you do), all dates (at least those relating to bookings) should be defined, stored, and displayed in UTC.
Local time is not relevant, and will lead to errors.