Refactor
This commit is contained in:
parent
089f569fd3
commit
8e34ceb458
|
@ -68,11 +68,10 @@ async def get_html(data_dir: str, postcode: str, uprn: str) -> str:
|
|||
def parse_waste_schedule_date(day_and_month: str) -> date:
|
||||
"""Parse waste schedule date."""
|
||||
today = date.today()
|
||||
this_year = today.year
|
||||
date_format = "%A %d %B %Y"
|
||||
d = datetime.strptime(f"{day_and_month} {this_year}", date_format).date()
|
||||
fmt = "%A %d %B %Y"
|
||||
d = datetime.strptime(f"{day_and_month} {today.year}", fmt).date()
|
||||
if d < today:
|
||||
d = datetime.strptime(f"{day_and_month} {this_year + 1}", date_format).date()
|
||||
d = datetime.strptime(f"{day_and_month} {today.year + 1}", fmt).date()
|
||||
return d
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue