From 34cbc7e0c17e74858050cca37a2a5538f5647778 Mon Sep 17 00:00:00 2001 From: Jerozgen Date: Wed, 4 Feb 2026 16:49:21 +0300 Subject: [PATCH] Use `numeric: always` for Italian and Russian (#5293) * Use `numeric: always` for Italian and Russian * Use RelativeTimeFormatNumeric type --- packages/ui/src/composables/how-ago.ts | 15 ++++++++------- packages/ui/src/composables/i18n.ts | 5 +++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/ui/src/composables/how-ago.ts b/packages/ui/src/composables/how-ago.ts index 6d86df93f..fa8efecb0 100644 --- a/packages/ui/src/composables/how-ago.ts +++ b/packages/ui/src/composables/how-ago.ts @@ -1,6 +1,7 @@ import { computed, type ComputedRef } from 'vue' import { injectI18n } from '../providers/i18n' +import { LOCALES } from './i18n.ts' export type Formatter = (value: Date | number | null | undefined, options?: FormatOptions) => string @@ -13,13 +14,13 @@ const formatters = new Map>() export function useRelativeTime(): Formatter { const { locale } = injectI18n() - const formatterRef = computed( - () => - new Intl.RelativeTimeFormat(locale.value, { - numeric: 'auto', - style: 'long', - }), - ) + const formatterRef = computed(() => { + const localeDefinition = LOCALES.find((loc) => loc.code === locale.value) + return new Intl.RelativeTimeFormat(locale.value, { + numeric: localeDefinition?.numeric || 'auto', + style: 'long', + }) + }) if (!formatters.has(locale.value)) { formatters.set(locale.value, formatterRef) diff --git a/packages/ui/src/composables/i18n.ts b/packages/ui/src/composables/i18n.ts index e220828ac..c25d2c2bb 100644 --- a/packages/ui/src/composables/i18n.ts +++ b/packages/ui/src/composables/i18n.ts @@ -27,6 +27,7 @@ export function defineMessages