From fe279d0207ba626145d45a3c69f16e13c20bb049 Mon Sep 17 00:00:00 2001 From: Red S Date: Tue, 1 Oct 2024 23:57:21 -0700 Subject: [PATCH] fix: csvreader: strip before parsing dates --- beancount_reds_importers/libreader/csvreader.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/beancount_reds_importers/libreader/csvreader.py b/beancount_reds_importers/libreader/csvreader.py index 0bd11af..4388281 100644 --- a/beancount_reds_importers/libreader/csvreader.py +++ b/beancount_reds_importers/libreader/csvreader.py @@ -128,7 +128,8 @@ def remove_non_numeric(x): # fixup dates def convert_date(d): - return datetime.datetime.strptime(d, self.date_format) + """Remove spaces and convert to datetime""" + return datetime.datetime.strptime(d.strip(), self.date_format) dates = getattr(self, "date_fields", []) + ["date", "tradeDate", "settleDate"] for i in dates: