Skip to content

Commit

Permalink
Fix "Date not available" error.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
deanlongstaff authored and 5ila5 committed Nov 3, 2023
1 parent fd1b4d6 commit dee89ec
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ def fetch(self):
]

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()
Expand Down

0 comments on commit dee89ec

Please sign in to comment.