From 4ff0703a3117abcf094b91334a9e8e886c676899 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Tue, 14 May 2024 22:54:33 -0700 Subject: [PATCH] fix(slack_alerting.py): fix timezone utc issue --- litellm/integrations/slack_alerting.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/litellm/integrations/slack_alerting.py b/litellm/integrations/slack_alerting.py index ec2740e3005..40258af6b8d 100644 --- a/litellm/integrations/slack_alerting.py +++ b/litellm/integrations/slack_alerting.py @@ -865,7 +865,10 @@ Model Info: # Calculate delta as an aware datetime object with the same timezone as report_sent delta = report_sent - delta_naive - if current_time >= delta: + current_time_utc = current_time.astimezone(timezone.utc) + delta_utc = delta.astimezone(timezone.utc) + + if current_time_utc >= delta_utc: # Sneak in the reporting logic here await self.send_daily_reports(router=llm_router) # Also, don't forget to update the report_sent time after sending the report!