Skip to content

Commit

Permalink
fix: add invertedSignIndicator option to formatDiffToTimecode() so av…
Browse files Browse the repository at this point in the history
…oid reverting time prior to calculating output.
  • Loading branch information
olzzon committed Oct 3, 2024
1 parent 26bda30 commit 29b1600
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion packages/webui/src/client/lib/rundown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ export namespace RundownUtils {
useSmartHours?: boolean,
minusPrefix?: string,
floorTime?: boolean,
hardFloor?: boolean
hardFloor?: boolean,
invertedSignIndicator?: boolean
): string {
let isNegative = milliseconds < 0
if (isNegative) {
Expand Down Expand Up @@ -177,6 +178,11 @@ export namespace RundownUtils {
}
}

// Reverse the + indicator to show overtime:
if (invertedSignIndicator && !(hours === 0 && minutes === 0 && secondsRest === 0)) {
isNegative = !isNegative
}

return (
(isNegative
? minusPrefix !== undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ export const CurrentPartOrSegmentRemaining = withTiming<IPartRemainingProps, {}>
<span
className={ClassNames(
this.props.className,
Math.floor(displayTimecode / 1000) <= 0 ? this.props.heavyClassName : undefined
Math.floor(displayTimecode / 1000) < 0 ? this.props.heavyClassName : undefined
)}
role="timer"
>
{RundownUtils.formatDiffToTimecode(displayTimecode || 0, true, false, true, false, true, '+', false, true)}
{RundownUtils.formatDiffToTimecode(displayTimecode, true, false, true, false, true, '', false, true, true)}
</span>
)
}
Expand Down

0 comments on commit 29b1600

Please sign in to comment.