Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normative: Read date-time options only once when creating DateTimeFormat objects #709

Closed
wants to merge 5 commits into from

Conversation

anba
Copy link
Contributor

@anba anba commented Sep 20, 2022

The first two commits are purely editorial and only move some things around, so it's easier to review the third commit, which contains the actual change.

Fixes #237
Fixes #706

@sffc sffc requested review from FrankYFTang and removed request for sffc September 23, 2022 22:11
spec/datetimeformat.html Outdated Show resolved Hide resolved
spec/datetimeformat.html Show resolved Hide resolved
@gibson042 gibson042 changed the title Read date-time options only once when creating DateTimeFormat objects Normative: Read date-time options only once when creating DateTimeFormat objects Sep 24, 2022
spec/datetimeformat.html Outdated Show resolved Hide resolved
@sffc
Copy link
Contributor

sffc commented Oct 6, 2022

TG2 discussion: https://github.com/tc39/ecma402/blob/master/meetings/notes-2022-10-06.md#normative-read-date-time-options-only-once-when-creating-datetimeformat-objects

Conclusion: Review the Test262 impact. Further discussion is not necessary in this group unless red flags show up. Approved with that condition.

@ryzokuken
Copy link
Member

@gibson042 any updates?

@Ms2ger
Copy link
Contributor

Ms2ger commented Jan 11, 2023

