diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/fenland_gov_uk.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/fenland_gov_uk.py index 8b1e0bb1..78d086e9 100644 --- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/fenland_gov_uk.py +++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/fenland_gov_uk.py @@ -1,5 +1,5 @@ import re -from datetime import datetime +from datetime import datetime, timedelta import requests from waste_collection_schedule import Collection @@ -68,11 +68,16 @@ class Source: collections = r.json()["features"][0]["properties"]["upcoming"] for collectionDate in collections: for collection in collectionDate["collections"]: + collectionDate = datetime.strptime( + collectionDate["date"], "%Y-%m-%dT%H:%M:%SZ" + ) + if collectionDate.hour == 23: + collectionDate = (timedelta(days=1) + collectionDate).date() + else: + collectionDate = collectionDate.date() entries.append( Collection( - date=datetime.strptime( - collectionDate["date"], "%Y-%m-%dT%H:%M:%SZ" - ).date(), + date=collectionDate, t=collection["desc"], icon=ICON_MAP.get(collection["name"]), ) diff --git a/doc/source/fenland_gov_uk b/doc/source/fenland_gov_uk.md similarity index 100% rename from doc/source/fenland_gov_uk rename to doc/source/fenland_gov_uk.md