Skip to content

Commit 0947c07

Browse files
committed
Ensure MoveRelativeDateTime is always called with a PlainDateTime
This is a bug in both the polyfill and the spec text, that is exposed by the tests added in the following commit.
1 parent 33f33eb commit 0947c07

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

lib/ecmascript.mjs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2849,9 +2849,7 @@ export const ES = ObjectAssign({}, ES2020, {
28492849

28502850
let calendar;
28512851
if (relativeTo) {
2852-
if (!(ES.IsTemporalDateTime(relativeTo) || ES.IsTemporalZonedDateTime(relativeTo))) {
2853-
throw new TypeError('starting point must be PlainDateTime or ZonedDateTime');
2854-
}
2852+
relativeTo = ES.ToTemporalDateTime(relativeTo);
28552853
calendar = GetSlot(relativeTo, CALENDAR);
28562854
}
28572855

@@ -2932,9 +2930,7 @@ export const ES = ObjectAssign({}, ES2020, {
29322930

29332931
let calendar;
29342932
if (relativeTo) {
2935-
if (!(ES.IsTemporalDateTime(relativeTo) || ES.IsTemporalZonedDateTime(relativeTo))) {
2936-
throw new TypeError('starting point must be PlainDateTime or ZonedDateTime');
2937-
}
2933+
relativeTo = ES.ToTemporalDateTime(relativeTo);
29382934
calendar = GetSlot(relativeTo, CALENDAR);
29392935
}
29402936

0 commit comments

Comments
 (0)