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:
|
def parse_waste_schedule_date(day_and_month: str) -> date:
|
||||||
"""Parse waste schedule date."""
|
"""Parse waste schedule date."""
|
||||||
today = date.today()
|
today = date.today()
|
||||||
this_year = today.year
|
fmt = "%A %d %B %Y"
|
||||||
date_format = "%A %d %B %Y"
|
d = datetime.strptime(f"{day_and_month} {today.year}", fmt).date()
|
||||||
d = datetime.strptime(f"{day_and_month} {this_year}", date_format).date()
|
|
||||||
if d < today:
|
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
|
return d
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue