From 8bab061d8e5ca573a6f3f773dd492d73da31d010 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Wed, 12 Jan 2022 15:45:31 -0300 Subject: [PATCH] Fix date comparison functions --- biostools/util.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/biostools/util.py b/biostools/util.py index 1a0c681..38dbdfb 100644 --- a/biostools/util.py +++ b/biostools/util.py @@ -30,13 +30,13 @@ def all_match(patterns, data): def date_cmp(date1, date2, pattern): # Run date regex. - date1_match = pattern.match(date1) - date2_match = pattern.match(date2) + date1_match = pattern.match(date1 or '') + date2_match = pattern.match(date2 or '') if date1_match and not date2_match: return 1 elif not date1_match and date2_match: return -1 - else: + elif not date1_match and not date2_match: return 0 # Extract year, month and day.