Skip to content

Latest commit

 

History

History
44 lines (31 loc) · 3.13 KB

README.md

File metadata and controls

44 lines (31 loc) · 3.13 KB

Polyfill (for testing only) for TC39 Time Zone Canonicalization proposal

This polyfill is only for testing the TC39 Time Zone Canonicalization proposal. The sole purpose of this polyfill is to run Test262 tests. DO NOT use it in production!

Like this proposal's spec text, the polyfill is stacked on top of the Temporal proposal's polyfill.

For ease of development, this proposal's polyfill changes—about 20 lines—live in a single commit at the top of the canonical-tz-polyfill branch of the Temporal proposal repo. These changes are also checked into this repo as polyfill.diff in the same directory as this README.

Testing this proposal

Test262 tests are available at tc39/test262#3837, although this PR is not expected to be merged unless this proposal reaches Stage 3.

Test roadmap

  • DONE Add lightweight "Demitasse" tests in test/canonicaltz.mjs that cover this proposal's full surface area
  • DONE Fix 15 existing Test262 tests that were broken by this proposal, because they assumed that time zone identifiers are always canonicalized
  • DONE Open a Test262 draft PR
  • DONE Migrate Temporal.TimeZone.p.equals (the only new API in this proposal) Demitasse tests to Test262
  • DONE Migrate Temporal.TimeZone Demitasse tests to Test262
  • DONE Migrate Temporal.ZonedDateTime Demitasse tests to Test262
  • DONE Migrate Intl.DateTimeFormat Demitasse tests to Test262
  • Remove Demitasse tests from this repo and from CI workflows

How to run tests

Before running tests, the polyfill code from the proposal-temporal branch linked above must be current in the temporal submodule in this repo. To do this, use npm run refresh-polyfill from the root of this repo. This script will also regenerate polyfill.diff, which should be checked in after any polyfill changes are pushed.

Once the polyfill code is updated, use npm test to run tests. To validate that this proposal doesn't break anything in Temporal, all 6000+ Temporal tests are run in addition to tests added or changed by this proposal. It takes 1-2 minutes on a fast machine to run all these tests using @js-temporal/temporal-test262-runner.

In CI, npm run refresh-polyfill-ci must be run before running tests. This script acts the same as npm run refresh-polyfill except:

  • If polyfill.diff is out of date, it fails with an error because we don't want PRs to be merged with an outdated polyfill diff
  • It won't build the polyfill because building happens later as part of testing scripts

Production polyfill plans

There is no plan to provide a separate production polyfill for this proposal, because it's so tightly integrated with Temporal. Instead, if this proposal makes it to Stage 4, we'll work with the maintainers of Temporal polyfills to ensure that the small number of changes in this proposal are integrated into those polyfills.