File tree Expand file tree Collapse file tree 1 file changed +21
-24
lines changed
Source/FikaAmazonAPI/ReportGeneration Expand file tree Collapse file tree 1 file changed +21
-24
lines changed Original file line number Diff line number Diff line change @@ -10,30 +10,27 @@ public class ReportDateRange
1010 public ReportDateRange ( DateTime startDate , DateTime endDate ) { StartDate = startDate ; EndDate = endDate ; }
1111
1212
13- public static IList < ReportDateRange > GetDateRange ( DateTime startDate , DateTime endDate , int MaxDays )
14- {
15- List < ReportDateRange > list = new List < ReportDateRange > ( ) ;
16- DateTime tempEnd = startDate ;
17- DateTime start = startDate ;
18-
19- while ( true )
20- {
21- tempEnd = tempEnd . AddDays ( MaxDays ) ;
22- if ( tempEnd > endDate )
23- {
24- tempEnd = endDate ;
25- list . Add ( new ReportDateRange ( start , tempEnd ) ) ;
26- break ;
27- }
28- else
29- {
30- list . Add ( new ReportDateRange ( start , tempEnd ) ) ;
31- start = tempEnd . AddSeconds ( 1 ) ;
32- }
33-
34- }
35-
36- return list ;
13+ public static IList < ReportDateRange > GetDateRange ( DateTime startDate , DateTime endDate , int maxDays )
14+ {
15+ List < ReportDateRange > list = new List < ReportDateRange > ( ) ;
16+ DateTime tempEnd ;
17+ DateTime start = startDate ;
18+
19+ while ( start < endDate )
20+ {
21+ tempEnd = start . AddDays ( maxDays ) ;
22+
23+ if ( tempEnd > endDate )
24+ {
25+ tempEnd = endDate ;
26+ }
27+
28+ list . Add ( new ReportDateRange ( start , tempEnd ) ) ;
29+
30+ start = tempEnd . AddSeconds ( 1 ) ;
31+ }
32+
33+ return list ;
3734 }
3835 }
3936}
You can’t perform that action at this time.
0 commit comments