Date Issue (rounding down to day)

I have some workflows that search for specific dates based on a “normalized” date via the “round down to day” function. my assumption was that it would always return the value of that day at midnight. however i’m now realizing that its not guaranteed, particularly if a user travels to a different time zone. Is there a better way to standardize the date values? In this situation I should only ever have one unique item per day.

By default, everything in Bubble is done in the local timezone of the User, so using Rounded down to day always causes inconsistencies with Dates unless you standardise the timezone. (right now it’s Wednesday 23rd October in the UK, but still Tuesday 22nd October in the USA, for example).

Assuming you actually need to use a Date type (and you probably do… although in some cases you can simply store dates as numbers or text), if you’re dealing with Users across multiple TimeZones you need to normalise all dates to a standardised timezone (i.e UTC).

So, Dates should be defined in reference to UTC time, and if using things like Rounded down to Day, this should be done in the User’s local timezone, and then converted to UTC. (Simply rounding the current date/time down to Day in UTC does not work - it needs to be done in the User’s local time, then converted to UTC).

There’s no (simple) way to do this natively in Bubble, so creating a new UTC date object with JavaScript (or using a library like Luxon) is the only way to do it.

But then all dates can be defined/stored/referenced/displayed in relation to UTC time, which ensure consistency throughout the app.