bigbuffet-rw/app/gabsocial/utils/numbers.js

11 lines
301 B
JavaScript
Raw Normal View History

2020-04-14 13:45:38 -07:00
import React from 'react';
2020-03-27 13:59:38 -07:00
import { FormattedNumber } from 'react-intl';
export const shortNumberFormat = number => {
if (number < 1000) {
return <FormattedNumber value={number} />;
} else {
return <span><FormattedNumber value={number / 1000} maximumFractionDigits={1} />K</span>;
}
};