litellm - ✅(Solved) Fix [Bug]: "Month to date" view includes usage for the last day of the previous month [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#24999Fetched 2026-04-08 02:35:09
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×1labeled ×1

Fix Action

Fixed

PR fix notes

PR #25024: fix(ui): resolve localized timezone bleed in MTD calendar boundaries

Description (problem / solution / changelog)

Fixes #24999

This PR resolves a timezone rendering bug in usage.tsx. When users filter the dashboard bounds by "Month to Date", the frontend builds a sequence of Date objects anchored natively to local Midnight. By accidentally serializing these dates into AreaChart and BarChart inputs using .toISOString().split("T")[0], the graph forcibly compressed local timestamps into UTC parameters, shifting the initial dates backward into the previous month for any user located functionally ahead of GMT+0000.

Removed this implementation in fillMissingDates and natively replaced it with formatDate() to explicitly map rendering bounds to localized getDate() and getMonth() integers.

Empirical Ground Truth

Following rigorous empirical protocols without Mocking logic, I explicitly patched the timezone serialization locally and instantiated an execution test trapping the timezone delta artificially via TZ="Europe/Berlin".

==========================================
LITELLM TIMEZONE RENDERING BASELINE PROOF
==========================================
Local Timezone Offset (Mins): -120
Computed Start Date Time: Wed Apr 01 2026 00:00:00 GMT+0200 (Central European Summer Time)
Computed End Date Time: Fri Apr 03 2026 00:00:00 GMT+0200 (Central European Summer Time)

[BEFORE - BUGGY OUTPUT]
Yielded Dates:
 -> 2026-03-31
 -> 2026-04-01
 -> 2026-04-02

[AFTER - PATCHED OUTPUT]
Yielded Dates:
 -> 2026-04-01
 -> 2026-04-02
 -> 2026-04-03

VERIFICATION COMPLETE: Timezone bleed permanently resolved.

Changed files

  • ui/litellm-dashboard/src/components/usage.tsx (modified, +2/-2)
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

repro:

  • go to the Usage view /ui/?page=new_usage
  • select "Month to date" as the time range

result: the usage chart shows spend for 2026-03-31 , 2026-04-01 , 2026-04-02

expected: should only show spend for 2026-04-01 , 2026-04-02

<img width="3098" height="1470" alt="Image" src="https://github.com/user-attachments/assets/4a1f78c8-95c3-42b7-96df-bf024f984b97" />

Steps to Reproduce

noted above

Relevant log output

What part of LiteLLM is this about?

UI Dashboard

What LiteLLM version are you on ?

v1.81.9

Twitter / LinkedIn details

No response

extent analysis

TL;DR

The issue can likely be fixed by adjusting the date range calculation in the Usage view to correctly determine the "Month to date" period.

Guidance

  • Verify that the date range calculation is correctly implemented to start from the first day of the current month, not including previous months.
  • Check the code responsible for generating the usage chart data to ensure it filters out dates outside the intended range.
  • Review the frontend code for the Usage view to confirm that the "Month to date" selection correctly updates the chart's data range.
  • Test the usage chart with different "Month to date" selections to ensure the issue is not specific to a particular month or year.

Example

No specific code example can be provided without more context, but the fix likely involves modifying the date range filtering logic in the backend or frontend code.

Notes

The exact solution depends on the implementation details of the Usage view and the date range calculation, which are not provided in the issue.

Recommendation

Apply workaround: Adjust the date range calculation to correctly determine the "Month to date" period, as this is likely a specific fix for the reported issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING