From 545ad896e2ce96a09df42c55ae197cf84e48c3c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 26 Feb 2020 19:47:21 +0100 Subject: [PATCH] create tz-aware datetimes when all we have is dates --- combo_plugin_gnm/templatetags/gnm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/combo_plugin_gnm/templatetags/gnm.py b/combo_plugin_gnm/templatetags/gnm.py index 7eb8b9f..def4283 100644 --- a/combo_plugin_gnm/templatetags/gnm.py +++ b/combo_plugin_gnm/templatetags/gnm.py @@ -238,14 +238,14 @@ def get_slots_from_mairie_format(data, base_datetime): def parse_valid_from(spec): valid_from = parse_datetime(spec.get('validFrom')) or parse_date(spec.get('validFrom')) if not isinstance(valid_from, datetime.datetime): - valid_from = datetime.datetime(valid_from.year, valid_from.month, valid_from.day) + valid_from = make_aware(datetime.datetime(valid_from.year, valid_from.month, valid_from.day)) return valid_from def parse_valid_through(spec): valid_through = parse_datetime(spec.get('validThrough')) or parse_date(spec.get('validThrough')) if not isinstance(valid_through, datetime.datetime): - valid_through = datetime.datetime(valid_through.year, valid_through.month, valid_through.day, 23, 59) + valid_through = make_aware(datetime.datetime(valid_through.year, valid_through.month, valid_through.day, 23, 59)) return valid_through