about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/util/numbers.js
blob: fdd8269ae27870509808d51ecd054a1196e5cfd0 (plain) (blame)
1
2
3
4
5
6
7
8
9
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>;
  }
};