fix(stats): format market share tokens

This commit is contained in:
Adam 2026-06-22 07:45:57 -05:00
commit 36264ccf90
No known key found for this signature in database
GPG key ID: 9CB48779AF150E75
2 changed files with 6 additions and 5 deletions

View file

@ -1450,9 +1450,7 @@ function formatCountryName(country: string) {
}
function formatGeoTokens(value: number) {
if (value >= 1) return formatTrillions(value)
if (value >= 0.001) return `${Number((value * 1000).toFixed(value >= 0.01 ? 0 : 1))}B`
return `${Math.round(value * 1_000_000)}M`
return formatTrillions(value)
}
function formatGeoShare(value: number) {
@ -1508,6 +1506,9 @@ function formatMarketMobileDate(label: string) {
}
function formatTrillions(value: number) {
if (value === 0) return "0"
if (value < 0.001) return `${Number((value * 1_000_000).toFixed(value >= 0.00001 ? 0 : 1))}M`
if (value < 1) return `${Number((value * 1_000).toFixed(value >= 0.01 ? 0 : 1))}B`
return `${value.toFixed(value >= 10 ? 0 : 1)}T`
}