From d067fa75a91b3fa5b37a9155ff40d86877e1eea6 Mon Sep 17 00:00:00 2001 From: Ben Mooney <61550824+sysmoon14@users.noreply.github.com> Date: Mon, 30 Dec 2024 16:36:25 +0000 Subject: [PATCH] Fix dates in the next year The line to push dates into the next year wasn't working, so I've rewritten it --- .../waste_collection_schedule/source/liverpool_gov_uk.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/liverpool_gov_uk.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/liverpool_gov_uk.py index f00a465d5..0c0fc3470 100644 --- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/liverpool_gov_uk.py +++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/liverpool_gov_uk.py @@ -54,10 +54,10 @@ def trimsuffix(s): date = today + timedelta(days=1) else: date = datetime.strptime(collectiondate, '%A, %d %B %Y').date() - - # As no year is specified we might need to add one year if it crosses Dec 31st - if date < today: - date.replace(year = today.year + 1) + # As no year is specified we might need to add one year if it crosses Dec 31st + if date.month == 1 and today.month == 12: + date = date.replace(year=date.year+1) + entries.append( Collection(