danthorpe / Money

Swift value types for working with money & currency
MIT License
933 stars 91 forks source link

Currency is truncated #45

Closed cyril94440 closed 8 years ago

cyril94440 commented 8 years ago

Hello,

I have a double value of 3.99 for example, and Money displays £3. Any ideas?

let money = Money(availability.lowestPrice.doubleValue)

let buttonString = "\(money) \(availability.buyacion)"
danthorpe commented 8 years ago

This is a bug - a regression from all the changes with localized description. I'm pretty sure that

let money = GBP(availability.lowestPrice.doubleValue)
let buttonString = "\(money) \(availability.buyacion)"

it would work as you expect. (But understand that it's not what you want - as it's not the local currency).

Hold tight - will fix this asap today or tomorrow.

danthorpe commented 8 years ago

This is now fixed, merged and released as v1.6.2 - thanks so much for raising the issue, I had an inkling that a regression had popped in. This has been sort of hard to test - because it depends on the current locale, which is obviously not fixed on the iOS Simulator.

cyril94440 commented 8 years ago

Thanks for the fix, however it seems that now it displays the decimal but still rounded. I pass a 7.99 double value and it displays 8.00

danthorpe commented 8 years ago

Hi @cyril94440 - thanks for the feedback - will look into this this week.