-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Fix today selector date mutation bug in dashboard components #12042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
colesmcintosh
merged 9 commits into
BerriAI:main
from
colesmcintosh:fix-today-selector-date-mutation-bug
Jun 26, 2025
Merged
Fix today selector date mutation bug in dashboard components #12042
colesmcintosh
merged 9 commits into
BerriAI:main
from
colesmcintosh:fix-today-selector-date-mutation-bug
Jun 26, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Create new Date objects instead of mutating original DateRangePicker dates - Fixes issue where first API call would mutate dateValue.from/to causing subsequent calls to use corrupted date ranges - Updated usage.tsx, cache_dashboard.tsx, and model_dashboard.tsx - Minimal change preserving original timezone logic
…mponent, simplifying date handling logic and improving consistency across components.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
… directly, improving clarity and consistency in metric data retrieval.
…proving timezone handling for date selections. Default time range visibility is set to true, ensuring better user experience in usage dashboards.
|
This was for a user issue from slack cc @krrishdholakia. @colesmcintosh can you add loom or screenshot ? |
- Fix date formatting in API calls from ISO format to YYYY-MM-DD - Update userDailyActivityCall, teamDailyActivityCall, and tagDailyActivityCall - Prevent date mutation by creating new Date objects before API calls - Set proper time boundaries (00:00:00 to 23:59:59) for same-day selections The API expects dates in YYYY-MM-DD format but the UI was sending full ISO timestamps, causing the Today filter to return empty results.
@ishaan-jaff @krrishdholakia Here's the Date Fix UI Demo |
ishaan-jaff
approved these changes
Jun 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Title
Fix today selector date mutation bug in dashboard components
Relevant issues
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/litellm/
directory, Adding at least 1 test is a hard requirement - see detailsmake test-unit
Type
🐛 Bug Fix
Changes
UsageDatePicker
component to centralize date handling logic across dashboard componentscache_dashboard.tsx
,model_dashboard.tsx
,usage.tsx
,new_usage.tsx
,entity_usage.tsx
)UsageDatePicker
component can be reused across all usage-related dashboard viewsFiles Modified:
ui/litellm-dashboard/src/components/cache_dashboard.tsx
- Simplified date handlingui/litellm-dashboard/src/components/entity_usage.tsx
- Updated to use new date pickerui/litellm-dashboard/src/components/model_dashboard.tsx
- Simplified date handlingui/litellm-dashboard/src/components/new_usage.tsx
- Updated to use new date pickerui/litellm-dashboard/src/components/shared/usage_date_picker.tsx
- New component for centralized date handlingui/litellm-dashboard/src/components/usage.tsx
- Simplified date handlingThe changes improve code maintainability by centralizing date selection logic and fix mutation issues that were causing problems with the today selector functionality.