diff --git a/src/composables/useFormatDateTime.ts b/src/composables/useFormatDateTime.ts index f25b893f..059ec52a 100644 --- a/src/composables/useFormatDateTime.ts +++ b/src/composables/useFormatDateTime.ts @@ -21,7 +21,7 @@ */ import type { MaybeRef } from 'vue' -import { getCanonicalLocale } from '@nextcloud/l10n' +import { getCanonicalLocale, getLanguage } from '@nextcloud/l10n' import { computed, onUnmounted, ref, toValue, watchEffect } from 'vue' import { t } from '../l10n.js' @@ -47,7 +47,7 @@ interface FormatDateOptions { } /** - * Composable for formatting time stamps using current users locale + * Composable for formatting time stamps using current users locale and language * * @param {import('vue').MaybeRef} timestamp Current timestamp * @param {object} opts Optional options @@ -86,7 +86,7 @@ export function useFormatDateTime( /** Time string formatted for main text */ const formattedTime = computed(() => { if (wrappedOptions.value.relativeTime !== false) { - const formatter = new Intl.RelativeTimeFormat(getCanonicalLocale(), { numeric: 'auto', style: wrappedOptions.value.relativeTime }) + const formatter = new Intl.RelativeTimeFormat(getLanguage(), { numeric: 'auto', style: wrappedOptions.value.relativeTime }) const diff = date.value.getTime() - currentTime.value const seconds = diff / 1000