Skip to content

Commit 86242e9

Browse files
committed
modified the math logic to better support user input but still maintain decimal accuracy
1 parent cca9d8b commit 86242e9

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

‎frontend/src/components/BudgetTable/BudgetTableAssignedCell.js‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,7 @@ export default function BudgetTableAssignedCell({ budgeted, onSubmit }) {
6262
const onKeyPress = e => {
6363
if (e.key === 'Enter') {
6464
try {
65-
const fixedValue = rowValue.replace(/\d+\.?\d*/g, (match, contents, offset, input) => {
66-
return Currency.inputToValue(match)
67-
})
68-
69-
const newValue = Currency.valueToDinero(mexp.eval(fixedValue))
65+
const newValue = Currency.inputToDinero(mexp.eval(rowValue))
7066
setRowValue(Currency.intlFormat(newValue))
7167
onSubmit(newValue, month)
7268
e.target.blur()

0 commit comments

Comments
 (0)