Skip to content

Commit

Permalink
Merge pull request #1119 from teofanis/master
Browse files Browse the repository at this point in the history
fix: correctly handle year increment for January dates (Broxbourne Council)
  • Loading branch information
robbrad authored Jan 4, 2025
2 parents 87a19fa + 0bef678 commit c1654ec
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def parse_data(self, page: str, **kwargs) -> dict:
rows = table.find_all("tr")

current_year = datetime.now().year
current_month = datetime.now().month

# Process each row into a list of dictionaries
for row in rows[1:]: # Skip the header row
Expand All @@ -56,7 +57,7 @@ def parse_data(self, page: str, **kwargs) -> dict:
if collection_date_text:
try:
collection_date = datetime.strptime(collection_date_text, "%a %d %b")
if collection_date.month == 1:
if collection_date.month == 1 and current_month != 1:
collection_date = collection_date.replace(year=current_year + 1)
else:
collection_date = collection_date.replace(year=current_year)
Expand Down

0 comments on commit c1654ec

Please sign in to comment.