From 0e9666d926b5c7cb3436cbf15f6e477354adb504 Mon Sep 17 00:00:00 2001 From: Frank Tang Date: Wed, 11 Jan 2023 15:58:18 -0800 Subject: [PATCH 1/5] Merge PrepareTemporalFields Avoiding two different version of PrepareTemporalFields for unneeded reason by adding the era and eraYear check into the ECAM262 version and remove the ECMA402 version. --- spec/abstractops.html | 5 ++++ spec/intl.html | 56 ------------------------------------------- 2 files changed, 5 insertions(+), 56 deletions(-) diff --git a/spec/abstractops.html b/spec/abstractops.html index d561e46b19..b170596130 100644 --- a/spec/abstractops.html +++ b/spec/abstractops.html @@ -1705,6 +1705,11 @@

1. Perform ! CreateDataPropertyOrThrow(_result_, _property_, _value_). 1. If _requiredFields_ is ~partial~ and _any_ is *false*, then 1. Throw a *TypeError* exception. + 1. If _requiredFields_ is not ~partial~, then + 1. Let _era_ be ? Get(_result_, *"era"*). + 1. Let _eraYear_ be ? Get(_result_, *"eraYear"*). + 1. If _era_ is *undefined* and _eraYear_ is not *undefined*, throw a *RangeError* exception. + 1. If _era_ is not *undefined* and _eraYear_ is *undefined*, throw a *RangeError* exception. 1. Return _result_. diff --git a/spec/intl.html b/spec/intl.html index d97066e5fd..62c8c7c51f 100644 --- a/spec/intl.html +++ b/spec/intl.html @@ -2540,61 +2540,5 @@

get Temporal.ZonedDateTime.prototype.eraYear

- - - -

Abstract Operations

- - -

- PrepareTemporalFields ( - _fields_: an Object, - _fieldNames_: a List of property names, - _requiredFields_: ~partial~ or a List of property names, - ): either a normal completion containing an Object, or an abrupt completion -

-
-
description
-
This definition supersedes the definition provided in .
-
redefinition
-
true
-
- - 1. Let _result_ be OrdinaryObjectCreate(*null*). - 1. Let _any_ be *false*. - 1. For each property name _property_ of _fieldNames_, do - 1. Let _value_ be ? Get(_fields_, _property_). - 1. If _value_ is not *undefined*, then - 1. Set _any_ to *true*. - 1. If _property_ is in the Property column of and there is a Conversion value in the same row, then - 1. Let _Conversion_ be the Conversion value of the same row. - 1. If _Conversion_ is ~ToIntegerWithTruncation~, then - 1. Set _value_ to ? ToIntegerWithTruncation(_value_). - 1. Set _value_ to 𝔽(_value_). - 1. Else if _Conversion_ is ~ToPositiveIntegerWithTruncation~, then - 1. Set _value_ to ? ToPositiveIntegerWithTruncation(_value_). - 1. Set _value_ to 𝔽(_value_). - 1. Else, - 1. Assert: _Conversion_ is ~ToString~. - 1. Set _value_ to ? ToString(_value_). - 1. Perform ! CreateDataPropertyOrThrow(_result_, _property_, _value_). - 1. Else if _requiredFields_ is a List, then - 1. If _requiredFields_ contains _property_, then - 1. Throw a *TypeError* exception. - 1. If _property_ is in the Property column of , then - 1. Set _value_ to the corresponding Default value of the same row. - 1. Perform ! CreateDataPropertyOrThrow(_result_, _property_, _value_). - 1. If _requiredFields_ is ~partial~ and _any_ is *false*, then - 1. Throw a *TypeError* exception. - 1. If _requiredFields_ is not ~partial~, then - 1. Let _era_ be ? Get(_result_, *"era"*). - 1. Let _eraYear_ be ? Get(_result_, *"eraYear"*). - 1. If _era_ is *undefined* and _eraYear_ is not *undefined*, or if _era_ is not *undefined* and _eraYear_ is *undefined*, then - 1. Throw a *RangeError* exception. - 1. Return _result_. - -
-
-
From d1fe286b52a89cda30f76f3a47684ca055638674 Mon Sep 17 00:00:00 2001 From: Aditi Date: Wed, 25 Jan 2023 20:57:48 +0530 Subject: [PATCH 2/5] Remove era/eraYear check from PrepareTemporalFields --- spec/abstractops.html | 5 ----- 1 file changed, 5 deletions(-) diff --git a/spec/abstractops.html b/spec/abstractops.html index b170596130..d561e46b19 100644 --- a/spec/abstractops.html +++ b/spec/abstractops.html @@ -1705,11 +1705,6 @@

