1Hive / apiary

Aragon DAO explorer
https://apiary.1hive.org
GNU General Public License v3.0
25 stars 16 forks source link

Format all numbers consistently (using toLocaleString) #149

Closed sembrestels closed 4 years ago

onbjerg commented 4 years ago

Can we just remove fixedDecimals and always have that behavior?

sembrestels commented 4 years ago

It is not used always, it is there because organizations and activity are integers.

onbjerg commented 4 years ago

At this point we should probably consider a small component then. I'm not sure if I like the idea of having to pass undefined in most of the cases, and in general I think fixedDecimals should probably have been a number parameter, not a boolean. What do you think?

sembrestels commented 4 years ago

If we want to stick with just one function (formatNumber), we can just change the order of the parameters (formatNumber(num, decimals = 0, cutoff = 10000)), so we avoid to pass the undefined value.

Another option is to define two functions: formatInteger(num, cutoff = 10000) and formatFloat(num, cutoff = 10000, decimals = 2).

Which do you prefer?

onbjerg commented 4 years ago

I think changing the order of the parameters like you first proposed would make most sense to be honest. Good thinking

onbjerg commented 4 years ago

@lkngtn You can deploy this whenever