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])