Skip to content

Commit a73b0fb

Browse files
committed
Fix list of field names passed to calendar.fields()
In ToTemporalDateTime and ToTemporalZonedDateTime, the polyfill did not match the spec text. The list of fields in the spec text includes the time field names. (This will be tested in a following commit.)
1 parent 3d72048 commit a73b0fb

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

lib/ecmascript.mjs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,18 @@ export const ES = ObjectAssign({}, ES2020, {
12361236
}
12371237

12381238
calendar = ES.GetOptionalTemporalCalendar(item);
1239-
const fieldNames = ES.CalendarFields(calendar, ['day', 'month', 'monthCode', 'year']);
1239+
const fieldNames = ES.CalendarFields(calendar, [
1240+
'day',
1241+
'hour',
1242+
'microsecond',
1243+
'millisecond',
1244+
'minute',
1245+
'month',
1246+
'monthCode',
1247+
'nanosecond',
1248+
'second',
1249+
'year'
1250+
]);
12401251
const fields = ES.ToTemporalDateTimeFields(item, fieldNames);
12411252
({
12421253
year,
@@ -1508,7 +1519,18 @@ export const ES = ObjectAssign({}, ES2020, {
15081519
if (ES.Type(item) === 'Object') {
15091520
if (ES.IsTemporalZonedDateTime(item)) return item;
15101521
calendar = ES.GetOptionalTemporalCalendar(item);
1511-
const fieldNames = ES.CalendarFields(calendar, ['day', 'month', 'year']);
1522+
const fieldNames = ES.CalendarFields(calendar, [
1523+
'day',
1524+
'hour',
1525+
'microsecond',
1526+
'millisecond',
1527+
'minute',
1528+
'month',
1529+
'monthCode',
1530+
'nanosecond',
1531+
'second',
1532+
'year'
1533+
]);
15121534
const fields = ES.ToTemporalZonedDateTimeFields(item, fieldNames);
15131535
({
15141536
year,

0 commit comments

Comments
 (0)