kipcole9/money

Money.parse error with single-digit currency amounts

Closed this issue · 2 comments

Not sure if this is by design, but when using Money.parse to create #Money from single-digit amounts, I get a Money.Invalid error. E.g. when I try to Money.parse USD1, the amount is invalid:

iex(1)> Money.parse("USD1")
{:error, {Money.Invalid, "Could not parse \"USD1\"."}}

iex(2)> Money.parse("USD10")
#Money<:USD, 10>

iex(3)> Money.parse("USD1.00")
#Money<:USD, 1.00>

iex(4)> Money.parse("USD9")   
{:error, {Money.Invalid, "Could not parse \"USD9\"."}}

iex(5)> Money.parse("USD90")
#Money<:USD, 90>

iex(6)> Money.parse("USD9.0") 
#Money<:USD, 9.0>

iex(7)> Money.parse("USD9.00")
#Money<:USD, 9.00>

Pushed a release version 4.2.1 to github and published version 4.2.1 to hex.

Thanks for the report and sorry for the inconvenience.

Thanks a ton for the fix! No need to apologize... this package is incredibly convenient :P