Skip to content

Commit bf7a738

Browse files
Ms2gerptomato
authored andcommitted
[polyfill] Handle missing argument to withCalendar methods.
1 parent 36082aa commit bf7a738

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

lib/plaindate.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ export class PlainDate {
127127
}
128128
withCalendar(calendar) {
129129
if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');
130+
calendar = ES.ToTemporalCalendar(calendar);
130131
return new PlainDate(GetSlot(this, ISO_YEAR), GetSlot(this, ISO_MONTH), GetSlot(this, ISO_DAY), calendar);
131132
}
132133
add(temporalDurationLike, options = undefined) {

lib/plaindatetime.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ export class PlainDateTime {
271271
}
272272
withCalendar(calendar) {
273273
if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');
274+
calendar = ES.ToTemporalCalendar(calendar);
274275
return new PlainDateTime(
275276
GetSlot(this, ISO_YEAR),
276277
GetSlot(this, ISO_MONTH),

0 commit comments

Comments
 (0)