diff --git a/services/tenant-ui/frontend/src/helpers/index.ts b/services/tenant-ui/frontend/src/helpers/index.ts index 7f0c6fde0..cf83c170b 100644 --- a/services/tenant-ui/frontend/src/helpers/index.ts +++ b/services/tenant-ui/frontend/src/helpers/index.ts @@ -21,7 +21,7 @@ function i18n2DateLocale(i18nLocale: I18nLocale): Locale { } function _dateFnsFormat(value: string, formatter: string) { - const locale: any = i18n.global.locale; + const locale: any = i18n.global?.locale || ''; const formatted = ''; try { if (value) { diff --git a/services/tenant-ui/frontend/test/setupGlobalMocks.ts b/services/tenant-ui/frontend/test/setupGlobalMocks.ts index 6d9db249b..06487d6bc 100644 --- a/services/tenant-ui/frontend/test/setupGlobalMocks.ts +++ b/services/tenant-ui/frontend/test/setupGlobalMocks.ts @@ -76,6 +76,7 @@ vi.mock('@/store', () => ({ })); vi.mock('vue-i18n', () => ({ + createI18n: vi.fn(() => ({})), useI18n: vi.fn(() => ({ locale: vi.fn(() => 'en'), t: vi.fn((key: string) => key),