Fix handling of -0 in budget summary (#229)

* Fix handling of -0 in budget summary

* Update based on review

Co-Authored-By: Tom French <15848336+TomAFrench@users.noreply.github.com>
This commit is contained in:
Jed Fox 2022-08-31 17:38:16 -04:00 committed by GitHub
parent f09f2dfe7b
commit 9e7f94a237
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -112,11 +112,9 @@ function TotalsList({ prevMonthName, collapsed }) {
<CellValue
binding={rolloverBudget.forNextMonth}
formatter={value => {
let n = parseInt(value);
n = isNaN(n) ? 0 : -n;
let v = format(n, 'financial');
return n > 0 ? '+' + v : n === 0 ? '-' + v : v;
let n = parseInt(value) || 0;
let v = format(Math.abs(n), 'financial');
return n >= 0 ? '-' + v : '+' + v;
}}
style={[{ fontWeight: 600 }, styles.tnum]}
/>