Skip to content

Commit

Permalink
Temporal: Fix PlainDateTime construct args
Browse files Browse the repository at this point in the history
I discovered these tests had omitted some arguments to the PlainDateTime
constructor, leaving the calendar in the wrong position.

The tests were technically not incorrect, since the operation
ToIntegerThrowOnInfinity on the string "gregory" gives 0. But they could
spuriously pass if the implementation didn't do argument conversion
correctly, failed to throw on eraYear being ±Infinity, but subsequently
threw RangeError anyway because the calendars of the arguments didn't
match.
  • Loading branch information
ptomato authored and Ms2ger committed Oct 26, 2022
1 parent ade328d commit 85373b4
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ includes: [compareArray.js, temporalHelpers.js]
features: [Temporal]
---*/

const other = new Temporal.PlainDateTime(2000, 5, 2, 15, "gregory");
const other = new Temporal.PlainDateTime(2000, 5, 2, 15, 0, 0, 0, 0, 0, "gregory");
const base = { era: "ad", month: 5, day: 2, hour: 15, calendar: "gregory" };

[Infinity, -Infinity].forEach((inf) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ includes: [compareArray.js, temporalHelpers.js]
features: [Temporal]
---*/

const instance = new Temporal.PlainDateTime(2000, 5, 2, 15, "gregory");
const instance = new Temporal.PlainDateTime(2000, 5, 2, 15, 0, 0, 0, 0, 0, "gregory");
const base = { era: "ad", month: 5, day: 2, hour: 15, calendar: "gregory" };

[Infinity, -Infinity].forEach((inf) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ includes: [compareArray.js, temporalHelpers.js]
features: [Temporal]
---*/

const instance = new Temporal.PlainDateTime(2000, 5, 2, 15, "gregory");
const instance = new Temporal.PlainDateTime(2000, 5, 2, 15, 0, 0, 0, 0, 0, "gregory");
const base = { era: "ad", month: 5, day: 2, hour: 15, calendar: "gregory" };

[Infinity, -Infinity].forEach((inf) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ includes: [compareArray.js, temporalHelpers.js]
features: [Temporal]
---*/

const instance = new Temporal.PlainDateTime(2000, 5, 2, 15, "gregory");
const instance = new Temporal.PlainDateTime(2000, 5, 2, 15, 0, 0, 0, 0, 0, "gregory");
const base = { era: "ad", month: 5, day: 2, hour: 15, calendar: "gregory" };

[Infinity, -Infinity].forEach((inf) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ includes: [compareArray.js, temporalHelpers.js]
features: [Temporal]
---*/

const instance = new Temporal.PlainDateTime(2000, 5, 2, 15, "gregory");
const instance = new Temporal.PlainDateTime(2000, 5, 2, 15, 0, 0, 0, 0, 0, "gregory");
const base = { era: "ad", month: 5, day: 2, calendar: "gregory" };

[Infinity, -Infinity].forEach((inf) => {
Expand Down

0 comments on commit 85373b4

Please sign in to comment.