diff --git a/crans_utils.py b/crans_utils.py index 0e5357d..3b358bc 100644 --- a/crans_utils.py +++ b/crans_utils.py @@ -350,10 +350,11 @@ def localized_datetime(date=None, tz=None): %Y%m%d%H%M%S, and a tz timezone looking like +0200""" if tz is None: - if "+" in date or '-' in date or 'Z' in date: - if date.endswith("Z"): - date = date[:-1] + "+0000" - date, tz = date[:-5], date[-5:] + if date is not None: + if "+" in date or '-' in date or 'Z' in date: + if date.endswith("Z"): + date = date[:-1] + "+0000" + date, tz = date[:-5], date[-5:] _notz = (tz is None)