Any way you could allow “Extracting a component from the date” to be relative to a dynamic time zone instead of current user’s timezone?
Thanks
Any way you could allow “Extracting a component from the date” to be relative to a dynamic time zone instead of current user’s timezone?
Thanks
With the exception of the day-of-week index, you can actually do this already. The date :formatted as… operator (with the addition of :converted to number) gives us everything we need.
I built a little explainer for this. See runtime here:
And here’s the editor (just look at the text element to see how you build the expressions):
I built this just using UTC as the static timezone for the “other” zone, but of course all of this can use dynamic timezone.
Hope this helps! (For more on dates and date formatting, see http://forum.bubble.io/t/live-bubbling-with-keith-lets-talk-about-dates-explaining-the-basics-of-dates-in-bubble/64195.)
Hey Keith. Thanks for your reply. I actually do need it for day-of-week index.
My clients want to be able to define their own weekendDefinition but they move around timezones when using my app. I can handle everything with dynamic timezones, except for dayOfWeek.
You can build a little translator to do this via Option Sets. (In ye olden days, you’d have to create some objects in your database to do this, but it’s more performant to do it in the page with option sets.)
I updated my sample project. Here’s an Option Set I’ve created that maps day of week (DOW) names to various indices:
And an individual DOW looks like this:
And so, now, referring to this Option Set returns to us the list of all DOW objects (but we didn’t have to fetch those from the database, though we could have just built an object that’s identical called “DOW” in our database and done “Search for DOWs”). And then we can :filter that list to just give us 1 item (we match the Option to be the Option whose Short Name is the date :formatted as ‘ddd’ (this yields us Mon, Tue, Wed, etc.).
And then we we can get that day of week’s index by referring to the index field we are interested in:
Building expressions like this is annoying as the expression itself (once complete) obscures what’s going on inside and so you have to click into it to understand. It’s like this… here’s the filter:
And then within that, the date formatting:
But I bet you get the idea now.
Awesome, I can make it work that way
Thanks Keith.