Closed Bug 1856428 Opened 8 months ago Closed 8 months ago

Intl.DateTimeFormat().resolvedOptions().timeZone invalid/changed in MacOS Sonoma

Categories

(Core :: Internationalization, defect)

Firefox 118
defect

Tracking

()

VERIFIED FIXED
120 Branch
Tracking Status
firefox-esr115 --- verified
firefox118 --- wontfix
firefox119 --- verified
firefox120 --- verified

People

(Reporter: aeggum12, Assigned: m_kato)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 1 obsolete file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/118.0

Steps to reproduce:

After upgrading to MacOS Sonoma, running Intl.DateTimeFormat().resolvedOptions().timeZone is returning "Etc/GMT+5". Prior to upgrading, it had been returning "America/Chicago", "America/Bogota", etc.

There is a similar issue reported to Chrome, where it is returning undefined [1]. Perhaps something changed with the MacOS Sonoma release causing timeZone to break? This same snippet works as expected in Safari.

[1] - https://support.google.com/chrome/thread/231926653/timezone-return-undefined?hl=en

Steps:
1 - open dev tools console
2 - Intl.DateTimeFormat().resolvedOptions().timeZone

Actual results:

Etc/GMT+5

Expected results:

America/Bogota

The Bugbug bot thinks this bug should belong to the 'Core::Widget: Cocoa' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Widget: Cocoa
Product: Firefox → Core
Blocks: 1837285
Severity: -- → S3
Priority: -- → P3
Status: UNCONFIRMED → NEW
Component: Widget: Cocoa → Internationalization
Ever confirmed: true

The component has been changed since the backlog priority was decided, so we're resetting it.
For more information, please visit BugBot documentation.

Priority: P3 → --

Seems like we're using uprv_tzname to detect the system timezone: https://searchfox.org/mozilla-central/rev/630d2c45fc127a44756e3cca8cef51c35654a4b4/intl/icu/source/common/putil.cpp#1112
In the forest of ifdefs I haven't been able to find how we detect the timezone on macOS.

NSTimeZone.systemTimeZone seems like the recommended way to get this information on macOS.

(In reply to Markus Stange [:mstange] from comment #4)

Seems like we're using uprv_tzname to detect the system timezone: https://searchfox.org/mozilla-central/rev/630d2c45fc127a44756e3cca8cef51c35654a4b4/intl/icu/source/common/putil.cpp#1112
In the forest of ifdefs I haven't been able to find how we detect the timezone on macOS.

Unless the TZ environment variable is set, the time zone is determined through this realpath call, which reads the target of the link file "/etc/localtime".

Maybe this is similar to bug 1848615, and the time zone files are now in a directory which can't be read because of the content sandbox? Does it work correctly when MOZ_DISABLE_CONTENT_SANDBOX=1 is used?

Duplicate of this bug: 1856393

Btw, Etc/GMT+5 is likely being returned from this fallback. This code path is taken when no alternative time zone can be determined by ICU, cf. remapShortTimeZone, which can map time zone offsets to alternative target like Europe/Athens (see also bug 1856393).

Impact of this bug is also affecting Thunderbird in Calendar

To save you all some debugging time: https://unicode-org.atlassian.net/browse/ICU-22541

Duplicate of this bug: 1854814
Assignee: nobody → m_kato
Status: NEW → ASSIGNED
Pushed by m_kato@ga2.so-net.ne.jp:
https://hg.mozilla.org/integration/autoland/rev/91657cb1296c
MacOS Sonoma doesn't return correct timezone. r=anba
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 120 Branch

Comment on attachment 9358461 [details]
Bug 1856428 - MacOS Sonoma doesn't return correct timezone. r=anba

Beta/Release Uplift Approval Request

  • User impact if declined: When user upgrades macOS to 14, Intl.DateTimeFormat() returns different timezone string.
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: See https://bugzilla.mozilla.org/show_bug.cgi?id=1856428#c0
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): If timezone directory is different, use new path.
  • String changes made/needed: N/A
  • Is Android affected?: No
Attachment #9358461 - Flags: approval-mozilla-beta?
Flags: qe-verify+
Attached patch For ESR115Splinter Review

Comment on attachment 9358604 [details] [diff] [review]
For ESR115

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: Intl.DateTimeFormat().resolvedOptions().timeZone returns different result if upgrading to macOS 14.
  • User impact if declined: Intl.DateTimeFormat().resolvedOptions().timeZone returns different result if upgrading to macOS 14.
  • Fix Landed on Version: 120
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): If timezone directory is different, use new path.
Attachment #9358604 - Flags: approval-mozilla-esr115?
Attachment #9358461 - Flags: approval-mozilla-esr115?
Attachment #9358461 - Flags: approval-mozilla-esr115?

Comment on attachment 9358461 [details]
Bug 1856428 - MacOS Sonoma doesn't return correct timezone. r=anba

Switching uplift request to release. Fx119 is now in release candidate.

Attachment #9358461 - Flags: approval-mozilla-beta? → approval-mozilla-release?

Comment on attachment 9358461 [details]
Bug 1856428 - MacOS Sonoma doesn't return correct timezone. r=anba

Approved for 119.0 RC1

Attachment #9358461 - Flags: approval-mozilla-release? → approval-mozilla-release+

Comment on attachment 9358604 [details] [diff] [review]
For ESR115

Approved for 115.4esr.

Attachment #9358604 - Flags: approval-mozilla-esr115? → approval-mozilla-esr115+

Even if ASCII, old line segmenter rules aren't compatible with UAX#14.
layout/reftests/line-breaking/markup-src-1.html runs on old segmenter prefs,
so we should use old non-breaking conditions for it with old segmenter.

Also, if word-break is break-all, we might have break opportunity for AL, NU,
IS, and QU combinations. So we should use ICU4X segmenter if break-all.

Depends on D190379

:m_kato could you consider tracking any future changes under a different bug?
This will make it easier for tracking?

Flags: needinfo?(m_kato)
Attachment #9358775 - Attachment is obsolete: true

(In reply to Donal Meehan [:dmeehan] from comment #23)

:m_kato could you consider tracking any future changes under a different bug?
This will make it easier for tracking?

this is mistake. Thanks for notification.

Flags: needinfo?(m_kato)
QA Whiteboard: [qa-triaged]

Reproduced the issue with Firefox 120.0a1 (2023-10-02) on macOS 14 Sonoma ARM by setting the Date & Time > Closest city to Bogota - Colombia and following the steps from comment 0. The result was Etc/GMT+5.
The issue is verified fixed on macOS 14 Sonoma Arm and Intel with Firefox 120.0a1 (2023-10-16), 119.0RC1 and 115.4esr. Having the time set to Bogota - Colombia will correctly display America/Bogota in the console after following the steps from comment 0. Also having the time set to Helsinki - Finland will correctly display Europe/Helsinki in the console as stated in bug 1856393#c0. Tested on macOS 12 Intel on all versions and the same results are displayed.

Status: RESOLVED → VERIFIED
Has STR: --- → yes
QA Whiteboard: [qa-triaged]
Flags: qe-verify+
Duplicate of this bug: 1860456
See Also: → 1803564
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: