Skip to content

Commit

Permalink
fix: fix uncaught error in proposal time remaining (#998)
Browse files Browse the repository at this point in the history
  • Loading branch information
emccorson committed Aug 19, 2024
1 parent 28c60f3 commit 7cf5d7f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion apps/namadillo/src/App/Governance/ProposalHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ const TimeRemaining: React.FC<{
proposal.currentTime,
proposal.endTime
);
return `${timeRemaining} Remaining`;
return timeRemaining ? `${timeRemaining} Remaining` : "";
}
}

Expand Down
7 changes: 3 additions & 4 deletions apps/namadillo/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,10 @@ export const secondsToDateTimeString = (seconds: bigint): string =>
export const secondsToTimeRemainingString = (
startTimeInSeconds: bigint,
endTimeInSeconds: bigint
): string => {
): string | undefined => {
return;
if (endTimeInSeconds < startTimeInSeconds) {
throw new Error(
`endTimeInSeconds ${endTimeInSeconds} is before startTimeInSeconds ${startTimeInSeconds}`
);
return undefined;
}

const toMilliNumber = (n: bigint): number =>
Expand Down

0 comments on commit 7cf5d7f

Please sign in to comment.