Skip to content

Commit 72d282f

Browse files
committed
fix the case where there is no decimal value passed
1 parent 2169530 commit 72d282f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libs/CurrencyUtils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ function convertToFrontendAmountAsInteger(amountAsInt: number): number {
9898
* @note we do not support any currencies with more than two decimal places.
9999
*/
100100
function convertToFrontendAmountAsString(amountAsInt: number): string {
101-
return convertToFrontendAmountAsInteger(amountAsInt).toFixed(2);
101+
const shouldShowDecimal = amountAsInt % 100 === 0;
102+
return amountAsInt ? convertToFrontendAmountAsInteger(amountAsInt).toFixed(shouldShowDecimal ? 0 : 2) : '';
102103
}
103104

104105
/**

0 commit comments

Comments
 (0)