feat(site): add DateRangePicker to analytics page#23992
Closed
DanielleMaywood wants to merge 1 commit into
Closed
Conversation
This was referenced Apr 2, 2026
086af11 to
d1126ba
Compare
2647970 to
e866d28
Compare
d1126ba to
5a71b01
Compare
10e5668 to
ca81cdd
Compare
2df2da3 to
8c37a80
Compare
ca81cdd to
2ad4c35
Compare
This was referenced Apr 7, 2026
8c37a80 to
4a8ae12
Compare
2ad4c35 to
0d52625
Compare
4a8ae12 to
1339fdf
Compare
0d52625 to
d18e3a3
Compare
1339fdf to
c9b492e
Compare
f36406b to
847cb45
Compare
c9b492e to
d763bdd
Compare
847cb45 to
421a732
Compare
fcfb877 to
254e305
Compare
421a732 to
581dfdc
Compare
254e305 to
debdc88
Compare
581dfdc to
70f8e74
Compare
debdc88 to
f79e590
Compare
4fe05f9 to
f04c99f
Compare
be3c23d to
646b432
Compare
f04c99f to
069be14
Compare
646b432 to
669328e
Compare
069be14 to
37b0cbb
Compare
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
PR 3/4 in a stack to unify agent settings pages.
What
Replaces the fixed 30-day date range on the analytics page with a URL search param–driven
DateRangePicker, and extracts a shared date utility.Why
The analytics page previously hardcoded a 30-day lookback with no way to change it. Adding the same
DateRangePickercomponent already used on the Spend page (PR 4) lets users select custom date ranges. Persisting the selection in URL search params (startDate/endDate) means the range survives page refreshes and can be shared via URL.The date utility extraction addresses a duplication issue: both the analytics and spend pages need to detect exclusive-midnight end dates (the date picker uses midnight of the following day as the exclusive upper bound) and adjust the display by −1 ms. This logic was duplicated inline in both view components.
utils/dateRange.tsprovidesisMidnightandtoInclusiveDateRangeas a single source of truth.Changes
AgentAnalyticsPage— parsesstartDate/endDatefrom URL search params, validates them, falls back to the default 30-day range. PassesonDateRangeChangethat updates the URL params and resets to page 1.AgentAnalyticsPageView— usestoInclusiveDateRange()from the new utility instead of inline midnight detection. AddsSectionHeaderfor consistent page headings.utils/dateRange.ts—isMidnight(date)predicate andtoInclusiveDateRange(dateRange, hasExplicitDateRange)helper.formatUsageDateRangewill be added in PR 4 when it gains its first consumer.Layout standardization —
ChatModelAdminPanelandMCPServerAdminPanelchanged fromspace-y-3tospace-y-6to match the vertical rhythm used across the other settings pages.PRInsightsViewgains aSectionHeaderwithAdminBadgefor consistency.Stack