From bfa910ad1014d016e7a32caf1d3d3e7e86543ed9 Mon Sep 17 00:00:00 2001 From: Simeon Wong Date: Thu, 2 May 2024 14:03:33 -0400 Subject: [PATCH] handle negative amounts (refunds) --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 90af65d..ca17dfe 100644 --- a/index.html +++ b/index.html @@ -70,7 +70,7 @@

Interactive table

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);