diff --git a/components/status/StatusPoll.vue b/components/status/StatusPoll.vue index 5fbc8c43..611f9489 100644 --- a/components/status/StatusPoll.vue +++ b/components/status/StatusPoll.vue @@ -13,6 +13,7 @@ function toPercentage(num: number) { const timeAgoOptions = useTimeAgoOptions() const expiredTimeAgo = useTimeAgo(poll.expiresAt!, timeAgoOptions) const expiredTimeFormatted = useFormattedDateTime(poll.expiresAt!) +const { formatHumanReadableNumber } = useHumanReadableNumber() const masto = useMasto() async function vote(e: Event) { @@ -57,7 +58,7 @@ async function vote(e: Event) {
- {{ $t('status.poll.count', poll.votersCount ?? 0) }} + {{ $t('status.poll.count', formatHumanReadableNumber(poll.votersCount ?? 0)) }} · diff --git a/composables/i18n.ts b/composables/i18n.ts index 2e636acc..bbbbd399 100644 --- a/composables/i18n.ts +++ b/composables/i18n.ts @@ -3,7 +3,7 @@ import type { MaybeComputedRef, UseTimeAgoOptions } from '@vueuse/core' const formatter = Intl.NumberFormat() -export const humanReadableNumber = ( +const humanReadableNumber = ( num: number, { k, m }: { k: string; m: string } = { k: 'K', m: 'M' }, useFormatter: Intl.NumberFormat = formatter,