Upgrade Astral to 2.2 (#48573)

This commit is contained in:
FMKaiba 2021-04-01 15:29:08 -07:00 committed by GitHub
parent e76503ddc3
commit 09eb74fd9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 211 additions and 188 deletions

View file

@ -173,20 +173,6 @@ class TodSensor(BinarySensorEntity):
self._time_before = before_event_date
# We are calculating the _time_after value assuming that it will happen today
# But that is not always true, e.g. after 23:00, before 12:00 and now is 10:00
# If _time_before and _time_after are ahead of current_datetime:
# _time_before is set to 12:00 next day
# _time_after is set to 23:00 today
# current_datetime is set to 10:00 today
if (
self._time_after > self.current_datetime
and self._time_before > self.current_datetime + timedelta(days=1)
):
# remove one day from _time_before and _time_after
self._time_after -= timedelta(days=1)
self._time_before -= timedelta(days=1)
# Add offset to utc boundaries according to the configuration
self._time_after += self._after_offset
self._time_before += self._before_offset