We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The example given in the docs works as expected.
import { USD } from '@dinero.js/currencies'; const d1 = dinero({ amount: 1050, currency: USD }); const d2 = dinero({ amount: 10545, currency: USD, scale: 3 }); toUnits(d1); // [10, 50] toUnits(d2); // [10, 545]
However if we change it to a leading zero in the minors, we lose this:
import { USD } from '@dinero.js/currencies'; const d1 = dinero({ amount: 1005, currency: USD }); const d2 = dinero({ amount: 10054, currency: USD, scale: 3 }); toUnits(d1); // [10, 5] toUnits(d2); // [10, 54]
import { USD } from '@dinero.js/currencies'; const d1 = dinero({ amount: 1005, currency: USD }); const d2 = dinero({ amount: 10054, currency: USD, scale: 3 }); toUnits(d1); // [10, 05] toUnits(d2); // [10, 054]
As this is not possible, the "toUnits()" should return a string in order to preserve leading zeros.
Use the above "Current behavior" example.
2.0.0-alpha.14
Nodejs 14
The text was updated successfully, but these errors were encountered:
sarahdayan
No branches or pull requests
Is there an existing issue for this?
Current behavior
The example given in the docs works as expected.
However if we change it to a leading zero in the minors, we lose this:
Expected behavior
As this is not possible, the "toUnits()" should return a string in order to preserve leading zeros.
Steps to reproduce
Use the above "Current behavior" example.
Version
2.0.0-alpha.14
Environment
Nodejs 14
Code of Conduct
The text was updated successfully, but these errors were encountered: