fix: Format view count correctly on shared links table
This commit is contained in:
@@ -2,6 +2,21 @@ import { i18n } from "i18next";
|
||||
import { unicodeCLDRtoBCP47 } from "@shared/utils/date";
|
||||
import Desktop from "./Desktop";
|
||||
|
||||
/**
|
||||
* Formats a number using the user's locale where possible.
|
||||
*
|
||||
* @param number The number to format
|
||||
* @param locale The locale to use for formatting (BCP47 format)
|
||||
* @returns The formatted number as a string
|
||||
*/
|
||||
export function formatNumber(number: number, locale: string) {
|
||||
try {
|
||||
return new Intl.NumberFormat(locale).format(number);
|
||||
} catch (e) {
|
||||
return number.toString();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects the user's language based on the browser's language settings.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user