From 89b7c1e5ca064df01a3d1da02432cc6004439fcf Mon Sep 17 00:00:00 2001 From: Julien Palard Date: Sat, 30 Mar 2024 17:17:56 +0100 Subject: [PATCH] Handle pre-2019 date format. --- boursobank.py | 6 ++++-- tests/test_parse.py | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/boursobank.py b/boursobank.py index f666034..80b31b6 100644 --- a/boursobank.py +++ b/boursobank.py @@ -11,7 +11,7 @@ from rich.table import Table from rich import print as rich_print from rich.panel import Panel -__version__ = "0.3" +__version__ = "0.4" DATE_RE = r"([0-9]{1,2}/[0-9]{2}/[0-9]{2,4})" @@ -145,6 +145,8 @@ class CardLineDebit(CardLine): class CardLineDebitWithFrancs(CardLineDebit): + """Around 2019-03-08 the date format changed from 08032019 to 08/03/19.""" + PATTERN = re.compile( rf"\s+A\s+VOTRE\s+DEBIT\s+LE\s+{DATE_RE}\s+" rf"(?P[0-9.,]+)\s+(?P[0-9.,]+)$" @@ -155,7 +157,7 @@ class CardLineWithFrancs(CardLine): """Represents one line (debit or credit) in a card statement.""" PATTERN = re.compile( - rf"\s*(?P{DATE_RE})\s+CARTE\s+(?P{DATE_RE})" + rf"\s*(?P{DATE_RE})\s+CARTE\s+(?P{DATE_RE}|[0-9]{{8}})" rf"\s+(?P