From ea55c7d3c1b811a80dbd46e0d2f1a8921078e3cb Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Wed, 12 May 2021 15:24:45 -0700 Subject: [PATCH] Normative: Correct definition order of properties on PlainDateTime.getISOFields object This was intended to be alphabetical. See: #1508 --- .../getISOFields/field-traversal-order.js | 20 +++++++++++++ .../getISOFields/field-traversal-order.js | 26 +++++++++++++++++ .../getISOFields/field-traversal-order.js | 20 +++++++++++++ .../getISOFields/field-traversal-order.js | 23 +++++++++++++++ .../getISOFields/field-traversal-order.js | 20 +++++++++++++ .../getISOFields/field-traversal-order.js | 28 +++++++++++++++++++ spec/plaindatetime.html | 2 +- 7 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 polyfill/test/PlainDate/prototype/getISOFields/field-traversal-order.js create mode 100644 polyfill/test/PlainDateTime/prototype/getISOFields/field-traversal-order.js create mode 100644 polyfill/test/PlainMonthDay/prototype/getISOFields/field-traversal-order.js create mode 100644 polyfill/test/PlainTime/prototype/getISOFields/field-traversal-order.js create mode 100644 polyfill/test/PlainYearMonth/prototype/getISOFields/field-traversal-order.js create mode 100644 polyfill/test/ZonedDateTime/prototype/getISOFields/field-traversal-order.js diff --git a/polyfill/test/PlainDate/prototype/getISOFields/field-traversal-order.js b/polyfill/test/PlainDate/prototype/getISOFields/field-traversal-order.js new file mode 100644 index 0000000000..32acd5555f --- /dev/null +++ b/polyfill/test/PlainDate/prototype/getISOFields/field-traversal-order.js @@ -0,0 +1,20 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.getisofields +description: Properties added in correct order to object returned from getISOFields +includes: [compareArray.js] +---*/ + +const expected = [ + "calendar", + "isoDay", + "isoMonth", + "isoYear", +]; + +const date = new Temporal.PlainDate(2000, 5, 2); +const result = date.getISOFields(); + +assert.compareArray(Object.keys(result), expected); diff --git a/polyfill/test/PlainDateTime/prototype/getISOFields/field-traversal-order.js b/polyfill/test/PlainDateTime/prototype/getISOFields/field-traversal-order.js new file mode 100644 index 0000000000..2bd791f602 --- /dev/null +++ b/polyfill/test/PlainDateTime/prototype/getISOFields/field-traversal-order.js @@ -0,0 +1,26 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.getisofields +description: Properties added in correct order to object returned from getISOFields +includes: [compareArray.js] +---*/ + +const expected = [ + "calendar", + "isoDay", + "isoHour", + "isoMicrosecond", + "isoMillisecond", + "isoMinute", + "isoMonth", + "isoNanosecond", + "isoSecond", + "isoYear", +]; + +const datetime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +const result = datetime.getISOFields(); + +assert.compareArray(Object.keys(result), expected); diff --git a/polyfill/test/PlainMonthDay/prototype/getISOFields/field-traversal-order.js b/polyfill/test/PlainMonthDay/prototype/getISOFields/field-traversal-order.js new file mode 100644 index 0000000000..e263c9baf9 --- /dev/null +++ b/polyfill/test/PlainMonthDay/prototype/getISOFields/field-traversal-order.js @@ -0,0 +1,20 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainmonthday.prototype.getisofields +description: Properties added in correct order to object returned from getISOFields +includes: [compareArray.js] +---*/ + +const expected = [ + "calendar", + "isoDay", + "isoMonth", + "isoYear", +]; + +const md = new Temporal.PlainMonthDay(5, 2); +const result = md.getISOFields(); + +assert.compareArray(Object.keys(result), expected); diff --git a/polyfill/test/PlainTime/prototype/getISOFields/field-traversal-order.js b/polyfill/test/PlainTime/prototype/getISOFields/field-traversal-order.js new file mode 100644 index 0000000000..f3ca6a82a7 --- /dev/null +++ b/polyfill/test/PlainTime/prototype/getISOFields/field-traversal-order.js @@ -0,0 +1,23 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.prototype.getisofields +description: Properties added in correct order to object returned from getISOFields +includes: [compareArray.js] +---*/ + +const expected = [ + "calendar", + "isoHour", + "isoMicrosecond", + "isoMillisecond", + "isoMinute", + "isoNanosecond", + "isoSecond", +]; + +const time = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); +const result = time.getISOFields(); + +assert.compareArray(Object.keys(result), expected); diff --git a/polyfill/test/PlainYearMonth/prototype/getISOFields/field-traversal-order.js b/polyfill/test/PlainYearMonth/prototype/getISOFields/field-traversal-order.js new file mode 100644 index 0000000000..042271349e --- /dev/null +++ b/polyfill/test/PlainYearMonth/prototype/getISOFields/field-traversal-order.js @@ -0,0 +1,20 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.getisofields +description: Properties added in correct order to object returned from getISOFields +includes: [compareArray.js] +---*/ + +const expected = [ + "calendar", + "isoDay", + "isoMonth", + "isoYear", +]; + +const ym = new Temporal.PlainYearMonth(2000, 5); +const result = ym.getISOFields(); + +assert.compareArray(Object.keys(result), expected); diff --git a/polyfill/test/ZonedDateTime/prototype/getISOFields/field-traversal-order.js b/polyfill/test/ZonedDateTime/prototype/getISOFields/field-traversal-order.js new file mode 100644 index 0000000000..e3541ed4e2 --- /dev/null +++ b/polyfill/test/ZonedDateTime/prototype/getISOFields/field-traversal-order.js @@ -0,0 +1,28 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.getisofields +description: Properties added in correct order to object returned from getISOFields +includes: [compareArray.js] +---*/ + +const expected = [ + "calendar", + "isoDay", + "isoHour", + "isoMicrosecond", + "isoMillisecond", + "isoMinute", + "isoMonth", + "isoNanosecond", + "isoSecond", + "isoYear", + "offset", + "timeZone", +]; + +const datetime = new Temporal.ZonedDateTime(1_000_086_400_987_654_321n, "UTC"); +const result = datetime.getISOFields(); + +assert.compareArray(Object.keys(result), expected); diff --git a/spec/plaindatetime.html b/spec/plaindatetime.html index e1f16abbca..5d104ba7c7 100644 --- a/spec/plaindatetime.html +++ b/spec/plaindatetime.html @@ -712,10 +712,10 @@

