Skip to content

Conversation

@catamorphism
Copy link
Contributor

@catamorphism catamorphism commented Dec 9, 2025

bd18128

[Temporal] Implement comparison methods for PlainYearMonth
https://bugs.webkit.org/show_bug.cgi?id=303799

Reviewed by Sosuke Suzuki.

Co-authored-by: SUZUKI Sosuke <aosukeke@gmail.com>

Implement `compare`, `equals`, and `valueOf`.
* JSTests/stress/temporal-plainyearmonth.js:
(shouldBe):
(shouldThrow):
* JSTests/test262/config.yaml:
* Source/JavaScriptCore/runtime/TemporalPlainYearMonthConstructor.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/TemporalPlainYearMonthPrototype.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):

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

97b1f6d

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 ✅ 🧪 api-mac-debug ✅ 🛠 wpe-cairo-libwebrtc
✅ 🛠 🧪 jsc 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 🧪 jsc-arm64 ✅ 🛠 vision ✅ 🧪 mac-wk2 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🧪 vision-wk2 ✅ 🧪 mac-wk2-stress 🛠 playstation
✅ 🛠 tv ✅ 🧪 mac-intel-wk2 ✅ 🛠 jsc-armv7
✅ 🛠 tv-sim ✅ 🛠 mac-safer-cpp ✅ 🧪 jsc-armv7-tests
✅ 🛠 watch
✅ 🛠 watch-sim

@catamorphism catamorphism requested a review from a team as a code owner December 9, 2025 02:45
@catamorphism catamorphism self-assigned this Dec 9, 2025
@catamorphism catamorphism added the JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues. label Dec 9, 2025
if (yearMonth->plainYearMonth() != other->plainYearMonth())
return JSValue::encode(jsBoolean(false));

return JSValue::encode(jsBoolean(true));
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we compare calendar here like for PlainDate#equals ?

Copy link
Contributor

Choose a reason for hiding this comment

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

On the one hand yes, on the other hand having different calendar values is currently not implemented...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PlainYearMonth doesn't have a calendar field yet, because as Philip mentioned, different calendars aren't implemented yet.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I know that different calendar is not implemented. However, I thought that if it would be needed in the future, it might as well be implemented in this PR for consistency with PlainDate#equals.

But I think this is a minor issue and will eventually be implemented and tested, so it is acceptable for me

@catamorphism catamorphism force-pushed the plainmonthday-plainyearmonth-part-11 branch from 962b9d5 to 97b1f6d Compare December 9, 2025 20:37
Copy link
Contributor

@sosukesuzuki sosukesuzuki left a comment

Choose a reason for hiding this comment

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

r=me

@catamorphism catamorphism added the request-merge-queue Request a pull request to be added to merge-queue once ready label Dec 10, 2025
@ptomato ptomato added merge-queue Applied to send a pull request to merge-queue and removed request-merge-queue Request a pull request to be added to merge-queue once ready labels Dec 10, 2025
https://bugs.webkit.org/show_bug.cgi?id=303799

Reviewed by Sosuke Suzuki.

Co-authored-by: SUZUKI Sosuke <aosukeke@gmail.com>

Implement `compare`, `equals`, and `valueOf`.
* JSTests/stress/temporal-plainyearmonth.js:
(shouldBe):
(shouldThrow):
* JSTests/test262/config.yaml:
* Source/JavaScriptCore/runtime/TemporalPlainYearMonthConstructor.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/TemporalPlainYearMonthPrototype.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):

Canonical link: https://commits.webkit.org/304196@main
@webkit-commit-queue webkit-commit-queue force-pushed the plainmonthday-plainyearmonth-part-11 branch from 97b1f6d to bd18128 Compare December 10, 2025 02:35
@webkit-commit-queue
Copy link
Collaborator

Committed 304196@main (bd18128): https://commits.webkit.org/304196@main

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

@webkit-commit-queue webkit-commit-queue merged commit bd18128 into WebKit:main Dec 10, 2025
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Dec 10, 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