From 3760b6ac9efc602881cab8eea55a41c957110349 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Mon, 6 Nov 2023 18:57:04 +0000 Subject: [PATCH] Add time to Backwell bins --- agenda/waste_schedule.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/agenda/waste_schedule.py b/agenda/waste_schedule.py index e9b9994..da9291a 100644 --- a/agenda/waste_schedule.py +++ b/agenda/waste_schedule.py @@ -5,15 +5,18 @@ import os import re import typing from collections import defaultdict -from datetime import date, datetime, timedelta +from datetime import date, datetime, timedelta, time import httpx import lxml.html +import pytz from .types import Event ttl_hours = 6 +uk_tz = pytz.timezone("Europe/London") + def make_waste_dir(data_dir: str) -> None: """Make waste dir if missing.""" @@ -91,7 +94,11 @@ def parse(root: lxml.html.HtmlElement) -> list[Event]: by_date[following_date].append(service) return [ - Event(name="waste_schedule", date=d, title="Backwell: " + ", ".join(services)) + Event( + name="waste_schedule", + date=uk_tz.localize(datetime.combine(d, time(6, 30))), + title="Backwell: " + ", ".join(services), + ) for d, services in by_date.items() ]