Problem
The daily token usage chart on the Dashboard analytics page groups sessions by UTC date, ignoring the user-configured timezone. For users outside UTC, this causes:
- Today's sessions that started after midnight local time but before midnight UTC are grouped under yesterday in the chart
- Sessions across date boundaries (e.g., local midnight) get split across wrong days
Current Behavior
SELECT date(started_at, 'unixepoch') as day, ...
FROM sessions WHERE started_at > ?
GROUP BY day ORDER BY day
date(started_at, 'unixepoch') gives UTC dates regardless of the timezone setting in config.yaml.
Expected Behavior
The chart should respect the user's configured timezone (or server-local timezone). For example, if timezone: Asia/Bangkok (UTC+7), daily grouping should use Bangkok dates.
Proposed Fix
Add the timezone offset (seconds) to started_at before converting:
SELECT date(started_at + ?, 'unixepoch') as day, ...
Where ? is the offset from hermes_time.get_timezone().
Compatibility Note
This change only touches the backend SQL query — the response schema (daily array with day, input_tokens, output_tokens, etc.) stays identical. The frontend uses day as a date string ("2026-05-12") via toLocaleDateString(), so it is backward-compatible with cached frontend JS. No new fields needed.
Related
Hermes already supports timezone configuration via:
timezone key in ~/.hermes/config.yaml
HERMES_TIMEZONE env var (legacy)
hermes_time.now() / hermes_time.get_timezone() helper
This was partially addressed in v0.4.0 (naive timestamp fix) but the dashboard analytics chart was never updated.
Environment
- Hermes Agent current main
- Affected page: Dashboard → Analytics → Daily Token Usage
Problem
The daily token usage chart on the Dashboard analytics page groups sessions by UTC date, ignoring the user-configured timezone. For users outside UTC, this causes:
Current Behavior
date(started_at, 'unixepoch')gives UTC dates regardless of thetimezonesetting inconfig.yaml.Expected Behavior
The chart should respect the user's configured timezone (or server-local timezone). For example, if
timezone: Asia/Bangkok(UTC+7), daily grouping should use Bangkok dates.Proposed Fix
Add the timezone offset (seconds) to
started_atbefore converting:Where
?is the offset fromhermes_time.get_timezone().Compatibility Note
This change only touches the backend SQL query — the response schema (
dailyarray withday,input_tokens,output_tokens, etc.) stays identical. The frontend usesdayas a date string ("2026-05-12") viatoLocaleDateString(), so it is backward-compatible with cached frontend JS. No new fields needed.Related
Hermes already supports timezone configuration via:
timezonekey in~/.hermes/config.yamlHERMES_TIMEZONEenv var (legacy)hermes_time.now()/hermes_time.get_timezone()helperThis was partially addressed in v0.4.0 (naive timestamp fix) but the dashboard analytics chart was never updated.
Environment