From 176c8466a450c016cdd32a41532964b47671a845 Mon Sep 17 00:00:00 2001
From: kyangk <kyangk@gmail.com>
Date: Sat, 27 Apr 2024 13:26:12 -0700
Subject: [PATCH] Ignore transactions with empty date & amount (#2653)

---
 .../loot-core/src/server/accounts/parse-file.ts  | 16 +++++++++-------
 upcoming-release-notes/2653.md                   |  6 ++++++
 2 files changed, 15 insertions(+), 7 deletions(-)
 create mode 100644 upcoming-release-notes/2653.md

diff --git a/packages/loot-core/src/server/accounts/parse-file.ts b/packages/loot-core/src/server/accounts/parse-file.ts
index 03c34f076..4bd47d35f 100644
--- a/packages/loot-core/src/server/accounts/parse-file.ts
+++ b/packages/loot-core/src/server/accounts/parse-file.ts
@@ -96,13 +96,15 @@ async function parseQIF(filepath: string): Promise<ParseFileResult> {
 
   return {
     errors: [],
-    transactions: data.transactions.map(trans => ({
-      amount: trans.amount != null ? looselyParseAmount(trans.amount) : null,
-      date: trans.date,
-      payee_name: trans.payee,
-      imported_payee: trans.payee,
-      notes: trans.memo || null,
-    })),
+    transactions: data.transactions
+      .map(trans => ({
+        amount: trans.amount != null ? looselyParseAmount(trans.amount) : null,
+        date: trans.date,
+        payee_name: trans.payee,
+        imported_payee: trans.payee,
+        notes: trans.memo || null,
+      }))
+      .filter(trans => trans.date != null && trans.amount != null),
   };
 }
 
diff --git a/upcoming-release-notes/2653.md b/upcoming-release-notes/2653.md
new file mode 100644
index 000000000..e71c624bd
--- /dev/null
+++ b/upcoming-release-notes/2653.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [kyangk]
+---
+
+Ignore transactions with empty date & amount
-- 
GitLab