mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-18 20:59:39 +02:00
Format money for trade history in holdings drawer (#1961)
* Format money for trade history in holdings drawer * Fix broken tests * Lint fix
This commit is contained in:
parent
86bf47a32e
commit
a3cd5f4f1d
4 changed files with 14 additions and 7 deletions
|
@ -13,7 +13,7 @@ module Money::Formatting
|
|||
local_option_overrides = locale_options(locale)
|
||||
|
||||
{
|
||||
unit: currency.symbol,
|
||||
unit: get_symbol,
|
||||
precision: currency.default_precision,
|
||||
delimiter: currency.delimiter,
|
||||
separator: currency.separator,
|
||||
|
@ -22,6 +22,14 @@ module Money::Formatting
|
|||
end
|
||||
|
||||
private
|
||||
def get_symbol
|
||||
if currency.symbol == "$" && currency.iso_code != "USD"
|
||||
[ currency.iso_code.first(2), currency.symbol ].join
|
||||
else
|
||||
currency.symbol
|
||||
end
|
||||
end
|
||||
|
||||
def locale_options(locale)
|
||||
case [ currency.iso_code, locale.to_sym ]
|
||||
when [ "EUR", :nl ], [ "EUR", :pt ]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue