šŸ•’ System/GMT Time - Solved!

I access by computer

And also on my android phone

@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?

image

1 Like

I just went to the link you sent and now the difference is -17

1 Like

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. :disappointed:

1 Like

@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.

4 Likes

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.

1 Like

I just replaced your method with the plugin method in 4 of my apps, and it seems to work perfectly :slight_smile:

2 Likes

@Jeff_Hager looks like I spoke too soon. The Format Date option appears to have stopped working :roll_eyes:

Screen Shot 2021-11-13 at 12.36.55 AM

Does it work for you? (Iā€™m willing to bet that it doesā€¦ but not my whole house :smiley: )

I am not Jeff but it is working for me. @Darren_Murphy

1 Like

Yep, thatā€™s what I expected.

Iā€™d also be willing to bet that it probably doesnā€™t work for @ThinhDinh. Or for @V88 either :wink:

1 Like

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ā€¦

1 Like

Hasnā€™t worked for me since we spoke last about it!

1 Like

Can confirm, itā€™s not working if I change the browser language to Vietnamese.

1 Like

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.

3 Likes

Will take a look for sure - cheers @Darren_Murphy

image

2 Likes