Skip to content

Commit

Permalink
Polyfill: Make Duration.p.with() conform to spec
Browse files Browse the repository at this point in the history
The spec text uses ToTemporalPartialDurationRecord here, not
PrepareTemporalFields.

This is relevant because we are going to refactor PrepareTemporalFields as
part of #2925.
  • Loading branch information
ptomato committed Aug 21, 2024
1 parent bb245a8 commit 54f79f6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
19 changes: 2 additions & 17 deletions polyfill/lib/duration.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -160,23 +160,8 @@ export class Duration {
}
with(durationLike) {
if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');
const partialDuration = ES.PrepareTemporalFields(
durationLike,
[
'days',
'hours',
'microseconds',
'milliseconds',
'minutes',
'months',
'nanoseconds',
'seconds',
'weeks',
'years'
],
'partial'
);
let {
const partialDuration = ES.ToTemporalPartialDurationRecord(durationLike);
const {
years = GetSlot(this, YEARS),
months = GetSlot(this, MONTHS),
weeks = GetSlot(this, WEEKS),
Expand Down
10 changes: 0 additions & 10 deletions polyfill/lib/ecmascript.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -229,16 +229,6 @@ const BUILTIN_CASTS = new Map([
['millisecond', ToIntegerWithTruncation],
['microsecond', ToIntegerWithTruncation],
['nanosecond', ToIntegerWithTruncation],
['years', ToIntegerIfIntegral],
['months', ToIntegerIfIntegral],
['weeks', ToIntegerIfIntegral],
['days', ToIntegerIfIntegral],
['hours', ToIntegerIfIntegral],
['minutes', ToIntegerIfIntegral],
['seconds', ToIntegerIfIntegral],
['milliseconds', ToIntegerIfIntegral],
['microseconds', ToIntegerIfIntegral],
['nanoseconds', ToIntegerIfIntegral],
['offset', ToPrimitiveAndRequireString]
]);

Expand Down

0 comments on commit 54f79f6

Please sign in to comment.