Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions daemon/cc_info_timer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
}
Comment on lines +220 to 230
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For conciseness, you can inline the .UTC() calls and remove the temporary variables sinceUTC and nowUTC since they are used only once. This makes the code more direct and reduces verbosity.

	// Convert to UTC before sending to server to avoid timezone parsing issues
	variables := map[string]interface{}{
		"filter": map[string]interface{}{
			"since":      since.UTC().Format(time.RFC3339),
			"until":      now.UTC().Format(time.RFC3339),
			"clientType": "claude_code",
		},
	}

Expand Down
8 changes: 6 additions & 2 deletions model/cc_statusline_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
}
Comment on lines +58 to 68
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Similar to the other file, you can make this more concise by inlining the .UTC() calls and removing the temporary variables startOfDayUTC and nowUTC.

	// Convert to UTC before sending to server to avoid timezone parsing issues
	variables := map[string]interface{}{
		"filter": map[string]interface{}{
			"since":      startOfDay.UTC().Format(time.RFC3339),
			"until":      now.UTC().Format(time.RFC3339),
			"clientType": "claude_code",
		},
	}

Expand Down