From dd1bbcfb0b22fda76018fda653cdfc95e5f05c69 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Thu, 25 May 2023 17:26:34 -0500 Subject: Add scrollview to drawer --- src/view/com/util/numeric/format.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/view/com/util/numeric/format.ts') diff --git a/src/view/com/util/numeric/format.ts b/src/view/com/util/numeric/format.ts index f0e90217f..7aa5a4f4d 100644 --- a/src/view/com/util/numeric/format.ts +++ b/src/view/com/util/numeric/format.ts @@ -3,3 +3,13 @@ export const formatCount = (num: number) => notation: 'compact', maximumFractionDigits: 1, }).format(num) + +export function formatCountShortOnly(num: number): string { + if (num >= 1000000) { + return (num / 1000000).toFixed(1) + 'M' + } + if (num >= 1000) { + return (num / 1000).toFixed(1) + 'K' + } + return String(num) +} -- cgit 1.4.1