@@ -734,8 +734,8 @@ class CopilotTokenTracker implements vscode.Disposable {
734734 // Calculate Previous Month boundaries
735735 const lastMonthEnd = new Date ( now . getFullYear ( ) , now . getMonth ( ) , 0 , 23 , 59 , 59 , 999 ) ; // Last day of previous month
736736 const lastMonthStart = new Date ( lastMonthEnd . getFullYear ( ) , lastMonthEnd . getMonth ( ) , 1 ) ;
737- // Calculate last 30 days boundary
738- const last30DaysStart = new Date ( now . getTime ( ) - 30 * 24 * 60 * 60 * 1000 ) ;
737+ // Calculate last 30 days boundary (midnight, so numbers don't shift during a refresh)
738+ const last30DaysStart = new Date ( now . getFullYear ( ) , now . getMonth ( ) , now . getDate ( ) - 30 ) ;
739739
740740 const todayStats = { tokens : 0 , thinkingTokens : 0 , estimatedTokens : 0 , actualTokens : 0 , sessions : 0 , interactions : 0 , modelUsage : { } as ModelUsage , editorUsage : { } as EditorUsage } ;
741741 const monthStats = { tokens : 0 , thinkingTokens : 0 , estimatedTokens : 0 , actualTokens : 0 , sessions : 0 , interactions : 0 , modelUsage : { } as ModelUsage , editorUsage : { } as EditorUsage } ;
@@ -1243,7 +1243,7 @@ class CopilotTokenTracker implements vscode.Disposable {
12431243
12441244 const now = new Date ( ) ;
12451245 const todayStart = new Date ( now . getFullYear ( ) , now . getMonth ( ) , now . getDate ( ) ) ;
1246- const last30DaysStart = new Date ( now . getTime ( ) - 30 * 24 * 60 * 60 * 1000 ) ;
1246+ const last30DaysStart = new Date ( now . getFullYear ( ) , now . getMonth ( ) , now . getDate ( ) - 30 ) ;
12471247 const monthStart = new Date ( now . getFullYear ( ) , now . getMonth ( ) , 1 ) ;
12481248
12491249 this . log ( '🔍 [Usage Analysis] Starting calculation...' ) ;
0 commit comments