]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Better Handle arbitrary ISO 8601 strings with dateutil.parser.isoparse 2441/head
authorMichael Shamoon <4887959+shamoon@users.noreply.github.com>
Sun, 15 Jan 2023 23:06:35 +0000 (15:06 -0800)
committerMichael Shamoon <4887959+shamoon@users.noreply.github.com>
Sun, 15 Jan 2023 23:14:55 +0000 (15:14 -0800)
src/documents/tasks.py

index b5dc264fb4c1162cd60cfe1af6e9c8ac946cc4f2..0168b42ba13cd126c7f4a03aa26ea35e27f002bd 100644 (file)
@@ -3,10 +3,10 @@ import logging
 import os
 import shutil
 import uuid
-from datetime import datetime
 from pathlib import Path
 from typing import Type
 
+import dateutil.parser
 import tqdm
 from asgiref.sync import async_to_sync
 from celery import shared_task
@@ -105,7 +105,7 @@ def consume_file(
     # More types will be retained through JSON encode/decode
     if override_created is not None and isinstance(override_created, str):
         try:
-            override_created = datetime.fromisoformat(override_created)
+            override_created = dateutil.parser.isoparse(override_created)
         except Exception:
             pass