diff --git a/app/javascript/gabsocial/utils/numbers.js b/app/javascript/gabsocial/utils/numbers.js index 727d5483..63e3bc96 100644 --- a/app/javascript/gabsocial/utils/numbers.js +++ b/app/javascript/gabsocial/utils/numbers.js @@ -14,9 +14,13 @@ export const shortNumberFormat = (number) => { } } + const isMillions = number > 999999 + const isThousands = number > 999 && !isMillions + const divisor = isMillions ? 1000000 : isThousands ? 1000 : 1 + const suffix = isMillions ? 'm' : isThousands ? 'k' : '' return ( - k + {suffix} ) }