Skip to content

Commit

Permalink
handle negative amounts (refunds)
Browse files Browse the repository at this point in the history
  • Loading branch information
dtxe committed May 2, 2024
1 parent 7448304 commit bfa910a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ <h4 style="margin-top: 2em;">Interactive table</h4>
if (!lines[i + 1].match(/^\d/)) {
const category = lines[i];
const expenseName = lines[++i];
const amounts = lines[++i].match(/([\d,]+\.\d+) CAD([\d,]+\.\d+)? ([A-Z]{3})?/);
const amounts = lines[++i].match(/([\-\d,]+\.\d+) CAD([\-\d,]+\.\d+)? ([A-Z]{3})?/);
const amountInCAD = amounts[1].replace(/,/g, '');
const amountInOriginalCurrency = (amounts[3] ? `${amounts[2]} ${amounts[3]}` : '').replace(/,/g, '');
const dateFormatted = formatDate(currentDate);
Expand Down

0 comments on commit bfa910a

Please sign in to comment.