Skip to content

Commit

Permalink
Normative: Correct definition order of properties on PlainDateTime.ge…
Browse files Browse the repository at this point in the history
…tISOFields object

This was intended to be alphabetical.

See: #1508
  • Loading branch information
ptomato committed May 12, 2021
1 parent d4c90c8 commit ea55c7d
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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);
Original file line number Diff line number Diff line change
@@ -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);
Original file line number Diff line number Diff line change
@@ -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);
Original file line number Diff line number Diff line change
@@ -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);
Original file line number Diff line number Diff line change
@@ -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);
Original file line number Diff line number Diff line change
@@ -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);
2 changes: 1 addition & 1 deletion spec/plaindatetime.html
Original file line number Diff line number Diff line change
Expand Up @@ -712,10 +712,10 @@ <h1>Temporal.PlainDateTime.prototype.getISOFields ( )</h1>
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]])).
Expand Down

0 comments on commit ea55c7d

Please sign in to comment.