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:
Dean Longstaff
2023-11-03 09:15:31 +00:00
committed by 5ila5
parent fd1b4d62b5
commit dee89ecc85

View File

@@ -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()