-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Normative: Correct names of properties on ZonedDateTime.getISOFields …
…object This was an oversight due to two pull requests crossing each other. The "iso" prefix was an intentional choice, for consistency, and to keep the possibility of time calendars open. Closes: #1508
- Loading branch information
Showing
7 changed files
with
113 additions
and
6 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
polyfill/test/PlainDate/prototype/getISOFields/field-names.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// 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: Correct field names on the object returned from getISOFields | ||
---*/ | ||
|
||
const date = new Temporal.PlainDate(2000, 5, 2); | ||
|
||
const result = date.getISOFields(); | ||
assert.sameValue(result.isoYear, 2000, "isoYear result"); | ||
assert.sameValue(result.isoMonth, 5, "isoMonth result"); | ||
assert.sameValue(result.isoDay, 2, "isoDay result"); | ||
assert.sameValue(result.calendar.id, "iso8601", "calendar result"); |
21 changes: 21 additions & 0 deletions
21
polyfill/test/PlainDateTime/prototype/getISOFields/field-names.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// 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: Correct field names on the object returned from getISOFields | ||
---*/ | ||
|
||
const datetime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); | ||
|
||
const result = datetime.getISOFields(); | ||
assert.sameValue(result.isoYear, 2000, "isoYear result"); | ||
assert.sameValue(result.isoMonth, 5, "isoMonth result"); | ||
assert.sameValue(result.isoDay, 2, "isoDay result"); | ||
assert.sameValue(result.isoHour, 12, "isoHour result"); | ||
assert.sameValue(result.isoMinute, 34, "isoMinute result"); | ||
assert.sameValue(result.isoSecond, 56, "isoSecond result"); | ||
assert.sameValue(result.isoMillisecond, 987, "isoMillisecond result"); | ||
assert.sameValue(result.isoMicrosecond, 654, "isoMicrosecond result"); | ||
assert.sameValue(result.isoNanosecond, 321, "isoNanosecond result"); | ||
assert.sameValue(result.calendar.id, "iso8601", "calendar result"); |
15 changes: 15 additions & 0 deletions
15
polyfill/test/PlainMonthDay/prototype/getISOFields/field-names.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// 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: Correct field names on the object returned from getISOFields | ||
---*/ | ||
|
||
const md = new Temporal.PlainMonthDay(5, 2); | ||
|
||
const result = md.getISOFields(); | ||
assert.sameValue(result.isoYear, 1972, "isoYear result"); | ||
assert.sameValue(result.isoMonth, 5, "isoMonth result"); | ||
assert.sameValue(result.isoDay, 2, "isoDay result"); | ||
assert.sameValue(result.calendar.id, "iso8601", "calendar result"); |
18 changes: 18 additions & 0 deletions
18
polyfill/test/PlainTime/prototype/getISOFields/field-names.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// 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: Correct field names on the object returned from getISOFields | ||
---*/ | ||
|
||
const time = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); | ||
|
||
const result = time.getISOFields(); | ||
assert.sameValue(result.isoHour, 12, "isoHour result"); | ||
assert.sameValue(result.isoMinute, 34, "isoMinute result"); | ||
assert.sameValue(result.isoSecond, 56, "isoSecond result"); | ||
assert.sameValue(result.isoMillisecond, 987, "isoMillisecond result"); | ||
assert.sameValue(result.isoMicrosecond, 654, "isoMicrosecond result"); | ||
assert.sameValue(result.isoNanosecond, 321, "isoNanosecond result"); | ||
assert.sameValue(result.calendar.id, "iso8601", "calendar result"); |
15 changes: 15 additions & 0 deletions
15
polyfill/test/PlainYearMonth/prototype/getISOFields/field-names.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// 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: Correct field names on the object returned from getISOFields | ||
---*/ | ||
|
||
const ym = new Temporal.PlainYearMonth(2000, 5); | ||
|
||
const result = ym.getISOFields(); | ||
assert.sameValue(result.isoYear, 2000, "isoYear result"); | ||
assert.sameValue(result.isoMonth, 5, "isoMonth result"); | ||
assert.sameValue(result.isoDay, 1, "isoDay result"); | ||
assert.sameValue(result.calendar.id, "iso8601", "calendar result"); |
23 changes: 23 additions & 0 deletions
23
polyfill/test/ZonedDateTime/prototype/getISOFields/field-names.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.zoneddatetime.prototype.getisofields | ||
description: Correct field names on the object returned from getISOFields | ||
---*/ | ||
|
||
const datetime = new Temporal.ZonedDateTime(1_000_086_400_987_654_321n, "UTC"); | ||
|
||
const result = datetime.getISOFields(); | ||
assert.sameValue(result.isoYear, 2001, "isoYear result"); | ||
assert.sameValue(result.isoMonth, 9, "isoMonth result"); | ||
assert.sameValue(result.isoDay, 10, "isoDay result"); | ||
assert.sameValue(result.isoHour, 1, "isoHour result"); | ||
assert.sameValue(result.isoMinute, 46, "isoMinute result"); | ||
assert.sameValue(result.isoSecond, 40, "isoSecond result"); | ||
assert.sameValue(result.isoMillisecond, 987, "isoMillisecond result"); | ||
assert.sameValue(result.isoMicrosecond, 654, "isoMicrosecond result"); | ||
assert.sameValue(result.isoNanosecond, 321, "isoNanosecond result"); | ||
assert.sameValue(result.offset, "+00:00", "offset result"); | ||
assert.sameValue(result.calendar.id, "iso8601", "calendar result"); | ||
assert.sameValue(result.timeZone.id, "UTC", "timeZone result"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters