fix: resolve dates and bucket timestamps in local time - #14
Merged
Conversation
Two bug classes were mixing UTC and local time across the CLI:
1. Absolute date flags (--since 2025-01-01, show 2025-03-08) used
time.Parse which defaults to UTC. In EDT that's Jan 1 midnight UTC =
Dec 31 8pm local, so --since silently included yesterday evening's
data and show <date> returned workouts from the wrong calendar day.
Relative flags (--since 7d, today, yesterday) already anchored to
local time, so the two forms of the same flag had different
semantics.
2. API timestamps (StartedAt, RFC3339 with the server's zone) were
formatted to YYYY-MM-DD without converting to local first. A 11pm
local workout (4am UTC next day) bucketed under the wrong date in
stats and monthly bodyweight averages, and failed to match in
'workouts show <date>'.
Fix is mechanical: ParseInLocation(..., time.Local) for user date
parsing, and .Local() before every Format("2006-01-02") used as a
bucket key or display string.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4 tasks
DTTerastar
pushed a commit
that referenced
this pull request
May 19, 2026
…#48) Wires liftoff-export-cli into the cross-CLI compat suite for §4 (--format) of CONTRACT.md, mirroring crono's machine-attestation pattern. - compat_contract_test.go (build tag: compat) runs compat/formats.RunContract against the built binary via LIFTOFF_EXPORT_BIN. - New CI job builds the binary, runs `go mod tidy`, then `go test -tags=compat -run TestContractFormats ./...`. - Existing `go vet + test` job kept untouched. - Subcommands list targets the four data-producing leaves that take --format without a required positional: `workouts list`, `workouts stats`, `bodyweights list`, `bodyweights stats`. Excludes `workouts show` because its mandatory <date> positional would conflate "missing arg" with "bad format" in parse-level subtests. - SkipDataPath: true — liftoff's data path needs a stored OAuth token at ~/.config/liftoff-export/auth.json which CI does not provision; parse-level subtests still attest the §4 surface. - SupportedFormats: [markdown, json] — CSV is not yet wired, so CSVHasHeader skips with a named reason rather than failing. - go.mod pinned to merged-main pseudo-version v0.0.0-…-de9219e03369 (PR #12 nested-subcommand support + PR #14 SkipDataPath). Closes liftoff side of [QUA-16](/QUA/issues/QUA-16). Follows the crono pattern landed in [QUA-14](/QUA/issues/QUA-14). Co-authored-by: Terastar-Paperclip <noreply@paperclip.ing>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two bug classes were mixing UTC and local time, producing off-by-one-day results for users not in UTC:
Fix is mechanical:
Test plan
🤖 Generated with Claude Code