Closed flashup4all closed 5 months ago
@flashup4all Each currency has an exponent that expresses the decimal relationship between the currency and its minor unit. For example, the U.S. dollar has 100 cents, which is 10 to the power of 2, so the exponent for the U.S. dollar is 2 and Money.new(100, :USD)
is 1 U.S. dollar.
According to ISO 4217, the currency UGX
has an exponent equal to 0, which means that for a given currency, the minor unit is 1 UGX and Money.new(100, : UGX)
is 100 UGX
In the following example, am expecting
UGX
to return something like a thousandUsh750,000.00
but am getting a millionUsh75,000,000
instead.Money.to_string(Money.new(75000000, :USD))
response ="$750,000.00"
Money.to_string(Money.new(75000000, :NGN))
response ="₦750,000.00"
Money.to_string(Money.new(75000000, :UGX))
response ="Ush75,000,000"
How do I ensure I get the appropriate output?