We read the current user’s time zone and locale in a Forge app (Jira Cloud) so that dates match what Jira shows the user. On one account the value we get back is days out of date, and the stale value depends on which path we use to read it. Sharing the measurements in case someone has seen this or knows which source is meant to be authoritative.
Setup
- Forge resolver, nodejs24.x runtime.
- Path A: api.asUser().requestJira(‘/rest/api/3/myself’) → timeZone, locale
- Path B: api.asApp().requestJira(‘/rest/api/3/user?accountId=’) → timeZone, locale
- Path C: /rest/api/3/myself opened directly in the browser, same session as the Jira tab
History of the affected account
- Oct 5: time zone changed in id.atlassian.com (Account preferences) from America/Cuiaba to Asia/Tokyo, then back to America/Cuiaba about 40 minutes later.
Measurements on Oct 7 (times in America/Cuiaba)
- Before any change: account = America/Cuiaba. Path A = Asia/Tokyo. Path C = America/Cuiaba. (Path B was added that day and not measured before the test.)
- 15:06 account changed to America/Sao_Paulo.
- 15:10 no visible change.
- 15:16 Path B = America/Sao_Paulo. Path A still Asia/Tokyo. Path C still America/Cuiaba.
- 15:18 account changed back to America/Cuiaba.
- 15:22 and 15:29: Path B still America/Sao_Paulo, Path A still Asia/Tokyo, Path C still America/Cuiaba.
So at 15:16 the three paths returned three different zones for the same account at the same time. Path A had not followed any change for two days. Path B picked up the first change within ten minutes, but the change back had not reached it eleven minutes later. Path C did not move during the test, but was at least on a value the account really had.
The locale may be affected too: the app derives the first day of the week from it and showed weeks starting on Monday for this user, which is our fallback when no recognisable locale comes back, while the account is pt_BR (Sunday start, which is also what JQL startOfWeek() used for this user). We did not log the raw locale value, so treat this one as unconfirmed.
On another account, which we moved to Asia/Tokyo and back on Oct 7, Path A and Path C both followed each change within about two minutes, in both directions (Path B was not in place yet). So this is not reproducible on every account.
Questions
- Is there a known cache on the user profile behind /myself for OAuth/asUser calls, and is there a way to force it to refresh?
- Which source is meant to be authoritative for “the zone Jira displays dates in for this user”: /myself, /user?accountId, or the timezone in the Forge context? We have not measured the Forge context value on the affected account yet.
- Should this go to a support ticket or an ECO/FRGE issue instead?
For now we read Path B first and fall back to Path A, and we print the zone in the UI so a wrong value is visible to the user.
Hi @AmarildoPereira,
Partly tracked. ECO-1271, “view.getContext() returns a stale user timezone after Account Preferences changes”, sits in Long Term Backlog and covers the Forge context value from your question 2, though FRGE-2131 reports that same value as the browser zone so it’s a shaky tiebreaker.
No ticket turned up in ECO, FRGE or JRACLOUD for /myself through asUser() lagging. The REST reference and the Forge context docs don’t mention a cache.
The one staff measurement is dmorrow’s in this 2023 thread, where GET /rest/api/3/user picked a preference change up quickly. The reference says that field falls back to the instance default when the caller can’t see the user’s zone.
Not reproduced here.
For question 3, developer support as a bug, citing ECO-1271 with the three-path timeline. Is America/Sao_Paulo your site default by any chance? Path B was never read before the test.
Hi @Mihai_leanzero, thank you. That question lands on the weak spot of my post.
Short answer: I can’t rule it out. The affected instance is a test site whose default time zone was changed several times in earlier tests (Asia/Tokyo, Atlantic/Reykjavik, then America/Cuiaba). America/Cuiaba is the last value we have on record, but nobody wrote the default down on Oct 7.
If it was America/Cuiaba that day, Path B showing America/Sao_Paulo at 15:16 can only have come from the account. If it was America/Sao_Paulo, Path B may have been returning the instance default all along and never followed anything, and the fact that it did not move back after 15:18 fits that reading as well as it fits “lag”. So the asApp half of my title is weaker than I wrote it.
The sentence you point to in the reference, plus the 2023 report in that thread of the system zone coming back unless the profile visibility is “Anyone”, also means Path B depends on the user’s Local time visibility. That makes it a poor primary source whichever reading is right.
What I can do is measure it on an account we control: instance default different from the account zone, toggle Local time visibility, read Path A and Path B before and after. I’ll post the numbers here.
ECO-1271 read, thanks for finding it. Same family (locale updates, timezone stays), different path. After the measurement we’ll take it to developer support with the three-path timeline and that ticket as reference.
Measured, as promised. Short version: on an account we control, Path B does fall back to the instance default once Local time is hidden, and nothing in the response says so.
Setup: one account, two Jira Cloud sites with the same Forge app. Account zone America/Sao_Paulo. Both sites have a fixed GMT-4 instance default. Local time visibility started at “Anyone”, which the account had never changed.
Times in UTC, Oct 12, taken from /rest/api/3/serverInfo on each read.
- Before: Path A and Path B both America/Sao_Paulo.
- Between 11:38 and 11:41: Local time set to “Only you” in the Atlassian account profile.
- About 11:44: Path B still America/Sao_Paulo.
- 11:45:35: Path B = Etc/GMT+4. Path A = America/Sao_Paulo.
- Still Etc/GMT+4 on every read until the change back (11:51, 14:46, 17:21).
- About 17:20: Local time set back to “Anyone”.
- Site 1: Path B still Etc/GMT+4 at 17:21:16, America/Sao_Paulo at 17:22:28.
- Site 2: Path B still Etc/GMT+4 at 17:24:29, America/Sao_Paulo at 17:25:39.
- Path A (asUser /myself) returned America/Sao_Paulo throughout.
What this says:
- The reference sentence holds for Forge asApp. With the zone hidden, /user?accountId returns the instance default as a normal-looking zone name (Etc/GMT+4 here). There is no flag to tell a fallback from a real value.
- asUser /myself is not affected by the visibility setting. That differs from the Connect impersonation report in the 2023 thread.
- The change reaches each site on its own schedule: about 4 to 7 minutes one way, and 2 versus 5 minutes on two sites for the same change the other way.
So neither path is safe alone. A can stay on an old zone for days (my first post), and B silently becomes the site default for anyone who hides Local time. The “read B first” at the end of my first post was wrong, and we have changed it: we use A, and switch to B only when the two disagree and the browser’s current UTC offset matches B and not A. We compare offsets, not names, so America/Cuiaba and Etc/GMT+4 count as the same answer, and we show both readings when they disagree.
That still leaves a gap (A stale and the browser in a third zone), so one authoritative source would be better. Taking it to developer support next, with ECO-1271 as reference.
@Mihai_leanzero this does not settle your question about Oct 7, since that site’s default was never recorded. Your reading is at least as likely as mine.
Hi @AmarildoPereira,
That covers the visibility half. The ticket should probably lead with your first point, a hidden zone coming back as an ordinary zone name with nothing in the response marking it.
The reference sentence says the fallback happens and doesn’t say how a caller detects it. Comparing offsets against the browser is a sensible guard until then. Oct 7 stays open, the default wasn’t recorded.
Thanks, Mihai. Filed with developer support as ECOHELP-174241, leading with the hidden-zone fallback and with the Oct 7 timeline as the second part. I’ll post here if they come back with anything.
Atlassian support answered ECOHELP-174241. Summary, for anyone who lands here:
For the current user, the supported sources are /rest/api/3/myself with asUser() or the timezone in the Forge context. The zone Jira displays is the profile zone even when the profile field is private; the site default applies only when no zone is set.
For other users there is no reliable source: /user and /user/search return the site default when the zone is unset or hidden, and nothing in the response marks it. That is tracked as JRACLOUD-76910 (a Suggestion, open since 2021). They described the fix as large, because the profile service returns an empty zone in both cases.
User time zones are read from a cache, and there is no supported way for an app to refresh it. The Oct 7 case stays unreproduced.
One point I’ve asked them to confirm: they also said ECO-1271 is about view.getContext() returning the browser’s time zone, which would make the context value something other than the profile zone.
Support confirmed the open point: the timezone in view.getContext() comes from the browser, not from the user’s Atlassian preferences. For the current user, /rest/api/3/myself with asUser() is the source to use.