Skip to content

[JSC] Fix Compatibility Issues with timezone in Intl.DateTimeFormat#47959

Merged
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
Gumichocopengin8:eng/JSC-Fix-Compatibility-Issues-with-timezone-in-Intl-DateTimeFormat
Jul 18, 2025
Merged

[JSC] Fix Compatibility Issues with timezone in Intl.DateTimeFormat#47959
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
Gumichocopengin8:eng/JSC-Fix-Compatibility-Issues-with-timezone-in-Intl-DateTimeFormat

Conversation

@Gumichocopengin8
Copy link
Copy Markdown
Member

@Gumichocopengin8 Gumichocopengin8 commented Jul 13, 2025

1110ee1

[JSC] Fix Compatibility Issues with `timezone` in `Intl.DateTimeFormat`
https://bugs.webkit.org/show_bug.cgi?id=295856

Reviewed by Darin Adler.

The Intl.DateTimeFormat constructor [1] did not align with the current TC39 specification
regarding the handling of the timeZone option.
This patch implements GetAvailableNamedTimeZoneIdentifier [2] to bring the behavior
in line with the latest TC39 spec.

[1]: https://tc39.es/ecma402/#sec-createdatetimeformat
[2]: https://tc39.es/ecma402/#sec-getavailablenamedtimezoneidentifier

* JSTests/stress/intl-canonical-gmt.js:
* JSTests/stress/intl-datetimeformat.js:
* JSTests/test262/expectations.yaml:
* Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp:
(JSC::availableNamedTimeZoneIdentifier):
(JSC::IntlDateTimeFormat::initializeDateTimeFormat):
(JSC::canonicalizeTimeZoneName): Deleted.

Canonical link: https://commits.webkit.org/297594@main

6fd28e3

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🛠 wpe-cairo
✅ 🛠 🧪 jsc ✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 🧪 jsc-arm64 ✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2 🛠 playstation
✅ 🛠 tv ✅ 🛠 mac-safer-cpp ✅ 🛠 jsc-armv7
✅ 🛠 tv-sim ✅ 🧪 jsc-armv7-tests
✅ 🛠 watch
✅ 🛠 watch-sim

@Gumichocopengin8 Gumichocopengin8 requested a review from a team as a code owner July 13, 2025 18:14
@Gumichocopengin8 Gumichocopengin8 self-assigned this Jul 13, 2025
@Gumichocopengin8 Gumichocopengin8 added the JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues. label Jul 13, 2025
@Gumichocopengin8 Gumichocopengin8 force-pushed the eng/JSC-Fix-Compatibility-Issues-with-timezone-in-Intl-DateTimeFormat branch from 6bc1eb3 to ccb1d28 Compare July 13, 2025 18:52
@Gumichocopengin8 Gumichocopengin8 force-pushed the eng/JSC-Fix-Compatibility-Issues-with-timezone-in-Intl-DateTimeFormat branch from ccb1d28 to 79db17d Compare July 13, 2025 18:56
Comment thread Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp Outdated
@Gumichocopengin8 Gumichocopengin8 force-pushed the eng/JSC-Fix-Compatibility-Issues-with-timezone-in-Intl-DateTimeFormat branch from 79db17d to a72496e Compare July 16, 2025 01:51
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WebKit coding style reserves “get” for only certain kinds of function names, so even though the standard calls this GetAvailableNamedTimeZoneIdentifier we should probably name this availableNamedTimeZoneIdentifier.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment thread JSTests/stress/intl-datetimeformat.js Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is no longer accurate. We should consider changing it. I’m also not sure we need all these tests if we’re just testing that the same string comes back to us. I wonder what this means about capitalization, like does “australia/darwin” work?

Copy link
Copy Markdown
Member Author

@Gumichocopengin8 Gumichocopengin8 Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the comment.
I think these test cases are useful to make sure timezones are preserved and not canonicalized.

I wonder what this means about capitalization, like does “australia/darwin” work?

That's covered here

// Time zone is case insensitive.
shouldBe(Intl.DateTimeFormat('en', { timeZone: 'america/denver' }).resolvedOptions().timeZone, 'America/Denver');
shouldBe(Intl.DateTimeFormat('en', { timeZone: 'AMERICA/LOS_ANGELES' }).resolvedOptions().timeZone, 'America/Los_Angeles');

@Gumichocopengin8 Gumichocopengin8 force-pushed the eng/JSC-Fix-Compatibility-Issues-with-timezone-in-Intl-DateTimeFormat branch from a72496e to 6fd28e3 Compare July 16, 2025 22:36
@Gumichocopengin8
Copy link
Copy Markdown
Member Author

Would you mind adding the merge-queue label? I don't have the persimmon to do so.

@mcatanzaro mcatanzaro added the merge-queue Applied to send a pull request to merge-queue label Jul 18, 2025
https://bugs.webkit.org/show_bug.cgi?id=295856

Reviewed by Darin Adler.

The Intl.DateTimeFormat constructor [1] did not align with the current TC39 specification
regarding the handling of the timeZone option.
This patch implements GetAvailableNamedTimeZoneIdentifier [2] to bring the behavior
in line with the latest TC39 spec.

[1]: https://tc39.es/ecma402/#sec-createdatetimeformat
[2]: https://tc39.es/ecma402/#sec-getavailablenamedtimezoneidentifier

* JSTests/stress/intl-canonical-gmt.js:
* JSTests/stress/intl-datetimeformat.js:
* JSTests/test262/expectations.yaml:
* Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp:
(JSC::availableNamedTimeZoneIdentifier):
(JSC::IntlDateTimeFormat::initializeDateTimeFormat):
(JSC::canonicalizeTimeZoneName): Deleted.

Canonical link: https://commits.webkit.org/297594@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/JSC-Fix-Compatibility-Issues-with-timezone-in-Intl-DateTimeFormat branch from 6fd28e3 to 1110ee1 Compare July 18, 2025 15:15
@webkit-commit-queue
Copy link
Copy Markdown
Collaborator

Committed 297594@main (1110ee1): https://commits.webkit.org/297594@main

Reviewed commits have been landed. Closing PR #47959 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 1110ee1 into WebKit:main Jul 18, 2025
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Jul 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants