diff options
Diffstat (limited to 'packages/taler-util')
-rw-r--r-- | packages/taler-util/src/amounts.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/packages/taler-util/src/amounts.ts b/packages/taler-util/src/amounts.ts index f0434be0e..5a8c7f06f 100644 --- a/packages/taler-util/src/amounts.ts +++ b/packages/taler-util/src/amounts.ts @@ -407,7 +407,7 @@ export class Amounts { return `${a.currency}:${s}`; } - static stringifyValue(a: AmountJson): string { + static stringifyValue(a: AmountJson, minFractional: number = 0): string { const av = a.value + Math.floor(a.fraction / amountFractionalBase); const af = a.fraction % amountFractionalBase; let s = av.toString(); @@ -416,7 +416,7 @@ export class Amounts { s = s + "."; let n = af; for (let i = 0; i < amountFractionalLength; i++) { - if (!n) { + if (!n && i >= minFractional) { break; } s = s + Math.floor((n / amountFractionalBase) * 10).toString(); |