danthorpe / Money

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

Money description not correct #57

Open damirstuhec opened 8 years ago

damirstuhec commented 8 years ago

README states the following:

let pounds: GBP = 99.99
let euros: EUR = 149.50
print("You have \(pounds / 2) and \(euros + 30)")

You have £ 50.00

However, I'm seeing the following result:

print("\(USD(30.5))")

Simulator:

US$30.50

Device:

50,00 US$

As you can see, there is extra locale US printed before the currency amount. Also, the locale is printed before on simulator and after the amount on device. Also, there is a different separator being used. This is not aligned with README.

How can one control all of those things?

Also, I'll take this opportunity and ask how can one optionally remove the fraction numbers in case of a whole amount?

cc @danthorpe

damirstuhec commented 8 years ago

@danthorpe Any update on this?

danthorpe commented 8 years ago

Hi @damirstuhec - sorry - not had time to look into this. The issue is undoubtedly a NSLocale issue. What is the regions / language settings of your simulator/device?

damirstuhec commented 8 years ago

@danthorpe No problem.

Simulator Language: English Region: US

Device Language: English Region: Slovenia

danthorpe commented 8 years ago

Okay, so the positioning of the US$ is not an error - that is how NSNumberFormatter formats US dollars for Slovenia.

The US in the simulator though - that might well be an error...

damirstuhec commented 8 years ago

Ok, I see. But given the same locale, simulator and device should yield the same results, right?

danthorpe commented 8 years ago

Correct - given the same region settings, print(USD(30.5)) should yield the same result across all platforms including simulators.

damirstuhec commented 8 years ago

Ok, thanks. Will stay tuned about the fix on simulator.