This retrieves the entire user object, which includes timeZone property. However, it is unclear if this property is actually retrieved from the Atlassian ID account preference, or if this is the system timezone.
The reason why this is unclear is because apparently there is also a User Management API which I assume actually holds the most up-to-date information of the Atlassian ID account information, including locale and timezone.
The documentation says you can generate an API key for it, I was assuming that would work? I mean, I’d rather do it within the context of the Connect app, but if this is the right API to get timezone information, I can add the API key to my environment variables.
Oh shit, is that API only available to the current user, even though it asks for account ID? What is the point of having an API key for that user, and asking to provide an account ID in the path?
Oh well… ok, that won’t work. Let’s hope that the Jira.User timeZone property is accurate
This retrieves the entire user object, which includes timeZone property. However, it is unclear if this property is actually retrieved from the Atlassian ID account preference, or if this is the system timezone.
Is there a preference from Atlassian with regard to which API we should use, and which API is the most up-to-date?
I don’t think there is a preference per se, but as @danielwester inferred, apps will probably want to call GET /rest/api/3/user. My test was manual, but the time zone preference was updated quickly.
It seems, when call is made from Connect app, it returns system time zone unless user has set time zone privacy setting to “Anyone”.
Is there any way to work around this for use cases when actual time zone information is critical for end user experience?
We have found only the frontend method on the AP.user API: User. It obviously wont work in all use cases - ie backend processing only or something - but if your requests are all coming from your own frontend - then it does work well.
Reliably gets correct timezone (actually it completely ignores user privacy setting)>
Please be aware that this field is under profile visibility controls and that a user may intend to hide this field from the public. Because this API will provide unrestricted access to the current user’s timezone you should only use this API to establish context for the user. You should not present the user’s timezone in a way that can be seen by other users viewing the application.