Fix currencyToInteger returning null when amount is zero (#915)

Fixes #913. (And probably a few other similar bugs)
This commit is contained in:
Jed Fox
2023-04-20 17:21:56 -04:00
committed by GitHub
parent eed097d41e
commit 131bb86711
3 changed files with 14 additions and 3 deletions

View File

@@ -195,10 +195,15 @@ function ReconcileTooltip({ account, onReconcile, onClose }) {
let balance = useSheetValue(queries.accountBalance(account));
function onSubmit(e) {
e.preventDefault();
let input = e.target.elements[0];
let amount = currencyToInteger(input.value);
onReconcile(amount == null ? balance : amount);
onClose();
if (amount != null) {
onReconcile(amount == null ? balance : amount);
onClose();
} else {
input.select();
}
}
return (

View File

@@ -354,7 +354,7 @@ export function currencyToAmount(str) {
export function currencyToInteger(str) {
let amount = currencyToAmount(str);
return amount ? amountToInteger(amount) : null;
return amount == null ? null : amountToInteger(amount);
}
export function stringToInteger(str) {

View File

@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [j-f1]
---
Fix reconciling a budget with a zero value