From 1a6e06c2bdd274ddd72f40158735635488463c91 Mon Sep 17 00:00:00 2001 From: Kagamine Rin Date: Sun, 14 Jun 2026 13:51:45 -0400 Subject: [PATCH] fix: add timezone_offset valve for local date resolution --- litellm_dashboard.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/litellm_dashboard.py b/litellm_dashboard.py index 54d3621..d092910 100644 --- a/litellm_dashboard.py +++ b/litellm_dashboard.py @@ -5,7 +5,7 @@ author_url: https://rin.captcouch.xyz description: Check LiteLLM proxy health + auth status and get cost breakdowns with configurable timerange. Two functions, that's it. required_open_webui_version: 0.4.0 requirements: requests -version: 1.2.0 +version: 1.2.1 licence: MIT """ @@ -34,6 +34,10 @@ class Tools: default=True, description="Default behavior for zero-spend model filtering. When True, models with sub-$0.001 spend are hidden by default and summarized. The per-call hide_zero_spend parameter can override this.", ) + timezone_offset: int = Field( + default=0, + description="Timezone offset from UTC in hours (e.g. -4 for EDT, -5 for EST). Used for natural language date resolution (today, yesterday).", + ) def _headers(self) -> dict: """Build auth headers from valves.""" @@ -54,7 +58,8 @@ class Tools: Falls back to passthrough if already YYYY-MM-DD or unrecognized. """ date_str = date_str.strip().lower() - today = datetime.utcnow().date() + # Apply timezone offset to UTC now to get "local" today + today = (datetime.utcnow() + timedelta(hours=self.valves.timezone_offset)).date() # Direct shortcuts if date_str == "today":