Commit f0b52ff
fix: resolve dates and bucket timestamps in local time (#14)
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) <[email protected]>1 parent 2acd482 commit f0b52ff
3 files changed
Lines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
108 | 109 | | |
109 | 110 | | |
110 | 111 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
| 140 | + | |
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
| 165 | + | |
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
| 226 | + | |
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
| |||
0 commit comments