@@ -196,8 +196,14 @@ export class TimeTracker implements vscode.Disposable {
196196 return 'Other' ;
197197 }
198198
199+ private getLocalDateString ( date : Date ) : string {
200+ return new Date ( date . getTime ( ) - ( date . getTimezoneOffset ( ) * 60000 ) )
201+ . toISOString ( )
202+ . split ( 'T' ) [ 0 ] ;
203+ }
204+
199205 getTodayTotal ( ) : number {
200- const today = new Date ( ) . toISOString ( ) . split ( 'T' ) [ 0 ] ;
206+ const today = this . getLocalDateString ( new Date ( ) ) ;
201207 const entries = this . database . getEntries ( ) ;
202208 const todayTotal = entries
203209 . filter ( ( entry : TimeEntry ) => entry . date === today )
@@ -217,7 +223,7 @@ export class TimeTracker implements vscode.Disposable {
217223 }
218224
219225 getCurrentProjectTime ( ) : number {
220- const today = new Date ( ) . toISOString ( ) . split ( 'T' ) [ 0 ] ;
226+ const today = this . getLocalDateString ( new Date ( ) ) ;
221227 const currentProject = this . getCurrentProject ( ) ;
222228 const entries = this . database . getEntries ( ) ;
223229 const currentProjectTime = entries
@@ -266,8 +272,8 @@ export class TimeTracker implements vscode.Disposable {
266272
267273 private getTotalSince ( startDate : Date ) : number {
268274 const entries = this . database . getEntries ( ) ;
269- const startDateString = startDate . toISOString ( ) . split ( 'T' ) [ 0 ] ;
270- const now = new Date ( ) . toISOString ( ) . split ( 'T' ) [ 0 ] ;
275+ const startDateString = this . getLocalDateString ( startDate ) ;
276+ const now = this . getLocalDateString ( new Date ( ) ) ;
271277
272278 const filteredEntries = entries . filter ( entry =>
273279 entry . date >= startDateString && entry . date <= now
0 commit comments