Skip to content

Commit

Permalink
fix the case where there is no decimal value passed
Browse files Browse the repository at this point in the history
  • Loading branch information
abzokhattab committed Feb 6, 2024
1 parent 2169530 commit 72d282f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libs/CurrencyUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ function convertToFrontendAmountAsInteger(amountAsInt: number): number {
* @note we do not support any currencies with more than two decimal places.
*/
function convertToFrontendAmountAsString(amountAsInt: number): string {
return convertToFrontendAmountAsInteger(amountAsInt).toFixed(2);
const shouldShowDecimal = amountAsInt % 100 === 0;
return amountAsInt ? convertToFrontendAmountAsInteger(amountAsInt).toFixed(shouldShowDecimal ? 0 : 2) : '';
}

/**
Expand Down

0 comments on commit 72d282f

Please sign in to comment.