fix: money in words
[!NOTE] Please wait for #27178 to reduce the diff. Until then, please look at the last commit (06fd6f6) only.
Money in words does not work correctly for fractions that are not a factor of ten (10, 100, 100). For example, some currencies have five fraction units constituting one main unit, i.e. $ 1 == 5 cents and $ 0.2 == 1 cent.
This PR solves this by:
- Using the
fraction_unitsfrom the Currency definition instead of guessing them from the number format's decimal places. - Calculating
fraction * fraction_unitsinstead of just treating thefractionas an integer. - Adding a test case for this scenario.
Todo:
- [ ] check if we can remove Number Format from Currency (rely on the fraction units only) (related bug: #26584)?
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed within 3 days if no further activity occurs, but it only takes a comment to keep a contribution alive :) Also, even if it is closed, you can always reopen the PR when you're ready. Thank you for contributing.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed within 3 days if no further activity occurs, but it only takes a comment to keep a contribution alive :) Also, even if it is closed, you can always reopen the PR when you're ready. Thank you for contributing.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed within 3 days if no further activity occurs, but it only takes a comment to keep a contribution alive :) Also, even if it is closed, you can always reopen the PR when you're ready. Thank you for contributing.
We can safely ignore the Semgrep failure in this case.