fix: pass time.Local to gocronometer parsers — closes #13#28
Merged
Conversation
Three call sites in cronoclient.Client hardcoded time.UTC when invoking ExportServingsParsedWithLocation, ExportExercisesParsedWithLocation, and ExportBiometricRecordsParsedWithLocation. The result was that every RecordedTime emitted by these subcommands carried a UTC offset (`...Z`) regardless of the host zone, in direct violation of the timezone contract: https://github.com/quantcli/common/blob/main/CONTRACT.md#2-timezone-policy Beyond the JSON cosmetic, this caused the markdown date-bucketing in cmd/format.go (`r.RecordedTime.Format("2006-01-02")`) to compute the wrong calendar day for any host west of UTC: a record logged at 9pm local on day N bucketed one day late. Fix: time.UTC → time.Local in all three calls. Verified: $ crono-export servings --since 7d --format json | jq '.[0].RecordedTime' "2026-05-02T00:00:00-04:00" # was "2026-05-02T00:00:00Z" Closes #13. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Orca <help@stably.ai>
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
Fixes #13. Three call sites in `cronoclient.Client` hardcoded `time.UTC` when invoking `ExportServingsParsedWithLocation`, `ExportExercisesParsedWithLocation`, and `ExportBiometricRecordsParsedWithLocation`. The result was every `RecordedTime` emitted by these subcommands carried a UTC offset (`...Z`) regardless of the host zone, in direct violation of CONTRACT §2.
Beyond the JSON cosmetic, this caused the markdown date-bucketing in `cmd/format.go` (`r.RecordedTime.Format("2006-01-02")`) to compute the wrong calendar day for any host west of UTC: a record logged at 9pm local on day N bucketed one day late.
```diff
```
(× 3, all in `internal/cronoclient/client.go`.)
Test plan
```
$ crono-export servings --since 7d --format json | jq '.[0].RecordedTime'
"2026-05-02T00:00:00Z"
```
```
$ crono-export servings --since 7d --format json | jq '.[0].RecordedTime'
"2026-05-02T00:00:00-04:00"
```
🤖 Generated with Claude Code
Made with Orca 🐋