Skip to content
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

Comparisons like greaterThan very broken #87

Open
ShawnFumo opened this issue Mar 16, 2022 · 0 comments
Open

Comparisons like greaterThan very broken #87

ShawnFumo opened this issue Mar 16, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@ShawnFumo
Copy link

There are many cases where comparisons such as greaterThan, greatherThanOrEqual, lessThan, lessThanOrEqual do not work reliably.

Works as expected (prints false):

const money = createMoney({amount: 1000, currency: 'USD'})
const money2 = createMoney({amount: 100, currency: 'USD'})
console.log(money.lessThanOrEqual(money2))

Does NOT work as expected (prints true):

const money = createMoney({amount: 1000, currency: 'USD'})
const money2 = createMoney({amount: 101, currency: 'USD'})
console.log(money.lessThanOrEqual(money2))

Another failure (prints false)

const money = createMoney({amount: 999, currency: 'USD'})
const money2 = createMoney({amount: 1500, currency: 'USD'})
console.log(money.lessThan(money2))

That something so basic isn't working in a library devoted to money calculations makes me really nervous about using it in general in a production setting. As much as the features seem nice, it seems like Dinero is under more active development.

@ShawnFumo ShawnFumo added the bug Something isn't working label Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant