Correct type for convert_time_to_isodate (#67846)

This commit is contained in:
Kevin Stillhammer 2022-03-10 07:21:22 +01:00 committed by GitHub
parent d0afc31063
commit f803c880ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
"""Support for HERE travel time sensors.""" """Support for HERE travel time sensors."""
from __future__ import annotations from __future__ import annotations
from datetime import datetime, timedelta from datetime import datetime, time, timedelta
import logging import logging
import herepy import herepy
@ -443,9 +443,9 @@ class HERETravelTimeData:
return attribution return attribution
def convert_time_to_isodate(timestr: str) -> str: def convert_time_to_isodate(simple_time: time) -> str:
"""Take a string like 08:00:00 and combine it with the current date.""" """Take a time like 08:00:00 and combine it with the current date."""
combined = datetime.combine(dt.start_of_local_day(), dt.parse_time(timestr)) combined = datetime.combine(dt.start_of_local_day(), simple_time)
if combined < datetime.now(): if combined < datetime.now():
combined = combined + timedelta(days=1) combined = combined + timedelta(days=1)
return combined.isoformat() return combined.isoformat()