Better Handle arbitrary ISO 8601 strings with dateutil.parser.isoparse

This commit is contained in:
Michael Shamoon 2023-01-15 15:06:35 -08:00
parent c9683808c9
commit 133532a463

View 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