@@ -13,8 +13,8 @@ export function useInsightsPeriod() {
13
13
const hoursAgo72 = new Date ( now . getTime ( ) - 72 * 60 * 60 * 1000 ) ;
14
14
15
15
return {
16
- from : hoursAgo72 . toISOString ( ) . split ( "T" ) [ 0 ] ,
17
- to : now . toISOString ( ) . split ( "T" ) [ 0 ] ,
16
+ from : hoursAgo72 . toISOString ( ) ,
17
+ to : now . toISOString ( ) ,
18
18
} ;
19
19
}
20
20
@@ -68,15 +68,14 @@ export type Insight = { functionId: string; componentPath: string | null } & (
68
68
function padAndSortHourlyData (
69
69
hourlyCounts : HourlyCount [ ] ,
70
70
periodStart ?: string ,
71
- _periodEnd ?: string , // This parameter is kept for backward compatibility but not used
72
71
) : HourlyCount [ ] {
73
72
// Get current time to limit future data points
74
73
const currentTime = new Date ( ) ;
75
74
76
75
if ( hourlyCounts . length === 0 ) {
77
76
// If no data but we have period start, create empty data from period start to now
78
77
if ( periodStart ) {
79
- const startDate = new Date ( ` ${ periodStart } T00:00:00Z` ) ;
78
+ const startDate = new Date ( periodStart ) ;
80
79
const endDate = new Date ( currentTime ) ;
81
80
82
81
const result : HourlyCount [ ] = [ ] ;
@@ -119,7 +118,7 @@ function padAndSortHourlyData(
119
118
120
119
if ( periodStart ) {
121
120
// Use the provided period start and current time as end
122
- startDate = new Date ( ` ${ periodStart } T00:00:00Z` ) ;
121
+ startDate = new Date ( periodStart ) ;
123
122
endDate = new Date ( currentTime ) ;
124
123
} else {
125
124
// Otherwise use min/max from the data
@@ -206,7 +205,10 @@ export function useInsights(): Insight[] | undefined {
206
205
const deployment = useCurrentDeployment ( ) ;
207
206
const common = {
208
207
deploymentName : deployment ?. name ,
209
- period,
208
+ period : {
209
+ from : period . from . split ( "T" ) [ 0 ] ,
210
+ to : period . to . split ( "T" ) [ 0 ] ,
211
+ } ,
210
212
teamId : team ?. id ! ,
211
213
projectId : null ,
212
214
componentPrefix : null ,
0 commit comments