mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-23 20:54:48 -04:00
(fix) move luxon configuration to locale.ts plugin, where config actually is defined
This commit is contained in:
parent
08788dfff5
commit
1f16d81df7
@ -1,4 +1,4 @@
|
||||
import { DateTime, Settings } from 'luxon';
|
||||
import { DateTime } from 'luxon';
|
||||
import { defineNuxtPlugin, useCookie, useRouter } from 'nuxt/app';
|
||||
import type { Pinia } from 'pinia';
|
||||
import { decodeTime } from 'ulid';
|
||||
@ -129,13 +129,6 @@ export default defineNuxtPlugin((nuxtApp) => {
|
||||
});
|
||||
};
|
||||
|
||||
try {
|
||||
Settings.defaultLocale = config.intlLocale || config.locale;
|
||||
DateTime.now().toFormat('y-MM-dd HH:mm'); // test if locale is supported by luxon
|
||||
} catch {
|
||||
Settings.defaultLocale = 'en';
|
||||
}
|
||||
|
||||
const datetime = (timestamp: number): string => {
|
||||
const dt = DateTime.fromSeconds(timestamp);
|
||||
return dt.toFormat('y-MM-dd HH:mm');
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { DateTime, Settings } from 'luxon';
|
||||
|
||||
import baseTranslations from '~/locale/_base/translations.suml';
|
||||
import type { Translations } from '~/locale/translations.ts';
|
||||
import buildLocaleList from '~/src/buildLocaleList.ts';
|
||||
@ -60,6 +62,13 @@ export default defineNuxtPlugin({
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
Settings.defaultLocale = config.intlLocale || config.locale;
|
||||
DateTime.now().toFormat('y-MM-dd HH:mm'); // test if locale is supported by luxon
|
||||
} catch {
|
||||
Settings.defaultLocale = 'en';
|
||||
}
|
||||
|
||||
return {
|
||||
provide: {
|
||||
// identifier must be different to config because it is already reserved for Nuxt runtime config
|
||||
|
Loading…
x
Reference in New Issue
Block a user