Skip to content

Commit

Permalink
workarounds for spreads for SWC minification :(
Browse files Browse the repository at this point in the history
  • Loading branch information
arshaw committed Apr 4, 2024
1 parent 05ca352 commit 943a534
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
25 changes: 22 additions & 3 deletions packages/temporal-polyfill/src/internal/isoFormat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,35 @@ export function formatZonedDateTimeIso<C extends IdLike, T extends IdLike>(
zonedDateTimeSlots0: ZonedDateTimeSlots<C, T>,
options?: ZonedDateTimeDisplayOptions,
): string {
const [a, b, c, d, e, f] = refineZonedDateTimeDisplayOptions(options)
return formatZonedEpochNanoIso(
getTimeZoneOps,
zonedDateTimeSlots0.calendar,
zonedDateTimeSlots0.timeZone,
zonedDateTimeSlots0.epochNanoseconds,
...refineZonedDateTimeDisplayOptions(options),
// workaround for https://github.com/swc-project/swc/issues/8806
a,
b,
c,
d,
e,
f,
)
}

export function formatPlainDateTimeIso<C extends IdLike>(
plainDateTimeSlots0: PlainDateTimeSlots<C>,
options?: DateTimeDisplayOptions,
): string {
const [a, b, c, d] = refineDateTimeDisplayOptions(options)
return formatDateTimeIso(
plainDateTimeSlots0.calendar,
plainDateTimeSlots0,
...refineDateTimeDisplayOptions(options),
// workaround for https://github.com/swc-project/swc/issues/8806
a,
b,
c,
d,
)
}

Expand Down Expand Up @@ -148,7 +160,14 @@ export function formatPlainTimeIso(
slots: PlainTimeSlots,
options?: TimeDisplayOptions,
): string {
return formatTimeIso(slots, ...refineTimeDisplayOptions(options))
const [a, b, c] = refineTimeDisplayOptions(options)
return formatTimeIso(
slots,
// workaround for https://github.com/swc-project/swc/issues/8806
a,
b,
c,
)
}

export function formatDurationIso(
Expand Down
15 changes: 7 additions & 8 deletions packages/temporal-polyfill/src/internal/round.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,13 @@ export function roundPlainTime(
slots: PlainTimeSlots,
options: TimeUnitName | RoundingOptions<TimeUnitName>,
): PlainTimeSlots {
const roundedIsoFields = roundTime(
slots,
...(refineRoundingOptions(options, Unit.Hour) as [
TimeUnit,
number,
RoundingMode,
]),
)
// workaround for https://github.com/swc-project/swc/issues/8806
const [a, b, c] = refineRoundingOptions(options, Unit.Hour) as [
TimeUnit,
number,
RoundingMode,
]
const roundedIsoFields = roundTime(slots, a, b, c)
return createPlainTimeSlots(roundedIsoFields)
}

Expand Down

0 comments on commit 943a534

Please sign in to comment.