diff --git a/src/client/includes/formatters.ts b/src/client/includes/formatters.ts index abe1cb9..7040289 100644 --- a/src/client/includes/formatters.ts +++ b/src/client/includes/formatters.ts @@ -42,12 +42,9 @@ export const getDateFormatter: MemoizedIntlFormatter< throw new Error('[svelte-i18n] A "locale" must be set to format dates') } - const hasInlineArgs = Object.keys(options).length > 0 - if (!hasInlineArgs) { - options = - typeof format === 'string' - ? getIntlFormatterOptions('date', format) - : getIntlFormatterOptions('date', 'short') + if (format) options = getIntlFormatterOptions('date', format) + else if (Object.keys(options).length === 0) { + options = getIntlFormatterOptions('date', 'short') } return new Intl.DateTimeFormat(locale, options) @@ -64,12 +61,9 @@ export const getTimeFormatter: MemoizedIntlFormatter< ) } - const hasInlineArgs = Object.keys(options).length > 0 - if (!hasInlineArgs) { - options = - typeof format === 'string' - ? getIntlFormatterOptions('time', format) - : getIntlFormatterOptions('time', 'short') + if (format) options = getIntlFormatterOptions('time', format) + else if (Object.keys(options).length === 0) { + options = getIntlFormatterOptions('time', 'short') } return new Intl.DateTimeFormat(locale, options) diff --git a/src/client/index.ts b/src/client/index.ts index 2f94c4f..861faf3 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -5,7 +5,7 @@ export function defineMessages(i: Record) { return i } -export { configure } from './configs' +export { init } from './configs' export { $locale as locale } from './stores/locale' export { $dictionary as dictionary, diff --git a/test/client/stores/locale.test.ts b/test/client/stores/locale.test.ts index 01583ae..1a44a20 100644 --- a/test/client/stores/locale.test.ts +++ b/test/client/stores/locale.test.ts @@ -1,7 +1,6 @@ import { get } from 'svelte/store' + import { lookupMessage } from '../../../src/client/includes/lookup' - - import { isFallbackLocaleOf, getFallbackOf,