Re:Dinero.js – JavaScript library for working with monetary ...
by mattnewton on Monday April 16, 2018 @03:25PM
(#16851922)
Read the faq and the divide documentation, couldn’t figure out how it handles fractional cents? Does it?
[ Parent
| on HN ]
Re:Dinero.js – JavaScript library for working with monetary ...
by rinchik on Monday April 16, 2018 @03:42PM
(#16852066)
Great point, I was about to say the same.
Looks like it does lose cents and can't be used in production.
from the source:
divide(a, b) {
return a / b
},
Re:Dinero.js – JavaScript library for working with monetary ...
by sarahdayan on Monday April 16, 2018 @04:04PM
(#16852213)
Hey! You need to use the allocate method for this. It will redistribute fractional cents and return an array of Dinero objects.