From b763b04565699469463b9a57fa82867fa0540275 Mon Sep 17 00:00:00 2001
From: Thomas Boby
Date: Sun, 25 Aug 2024 09:41:23 +0200
Subject: [PATCH] Oxford city: Support shortened month name
---
.../waste_collection_schedule/source/oxford_gov_uk.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
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),
)