From 1b7b417ddf7c19dbb0735cbac3c79080f802e4c3 Mon Sep 17 00:00:00 2001 From: AnnatarHe Date: Sun, 4 Jan 2026 23:08:30 +0800 Subject: [PATCH] fix(daemon): convert cc_info timestamps to UTC before sending to server MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- daemon/cc_info_timer.go | 8 ++++++-- model/cc_statusline_service.go | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/daemon/cc_info_timer.go b/daemon/cc_info_timer.go index 9dd3363..c31cec4 100644 --- a/daemon/cc_info_timer.go +++ b/daemon/cc_info_timer.go @@ -217,10 +217,14 @@ func (s *CCInfoTimerService) fetchCost(ctx context.Context, timeRange CCInfoTime since = time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location()) } + // Convert to UTC before sending to server to avoid timezone parsing issues + sinceUTC := since.UTC() + nowUTC := now.UTC() + variables := map[string]interface{}{ "filter": map[string]interface{}{ - "since": since.Format(time.RFC3339), - "until": now.Format(time.RFC3339), + "since": sinceUTC.Format(time.RFC3339), + "until": nowUTC.Format(time.RFC3339), "clientType": "claude_code", }, } diff --git a/model/cc_statusline_service.go b/model/cc_statusline_service.go index f74e431..e307381 100644 --- a/model/cc_statusline_service.go +++ b/model/cc_statusline_service.go @@ -55,10 +55,14 @@ func FetchDailyCost(ctx context.Context, config ShellTimeConfig) (float64, error now := time.Now() startOfDay := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location()) + // Convert to UTC before sending to server to avoid timezone parsing issues + startOfDayUTC := startOfDay.UTC() + nowUTC := now.UTC() + variables := map[string]interface{}{ "filter": map[string]interface{}{ - "since": startOfDay.Format(time.RFC3339), - "until": now.Format(time.RFC3339), + "since": startOfDayUTC.Format(time.RFC3339), + "until": nowUTC.Format(time.RFC3339), "clientType": "claude_code", }, }