@Jeff_Hager I haven’t copied back and check, are you using the “medium” format to calculate the dates. I don’t know if changing to “short” solves all problems.
@ThinhDinh I’m using the short format for the values used in the calculation base on your recommendation. I’m not sure yet how to reproduce this. I started to change the region and time settings on my computer, but it may require a restart. I’ll try to take a look and figure out what’s going on.
@phong_tran just to make sure, have you refreshed the app to make sure you have the latest changes?
I just went to the link you sent and now the difference is -17
As of tonight, this broke. When the clocks changed something happened, and the North American date format no longer works. I have users in Europe who are fine (their format is 7, November, 2021 00:00).
I have an app that has relied on this code for 6 months and the app is suddenly useless. @Mark I know you don’t officially support this method, but is there any way to give us what we had before the times changed tonight? Having a way to get UTC is critical to the functioning of a community app that allows members to schedule worldwide. Is there any solution here? 400 users basically without an app in an instant.
@John_Cabrera are you using the latest version of the math formula?
We uncovered an edge case about a month ago that caused it to fail around the end of each month.
Although your issue sounds like it’s different (related to a switch to daylight savings time?), it’s probably worth checking that you have the correct formula.
Update: Actually, @John_Cabrera I just realised that we do have another option now with the new Format Date plugin. All you need to do is pass that the users time with the
Z format parameter, and it’ll return the users UTC offset.
Yeah, like @Darren_Murphy mentioned, I would give the new plugin a shot over my method. I haven’t tested it yet, but hopefully it works better.
Out of curiosity though, what exactly broke? I checked may app and my Offset value did update from -5 to -6 like I expected.
I just replaced your method with the plugin method in 4 of my apps, and it seems to work perfectly
@Jeff_Hager looks like I spoke too soon. The Format Date option appears to have stopped working
Does it work for you? (I’m willing to bet that it does… but not my whole house )
I am not Jeff but it is working for me. @Darren_Murphy
Yep, that’s what I expected.
Haha I will check later but I have switched to the American formatting awhile ago so didn’t notice this when I first tried the column…
Hasn’t worked for me since we spoke last about it!
Can confirm, it’s not working if I change the browser language to Vietnamese.
I’ve pretty much given up on a solution to this. Seems so simple. I just want to convert all user timestamped events into UTC so that I can sort entities like comments (not built in but my own creation) chronologically in apps where my users are globally distributed. How can it be such a pain?
I’m currently using a variation of this.
The only change I made was to negate the return value, as I’m converting from UTC to local time, so I need the local offset rather than the UTC offset. (If you read the docs for getTimezoneOffset, you’ll see it returns the difference between UTC and local - so it gives the UTC offset from local time, as opposed to the local offset from UTC time)
So I’m using:
return -(new Date().getTimezoneOffset())/60
I think that’s probably going to be the most reliable solution for now.
Will take a look for sure - cheers @Darren_Murphy