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
4 changes: 2 additions & 2 deletions cli/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export async function calculateDetailedStats(
const monthStart = new Date(now.getFullYear(), now.getMonth(), 1);
const lastMonthStart = new Date(now.getFullYear(), now.getMonth() - 1, 1);
const lastMonthEnd = new Date(now.getFullYear(), now.getMonth(), 0, 23, 59, 59);
const last30DaysStart = new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000);
const last30DaysStart = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 30);

const periods: {
today: PeriodStats;
Expand Down Expand Up @@ -376,7 +376,7 @@ export async function calculateUsageAnalysisStats(sessionFiles: string[]): Promi

const now = new Date();
const todayStart = new Date(now.getFullYear(), now.getMonth(), now.getDate());
const last30DaysStart = new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000);
const last30DaysStart = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 30);
const monthStart = new Date(now.getFullYear(), now.getMonth(), 1);

const todayPeriod = createEmptyUsageAnalysisPeriod();
Expand Down
6 changes: 3 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -734,8 +734,8 @@ class CopilotTokenTracker implements vscode.Disposable {
// Calculate Previous Month boundaries
const lastMonthEnd = new Date(now.getFullYear(), now.getMonth(), 0, 23, 59, 59, 999); // Last day of previous month
const lastMonthStart = new Date(lastMonthEnd.getFullYear(), lastMonthEnd.getMonth(), 1);
// Calculate last 30 days boundary
const last30DaysStart = new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000);
// Calculate last 30 days boundary (midnight, so numbers don't shift during a refresh)
const last30DaysStart = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 30);

const todayStats = { tokens: 0, thinkingTokens: 0, estimatedTokens: 0, actualTokens: 0, sessions: 0, interactions: 0, modelUsage: {} as ModelUsage, editorUsage: {} as EditorUsage };
const monthStats = { tokens: 0, thinkingTokens: 0, estimatedTokens: 0, actualTokens: 0, sessions: 0, interactions: 0, modelUsage: {} as ModelUsage, editorUsage: {} as EditorUsage };
Expand Down Expand Up @@ -1243,7 +1243,7 @@ class CopilotTokenTracker implements vscode.Disposable {

const now = new Date();
const todayStart = new Date(now.getFullYear(), now.getMonth(), now.getDate());
const last30DaysStart = new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000);
const last30DaysStart = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 30);
const monthStart = new Date(now.getFullYear(), now.getMonth(), 1);

this.log('🔍 [Usage Analysis] Starting calculation...');
Expand Down
Loading