Skip to content

Commit

Permalink
Merge pull request #1017 from dmturner/main
Browse files Browse the repository at this point in the history
Fix for deprecated functions throwing error
  • Loading branch information
tobi-wan-kenobi authored Apr 13, 2024
2 parents dc3c09f + d161760 commit ed10923
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 ed10923

Please sign in to comment.