From 7d1b18619a720a0d6dc5879815b1e64be5e7917b Mon Sep 17 00:00:00 2001 From: jonsadev Date: Tue, 15 Jan 2019 15:51:34 -0700 Subject: [PATCH] web-ui: Update explorerCurrency pipe to fix 8 decimals (#81) --- web-ui/src/app/pipes/explorer-currency.pipe.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/web-ui/src/app/pipes/explorer-currency.pipe.ts b/web-ui/src/app/pipes/explorer-currency.pipe.ts index 594c0a0..7e2bc7b 100644 --- a/web-ui/src/app/pipes/explorer-currency.pipe.ts +++ b/web-ui/src/app/pipes/explorer-currency.pipe.ts @@ -6,6 +6,13 @@ import { Config } from '../config'; }) export class ExplorerCurrencyPipe implements PipeTransform { transform(currency: any): string { - return `${ currency } ${ Config.currentCurrency }`; + let currencyNumber: number; + if (typeof(currency) === 'number') { + currencyNumber = currency; + } else if (typeof(currency) === 'string') { + currencyNumber = parseFloat(currency); + } + + return `${ currencyNumber.toFixed(8) } ${ Config.currentCurrency }`; } }