aboutsummaryrefslogtreecommitdiffstats
path: root/fatcat_scholar
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-07-21 17:11:28 -0700
committerBryan Newbold <bnewbold@archive.org>2020-07-21 17:11:28 -0700
commite1a1520ce6ef2c8bec386730932eedca8694245a (patch)
treee59257c24ae7e3980413c39f0e08424bd7c83dfe /fatcat_scholar
parentf9cc2c2d40c2083549c333064582183c96162e05 (diff)
downloadfatcat-scholar-e1a1520ce6ef2c8bec386730932eedca8694245a.tar.gz
fatcat-scholar-e1a1520ce6ef2c8bec386730932eedca8694245a.zip
ensure SIM release date parses before assigning
Diffstat (limited to 'fatcat_scholar')
-rw-r--r--fatcat_scholar/transform.py7
1 files changed, 6 insertions, 1 deletions
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,