From e1a1520ce6ef2c8bec386730932eedca8694245a Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 21 Jul 2020 17:11:28 -0700 Subject: ensure SIM release date parses before assigning --- fatcat_scholar/transform.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'fatcat_scholar') diff --git a/fatcat_scholar/transform.py b/fatcat_scholar/transform.py index ac80efc..f6e2c46 100644 --- a/fatcat_scholar/transform.py +++ b/fatcat_scholar/transform.py @@ -1,5 +1,6 @@ import sys import argparse +import datetime from typing import List, Dict, Optional, Any, Sequence from dynaconf import settings @@ -95,7 +96,11 @@ def es_biblio_from_sim(sim: Dict[str, Any]) -> ScholarBiblio: release_date = None if len(date) == len("2000-01-01"): - release_date = date + try: + datetime.date.fromisoformat(date) + release_date = date + except ValueError: + pass return ScholarBiblio( # release_ident=release.ident, -- cgit v1.2.3