accounting
accounting copied to clipboard
Some features in Locale aren't available for formatting
Hi, thanks for a great library!
I'm working on a system that's dealing with both fiat currencies and a couple of cryptocurrencies and I thought I could easily build a Locale
object to describe common crypto formats (all decimal places, symbol after the number, etc)
I have this:
var cryptos = map[string]accounting.Locale{
"USDC": {
Name: "USD Coin",
FractionLength: 11,
ThouSep: ",",
DecSep: ".",
SpaceSep: " ",
UTFSymbol: "",
HTMLSymbol: "",
ComSymbol: "USDC",
Pre: false,
},
}
But then I realised, the actual formatting API doesn't accept some of these parameters, most importantly Pre
which I wanted to use to place the symbol after the value, which seems to be the consensus around crypto currency value formatting:
123.435 USDC
For example.
It seems this could be implemented in the formatMoneyString
function if Accounting
had a Pre
field.
Though, it also begs the question, why not just embed Locale
into Accounting
?
Anyway, would be happy to submit a PR for formatMoneyString
!