DAY = timedelta(1)
local_tz = get_localzone()
now = datetime.now(local_tz)
day_ago = local_tz.normalize(now - DAY)
naive = now.replace(tzinfo=None) - DAY
yesterday = local_tz.localize(naive, is_dst=None)
How can I subtract a day from a Python date?