Closed broad-well closed 1 month ago
def floor_day(d: datetime) -> datetime:
"""
Round down to the start of the day
"""
return d.min.replace(d.year, d.month, d.day, tzinfo=d.tzinfo) if has_time(d) else d
This appears to fix it on my end.
Thanks for solution. It indeed was an oversight.
I haven't had time to find the exact conditions that trigger the condition described in the title, but from a little digging in my debugger, I found the following behavior in
date_utils.py
:This effectively erases the timezone information. In my case, the return value is then compared to a timezone-aware datetime value from my dataset, which produces an error.