diff --git a/src/paperless_tesseract/parsers.py b/src/paperless_tesseract/parsers.py index 847e87f1a..37b2610c1 100644 --- a/src/paperless_tesseract/parsers.py +++ b/src/paperless_tesseract/parsers.py @@ -219,11 +219,19 @@ class RasterisedDocumentParser(DocumentParser): if m is None: return None - return dateparser.parse(m.group(0), + date = dateparser.parse(m.group(0), settings={'DATE_ORDER': self.DATE_ORDER, 'PREFER_DAY_OF_MONTH': 'first', 'RETURN_AS_TIMEZONE_AWARE': True}) + if date is not None: + self.log("info", "Detected document date " + date.strftime("%x") + + " based on string " + m.group(0)) + else: + self.log("info", "Unable to detect date for document") + + return date + def run_convert(*args):