From 757926e79420191a29da70cd832aa4b332644a9c Mon Sep 17 00:00:00 2001 From: David Amor Date: Thu, 19 Jun 2025 20:59:59 +0100 Subject: [PATCH] Update AdurAndWorthingCouncils.py --- .../uk_bin_collection/councils/AdurAndWorthingCouncils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/uk_bin_collection/uk_bin_collection/councils/AdurAndWorthingCouncils.py b/uk_bin_collection/uk_bin_collection/councils/AdurAndWorthingCouncils.py index 916520a532..3933a09551 100644 --- a/uk_bin_collection/uk_bin_collection/councils/AdurAndWorthingCouncils.py +++ b/uk_bin_collection/uk_bin_collection/councils/AdurAndWorthingCouncils.py @@ -69,8 +69,10 @@ def parse_data(self, page: str, **kwargs) -> dict: current_year = datetime.now().year bin_date = bin_date.replace(year=current_year) - # If the date is in the past, it's probably for next year - if bin_date < datetime.now(): + # Only add a year if the date is more than 30 days in the past + # This handles both mid-year and year-end transitions better + today = datetime.now() + if (today - bin_date).days > 30: bin_date = bin_date.replace(year=current_year + 1) collections.append((bin_type, bin_date))