diff --git a/postgrestutils/client/utils.py b/postgrestutils/client/utils.py index 6eae8d43bc13e9a043243ea3041cd50ca1fda58a..5daa063fbb867c19bf1c45314265b15f04e3deb8 100644 --- a/postgrestutils/client/utils.py +++ b/postgrestutils/client/utils.py @@ -38,9 +38,10 @@ def datetime_parser(json_dict): if DJANGO: try: parsed_dt = dateparse.parse_datetime(value) - if django_tz.is_naive(parsed_dt): - parsed_dt = django_tz.make_aware(parsed_dt) - json_dict[key] = parsed_dt + if parsed_dt: + if django_tz.is_naive(parsed_dt): + parsed_dt = django_tz.make_aware(parsed_dt) + json_dict[key] = parsed_dt except ValueError: pass # not a datetime, leave the string as it is else: