@@ -84,26 +84,26 @@ function TeamUsage() {
84
84
return totalCredits ;
85
85
} ;
86
86
87
- const handleCurrentMonthClick = ( start : any , end : any ) => {
87
+ const handleMonthClick = ( start : any , end : any ) => {
88
88
setStartDateOfBillMonth ( start ) ;
89
89
setEndDateOfBillMonth ( end ) ;
90
90
} ;
91
91
92
92
const getBillingHistory = ( ) => {
93
93
let rows = [ ] ;
94
94
for ( let i = 1 ; i < 7 ; i ++ ) {
95
- const endDateVar = i + 2 ;
95
+ const endDateVar = i - 1 ;
96
96
const startDate = new Date ( today . getFullYear ( ) , today . getMonth ( ) - i ) ;
97
- const endDate = new Date ( today . getFullYear ( ) , today . getMonth ( ) , endDateVar ) ;
97
+ const endDate = new Date ( today . getFullYear ( ) , today . getMonth ( ) - endDateVar , 0 ) ;
98
98
const timeStampOfStartDate = startDate . getTime ( ) ;
99
99
const timeStampOfEndDate = endDate . getTime ( ) ;
100
100
rows . push (
101
101
< div
102
102
key = { `billing${ i } ` }
103
- className = "text-lg text-gray-600 font-semibold truncate cursor-pointer"
104
- onClick = { ( ) => handleCurrentMonthClick ( timeStampOfStartDate , timeStampOfEndDate ) }
103
+ className = "text-lg text-gray-600 font-semibold truncate cursor-pointer gp-link "
104
+ onClick = { ( ) => handleMonthClick ( timeStampOfStartDate , timeStampOfEndDate ) }
105
105
>
106
- { startDate . toLocaleString ( "default" , { month : "long" } ) } { startOfCurrentMonth . getFullYear ( ) }
106
+ { startDate . toLocaleString ( "default" , { month : "long" } ) } { startDate . getFullYear ( ) }
107
107
</ div > ,
108
108
) ;
109
109
}
@@ -128,9 +128,7 @@ function TeamUsage() {
128
128
< div className = "text-base text-gray-500 truncate" > Period</ div >
129
129
< div
130
130
className = "text-lg text-gray-600 font-semibold truncate cursor-pointer"
131
- onClick = { ( ) =>
132
- handleCurrentMonthClick ( timestampStartOfCurrentMonth , Date . now ( ) )
133
- }
131
+ onClick = { ( ) => handleMonthClick ( timestampStartOfCurrentMonth , Date . now ( ) ) }
134
132
>
135
133
{ startOfCurrentMonth . toLocaleString ( "default" , { month : "long" } ) } { " " }
136
134
{ startOfCurrentMonth . getFullYear ( ) }
0 commit comments