diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/oxford_gov_uk.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/oxford_gov_uk.py index bc19dadf..65344e36 100644 --- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/oxford_gov_uk.py +++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/oxford_gov_uk.py @@ -58,9 +58,13 @@ class Source: matches = re.match(r"^(\w+) Next Collection: (.*)", paragraph.text) if matches: collection_type, date_string = matches.groups() + try: + date = datetime.strptime(date_string, "%A %d %B %Y").date() + except ValueError: + date = datetime.strptime(date_string, "%A %d %b %Y").date() entries.append( Collection( - date=datetime.strptime(date_string, "%A %d %B %Y").date(), + date=date, t=collection_type, icon=ICON_MAP.get(collection_type), )