diff options
author | pluralcafe-docker <docker@plural.cafe> | 2018-08-23 06:16:14 +0000 |
---|---|---|
committer | pluralcafe-docker <docker@plural.cafe> | 2018-08-23 06:16:14 +0000 |
commit | 0fa521de89168ef33423fc7306a33d4a1c3badf3 (patch) | |
tree | ce3663d75ca93ea2d32e10de532eb18a230cf6e0 /app/javascript/flavours/glitch/util/numbers.js | |
parent | a4935a8e24dcfa865fb330693d8ec90beca1aa98 (diff) | |
parent | 8aa58e34bb2b62192a997ac7ea8919b22fc45f80 (diff) |
Merge branch 'glitch'
Diffstat (limited to 'app/javascript/flavours/glitch/util/numbers.js')
-rw-r--r-- | app/javascript/flavours/glitch/util/numbers.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/util/numbers.js b/app/javascript/flavours/glitch/util/numbers.js new file mode 100644 index 000000000..fdd8269ae --- /dev/null +++ b/app/javascript/flavours/glitch/util/numbers.js @@ -0,0 +1,10 @@ +import React, { Fragment } from 'react'; +import { FormattedNumber } from 'react-intl'; + +export const shortNumberFormat = number => { + if (number < 1000) { + return <FormattedNumber value={number} />; + } else { + return <Fragment><FormattedNumber value={number / 1000} maximumFractionDigits={1} />K</Fragment>; + } +}; |