feat(intl): implement Temporal.PlainYearMonth.prototype.toLocaleString#5098
feat(intl): implement Temporal.PlainYearMonth.prototype.toLocaleString#5098alienx5499 wants to merge 6 commits intoboa-dev:mainfrom
Conversation
Test262 conformance changes
Fixed tests (1):Tested main commit: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5098 +/- ##
===========================================
+ Coverage 47.24% 59.86% +12.62%
===========================================
Files 476 589 +113
Lines 46892 63490 +16598
===========================================
+ Hits 22154 38010 +15856
- Misses 24738 25480 +742 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f11323d to
fceb44a
Compare
| Ok(JsString::from(year_month.inner.to_string()).into()) | ||
| #[cfg(feature = "intl")] | ||
| { | ||
| use crate::builtins::{ |
There was a problem hiding this comment.
issue: the implementation here should ideally follow or adapt the specification steps provided in the Temporal specification as additions to ECMA402
Test262 conformance changes
Fixed tests (2):Tested main commit: |
|
Hi @nekevss, I’ve addressed your feedback and aligned the implementation more closely with the Temporal -> ECMA-402 specification steps, and rebased on latest main. Since #5080 is now merged, the original blocking dependency should be resolved. Could you please take another look when you have time? If the Blocked label was only due to that dependency, it may no longer be needed. Let me know if anything still needs adjustment. Thanks! |
nekevss
left a comment
There was a problem hiding this comment.
This is looking good overall and the tests appear to be promising.
This method is a little tricky, especially when it comes to the specification. There's a lot of complicated specification text, but in order to better support the other temporal built-ins and follow up work on this code path.
It's worth noting that if there's other code paths that you aren't trying to support currently. Feel free to return a result where the other branches return a js_error!("Not yet implemented").
| } | ||
|
|
||
| // Compute epochNs from isoDate + NoonTimeRecord (steps 2-3), then pass it to the shared | ||
| // ECMA-402 formatting pipeline as epoch milliseconds. |
There was a problem hiding this comment.
issue: this should ideally not be inlined from HandleDateTimeValue.
The implementation here should probably stick as close to the specification as possible while also being able to expand to support the other temporal built-ins
|
Hi @nekevss, Updated based on your feedback, moved the Would appreciate a re-review when you have time. Thanks! |
This Pull Request fixes/closes #5083.
It changes the following:
Temporal.PlainYearMonth.prototype.toLocaleStringper spec. It now acts as a thin wrapper that delegates to a new, centralizedHandleDateTimeValuedispatcher (§15.6.22) in theIntlmodule. When the caller omitsdateStyle/timeStyle, defaultyear: "numeric"andmonth: "short"are applied so ICU does not fall back to full date defaults (referenceday) — fixes Test262default-does-not-include-day-time-and-time-zone-name.js.HandleDateTimeTemporalYearMonth(§15.6.16) to compute the Intl formatting anchor from the Temporal plain value; validate Intlcalendaragainst the Temporal calendar, and model Temporal plaintimeZoneby forcing IntltimeZoneto"+00:00".PlainYearMonth.prototype.toLocaleString: returns string, invalid receiver throwsTypeError, and (with theintlfeature) different locales/options affect output; plaintimeZoneis ignored/overridden, incompatiblecalendarthrows, and default output excludes reference day/time/timeZoneName (regression for Test262default-does-not-include-day-time-and-time-zone-name.js).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)cargo run -p boa_tester -- run --suite test/intl402/Temporal/PlainYearMonth/prototype/toLocaleString/default-does-not-include-day-time-and-time-zone-name.jsStatus: rebased onto
mainafter #5080; this PR now only contains the TemporalPlainYearMonth.prototype.toLocaleStringchanges for #5083.