Skip to content

API timestamps emitted in UTC, not the user's local zone — violates timezone contract #13

Closed

Description

@DTTerastar

internal/cronoclient/client.go hard-codes time.UTC when calling the gocronometer parsers:

recs, err := c.inner.ExportServingsParsedWithLocation(ctx, rng.Start, rng.End, time.UTC)         // L42
recs, err := c.inner.ExportExercisesParsedWithLocation(ctx, rng.Start, rng.End, time.UTC)        // L51
recs, err := c.inner.ExportBiometricRecordsParsedWithLocation(ctx, rng.Start, rng.End, time.UTC) // L60

This produces JSON timestamps like "RecordedTime": "2026-04-24T00:00:00Z" regardless of the host zone, e.g.:

$ /tmp/crono-export servings --since 7d --format json | jq '.[].RecordedTime' | sort -u
"2026-04-18T00:00:00Z"
"2026-04-19T00:00:00Z"
...
"2026-04-25T00:00:00Z"

Per the quantcli timezone policy: API timestamps should be .Local()-ed before bucketing/formatting, and JSON should keep the RFC3339 offset (e.g. 2026-04-24T00:00:00-04:00). The downstream markdown date-bucketing in cmd/format.go (r.RecordedTime.Format(\"2006-01-02\")) also assumes the timestamp is in local zone, so on machines west of UTC a record logged at 9pm local on day N currently buckets one day late.

Fix: pass time.Local instead of time.UTC to the three ExportXxxParsedWithLocation calls.

Severity: major

Activity

  1. added a commit that references this issue on May 9, 2026
    f6e8f1f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions