Skip to content

feat(intl): implement Temporal.PlainYearMonth.prototype.toLocaleString#5098

Draft
alienx5499 wants to merge 3 commits intoboa-dev:mainfrom
alienx5499:feat/5083-plainyearmonth-tolocalestring
Draft

feat(intl): implement Temporal.PlainYearMonth.prototype.toLocaleString#5098
alienx5499 wants to merge 3 commits intoboa-dev:mainfrom
alienx5499:feat/5083-plainyearmonth-tolocalestring

Conversation

@alienx5499
Copy link
Contributor

This Pull Request fixes/closes #5083.

It changes the following:

  • Implement Temporal.PlainYearMonth.prototype.toLocaleString per spec, using the shared format_date_time_locale pipeline (same pattern as Date.prototype.toLocaleDateString).
  • Add timestamp_for_first_of_month_utc in date/utils.rs to produce a formatting anchor (first day of month at 00:00:00 UTC) for Intl.DateTimeFormat; no extra JS object allocation on the hot path.
  • Add mod tests and tests for PlainYearMonth.toLocaleString: returns string, invalid receiver throws TypeError, and (with intl feature) different locales and options affect output.

Testing

  • cargo test -p boa_engine --no-default-features --features temporal --lib plain_year_month (Temporal-only tests)
  • cargo test -p boa_engine --features intl_bundled,temporal --lib plain_year_month (with intl)

Draft note: This branch temporarily includes the commits from #5080 so that format_date_time_locale is available. Once #5080 lands, I will rebase onto main and drop those commits so that this PR only contains the Temporal changes for #5083.

@github-actions github-actions bot added Waiting On Review Waiting on reviews from the maintainers C-Tests Issues and PRs related to the tests. C-Builtins PRs and Issues related to builtins/intrinsics C-Intl Changes related to the `Intl` implementation and removed Waiting On Review Waiting on reviews from the maintainers labels Mar 15, 2026
@github-actions github-actions bot added this to the v1.0.0 milestone Mar 15, 2026
@github-actions
Copy link

Test262 conformance changes

Test result main count PR count difference
Total 52,963 52,963 0
Passed 50,070 50,077 +7
Ignored 2,072 2,072 0
Failed 821 814 -7
Panics 0 0 0
Conformance 94.54% 94.55% +0.01%
Fixed tests (7):
test/intl402/Date/prototype/this-value-invalid-date.js (previously Failed)
test/intl402/Date/prototype/this-value-non-date.js (previously Failed)
test/intl402/Date/prototype/taint-Intl-DateTimeFormat.js (previously Failed)
test/intl402/Date/prototype/throws-same-exceptions-as-DateTimeFormat.js (previously Failed)
test/intl402/Date/prototype/toLocaleString/default-options-object-prototype.js (previously Failed)
test/intl402/Temporal/PlainYearMonth/prototype/toLocaleString/datestyle-and-timestyle.js (previously Failed)
test/staging/sm/misc/builtin-methods-reject-null-undefined-this.js (previously Failed)

Tested main commit: 3016f492d02a06033e11269fdcef603d293222c4
Tested PR commit: f11323db956ef61c8fa7a7d6bdba3b367ef1823e
Compare commits: 3016f49...f11323d

@codecov
Copy link

codecov bot commented Mar 15, 2026

Codecov Report

❌ Patch coverage is 95.45455% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.21%. Comparing base (6ddc2b4) to head (f11323d).
⚠️ Report is 855 commits behind head on main.

Files with missing lines Patch % Lines
...e/engine/src/builtins/intl/date_time_format/mod.rs 94.64% 3 Missing ⚠️
core/engine/src/builtins/date/mod.rs 94.87% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #5098       +/-   ##
===========================================
+ Coverage   47.24%   59.21%   +11.97%     
===========================================
  Files         476      563       +87     
  Lines       46892    62749    +15857     
===========================================
+ Hits        22154    37159    +15005     
- Misses      24738    25590      +852     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-Builtins PRs and Issues related to builtins/intrinsics C-Intl Changes related to the `Intl` implementation C-Tests Issues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Temporal.PlainYearMonth.prototype.toLocaleString

1 participant