Skip to content

biometrics/exercises/servings JSON RecordedTime always 00:00:00Z — time-of-day dropped, no local offset #19

Closed

Description

@DTTerastar

Every record returned by the typed export endpoints has a RecordedTime of exactly midnight UTC:

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

Two distinct problems collapsed into one observation:

  1. Time-of-day is missing. Cronometer records the time foods were logged (breakfast vs. dinner), but RecordedTime exposes only the calendar date as 00:00:00. Either the underlying CSV doesn't carry it (in which case the field name RecordedTime is misleading and should be RecordedDate) or the parser is stripping it.

  2. Zone is UTC, not local. The trailing Z shows the value is rendered in UTC. Per the timezone contract, JSON should keep the RFC3339 local offset, e.g. 2026-04-25T00:00:00-04:00. (See companion issue about time.UTC being passed to ExportXxxParsedWithLocation.) The 00:00 UTC value also creates an off-by-one for west-of-UTC users when the markdown renderer buckets by r.RecordedTime.Format(\"2006-01-02\") — "April 24 00:00 UTC" displays as April 23 in the user's local view.

Expected:

  • If Cronometer exposes meal-time, surface it.
  • Either way, render the timestamp in the local zone with offset, not as Z.

Severity: major

Activity

  1. DTTerastar commented on May 19, 2026

    @DTTerastar
    CollaboratorAuthor

    Closing as part-fixed / part-wontfix after investigation:

    Zone-as-UTC: already fixed by #37 (clean-room cronoapi rewrite). Current QA output shows local offset:

    "RecordedTime": "2026-04-11T00:00:00-04:00"
    

    Time-of-day missing: confirmed against the wire-format spec (internal/cronoclient/testdata/cronometer/WIRE_SHAPES.md) and the synthesized fixtures in client_test.go. Cronometer's CSV /export endpoints only emit a Day column (date), not a date+time. There is no time-of-day in the source to surface. Renaming RecordedTime → RecordedDate would be more honest but is a breaking schema change; deferring that decision to a future major version.

    Documented in cmd/prime.go GOTCHAS as part of this release: "RecordedTime is date-only (midnight in your local zone); Cronometer's CSV exports don't carry meal-time, so all times sort as 00:00."

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