mirror of
https://github.com/sascha-hemi/hacs_waste_collection_schedule.git
synced 2026-03-21 05:06:33 +01:00
Fix "Date not available" error.
Fixed an issue where the date returned from stockton_gov_uk would be "Date not available" during winter months for garden waste. This would cause an error when converting it to a date string.
This commit is contained in:
@@ -108,6 +108,10 @@ class Source:
|
||||
]
|
||||
|
||||
for date_node in date_nodes:
|
||||
# If date is "Date not available" then skip (Winter period)
|
||||
if date_node.text.strip() == "Date not available":
|
||||
continue
|
||||
|
||||
# Remove ordinal suffixes from date string
|
||||
date_string = re.sub(
|
||||
r"(?<=[0-9])(?:st|nd|rd|th)", "", date_node.text.strip()
|
||||
|
||||
Reference in New Issue
Block a user