fix: align report date defaults with recent periods

This commit is contained in:
Yvan
2026-11-05 14:26:36 +08:00
parent 31584c73bf
commit 22ba319f7f
16 changed files with 181 additions and 70 deletions
+1 -5
View File
@@ -89,11 +89,7 @@ func (uc *ServerAnalysisUsecase) List(ctx context.Context, f ServerAnalysisFilte
if err != nil {
return nil, err
}
if f.StartDate == nil || f.EndDate == nil {
now := uc.now().In(portraitLocation)
day := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, portraitLocation)
f.StartDate, f.EndDate = &day, &day
}
f.StartDate, f.EndDate = reportDateDefaults(f.StartDate, f.EndDate, 30, uc.now())
if f.EndDate.Before(*f.StartDate) {
return nil, ErrAnalyticsDateOrder
}