Skip to content

Commit 8f7261d

Browse files
committed
Polyfill: Update to reflect editorial change in ToTemporalZonedDateTime
See PR #3134.
1 parent f885885 commit 8f7261d

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

polyfill/lib/ecmascript.mjs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,7 +1480,7 @@ export function InterpretISODateTimeOffset(
14801480
export function ToTemporalZonedDateTime(item, options = undefined) {
14811481
let isoDate, time, timeZone, offset, calendar;
14821482
let matchMinute = false;
1483-
let offsetBehaviour = 'option';
1483+
let hasUTCDesignator = false;
14841484
let disambiguation, offsetOpt;
14851485
if (Type(item) === 'Object') {
14861486
if (IsTemporalZonedDateTime(item)) {
@@ -1503,9 +1503,6 @@ export function ToTemporalZonedDateTime(item, options = undefined) {
15031503
['timeZone']
15041504
);
15051505
({ offset, timeZone } = fields);
1506-
if (offset === undefined) {
1507-
offsetBehaviour = 'wall';
1508-
}
15091506
const resolvedOptions = GetOptionsObject(options);
15101507
disambiguation = GetTemporalDisambiguationOption(resolvedOptions);
15111508
offsetOpt = GetTemporalOffsetOption(resolvedOptions, 'reject');
@@ -1517,11 +1514,7 @@ export function ToTemporalZonedDateTime(item, options = undefined) {
15171514
RequireString(item)
15181515
));
15191516
timeZone = ToTemporalTimeZoneIdentifier(tzAnnotation);
1520-
if (z) {
1521-
offsetBehaviour = 'exact';
1522-
} else if (!offset) {
1523-
offsetBehaviour = 'wall';
1524-
}
1517+
if (z) hasUTCDesignator = true;
15251518
if (!calendar) calendar = 'iso8601';
15261519
calendar = CanonicalizeCalendar(calendar);
15271520
// Allow imprecise offset matching unless the provided offset is precise
@@ -1538,6 +1531,12 @@ export function ToTemporalZonedDateTime(item, options = undefined) {
15381531
GetTemporalOverflowOption(resolvedOptions); // validate and ignore
15391532
isoDate = { year, month, day };
15401533
}
1534+
let offsetBehaviour = 'option';
1535+
if (hasUTCDesignator) {
1536+
offsetBehaviour = 'exact';
1537+
} else if (!offset) {
1538+
offsetBehaviour = 'wall';
1539+
}
15411540
let offsetNs = 0;
15421541
if (offsetBehaviour === 'option') offsetNs = ParseDateTimeUTCOffset(offset);
15431542
const epochNanoseconds = InterpretISODateTimeOffset(

0 commit comments

Comments
 (0)