From 5d48c5d2f0249534331b78392928f33fb724f9fd Mon Sep 17 00:00:00 2001 From: mamrehn Date: Thu, 25 Dec 2025 23:07:03 +0100 Subject: [PATCH] fix: Apply range bounds to both sunrise and sunset times For Sunset: If the calculated UT value is negative or >= 24 hours (which can happen with certain timezone offsets), it's not normalized --- suntime/suntime.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/suntime/suntime.py b/suntime/suntime.py index e4eb53a..2fad95a 100644 --- a/suntime/suntime.py +++ b/suntime/suntime.py @@ -137,8 +137,7 @@ def get_sun_timedelta(self, at_date, time_zone, is_rise_time=True, zenith=90.8): # 7c. rounding and impose range bounds UT = round(UT, 2) - if is_rise_time: - UT = self._force_range(UT, 24) + UT = self._force_range(UT, 24) # Apply to both sunrise and sunset # 8. return timedelta return timedelta(hours=UT)