1. Perform ! CreateDataPropertyOrThrow(_result_, _property_, _value_). 1. If _requiredFields_ is ~partial~ and _any_ is *false*, then 1. Throw a *TypeError* exception. - 1. If _requiredFields_ is not ~partial~, then - 1. Let _era_ be ? Get(_result_, *"era"*). - 1. Let _eraYear_ be ? Get(_result_, *"eraYear"*). - 1. If _era_ is *undefined* and _eraYear_ is not *undefined*, throw a *RangeError* exception. - 1. If _era_ is not *undefined* and _eraYear_ is *undefined*, throw a *RangeError* exception. 1. Return _result_. From 6260c00841b4dd747b68da7e528989c3f4db32b1 Mon Sep 17 00:00:00 2001 From: Aditi Date: Fri, 10 Feb 2023 16:58:03 +0530 Subject: [PATCH 3/5] Updated polyfill --- polyfill/lib/ecmascript.mjs | 3 --- 1 file changed, 3 deletions(-) diff --git a/polyfill/lib/ecmascript.mjs b/polyfill/lib/ecmascript.mjs index 1e7f8af42c..974e902bd9 100644 --- a/polyfill/lib/ecmascript.mjs +++ b/polyfill/lib/ecmascript.mjs @@ -1029,9 +1029,6 @@ export const ES = ObjectAssign({}, ES2022, { if (requiredFields === 'partial' && !any) { throw new TypeError(emptySourceErrorMessage); } - if ((result['era'] === undefined) !== (result['eraYear'] === undefined)) { - throw new RangeError("properties 'era' and 'eraYear' must be provided together"); - } return result; }, ToTemporalTimeRecord: (bag, completeness = 'complete') => { From 787a1ac935bade2129e8c37c59443d3c1dc60907 Mon Sep 17 00:00:00 2001 From: Aditi Date: Tue, 7 Mar 2023 23:11:47 +0530 Subject: [PATCH 4/5] Add validation to check both era/eraYear are present for non-iso calendars --- polyfill/lib/calendar.mjs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/polyfill/lib/calendar.mjs b/polyfill/lib/calendar.mjs index f8a878543d..a2014e2da4 100644 --- a/polyfill/lib/calendar.mjs +++ b/polyfill/lib/calendar.mjs @@ -649,6 +649,11 @@ const nonIsoHelperBase = { throw new RangeError(`eraYear ${eraYear} does not match year ${year}`); } } + if (this.hasEra) { + if ((calendarDate['era'] === undefined) !== (calendarDate['eraYear'] === undefined)) { + throw new RangeError("properties 'era' and 'eraYear' must be provided together"); + } + } }, /** * Allows derived calendars to add additional fields and/or to make From d8c8bb1d29db4cee223ace0c8e358a61a7060360 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Tue, 7 Mar 2023 16:02:59 -0800 Subject: [PATCH 5/5] Update test262 --- polyfill/test262 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polyfill/test262 b/polyfill/test262 index 4f5eb40ee0..53e5ef817e 160000 --- a/polyfill/test262 +++ b/polyfill/test262 @@ -1 +1 @@ -Subproject commit 4f5eb40ee086135bb0fa2afa53062f6ebc449829 +Subproject commit 53e5ef817eb212d0d4f6f0ab44275094e5bf876d