Skip to content

Conversation

@ioannad
Copy link
Contributor

@ioannad ioannad commented Jan 20, 2026

without regard to DST.

This implements normative change of PR #3246 in the polyfill.

Related to issue #3212

This adds a new (boolean) argument isPlain to getSlotLazy, which, when isPlain is set to true copies the options object of the cached Intl.DateTimeFormat object and amends the copied options to have timeZone = 'UTC'.

Then from extractOverrides we use GetUTCEpochNanoseconds to calculate the nanoseconds of the plain temporal objects, and get a formatter for these using getSlotLazy with the isPlain argument set to true. Thus the formatter for the plain objects can be aware that the nanoseconds calculated for these objects are UTC based, independent of the actual timezone it was created in.

This makes the plain* objects be UTC based, implementing the changes in #3246 as closely as possible.

@codecov
Copy link

codecov bot commented Jan 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.91%. Comparing base (a91494f) to head (c0abd32).
⚠️ Report is 15 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3257   +/-   ##
=======================================
  Coverage   97.91%   97.91%           
=======================================
  Files          22       22           
  Lines       10367    10373    +6     
  Branches     1805     1807    +2     
=======================================
+ Hits        10151    10157    +6     
  Misses        197      197           
  Partials       19       19           

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

without regard to DST.

This implements normative change of
PR tc39#3246
in the polyfill.
@ioannad ioannad force-pushed the plain-temporal-objects-format-in-UTC branch from 9d7c2dd to c0abd32 Compare January 20, 2026 10:27
ioannad added a commit to ioannad/test262 that referenced this pull request Jan 20, 2026
…ones.

These are basic tests for proposal-temporal's normative change
PR tc39/proposal-temporal#3246 and
polyfill fix PR tc39/proposal-temporal#3257

More tests will be added here to include tests of .toLocaleString for PlainTime,
PlainDate, PlainYearMonth, PlainMonthDay, and tests for formatToParts,
formatRange, and formatRangeToParts.
@ioannad
Copy link
Contributor Author

ioannad commented Jan 20, 2026

Some basic tests are in this test262 draft PR: tc39/test262#4878
marked as draft before it is expanded to a comprehensive set of tests for all Plain* temporal objects and all format* functions of Intl.DateTimeFormat.

ioannad added a commit to ioannad/test262 that referenced this pull request Jan 20, 2026
…ones.

These are tests for proposal-temporal's normative change
PR tc39/proposal-temporal#3246 and
polyfill fix PR tc39/proposal-temporal#3257
Copy link
Collaborator

@ptomato ptomato left a comment

Choose a reason for hiding this comment

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

Thanks!
I will probably end up closing this PR and pulling the commit into #3246 when landing it, but I'll figure that out tomorrow.

Comment on lines +69 to +78
function getSlotLazy(obj, slot, isPlain) {
let val = GetSlot(obj, slot);
if (typeof val === 'function') {
val = new IntlDateTimeFormat(GetSlot(obj, LOCALE), val(GetSlot(obj, OPTIONS)));
const baseOptions = val(GetSlot(obj, OPTIONS));
const options = ObjectAssign({}, baseOptions);
const amendedOptions = val(options);
if (isPlain) {
amendedOptions.timeZone = 'UTC';
}
val = new IntlDateTimeFormat(GetSlot(obj, LOCALE), amendedOptions);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This works, but can be optimized further: I think we can set options.timeZone = 'UTC' in each of the amend functions, rather than here, because when we read e.g. the DATE slot, it will always be with isPlain = true.

ptomato pushed a commit to ioannad/test262 that referenced this pull request Jan 30, 2026
…ones.

These are tests for proposal-temporal's normative change
PR tc39/proposal-temporal#3246 and
polyfill fix PR tc39/proposal-temporal#3257
@ptomato
Copy link
Collaborator

ptomato commented Jan 30, 2026

Rebased, pushed a commit to address my own comment, and merged into #3246. Thanks!

@ptomato ptomato closed this Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants