Skip to content

Commit

Permalink
fix: robbrad#1089 - Correct shifted dates in Bromley Borough Council
Browse files Browse the repository at this point in the history
  • Loading branch information
dp247 committed Dec 17, 2024
1 parent 16bcd10 commit 80d3fc4
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class CouncilClass(AbstractGetBinDataClass):
"""

def parse_data(self, page: str, **kwargs) -> dict:
# Make a BS4 object
driver = None
try:
bin_data_dict = {"bins": []}
Expand Down Expand Up @@ -76,12 +75,13 @@ def parse_data(self, page: str, **kwargs) -> dict:
# Get the current year
current_year = datetime.now().year

# Append the year to the date
date_with_year = date_object.replace(year=current_year)

# Check if the parsed date is in the past compared to the current date
if date_object < datetime.now():
# If the parsed date is in the past, assume it's for the next year
current_year += 1
# Append the year to the date
date_with_year = date_object.replace(year=current_year)

# Format the date with the year
date_with_year_formatted = date_with_year.strftime(
Expand Down

0 comments on commit 80d3fc4

Please sign in to comment.