Skip to content

Fix a spec violation in Date.prototype.toLocaleString#5324

Open
Vellumic wants to merge 2 commits intoboa-dev:mainfrom
Vellumic:fix/format-date-time-locale
Open

Fix a spec violation in Date.prototype.toLocaleString#5324
Vellumic wants to merge 2 commits intoboa-dev:mainfrom
Vellumic:fix/format-date-time-locale

Conversation

@Vellumic
Copy link
Copy Markdown
Contributor

@Vellumic Vellumic commented Apr 12, 2026

This Pull Request fixes/closes #5323

Changes

  • Eliminates the code which broke the standard behavior, when calling Date.prototype.toLocaleString with dateStyle/timeStyle options.
  • Adds a regression test to ensure that dateStyle and timeStyle don't force a fallback to a combined date-time string, as per ECMA-402

Validation

  • Run (all passed)
cargo test --package boa_engine --lib --features intl_bundled -- builtins::intl::date_time_format::tests --nocapture
  • Manual check
>> const date = new Date(Date.UTC(2024, 2, 10, 2, 30))
undefined
>> date.toLocaleString("en-US", {dateStyle: "short"})
"3/10/24"
>> date.toLocaleString("en-US", {timeStyle: "short"})
"2:30\u{202f}AM"

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

github-actions bot commented Apr 12, 2026

Test262 conformance changes

Test result main count PR count difference
Total 53,125 53,125 0
Passed 51,049 51,049 0
Ignored 1,482 1,482 0
Failed 594 594 0
Panics 0 0 0
Conformance 96.09% 96.09% 0.00%

Tested main commit: 3cec5e6bc4454077cb8d65b537d368d633137e0e
Tested PR commit: ff676cda6e326dae77479ffb6b12a73d6ed25456
Compare commits: 3cec5e6...ff676cd

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.85%. Comparing base (6ddc2b4) to head (ff676cd).
⚠️ Report is 951 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #5324       +/-   ##
===========================================
+ Coverage   47.24%   59.85%   +12.60%     
===========================================
  Files         476      590      +114     
  Lines       46892    63683    +16791     
===========================================
+ Hits        22154    38115    +15961     
- Misses      24738    25568      +830     

☔ 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.

@github-actions github-actions bot added the C-Tests Issues and PRs related to the tests. label Apr 13, 2026
Copy link
Copy Markdown
Member

@HalidOdat HalidOdat left a comment

Choose a reason for hiding this comment

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

Looks good to me! 😄

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. Waiting On Review Waiting on reviews from the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Date.prototype.toLocaleString behavior violates the ECMA-402

2 participants