mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-01 10:09:56 +00:00
Fix date-fns locale import failing for some locales
This commit is contained in:
parent
cf9f37fbc4
commit
ed1f208e47
1 changed files with 10 additions and 0 deletions
|
@ -7,6 +7,16 @@ export default async function () {
|
||||||
lang = "en-US";
|
lang = "en-US";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if lang and country are the same, then date-fns expects only the lang
|
||||||
|
// eg: instead of "fr-FR", we should import just "fr"
|
||||||
|
|
||||||
|
if (lang.includes("-")) {
|
||||||
|
const parts = lang.split("-");
|
||||||
|
if (parts[0] === parts[1].toLowerCase()) {
|
||||||
|
lang = parts[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const locale = (
|
const locale = (
|
||||||
await import(
|
await import(
|
||||||
/* webpackExclude: /\.js\.flow$/ */
|
/* webpackExclude: /\.js\.flow$/ */
|
||||||
|
|
Loading…
Reference in a new issue