-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Monetary Abbreviations (Proposal) #77
Comments
Hey! I like this idea a lot but I'd question how you would get around the precision of abbreviation, i.e. some people might want $151k for $150,899 instead of $150.9k. Does your implementation cover this at all? I'm just trying to think of some similar examples that make decisions on precision but I don't think there are any in this package. I think it's probably fine to be opinionated on what it should be, i.e. if it doesn't round to a whole number, then it displays to one decimal place but would want to be clear in documentation. |
you mean something like this? |
@jamesallured - https://github.com/dustin/go-humanize/blob/master/si.go#LC101 The monetary code could follow SI @lfaoro - one could add non-shorthand notation as well I would leave out the currencies in the beginning, focus on something easy |
This isn't quite universal, though. In finance, US dollars are abbreviated to million with MM (thousand thousand). In environments that use Lakh, it's super confusing. This quickly becomes a localization issue. I'm not sure how to generalize this to the different use cases since we do have different precision and localization requirements. |
@dustin - wouldn't it be a lot simpler to have the user supply a map[float64]string{
...
3: "thousand",
6: "million",
9: "billion",
...
} that way you can separate the algorithm from the data. It may require some work for building the object, that has a parser etc. but it is doable. |
I would like to see functionality for monetary abbreviation.
For example, an application I wrote recently integrates with a game I play. It displays in game currency with abbreviations. $1,000,000 becomes $1m, $150,899 becomes $150.9k, etc.
I already have an implementation that I made, so I was wondering if this functionality would be welcome in this project.
The text was updated successfully, but these errors were encountered: