Open buelowp opened 6 months ago
I also ran into this problem...
I've run into the same issue too. I think the problem might be in suntime.py
with get_sun_timedelta
function as the returning timedelta(hours=UT)
variable is negative.
I have the same problem too since a couple of days ago, but it's consistent ever since 😐
This issue seems to have been introduced by e9b1fa471dbed4da039a1905596de68e9adfaa70.
The bug seems to only happen for days 1 through 80 of the year (i.e. 2024-01-01 through 2024-03-19 are fine this year).
Update: Removing this conditional (run the code for both sunrise and sunset) seems to fix the issue. Not sure if it impacts anything else, but the conditional wasn't there before.
Same issue here.
I have the same issue
Also hitting this. It would be nice to have a fix. As it currently stands my estimation of the amount of sunlight at given points looks very wrong:
I've just run into this issue.
In the mean time you can use version 1.2.5 (1.3.0 and 1.3.1 are borked and 1.3.2 is one day in the past):
pip3 install suntime==1.2.5
I have just noted that, despite using 1.2.5, now my sunrise date is the following day but the time is right. So, for my basic chicken coop needs I have done this ugly hack: combining the current date with the sunrise/sunset times. Don't use that if you have NASA needs ;-)
# UTC+10
tz_name = 'Australia/Brisbane'
tz = zoneinfo.ZoneInfo(tz_name)
# Fix for buggy(?) suntime library (sunrise is right time but date is the next day):
# was: 2024-09-20 05:41:00+10:00 --> 2024-09-19 17:43:00+10:00
# with this fix becomes: 2024-09-19 05:41:00 --> 2024-09-19 17:43:00
sunrise = datetime.combine(datetime.now(), today_sr.astimezone(tz).time())
sunset = datetime.combine(datetime.now(), today_ss.astimezone(tz).time())
I think this may be the same as #29 but testing it, I couldn't exactly get the same reproduction. At issue is when I use this library on my Pi, I'm getting a sunset value from the day before, but sunrise is correct.
This little snippet reproduces the issue for me.
which gives me the following results
The values returned are correct, but notice that sunset is yesterday, which doesn't make a lot of sense. This behavior is the same whether I use at_date or not.