Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions polyfill/lib/intl.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ if ('formatRangeToParts' in IntlDateTimeFormat.prototype) {

DateTimeFormat.prototype = Object.create(IntlDateTimeFormat.prototype, properties);

Object.defineProperty(DateTimeFormat, 'prototype', {
writable: false,
enumerable: false,
configurable: false
});

function resolvedOptions() {
return this[ORIGINAL].resolvedOptions();
}
Expand Down
24 changes: 24 additions & 0 deletions polyfill/lib/shim.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,28 @@ function copy(target, source) {
}
}

// Work around https://github.com/babel/babel/issues/2025.
const types = [
globalThis.Temporal.Instant,
globalThis.Temporal.Calendar,
globalThis.Temporal.PlainDate,
globalThis.Temporal.PlainDateTime,
globalThis.Temporal.Duration,
globalThis.Temporal.PlainMonthDay,
// globalThis.Temporal.Now, // plain object (not a constructor), so no `prototype`
globalThis.Temporal.PlainTime,
globalThis.Temporal.TimeZone,
globalThis.Temporal.PlainYearMonth,
globalThis.Temporal.ZonedDateTime
];
for (const type of types) {
const descriptor = Object.getOwnPropertyDescriptor(type, 'prototype');
if (descriptor.configurable || descriptor.enumerable || descriptor.writable) {
descriptor.configurable = false;
descriptor.enumerable = false;
descriptor.writable = false;
Object.defineProperty(type, 'prototype', descriptor);
}
}

export { Temporal, Intl, toTemporalInstant };