Use Intl.DateTimeFormat instead of moment for date formatting

This commit is contained in:
Josh Perez 2023-03-02 13:43:25 -05:00 committed by GitHub
parent bd40a7fb98
commit 356fb301e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 106 additions and 91 deletions

View 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';
}
})
);
}