Preserve thousands separators in decimal parsers#36
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7966d2a4dd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (lastDot > -1 && /^\d{1,3}(\.\d{3})+$/.test(text)) { | ||
| return text.replace(/\./g, ""); |
There was a problem hiding this comment.
Preserve three-decimal measurement inputs
In the utilities module this parser is also used for meter readings and unit rates, not just currency fields. When users rely on the existing dot-decimal support and enter a value with exactly three fractional digits, such as 123.456 for a reading or 36.386 for a rate, this new thousands regex converts it to 123456/36386, corrupting the settlement calculation. Please limit the dot-thousands heuristic to fields where a grouped integer is expected, or otherwise disambiguate it so three-decimal measurements are preserved.
Useful? React with 👍 / 👎.
Summary
Tests
Closes #35