@@ -22,16 +22,24 @@ export async function getVolumeGroupDetails(
2222 const groupDetails : VolumeGroup =
2323 await deps . supplierConfigRepo . getVolumeGroup ( groupId ) ;
2424
25+ const startOfDay = new Date ( ) ;
26+ startOfDay . setHours ( 0 , 0 , 0 , 0 ) ;
27+ const endOfDay = new Date ( ) ;
28+ endOfDay . setHours ( 23 , 59 , 59 , 999 ) ;
2529 deps . logger . info ( {
26- description : "Comparing dates for volume group" ,
27- startdate : new Date ( groupDetails . startDate ) ,
28- endDate : groupDetails . endDate ? new Date ( groupDetails . endDate ) : null ,
29- currentDate : new Date ( ) ,
30+ description : "Checking if volume group is active based on status and dates" ,
31+ groupId,
32+ status : groupDetails . status ,
33+ startDate : groupDetails . startDate ,
34+ endDate : groupDetails . endDate ,
35+ startOfDay : startOfDay . toISOString ( ) ,
36+ endOfDay : endOfDay . toISOString ( ) ,
3037 } ) ;
38+
3139 if (
3240 groupDetails . status === "PROD" &&
33- new Date ( groupDetails . startDate ) <= new Date ( ) &&
34- ( ! groupDetails . endDate || new Date ( groupDetails . endDate ) >= new Date ( ) )
41+ new Date ( groupDetails . startDate ) < endOfDay &&
42+ ( ! groupDetails . endDate || new Date ( groupDetails . endDate ) >= startOfDay )
3543 ) {
3644 return groupDetails ;
3745 }
0 commit comments