Skip to content

Commit

Permalink
fix for deprecated functions throwing error
Browse files Browse the repository at this point in the history
  • Loading branch information
dmturner committed Apr 13, 2024
1 parent dc3c09f commit d161760
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions bumblebee_status/modules/contrib/sun.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ def __calculate_times(self):
order_matters = True

try:
self.__sunrise = self.__sun.get_local_sunrise_time()
self.__sunrise = self.__sun.get_sunrise_time(time_zone=tzlocal())
except SunTimeException:
self.__sunrise = "no sunrise"
order_matters = False

try:
self.__sunset = self.__sun.get_local_sunset_time()
self.__sunset = self.__sun.get_sunset_time(time_zone=tzlocal())
except SunTimeException:
self.__sunset = "no sunset"
order_matters = False
Expand All @@ -84,18 +84,18 @@ def __calculate_times(self):

now = datetime.datetime.now(tz=tzlocal())
if now > self.__sunset:
tomorrow = (now + datetime.timedelta(days=1)).date()
tomorrow = (now + datetime.timedelta(days=1))
try:
self.__sunrise = self.__sun.get_local_sunrise_time(tomorrow)
self.__sunset = self.__sun.get_local_sunset_time(tomorrow)
self.__sunrise = self.__sun.get_sunrise_time(tomorrow, tzlocal())
self.__sunset = self.__sun.get_sunset_time(tomorrow, tzlocal())
except SunTimeException:
self.__sunrise = "no sunrise"
self.__sunset = "no sunset"

elif now > self.__sunrise:
tomorrow = (now + datetime.timedelta(days=1)).date()
try:
self.__sunrise = self.__sun.get_local_sunrise_time(tomorrow)
self.__sunrise = self.__sun.get_sunrise_time(tomorrow, tzlocal())
except SunTimeException:
self.__sunrise = "no sunrise"
return
Expand Down

0 comments on commit d161760

Please sign in to comment.