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.
There are many cases where comparisons such as greaterThan, greatherThanOrEqual, lessThan, lessThanOrEqual do not work reliably.
Works as expected (prints false):
Does NOT work as expected (prints true):
Another failure (prints false)
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.