-
-
Notifications
You must be signed in to change notification settings - Fork 939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Commerce price does not return fractional currency prices #350
Comments
@Shinigami92 Would you consider this a bug or feature request? |
I think the precision could be a bug, but maybe it was considered as wanted cause if you have e.g. an app that shows some prices, the prices are just xx.00 What I think would be a better idea is to directly create a whole new module for I think we could do 2-3 PRs targeting different versions, on the other side we should ask some folks if the |
We could also try to play around with https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat#using_options 👀 |
A comment here on pricing, it's not safe to assume that all prices are formatted to two decimals. E.g. in the US, prices for gasoline are $2.999/gallon. Even within a singular currency, there are inconsistencies. |
Yes, I think a new module would be the best approach here, too. |
@Shinigami92 should this be put under v6.2 or v7? thanks |
To get some more prio to other features, I think we can put this into v7 for now |
I would suggest dropping this function as we have |
IMO we should localize the output some more. E.g. |
I think currency should not come with a price. I might want to stay on |
I'm not sure, I could honestly go either way on this. We could have this function return values with currency symbols, which would be nice, but |
I haven't worked with that api yet, but it looks straight forward. |
@Shinigami92 what would be your suggestion then? |
I must say, I don't know |
Team decision We want to change the implementation of the |
I would like to try to solve this task. Could assign to me? |
Describe the bug
faker.commerce.price()
always returns a value with full price.=>
245.00
,842.00
It would be nice if it could also generate prices with fractional currency prices
=>
245.71
,842.45
Also if invalid prices ranges are given, then the returned prices does not respect the decimal places paramter.
Reproduction
faker.commerce.price()
=>245.00
faker.commerce.price(-1)
=>0
Additional Info
No response
The text was updated successfully, but these errors were encountered: