Is it possible that an action is missing to tell Bubble server side in which time zone it should run a ‘API Workflow’ according to the time zone of the current user or current wanted time zone?
For example, Bubble uses UTC to save all dates, its server is in the time zone (PST) and the user is in New York (EST). If the user save a date at 8h56am, UTC is 12h56pm and at Bubble server it is 5h56am. When making server-side date calculation, it’s all done on PST area for a user in EST area.
What am I missing? Believe me, I tried hard to understand the situation.
I have the same question, at least I think I do. Permit me to give another concrete example, @JohnMark. Let me know if you think it is a different situation/question to yours and I’ll create a separate ticket.
In my case, in an API workflow, I want to schedule an email to be sent 3 working days from the current date, at 09:15 Eastern Time. How can I schedule this? I have got some JS to calculate 3 working days from a given date so now I just need to pass a date/time to that JS and the date should be today at 09:15 Eatern (i.e. current date/time with the time adjusted to 09:15 ET). I can’t see how to do this. I suppose that if I know the server timezone for definite then instead of 09:15 ET I could just send the equivalent time in the server’s timezone, but a) I’m not certain what the server timezone is and b) it seems inelegant and somewhat risky. What if the server is changed to a different location in future?
It is relatively easy to discover the server’s time zone, performing an action with the time, and update it in a variable. I created a time zone table which then does the conversion. One of my challenges is when I call another ‘Workflow API’ inside a ‘Workflow API’. He’s completely losing track of who it came from. I’m going to get back to work on this case. I still think it is missing a single action Timezone.
Yes, the current server time one is can be determined. The challenge for me was how to dynamically determine not just the server time but its offset from the ET timezone and then use that offset to calculate a date/time to schedule my workflow (3 business days in the future)- all from the server.
I ended up saving a control time in UTC to the database (4:15 pm) and then using change_to date mutators to achieve this.
I agree that it would be far easier if @Bubble would include the ability to specify a timezone when scheduling a workflow. While they’re at it, a ‘+(working days):’ function would be a nice addition too. I guess we would then get into the question of what are working days - Mon-Fri / Sun-Thu? What about national holidays. It’s a locale thing. I think a standard Mon to Fri one would be better than nothing though.