[Embeds] Format big numbers (#5087)

This commit is contained in:
Samuel Newman
2024-09-02 21:04:26 +01:00
committed by GitHub
parent f3f7dfc3e6
commit 0469ca6cb4
6 changed files with 21 additions and 11 deletions
+10
View File
@@ -16,3 +16,13 @@ export function getRkey({uri}: {uri: string}): string {
const at = new AtUri(uri)
return at.rkey
}
const formatter = new Intl.NumberFormat('en-US', {
notation: 'compact',
maximumFractionDigits: 1,
roundingMode: 'trunc',
})
export function prettyNumber(number: number) {
return formatter.format(number)
}