diff --git a/ui/litellm-dashboard/src/components/key_team_helpers/BudgetWindowsEditor.test.ts b/ui/litellm-dashboard/src/components/key_team_helpers/BudgetWindowsEditor.test.ts new file mode 100644 index 00000000000..9fa157e8680 --- /dev/null +++ b/ui/litellm-dashboard/src/components/key_team_helpers/BudgetWindowsEditor.test.ts @@ -0,0 +1,29 @@ +import { describe, expect, it } from "vitest"; + +import { BUDGET_WINDOW_OPTIONS } from "./BudgetWindowsEditor"; + +const hintFor = (value: string): string => { + const option = BUDGET_WINDOW_OPTIONS.find((o) => o.value === value); + if (!option) throw new Error(`no budget window option for ${value}`); + return option.resetHint; +}; + +describe("BUDGET_WINDOW_OPTIONS reset hints", () => { + it("describes the weekly window as resetting on Monday, matching the backend", () => { + expect(hintFor("7d")).toContain("Monday"); + expect(hintFor("7d")).not.toContain("Sunday"); + }); + + it("does not claim a fixed UTC reset, since the backend honors the configured timezone", () => { + for (const option of BUDGET_WINDOW_OPTIONS) { + expect(option.resetHint).not.toContain("midnight UTC"); + } + }); + + it("points at litellm_settings.timezone and its UTC default for every window that resets at a time of day", () => { + for (const value of ["24h", "7d", "30d"]) { + expect(hintFor(value)).toContain("litellm_settings.timezone"); + expect(hintFor(value)).toContain("defaults to UTC"); + } + }); +}); diff --git a/ui/litellm-dashboard/src/components/key_team_helpers/BudgetWindowsEditor.tsx b/ui/litellm-dashboard/src/components/key_team_helpers/BudgetWindowsEditor.tsx index 3f8b2484c7b..b484ab50366 100644 --- a/ui/litellm-dashboard/src/components/key_team_helpers/BudgetWindowsEditor.tsx +++ b/ui/litellm-dashboard/src/components/key_team_helpers/BudgetWindowsEditor.tsx @@ -8,11 +8,13 @@ export interface BudgetWindowEntry { max_budget: number | null; } +const RESET_TIMEZONE_NOTE = "in the proxy timezone (litellm_settings.timezone, defaults to UTC)"; + export const BUDGET_WINDOW_OPTIONS = [ { value: "1h", label: "Hourly", resetHint: "Resets every hour" }, - { value: "24h", label: "Daily", resetHint: "Resets daily at midnight UTC" }, - { value: "7d", label: "Weekly", resetHint: "Resets every Sunday at midnight UTC" }, - { value: "30d", label: "Monthly", resetHint: "Resets on the 1st of every month at midnight UTC" }, + { value: "24h", label: "Daily", resetHint: `Resets daily at midnight ${RESET_TIMEZONE_NOTE}` }, + { value: "7d", label: "Weekly", resetHint: `Resets every Monday at midnight ${RESET_TIMEZONE_NOTE}` }, + { value: "30d", label: "Monthly", resetHint: `Resets on the 1st of each month at midnight ${RESET_TIMEZONE_NOTE}` }, ]; interface BudgetWindowsEditorProps {