From a29acd7b745eb0a9b71eeb8023a5608e46c740aa Mon Sep 17 00:00:00 2001 From: "Ed (ODSC)" Date: Wed, 2 Oct 2024 16:21:27 +0100 Subject: [PATCH] utils.py: Drop unparseable dates --- libcovebods/utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libcovebods/utils.py b/libcovebods/utils.py index 97be836..e638237 100644 --- a/libcovebods/utils.py +++ b/libcovebods/utils.py @@ -70,7 +70,8 @@ def sort_by_date(list_with_date, index): out = [] for item in list_with_date: date = parse_date_field(item[index]) - new_item = item.copy() - new_item[index] = date - out.append(new_item) + if date: + new_item = item.copy() + new_item[index] = date + out.append(new_item) return sorted(out, key=lambda x: x[index])