Temporal.PlainDateTime.prototype.getISOFields ( )

1. Perform ! CreateDataPropertyOrThrow(_fields_, *"calendar"*, _dateTime_.[[Calendar]]). 1. Perform ! CreateDataPropertyOrThrow(_fields_, *"isoDay"*, 𝔽(_dateTime_.[[ISODay]])). 1. Perform ! CreateDataPropertyOrThrow(_fields_, *"isoHour"*, 𝔽(_dateTime_.[[ISOHour]])). - 1. Perform ! CreateDataPropertyOrThrow(_fields_, *"isoMonth"*, 𝔽(_dateTime_.[[ISOMonth]])). 1. Perform ! CreateDataPropertyOrThrow(_fields_, *"isoMicrosecond"*, 𝔽(_dateTime_.[[ISOMicrosecond]])). 1. Perform ! CreateDataPropertyOrThrow(_fields_, *"isoMillisecond"*, 𝔽(_dateTime_.[[ISOMillisecond]])). 1. Perform ! CreateDataPropertyOrThrow(_fields_, *"isoMinute"*, 𝔽(_dateTime_.[[ISOMinute]])). + 1. Perform ! CreateDataPropertyOrThrow(_fields_, *"isoMonth"*, 𝔽(_dateTime_.[[ISOMonth]])). 1. Perform ! CreateDataPropertyOrThrow(_fields_, *"isoNanosecond"*, 𝔽(_dateTime_.[[ISONanosecond]])). 1. Perform ! CreateDataPropertyOrThrow(_fields_, *"isoSecond"*, 𝔽(_dateTime_.[[Second]])). 1. Perform ! CreateDataPropertyOrThrow(_fields_, *"isoYear"*, 𝔽(_dateTime_.[[ISOYear]])).