@@ -22,8 +22,8 @@ function updateDocFilter(userId: string, clientId: string): mongo.Filter<mongo.D
2222 user_id : userId ,
2323 client_id : clientId ,
2424 connect_at : {
25- $gte : new Date ( year , month , today , 0 , 0 , 0 ) ,
26- $lt : new Date ( year , month , nextDay , 0 , 0 , 0 )
25+ $gte : new Date ( ` ${ year } - ${ month } - ${ today } ` ) ,
26+ $lt : new Date ( ` ${ year } - ${ month } - ${ nextDay } ` )
2727 }
2828 } ;
2929}
@@ -37,7 +37,7 @@ function timeSpan(timeframe: event_types.TimeFrames): mongo.Filter<mongo.Documen
3737 const thisMonth = month ;
3838 const nextMonth = month == 11 ? 0 : month + 1 ;
3939 return {
40- connect_at : { $gte : new Date ( year , thisMonth , 1 , 0 , 0 , 0 ) , $lte : new Date ( year , nextMonth , 1 , 0 , 0 , 0 ) }
40+ connect_at : { $gte : new Date ( ` ${ year } - ${ thisMonth } - ${ 1 } ` ) , $lte : new Date ( ` ${ year } - ${ nextMonth } - ${ 1 } ` ) }
4141 } ;
4242 }
4343 case 'week' : {
@@ -51,8 +51,8 @@ function timeSpan(timeframe: event_types.TimeFrames): mongo.Filter<mongo.Documen
5151 const weekEnd = parseDate ( weekEndDate ) ;
5252 return {
5353 connect_at : {
54- $gte : new Date ( weekStart . year , weekStart . month , weekStart . today , 0 , 0 , 0 ) ,
55- $lte : new Date ( weekEnd . year , weekEnd . month , weekEnd . today , 0 , 0 , 0 )
54+ $gte : new Date ( ` ${ weekStart . year } - ${ weekStart . month } - ${ weekStart . today } ` ) ,
55+ $lte : new Date ( ` ${ weekEnd . year } - ${ weekEnd . month } - ${ weekEnd . today + 1 } ` ) // +1 to include the end date
5656 }
5757 } ;
5858 }
@@ -61,8 +61,8 @@ function timeSpan(timeframe: event_types.TimeFrames): mongo.Filter<mongo.Documen
6161 const nextDay = today + 1 ;
6262 return {
6363 connect_at : {
64- $gte : new Date ( year , month , today , 0 , 0 , 0 ) ,
65- $lt : new Date ( year , month , nextDay , 0 , 0 , 0 )
64+ $gte : new Date ( ` ${ year } - ${ month } - ${ today } ` ) ,
65+ $lt : new Date ( ` ${ year } - ${ month } - ${ nextDay } ` )
6666 }
6767 } ;
6868 }
0 commit comments