Please also note the changes going in a similar direction in Temporal. (I don't have the time right now to review if any changes would be helpful here or there.)

@anba
Copy link
Contributor Author

anba commented Jan 12, 2023

Conclusion: Review the Test262 impact.

Test262 PR created at tc39/test262#3768.

@justingrant
Copy link
Contributor

Please also note the changes going in a similar direction in Temporal. (I don't have the time right now to review if any changes would be helpful here or there.)

I filed tc39/proposal-temporal#2473 to adapt to this change on the Temporal side.

gibson042 added a commit to gibson042/engine262 that referenced this pull request Jan 14, 2023
gibson042 added a commit to gibson042/engine262 that referenced this pull request Jan 14, 2023
Ref tc39/ecma402#709 (comment)

Passes relevant tests after minor modification:
```sh
$ npm run test:test262 -- --extended-tests --run-slow-tests $(
    find $(
      find test/test262/test262/ -type d -a '(' -iname '*intl*' -o -iname '*402*' ')' -prune | \
      tee /dev/stderr \
    ) -iname '*date*' -prune | \
    grep -viE 'temporal|\bdate\b|\bsupportedValuesOf\b|\bDisplayName'
  )
test/test262/test262/test/staging/Intl402
test/test262/test262/test/intl402
test/test262/test262/implementation-contributed/v8/intl
test/test262/test262/implementation-contributed/v8/test262/local-tests/test/intl402

> @engine262/[email protected] test:test262
> node --enable-source-maps test/test262/test262.js --extended-tests --run-slow-tests test/test262/test262/test/intl402/DateTimeFormat test/test262/test262/test/intl402/Intl/DateTimeFormat test/test262/test262/implementation-contributed/v8/test262/local-tests/test/intl402/DateTimeFormat

 engine262 Test Runner
 Detected 4 CPUs
 Not running on CI

[00:04|:  342|+  322|-    0|»   20] (68.00/s)

$ pushd test/test262/test262/ && git diff; popd
diff --git i/harness/testIntl.js w/harness/testIntl.js
index 286ccd129e..f674055e2c 100644
--- i/harness/testIntl.js
+++ w/harness/testIntl.js
@@ -42,7 +42,8 @@ defines:
  *   @param {Function} Constructor the constructor object to test with.
  */
 function testWithIntlConstructors(f) {
-  var constructors = ["Collator", "NumberFormat", "DateTimeFormat"];
+  // engine262 does not yet implement Collator or NumberFormat.
+  var constructors = [/*"Collator", "NumberFormat",*/ "DateTimeFormat"];

   // Optionally supported Intl constructors.
   // NB: Intl.Locale isn't an Intl service constructor!
diff --git i/implementation-contributed/v8/test262/local-tests/test/intl402/DateTimeFormat/12.1.1_1.js w/implementation-contributed/v8/test262/local-tests/test/intl402/DateTimeFormat/12.1.1_1.js
index 64845e74a9..bee9c5cf53 100644
--- i/implementation-contributed/v8/test262/local-tests/test/intl402/DateTimeFormat/12.1.1_1.js
+++ w/implementation-contributed/v8/test262/local-tests/test/intl402/DateTimeFormat/12.1.1_1.js
@@ -11,7 +11,8 @@ includes: [testIntl.js]
 testWithIntlConstructors(function (Constructor) {
     var obj, newObj;

-    if (Constructor === Intl.DateTimeFormat) {
+    // engine262 does not implement ChainDateTimeFormat (which is normative-optional).
+    if (false && Constructor === Intl.DateTimeFormat) {
       obj = new Constructor();
       newObj = Intl.DateTimeFormat.call(obj);
       if (obj !== newObj) {
diff --git i/test/intl402/DateTimeFormat/date-time-options.js w/test/intl402/DateTimeFormat/date-time-options.js
index 7d9ef93d20..8c8502fc3b 100644
--- i/test/intl402/DateTimeFormat/date-time-options.js
+++ w/test/intl402/DateTimeFormat/date-time-options.js
@@ -36,6 +36,8 @@ function testWithDateTimeFormat(options, expected) {
 }

 function testWithToLocale(f, options, expected) {
+    // engine262 does not yet implement Intl-integrated Date.prototype.toLocaleString.
+    return;
     // expected can be either one subset or an array of possible subsets
     if (expected.length === undefined) {
         expected = [expected];
```
gibson042 added a commit to gibson042/engine262 that referenced this pull request Jan 14, 2023
Ref tc39/ecma402#709 (comment)

Passes relevant tests after minor modification:
```sh
$ npm run test:test262 -- --extended-tests --run-slow-tests $(
    find $(
      find test/test262/test262/ -type d -a '(' -iname '*intl*' -o -iname '*402*' ')' -prune | \
      tee /dev/stderr \
    ) -iname '*date*' -prune | \
    grep -viE 'temporal|\bdate\b|\bsupportedValuesOf\b|\bDisplayName'
  )
test/test262/test262/test/staging/Intl402
test/test262/test262/test/intl402
test/test262/test262/implementation-contributed/v8/intl
test/test262/test262/implementation-contributed/v8/test262/local-tests/test/intl402

> @engine262/[email protected] test:test262
> node --enable-source-maps test/test262/test262.js --extended-tests --run-slow-tests test/test262/test262/test/intl402/DateTimeFormat test/test262/test262/test/intl402/Intl/DateTimeFormat test/test262/test262/implementation-contributed/v8/test262/local-tests/test/intl402/DateTimeFormat

 engine262 Test Runner
 Detected 4 CPUs
 Not running on CI

[00:04|:  342|+  322|-    0|»   20] (68.00/s)

$ pushd test/test262/test262/ && git diff; popd
diff --git i/harness/testIntl.js w/harness/testIntl.js
index 286ccd129e..f674055e2c 100644
--- i/harness/testIntl.js
+++ w/harness/testIntl.js
@@ -42,7 +42,8 @@ defines:
  *   @param {Function} Constructor the constructor object to test with.
  */
 function testWithIntlConstructors(f) {
-  var constructors = ["Collator", "NumberFormat", "DateTimeFormat"];
+  // engine262 does not yet implement Collator or NumberFormat.
+  var constructors = [/*"Collator", "NumberFormat",*/ "DateTimeFormat"];

   // Optionally supported Intl constructors.
   // NB: Intl.Locale isn't an Intl service constructor!
diff --git i/implementation-contributed/v8/test262/local-tests/test/intl402/DateTimeFormat/12.1.1_1.js w/implementation-contributed/v8/test262/local-tests/test/intl402/DateTimeFormat/12.1.1_1.js
index 64845e74a9..bee9c5cf53 100644
--- i/implementation-contributed/v8/test262/local-tests/test/intl402/DateTimeFormat/12.1.1_1.js
+++ w/implementation-contributed/v8/test262/local-tests/test/intl402/DateTimeFormat/12.1.1_1.js
@@ -11,7 +11,8 @@ includes: [testIntl.js]
 testWithIntlConstructors(function (Constructor) {
     var obj, newObj;

-    if (Constructor === Intl.DateTimeFormat) {
+    // engine262 does not implement ChainDateTimeFormat (which is normative-optional).
+    if (false && Constructor === Intl.DateTimeFormat) {
       obj = new Constructor();
       newObj = Intl.DateTimeFormat.call(obj);
       if (obj !== newObj) {
diff --git i/test/intl402/DateTimeFormat/date-time-options.js w/test/intl402/DateTimeFormat/date-time-options.js
index 7d9ef93d20..8c8502fc3b 100644
--- i/test/intl402/DateTimeFormat/date-time-options.js
+++ w/test/intl402/DateTimeFormat/date-time-options.js
@@ -36,6 +36,8 @@ function testWithDateTimeFormat(options, expected) {
 }

 function testWithToLocale(f, options, expected) {
+    // engine262 does not yet implement Intl-integrated Date.prototype.toLocaleString.
+    return;
     // expected can be either one subset or an array of possible subsets
     if (expected.length === undefined) {
         expected = [expected];
```
gibson042 added a commit to gibson042/engine262 that referenced this pull request Jan 14, 2023
Implements tc39/ecma402#709

Introduced test failures:
```sh
$ npm run test:test262 -- --extended-tests --run-slow-tests $(find $(find test/test262/test262/ -type d -a '(' -iname '*intl*' -o -iname '*402*' ')' -prune | tee /dev/stderr) -iname '*date*' -prune | grep -viE 'temporal|\bdate\b|\bsupportedValuesOf\b|\bDisplayName') 2>&1 | grep -vE '^[[:space:]]+ at ' | tee /dev/stderr | awk '/^FAILURE!/ { files[$2]++ } END { printf "\n\n# Files\n" > "/dev/stderr"; for(f in files) print f; }' | sort -u
$ npm run test:test262 -- --extended-tests --run-slow-tests $(
    find $(
      find test/test262/test262/ -type d -a '(' -iname '*intl*' -o -iname '*402*' ')' -prune | \
      tee /dev/stderr \
    ) -iname '*date*' -prune | \
    grep -viE 'temporal|\bdate\b|\bsupportedValuesOf\b|\bDisplayName'
  ) 2>&1 | \
  grep -vE '^[[:space:]]+ at ' | \
  tee /dev/stderr | \
  awk '/^FAILURE/ { a[$2]++ } END { print "\n\n# Files" > "/dev/stderr"; for(f in a) print f }' | \
  sort -u
test/test262/test262/test/staging/Intl402
test/test262/test262/test/intl402
test/test262/test262/implementation-contributed/v8/intl
test/test262/test262/implementation-contributed/v8/test262/local-tests/test/intl402

> @engine262/[email protected] test:test262
> node --enable-source-maps test/test262/test262.js --extended-tests --run-slow-tests test/test262/test262/test/intl402/DateTimeFormat test/test262/test262/test/intl402/Intl/DateTimeFormat test/test262/test262/implementation-contributed/v8/test262/local-tests/test/intl402/DateTimeFormat

 engine262 Test Runner
 Detected 4 CPUs
 Not running on CI

[00:00|:  342|+    0|-    0|»   20] (0.00/s)
FAILURE! intl402/DateTimeFormat/constructor-options-order-dayPeriod.js
Checks the order of getting options of 'dayPeriod' for the DateTimeFormat constructor. (Strict Mode)
Error: Expected [day, dayPeriod, hour] and [day, dayPeriod, hour, day, dayPeriod, hour] to have the same contents.

FAILURE! intl402/DateTimeFormat/constructor-options-order-dayPeriod.js
Checks the order of getting options of 'dayPeriod' for the DateTimeFormat constructor.
Error: Expected [day, dayPeriod, hour] and [day, dayPeriod, hour, day, dayPeriod, hour] to have the same contents.

FAILURE! intl402/DateTimeFormat/constructor-options-order-timedate-style.js
Checks the order of getting options for the DateTimeFormat constructor.
Error: Expected [localeMatcher, hour12, hourCycle, timeZone, weekday, era, year, month, day, hour, minute, second, timeZoneName, formatMatcher, dateStyle, timeStyle] and [weekday, year, month, day, hour, minute, second, dateStyle, timeStyle, localeMatcher, hour12, hourCycle, timeZone, weekday, era, year, month, day, hour, minute, second, timeZoneName, formatMatcher, dateStyle, timeStyle] to have the same contents.

FAILURE! intl402/DateTimeFormat/constructor-options-order-fractionalSecondDigits.js
Checks the order of getting options of 'fractionalSecondDigits' for the DateTimeFormat constructor. (Strict Mode)
Error: Expected [localeMatcher, second, fractionalSecondDigits, timeZoneName, formatMatcher] and [second, fractionalSecondDigits, localeMatcher, second, fractionalSecondDigits, timeZoneName, formatMatcher] to have the same contents.

FAILURE! intl402/DateTimeFormat/constructor-options-order.js
Checks the order of getting options for the DateTimeFormat constructor. (Strict Mode)
Error: Expected [localeMatcher, hour12, hourCycle, timeZone, weekday, era, year, month, day, hour, minute, second, timeZoneName, formatMatcher] and [weekday, year, month, day, hour, minute, second, localeMatcher, hour12, hourCycle, timeZone, weekday, era, year, month, day, hour, minute, second, timeZoneName, formatMatcher] to have the same contents.

FAILURE! intl402/DateTimeFormat/constructor-options-order.js
Checks the order of getting options for the DateTimeFormat constructor.
Error: Expected [localeMatcher, hour12, hourCycle, timeZone, weekday, era, year, month, day, hour, minute, second, timeZoneName, formatMatcher] and [weekday, year, month, day, hour, minute, second, localeMatcher, hour12, hourCycle, timeZone, weekday, era, year, month, day, hour, minute, second, timeZoneName, formatMatcher] to have the same contents.

FAILURE! intl402/DateTimeFormat/constructor-options-order-fractionalSecondDigits.js
Checks the order of getting options of 'fractionalSecondDigits' for the DateTimeFormat constructor.
Error: Expected [localeMatcher, second, fractionalSecondDigits, timeZoneName, formatMatcher] and [second, fractionalSecondDigits, localeMatcher, second, fractionalSecondDigits, timeZoneName, formatMatcher] to have the same contents.

FAILURE! intl402/DateTimeFormat/constructor-options-order-timedate-style.js
Checks the order of getting options for the DateTimeFormat constructor. (Strict Mode)
Error: Expected [localeMatcher, hour12, hourCycle, timeZone, weekday, era, year, month, day, hour, minute, second, timeZoneName, formatMatcher, dateStyle, timeStyle] and [weekday, year, month, day, hour, minute, second, dateStyle, timeStyle, localeMatcher, hour12, hourCycle, timeZone, weekday, era, year, month, day, hour, minute, second, timeZoneName, formatMatcher, dateStyle, timeStyle] to have the same contents.
[00:04|:  342|+  314|-    8|»   20] (70.00/s)

intl402/DateTimeFormat/constructor-options-order-dayPeriod.js
intl402/DateTimeFormat/constructor-options-order-fractionalSecondDigits.js
intl402/DateTimeFormat/constructor-options-order-timedate-style.js
intl402/DateTimeFormat/constructor-options-order.js
```
@gibson042
Copy link
Contributor

gibson042 commented Jan 14, 2023

I confirmed with engine262 that the test changes at tc39/test262#3768 are the correct updates for this PR: engine262/engine262@3248ccc...gibson042:ecma402-gh-709-initializedatetimeformat

And since test changes are required, it's worth looking critically at the new read order proposed here [spoiler—I think slight modification is warranted]:

  1. localeMatcher [affects locale resolution, common to all service constructors]
  2. calendar [affects locale resolution]
  3. numberingSystem [affects locale resolution]
  4. hour12 [affects locale resolution]
  5. hourCycle [affects locale resolution]
  6. timeZone [e.g., "America/New_York"]
  7. component-specific configuration
    1. weekday
    2. era
    3. year
    4. month
    5. day
    6. dayPeriod
    7. hour
    8. minute
    9. second
    10. fractionalSecondDigits
    11. timeZoneName
  8. formatMatcher ["basic" vs. "best fit" output pattern selection hint]
  9. dateStyle [date-specific output pattern override]
  10. timeStyle [time-specific output pattern override]

Cross-facility comparison:

  • DisplayNames reads localeMatcher, style ["narrow", "short", "long"], type ["language", "region", etc.], and then narrow configuration.
  • ListFormat reads localeMatcher, type ["conjunction", "disjunction", "unit"], style ["long", "short", "narrow"].
  • NumberFormat reads localeMatcher, numberingSystem, style ["decimal", "currency", "unit", etc.—analogous to type in other facilities], style detail fields, and then a hodgepodge of other configuration (notation, compactDisplay ["short", "long"—somewhat similar to style in other facilities], comma and sign control, etc.).
  • RelativeTimeFormat reads localeMatcher, numberingSystem, style ["long", "short", "narrow"], and then configuration detail.

Considering the above, I think it does make sense to read calendar and numberingSystem where they are. formatMatcher and {date,time}Style form a style/type-like group that should probably precede reading component-specific fields, better aligning with DisplayNames and NumberFormat and RelativeTimeFormat. That leaves timeZone, which acts as input data augmentation and doesn't really have a great analogue in other facilities—I think it can make sense either immediately before or immediately after the aforementioned style group. I'm inclined to say "before", making the overall pattern "locale" then "context" then "style/type" then "details".

Concretely, I propose the narrow change here of moving the formatMatcher/dateStyle/timeStyle block immediately before the components-table loop and also reordering it to dateStyle then timeStyle then formatMatcher (since formatMatcher is subordinate to the other fields, only having an effect when they are both undefined).

EDIT: But I'm also fine with not reordering, since it may not survive #747 anyway.

gibson042 added a commit to gibson042/engine262 that referenced this pull request Jan 16, 2023
Ref tc39/ecma402#709 (comment)

Passes relevant tests after minor modification:
```sh
$ npm run test:test262 -- --extended-tests --run-slow-tests $(
    find $(
      find test/test262/test262/ -type d -a '(' -iname '*intl*' -o -iname '*402*' ')' -prune | \
      tee /dev/stderr \
    ) -iname '*date*' -prune | \
    grep -viE 'temporal|\bdate\b|\bsupportedValuesOf\b|\bDisplayName'
  )
test/test262/test262/test/staging/Intl402
test/test262/test262/test/intl402
test/test262/test262/implementation-contributed/v8/intl
test/test262/test262/implementation-contributed/v8/test262/local-tests/test/intl402

> @engine262/[email protected] test:test262
> node --enable-source-maps test/test262/test262.js --extended-tests --run-slow-tests test/test262/test262/test/intl402/DateTimeFormat test/test262/test262/test/intl402/Intl/DateTimeFormat test/test262/test262/implementation-contributed/v8/test262/local-tests/test/intl402/DateTimeFormat

 engine262 Test Runner
 Detected 4 CPUs
 Not running on CI

[00:04|:  342|+  322|-    0|»   20] (68.00/s)

$ pushd test/test262/test262/ && git diff; popd
diff --git i/harness/testIntl.js w/harness/testIntl.js
index 286ccd129e..f674055e2c 100644
--- i/harness/testIntl.js
+++ w/harness/testIntl.js
@@ -42,7 +42,8 @@ defines:
  *   @param {Function} Constructor the constructor object to test with.
  */
 function testWithIntlConstructors(f) {
-  var constructors = ["Collator", "NumberFormat", "DateTimeFormat"];
+  // engine262 does not yet implement Collator or NumberFormat.
+  var constructors = [/*"Collator", "NumberFormat",*/ "DateTimeFormat"];

   // Optionally supported Intl constructors.
   // NB: Intl.Locale isn't an Intl service constructor!
diff --git i/implementation-contributed/v8/test262/local-tests/test/intl402/DateTimeFormat/12.1.1_1.js w/implementation-contributed/v8/test262/local-tests/test/intl402/DateTimeFormat/12.1.1_1.js
index 64845e74a9..bee9c5cf53 100644
--- i/implementation-contributed/v8/test262/local-tests/test/intl402/DateTimeFormat/12.1.1_1.js
+++ w/implementation-contributed/v8/test262/local-tests/test/intl402/DateTimeFormat/12.1.1_1.js
@@ -11,7 +11,8 @@ includes: [testIntl.js]
 testWithIntlConstructors(function (Constructor) {
     var obj, newObj;

-    if (Constructor === Intl.DateTimeFormat) {
+    // engine262 does not implement ChainDateTimeFormat (which is normative-optional).
+    if (false && Constructor === Intl.DateTimeFormat) {
       obj = new Constructor();
       newObj = Intl.DateTimeFormat.call(obj);
       if (obj !== newObj) {
diff --git i/test/intl402/DateTimeFormat/date-time-options.js w/test/intl402/DateTimeFormat/date-time-options.js
index 7d9ef93d20..8c8502fc3b 100644
--- i/test/intl402/DateTimeFormat/date-time-options.js
+++ w/test/intl402/DateTimeFormat/date-time-options.js
@@ -36,6 +36,8 @@ function testWithDateTimeFormat(options, expected) {
 }

 function testWithToLocale(f, options, expected) {
+    // engine262 does not yet implement Intl-integrated Date.prototype.toLocaleString.
+    return;
     // expected can be either one subset or an array of possible subsets
     if (expected.length === undefined) {
         expected = [expected];
```
gibson042 added a commit to gibson042/engine262 that referenced this pull request Jan 16, 2023
Implements tc39/ecma402#709

Introduced test failures:
```sh
$ npm run test:test262 -- --extended-tests --run-slow-tests $(
    find $(
      find test/test262/test262/ -type d -a '(' -iname '*intl*' -o -iname '*402*' ')' -prune | \
      tee /dev/stderr \
    ) -iname '*date*' -prune | \
    grep -viE 'temporal|\bdate\b|\bsupportedValuesOf\b|\bDisplayName'
  ) 2>&1 | \
  grep -vE '^[[:space:]]+ at ' | \
  tee /dev/stderr | \
  awk '/^FAILURE/ { a[$2]++ } END { print "\n\nFILES" > "/dev/stderr"; for(f in a) print f }' | \
  sort -u
test/test262/test262/test/staging/Intl402
test/test262/test262/test/intl402
test/test262/test262/implementation-contributed/v8/intl
test/test262/test262/implementation-contributed/v8/test262/local-tests/test/intl402

> @engine262/[email protected] test:test262
> node --enable-source-maps test/test262/test262.js --extended-tests --run-slow-tests test/test262/test262/test/intl402/DateTimeFormat test/test262/test262/test/intl402/Intl/DateTimeFormat test/test262/test262/implementation-contributed/v8/test262/local-tests/test/intl402/DateTimeFormat

 engine262 Test Runner
 Detected 4 CPUs
 Not running on CI

[00:00|:  342|+    0|-    0|»   20] (0.00/s)
FAILURE! intl402/DateTimeFormat/constructor-options-order-dayPeriod.js
Checks the order of getting options of 'dayPeriod' for the DateTimeFormat constructor. (Strict Mode)
Error: Expected [day, dayPeriod, hour] and [day, dayPeriod, hour, day, dayPeriod, hour] to have the same contents.

FAILURE! intl402/DateTimeFormat/constructor-options-order-dayPeriod.js
Checks the order of getting options of 'dayPeriod' for the DateTimeFormat constructor.
Error: Expected [day, dayPeriod, hour] and [day, dayPeriod, hour, day, dayPeriod, hour] to have the same contents.

FAILURE! intl402/DateTimeFormat/constructor-options-order-timedate-style.js
Checks the order of getting options for the DateTimeFormat constructor.
Error: Expected [localeMatcher, hour12, hourCycle, timeZone, weekday, era, year, month, day, hour, minute, second, timeZoneName, formatMatcher, dateStyle, timeStyle] and [weekday, year, month, day, hour, minute, second, dateStyle, timeStyle, localeMatcher, hour12, hourCycle, timeZone, weekday, era, year, month, day, hour, minute, second, timeZoneName, formatMatcher, dateStyle, timeStyle] to have the same contents.

FAILURE! intl402/DateTimeFormat/constructor-options-order-fractionalSecondDigits.js
Checks the order of getting options of 'fractionalSecondDigits' for the DateTimeFormat constructor. (Strict Mode)
Error: Expected [localeMatcher, second, fractionalSecondDigits, timeZoneName, formatMatcher] and [second, fractionalSecondDigits, localeMatcher, second, fractionalSecondDigits, timeZoneName, formatMatcher] to have the same contents.

FAILURE! intl402/DateTimeFormat/constructor-options-order.js
Checks the order of getting options for the DateTimeFormat constructor. (Strict Mode)
Error: Expected [localeMatcher, hour12, hourCycle, timeZone, weekday, era, year, month, day, hour, minute, second, timeZoneName, formatMatcher] and [weekday, year, month, day, hour, minute, second, localeMatcher, hour12, hourCycle, timeZone, weekday, era, year, month, day, hour, minute, second, timeZoneName, formatMatcher] to have the same contents.

FAILURE! intl402/DateTimeFormat/constructor-options-order.js
Checks the order of getting options for the DateTimeFormat constructor.
Error: Expected [localeMatcher, hour12, hourCycle, timeZone, weekday, era, year, month, day, hour, minute, second, timeZoneName, formatMatcher] and [weekday, year, month, day, hour, minute, second, localeMatcher, hour12, hourCycle, timeZone, weekday, era, year, month, day, hour, minute, second, timeZoneName, formatMatcher] to have the same contents.

FAILURE! intl402/DateTimeFormat/constructor-options-order-fractionalSecondDigits.js
Checks the order of getting options of 'fractionalSecondDigits' for the DateTimeFormat constructor.
Error: Expected [localeMatcher, second, fractionalSecondDigits, timeZoneName, formatMatcher] and [second, fractionalSecondDigits, localeMatcher, second, fractionalSecondDigits, timeZoneName, formatMatcher] to have the same contents.

FAILURE! intl402/DateTimeFormat/constructor-options-order-timedate-style.js
Checks the order of getting options for the DateTimeFormat constructor. (Strict Mode)
Error: Expected [localeMatcher, hour12, hourCycle, timeZone, weekday, era, year, month, day, hour, minute, second, timeZoneName, formatMatcher, dateStyle, timeStyle] and [weekday, year, month, day, hour, minute, second, dateStyle, timeStyle, localeMatcher, hour12, hourCycle, timeZone, weekday, era, year, month, day, hour, minute, second, timeZoneName, formatMatcher, dateStyle, timeStyle] to have the same contents.
[00:04|:  342|+  314|-    8|»   20] (70.00/s)

FILES
intl402/DateTimeFormat/constructor-options-order-dayPeriod.js
intl402/DateTimeFormat/constructor-options-order-fractionalSecondDigits.js
intl402/DateTimeFormat/constructor-options-order-timedate-style.js
intl402/DateTimeFormat/constructor-options-order.js
```
@anba
Copy link
Contributor Author

anba commented Jan 16, 2023

EDIT: But I'm also fine with not reordering, since it may not survive #747 anyway.

Yeah, let's do any additional reordering as part of #747. That way this PR is restricted to fix the TOCTU issue described in #237.

@anba
Copy link
Contributor Author

anba commented Jun 29, 2023

Hi @ryzokuken, I don't see this issue being discussed at the May meeting. Do you plan to present it at the July meeting?

Thanks,
André

@ryzokuken
Copy link
Member

Hi @anba! I indeed missed the fact that there's consensus here. I'll present it in the July meeting.

@ryzokuken ryzokuken added the has consensus Has consensus from TC39-TG2 label Jun 29, 2023
@ryzokuken
Copy link
Member

ryzokuken commented Jul 21, 2023

This got approval at TG1, merging after merge conflict is fixed.

@FrankYFTang
Copy link
Contributor

The following tests in test262 need to be updated to match this PR

'intl402/DateTimeFormat/constructor-options-order-dayPeriod': [FAIL],
'intl402/DateTimeFormat/constructor-options-order': [FAIL],
'intl402/DateTimeFormat/constructor-options-order-fractionalSecondDigits': [FAIL],
'intl402/DateTimeFormat/constructor-options-order-timedate-style': [FAIL],

FrankYFTang added a commit to FrankYFTang/test262 that referenced this pull request Jul 21, 2023
ECMA402 PR709 remove unnecessary duplicated GetOption calls
This PR sync the test to PR709
PR709 recach TC39 consensus in July 2023 meeting.

tc39/ecma402#709
@FrankYFTang
Copy link
Contributor

Fix tests in tc39/test262#3879

@anba
Copy link
Contributor Author

anba commented Jul 22, 2023

The following tests in test262 need to be updated to match this PR

The test updates are in tc39/test262#3768.

@FrankYFTang
Copy link
Contributor

please rebase, resolve conflict and merge. Thanks

@justingrant
Copy link
Contributor

@ryzokuken - why is there a merge commit in this PR?

@ryzokuken
Copy link
Member

@justingrant because I tried giving the GitHub interface a chance :/ Will rebase manually next time.

@ljharb
Copy link
Member

ljharb commented Jul 27, 2023

@ryzokuken for future reference, there's an arrow next to "update branch" that lets you select "rebase branch", and it should work fine from the UI.

@ryzokuken
Copy link
Member

After a lot of confusion, I realized that part of my troubles fixing up the merge issues was that the commits were already in the main branch? 02bd03a. Closing the PR, phew.

@ryzokuken ryzokuken closed this Jul 27, 2023
Ms2ger pushed a commit to anba/test262 that referenced this pull request Jul 27, 2023
Ms2ger pushed a commit to tc39/test262 that referenced this pull request Jul 27, 2023
patrik-lengweiler pushed a commit to hexagon-geo-surv/v8 that referenced this pull request Jul 28, 2023
tc39/ecma402#709

Change DateTimeFormat logic to read option only once.
Track which fields is not undefined from the GetOptions.
Change test/intl to reflect the change and remove dup test.

PR709 reached TC39 consensus in July 2023 meeting.

Bug: v8:13908
Change-Id: I5a5429f6375a01b04e77093d32acb76ae1e40d11
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4706795
Commit-Queue: Frank Tang <[email protected]>
Reviewed-by: Shu-yu Guo <[email protected]>
Cr-Commit-Position: refs/heads/main@{#89241}
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Nov 5, 2023
…DateTimeFormat objects. r=dminor

Implements the changes from <tc39/ecma402#709>.

The `intl_DateTimeFormat` self-hosted function is replaced with `intl_CreateDateTimeFormat`,
which implements the new `CreateDateTimeFormat` abstract operation from the spec.

`intl_CreateDateTimeFormat` calls into the existing `InitializeDateTimeFormat` function
to actually initialise the newly created date-time formatter.

Differential Revision: https://phabricator.services.mozilla.com/D189539
jamienicol pushed a commit to jamienicol/gecko that referenced this pull request Nov 6, 2023
…DateTimeFormat objects. r=dminor

Implements the changes from <tc39/ecma402#709>.

The `intl_DateTimeFormat` self-hosted function is replaced with `intl_CreateDateTimeFormat`,
which implements the new `CreateDateTimeFormat` abstract operation from the spec.

`intl_CreateDateTimeFormat` calls into the existing `InitializeDateTimeFormat` function
to actually initialise the newly created date-time formatter.

Differential Revision: https://phabricator.services.mozilla.com/D189539
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Nov 8, 2023
…DateTimeFormat objects. r=dminor

Implements the changes from <tc39/ecma402#709>.

The `intl_DateTimeFormat` self-hosted function is replaced with `intl_CreateDateTimeFormat`,
which implements the new `CreateDateTimeFormat` abstract operation from the spec.

`intl_CreateDateTimeFormat` calls into the existing `InitializeDateTimeFormat` function
to actually initialise the newly created date-time formatter.

Differential Revision: https://phabricator.services.mozilla.com/D189539

UltraBlame original commit: c1042546a44b0a4c0bcd37a6f3a6e6c6070a4cff
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Nov 8, 2023
…DateTimeFormat objects. r=dminor

Implements the changes from <tc39/ecma402#709>.

The `intl_DateTimeFormat` self-hosted function is replaced with `intl_CreateDateTimeFormat`,
which implements the new `CreateDateTimeFormat` abstract operation from the spec.

`intl_CreateDateTimeFormat` calls into the existing `InitializeDateTimeFormat` function
to actually initialise the newly created date-time formatter.

Differential Revision: https://phabricator.services.mozilla.com/D189539

UltraBlame original commit: c1042546a44b0a4c0bcd37a6f3a6e6c6070a4cff
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Nov 8, 2023
…DateTimeFormat objects. r=dminor

Implements the changes from <tc39/ecma402#709>.

The `intl_DateTimeFormat` self-hosted function is replaced with `intl_CreateDateTimeFormat`,
which implements the new `CreateDateTimeFormat` abstract operation from the spec.

`intl_CreateDateTimeFormat` calls into the existing `InitializeDateTimeFormat` function
to actually initialise the newly created date-time formatter.

Differential Revision: https://phabricator.services.mozilla.com/D189539

UltraBlame original commit: c1042546a44b0a4c0bcd37a6f3a6e6c6070a4cff
@anba anba deleted the date-time-options-new branch June 20, 2024 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has consensus Has consensus from TC39-TG2 normative
Projects
Archived in project
8 participants