Skip to content

Commit c0dd522

Browse files
authored
Merge pull request #196 from shelltime/fix/ccinfo-timezone-utc-conversion
fix(daemon): convert cc_info timestamps to UTC before sending to server
2 parents 5fcdf95 + 1b7b417 commit c0dd522

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)