Use Intl.DateTimeFormat instead of moment for date formatting
This commit is contained in:
parent
bd40a7fb98
commit
356fb301e1
8 changed files with 106 additions and 91 deletions
14
ts/util/resolveCanonicalLocales.ts
Normal file
14
ts/util/resolveCanonicalLocales.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2023 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
export function resolveCanonicalLocales(locales: Array<string>): Array<string> {
|
||||
return Intl.getCanonicalLocales(
|
||||
locales.flatMap(locale => {
|
||||
try {
|
||||
return Intl.getCanonicalLocales(locale);
|
||||
} catch {
|
||||
return 'en';
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue