diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2019-08-13 12:22:33 +0200 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2019-08-19 21:49:39 +0200 |
commit | 26b249ad2dd04372aa56103ac59f9ece2eb58f0c (patch) | |
tree | c044d6be41c7ef70b91591bd5e2d14edada671ac /app | |
parent | 1488be7d9683fb3442c6f7bd4fd911d224f0c929 (diff) |
[Glitch] Fix short number formatting for numbers above million in web UI
Port 0e9668051e58b2ff4e48b82fa7cc17d385c7a5c9 to glitch-soc Signed-off-by: Thibaut Girka <thib@sitedethib.com>
Diffstat (limited to 'app')
-rw-r--r-- | app/javascript/flavours/glitch/util/numbers.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/util/numbers.js b/app/javascript/flavours/glitch/util/numbers.js index fdd8269ae..f7e4ceb93 100644 --- a/app/javascript/flavours/glitch/util/numbers.js +++ b/app/javascript/flavours/glitch/util/numbers.js @@ -4,7 +4,9 @@ import { FormattedNumber } from 'react-intl'; export const shortNumberFormat = number => { if (number < 1000) { return <FormattedNumber value={number} />; - } else { + } else if (number < 1000000) { return <Fragment><FormattedNumber value={number / 1000} maximumFractionDigits={1} />K</Fragment>; + } else { + return <Fragment><FormattedNumber value={number / 1000000} maximumFractionDigits={1} />M</Fragment>; } }; |