Skip to content

Commit

Permalink
app: Remove trailing zeros from rates/volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
martonp committed Mar 8, 2023
1 parent d8f3e90 commit 70ddc4c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions client/webserver/site/src/js/markets.ts
Expand Up @@ -3066,14 +3066,13 @@ function sortedMarkets (): ExchangeMarket[] {
}

const FourSigFigs = new Intl.NumberFormat((navigator.languages as string[]), {
minimumSignificantDigits: 4,
maximumSignificantDigits: 4
})

const intFormatter = new Intl.NumberFormat((navigator.languages as string[]))

function fourSigFigs (v: number): string {
if (v < 100) return FourSigFigs.format(v)
if (v < 1000) return FourSigFigs.format(v)
return intFormatter.format(Math.round(v))
}

Expand Down
3 changes: 1 addition & 2 deletions client/webserver/site/src/js/wallets.ts
Expand Up @@ -1299,13 +1299,12 @@ function assetIsConfigurable (assetID: number) {
}

const FourSigFigs = new Intl.NumberFormat((navigator.languages as string[]), {
minimumSignificantDigits: 4,
maximumSignificantDigits: 4
})

const intFormatter = new Intl.NumberFormat((navigator.languages as string[]))

function fourSigFigs (v: number): string {
if (v < 100) return FourSigFigs.format(v)
if (v < 1000) return FourSigFigs.format(v)
return intFormatter.format(Math.round(v))
}

0 comments on commit 70ddc4c

Please sign in to comment.