diff --git a/ui/litellm-dashboard/src/app/(dashboard)/usage/_components/components/UsagePageView.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/usage/_components/components/UsagePageView.test.tsx index 18ebee16745..5fd74aca99d 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/usage/_components/components/UsagePageView.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/usage/_components/components/UsagePageView.test.tsx @@ -35,6 +35,8 @@ vi.mock("./ClientUsagePanel", () => ({ }, })); +vi.mock("@/components/UsageAlerts/UsageAlertContext", () => ({ default: () => null })); + // The Overview tab. The Key Activity tab stays mounted and carries its own spend-derived totals, // so assertions about the overview's request tiles are scoped here rather than to the whole page. const overview = () => within(screen.getByRole("tabpanel", { name: "Overview" })); @@ -604,6 +606,34 @@ describe("UsagePage", () => { } as any); }); + it.each([ + { context: "deployment alert", alert: "&alert=example-alert", timezoneOffsetMinutes: 0 }, + { context: "ordinary usage", alert: "", timezoneOffsetMinutes: undefined }, + ])( + "uses the same daily timezone for totals and tag activity in $context", + async ({ alert, timezoneOffsetMinutes }) => { + renderWithProviders(, { + searchParams: `?from=2026-08-01&to=2026-08-08${alert}`, + }); + + await waitFor(() => + expect(mockDailyActivityAggregatedCall).toHaveBeenCalledWith( + "tag", + expect.objectContaining({ + startTime: new Date(2026, 7, 1), + endTime: new Date(2026, 7, 8, 23, 59, 59, 999), + }), + ), + ); + expect( + mockDailyActivityAggregatedCall.mock.calls.find(([entity]) => entity === "tag")?.[1].timezoneOffsetMinutes, + ).toBe(timezoneOffsetMinutes); + expect( + mockDailyActivityAggregatedCall.mock.calls.find(([entity]) => entity === "user")?.[1].timezoneOffsetMinutes, + ).toBe(timezoneOffsetMinutes); + }, + ); + it("hands the subscription usage to the fixed cost card for an admin and never fetches it otherwise", async () => { const { unmount } = renderWithProviders(); await waitFor(() => { diff --git a/ui/litellm-dashboard/src/app/(dashboard)/usage/_components/components/UsagePageView.tsx b/ui/litellm-dashboard/src/app/(dashboard)/usage/_components/components/UsagePageView.tsx index a5ef1d7649d..afbc1ba8391 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/usage/_components/components/UsagePageView.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/usage/_components/components/UsagePageView.tsx @@ -284,13 +284,13 @@ const UsagePage: React.FC = ({ teams, organizations, teamsLoadin const globalClientSelected = isAdmin && selectedClient !== null && globalClientScope; const needsAgentSummary = showTopAgents || globalClientSelected; const tagDailyRequest = useMemo( - () => (accessToken && startTime && endTime ? { accessToken, startTime, endTime, entityIds: null } : null), - [accessToken, startTime, endTime], + () => (dailyActivityRequest ? { ...dailyActivityRequest, entityIds: null } : null), + [dailyActivityRequest], ); const { data: tagDailyRaw, loading: tagDailyLoading } = useAggregatedDailyActivity({ fetch: () => ENTITY_API.tag.aggregated(tagDailyRequest as DailyActivityRequest), enabled: tagDailyRequest !== null && needsAgentSummary, - deps: [accessToken, startTime, endTime, needsAgentSummary], + deps: [tagDailyRequest, needsAgentSummary], }); const tagDaily = useMemo(() => toDailyData(tagDailyRaw), [tagDailyRaw]); const openAgentActivity = useCallback(