Skip to content

feat(dashboard): daily cost line + This Month timezone fix#151

Merged
phuryn merged 2 commits into
phuryn:mainfrom
paulabenzar:paula/daily-cost-line
Jul 10, 2026
Merged

feat(dashboard): daily cost line + This Month timezone fix#151
phuryn merged 2 commits into
phuryn:mainfrom
paulabenzar:paula/daily-cost-line

Conversation

@paulabenzar

Copy link
Copy Markdown
Contributor

Summary

  • Adds an Est. Cost line overlay to the Daily Token Usage chart — a line dataset on a dedicated right-side y-axis (accent color), computed per model before the daily aggregation so per-model pricing is applied correctly. Toggleable via the legend like all other series.
  • Fixes "This Month" including the last day of the previous month in UTC+ timezones: getRangeBounds was using toISOString() (UTC) to format dates constructed from local midnight, which shifted one day back. Now uses getFullYear/getMonth/getDate (local) throughout.

Test plan

  • Open dashboard, select "This Month" — verify only July dates appear (no June 30)
  • Daily Token Usage chart shows an orange Est. Cost line with $ values on the right axis
  • Toggling "Est. Cost" in the legend hides/shows the line
  • Cost line reflects the active model filter and date range
  • All 144 unit tests pass (python3 -m unittest discover -s tests -v)

Adds a per-day cost line (accent color, right y2 axis) on top of the
existing stacked bar chart. Cost is accumulated per model during the
daily aggregation pass so per-model pricing is applied correctly, then
rendered as a Chart.js line dataset with a dedicated y-axis.
…UTC shift

toISOString() outputs UTC, so in UTC+ timezones midnight local time converts
to the previous UTC date — causing "This Month" to include the last day of
the previous month. Use getFullYear/getMonth/getDate (local) instead.
phuryn added a commit that referenced this pull request Jul 10, 2026
PR #151 fixed getRangeBounds to format range bounds from local date
components, but rangeIncludesToday still derived 'today' via UTC
toISOString(), so the two could disagree near UTC midnight. Extract a
shared localISODate() helper and use it in both, removing the
duplicated formatting expression.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
phuryn added a commit that referenced this pull request Jul 10, 2026
…rate (#153), host/port docs (#150)

Add the #151 and #150 entries alongside the #153 bullet and set the
release date. VERSION / package.json / heading already agree at 1.5.5.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
phuryn added a commit that referenced this pull request Jul 10, 2026
@phuryn phuryn merged commit 370adcc into phuryn:main Jul 10, 2026
@phuryn

phuryn commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Thanks @paulabenzar — merged and shipped in v1.5.5. Both changes are in: the per-model-priced Est. Cost overlay on the Daily Token Usage chart (priced before the daily aggregation, so multi-model days are correct) and the This Month UTC+ timezone fix.

Follow-up on top of your commits: I applied the same local-date fix to rangeIncludesToday, which was still deriving "today" via toISOString() (UTC) and could disagree with your corrected range bounds near UTC midnight. Both now share a small localISODate() helper. Your commits are preserved and credited in the changelog.

Written by Pawel's agent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants