Our situation is different than most. There isn’t a risk of cheating. Being fast or slow doesn’t help someone. But, what we (and our users) want is everyone’s time to be the same so that we can prompt all of them with things at the same time.
So, we’ll try something like this out fairly soon. And, will let everyone know how well it works for us.
That’s entirely doable. Time is always difficult to deal with, so it’s not particularly easy though.
You’ll want to store each user’s timezone (if you’re running the query when they’re not active on the site). If they’re active on the site at that moment then you can grab their timezone in real-time.
Then, when you run the query set it to grab the data sets that were created, or edited within the corresponding 24 hour time period (or whatever logic you need). If you need help translating the timezones from the user to UTC (which is how Bubble stores it I believe), @kramwe created a public block on blockspring that does just this. We do that same in our application and it works great.
@kramwe, could you post a link to original post where you explain how other people can use the timezone block you created?
Here’s my understanding of how bubble handles time:
Say a user does an action on your site, you store the current_date/time field as date, the database will display this value in your timezone.
If instead, you store the current_date/time as a text field, then the database time will be a timestamp of the users time in their timezone.
In both of the above cases, the current_date/time is taken from the user’s computer which is hopefully right (hence much of the above discussion).
Some other points:
3. In the event you want to store a date and time say from a date picker calendar, the assumed timezone is the user’s timezone.
4. If the assumed timezone isn’t how you want the data stored, then save yourself $40/mo and use the open blockspring timezone converter I created and use to choose a timezone to go with the date picked.
@mishav, do you know how this could work / integrate with Bubble?
Update for the community: we’ve found that at least 2% of our users times are materially wrong (i.e., >5 mins off). Some seem to be in a different timezone (so off by hours) and other are off 5-10 mins. Haven’t seen one yet that’s 15-59 mins off. Your mileage may vary, but wanted to put this data point out there so people have at least some data to work with when making decisions about how to handle all of this.
You’re suggesting to use socket.io to send the server time to the user’s computer?
I’d like to explore this further. We’re finding that for ~5% of users that their computer time is not reliable (off by >5mins - set in a completely different timezone).
Does bubble support socket.io? Any idea how you’d integrate it?
It would help if you outline what you are going to do with the server time …
Sockets would be sending to javascript on the browser, from a dedicated non-Bubble server; probably too complex an option for what you’re looking for.
One easy solution is to retrieve a database thing’s Modified Date.
Another easy solution is to make an API call to your own app, and have an API workflow endpoint return the current date/time, which will be set by the server.
Wherever you get the date from, take care how you present it to the user; if you rely on the default Bubble formatting, it will use the Browser’s timezone etc. You can specify what you want by using :formatted as options.