Skip to content

Commit 1b7b417

Browse files
AnnatarHeclaude
andcommitted
fix(daemon): convert cc_info timestamps to UTC before sending to server
The cc_info fetching was sending timestamps with local timezone offset (e.g., "2026-01-04T00:00:00+08:00"), but the server stores data in UTC. If the server doesn't properly parse the timezone offset, it causes a mismatch in the returned data. Now timestamps are converted to UTC before formatting, ensuring the server receives unambiguous UTC values while still respecting the user's local timezone for day/week/month boundaries. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 5fcdf95 commit 1b7b417

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

daemon/cc_info_timer.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,14 @@ func (s *CCInfoTimerService) fetchCost(ctx context.Context, timeRange CCInfoTime
217217
since = time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
218218
}
219219

220+
// Convert to UTC before sending to server to avoid timezone parsing issues
221+
sinceUTC := since.UTC()
222+
nowUTC := now.UTC()
223+
220224
variables := map[string]interface{}{
221225
"filter": map[string]interface{}{
222-
"since": since.Format(time.RFC3339),
223-
"until": now.Format(time.RFC3339),
226+
"since": sinceUTC.Format(time.RFC3339),
227+
"until": nowUTC.Format(time.RFC3339),
224228
"clientType": "claude_code",
225229
},
226230
}

model/cc_statusline_service.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,14 @@ func FetchDailyCost(ctx context.Context, config ShellTimeConfig) (float64, error
5555
now := time.Now()
5656
startOfDay := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
5757

58+
// Convert to UTC before sending to server to avoid timezone parsing issues
59+
startOfDayUTC := startOfDay.UTC()
60+
nowUTC := now.UTC()
61+
5862
variables := map[string]interface{}{
5963
"filter": map[string]interface{}{
60-
"since": startOfDay.Format(time.RFC3339),
61-
"until": now.Format(time.RFC3339),
64+
"since": startOfDayUTC.Format(time.RFC3339),
65+
"until": nowUTC.Format(time.RFC3339),
6266
"clientType": "claude_code",
6367
},
6468
}

0 commit comments

Comments
 (0)