Use of period/comma as decimal point is inconsistent across the app
Many fields use a decimal point, others a comma. I think we should go with a decimal point everywhere. I come from a region where it's customary to use a comma as a decimal point and a period as thousands separator, and I still would prefer using a period because that seems to me to be the standard in finance.
lang="en"
This will depend on the user's region; for example in North America I have never seen a period used as a thousands separator. There's a way in javascript to detect the users settings in their browser that can be used to provide a different number formatting to match their preferences.
I'm proposing we do something like this:
export const formatNumberCompact = (
num: number | bigint,
maximumSignificantDigits = 3,
) => {
const userLocale = navigator.language || "en-US";
// Ensure displaying absolute zeros are unsigned(-), because javascript sucks sometimes.
if (num === 0 || num === 0n) num = 0;
return new Intl.NumberFormat(userLocale, {
maximumSignificantDigits: maximumSignificantDigits,
notation: "compact",
}).format(num);
};
We currently have this function but without the userLocale = navigator.language || "en-US". We just haven't implemented it in all areas consistently so if we are good with the formatting decision I'll go ahead and fix the remaining inconsistencies we have.
I think the main point is that we should make everything on the page uniform. 👍 Whether we go with commas as thousands separator despite the user's locale or we use the user's local or we let the user define a setting isn't as important. So just using the US convention seems fine to me.