Skip to content

Dashboard analytics daily chart uses UTC instead of configured timezone #23982

@Eji4h

Description

@Eji4h

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/cliCLI entry point, hermes_cli/, setup wizardtype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions