mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1import type {I18n} from '@lingui/core'
2
3export const formatCount = (i18n: I18n, num: number) => {
4 return i18n.number(num, {
5 notation: 'compact',
6 maximumFractionDigits: 1,
7 // `1,953` shouldn't be rounded up to 2k, it should be truncated.
8 // @ts-expect-error: `roundingMode` doesn't seem to be in the typings yet
9 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#roundingmode
10 roundingMode: 'trunc',
11 })
12}