elixirmoney / money

Elixir library for working with Money safer, easier, and fun... Is an interpretation of the Fowler's Money pattern in fun.prog.
https://hex.pm/packages/money/
MIT License
826 stars 139 forks source link

Incorrect currency symbol #190

Closed joshhifyre closed 1 year ago

joshhifyre commented 1 year ago

The symbol for the US Dollar is incorrect

Should be US$

https://en.wikipedia.org/wiki/United_States_dollar

Needs to be consistent across countries following this update: https://github.com/elixirmoney/money/commit/2bfeacf1b50dad17bc47bb9b0da7c262fe238e3b

Nitrino commented 1 year ago

The main and most common symbol for the American dollar is $. Its change will lead to many surprises and bugs. You can override the currency if needed

kupych commented 1 year ago

@Nitrino the main and most common symbol for the Canadian dollar is also $. The change made in https://github.com/elixirmoney/money/commit/2bfeacf1b50dad17bc47bb9b0da7c262fe238e3b DID lead to many surprises and bugs for us. Please revert this change as no one uses "Can$".

PJUllrich commented 5 months ago

Hey folks, is there a way to "override" the currency symbol for CAD? I'd prefer to have CA$ instead of Can$ throughout my application.

Nitrino commented 5 months ago

@PJUllrich Hey, you can add a custom currency with the same code and it will override the pre-defined one

config :money,
  custom_currencies: [
    CAD: %{name: "Canadian Dollar", symbol: "$", exponent: 2, number: 124},
  ]
iex(1)> Money.Currency.all()[:CAD]
%{name: "Canadian Dollar", number: 124, symbol: "$", exponent: 2}
iex(2)> Money.to_string(Money.new(100, :CAD))
"$1.00"