diff --git a/routers/api/v1/repo/cloudbrain_dashboard.go b/routers/api/v1/repo/cloudbrain_dashboard.go index 23b9f3080..eac29bf88 100644 --- a/routers/api/v1/repo/cloudbrain_dashboard.go +++ b/routers/api/v1/repo/cloudbrain_dashboard.go @@ -1259,7 +1259,7 @@ func getCloudbrainTimePeroid(ctx *context.Context, recordBeginTime time.Time) (t endTime = now } else if queryType == "current_month" { endTime = now - beginTime = time.Date(endTime.Year(), endTime.Month(), 2, 0, 0, 0, 0, now.Location()) + beginTime = time.Date(endTime.Year(), endTime.Month(), 1, 0, 0, 0, 0, now.Location()) } else if queryType == "monthly" { endTime = now beginTime = now.AddDate(0, -1, 1) @@ -1267,13 +1267,13 @@ func getCloudbrainTimePeroid(ctx *context.Context, recordBeginTime time.Time) (t } else if queryType == "current_year" { endTime = now - beginTime = time.Date(endTime.Year(), 1, 2, 0, 0, 0, 0, now.Location()) + beginTime = time.Date(endTime.Year(), 1, 1, 0, 0, 0, 0, now.Location()) } else if queryType == "last_month" { lastMonthTime := now.AddDate(0, -1, 0) - beginTime = time.Date(lastMonthTime.Year(), lastMonthTime.Month(), 2, 0, 0, 0, 0, now.Location()) - endTime = time.Date(now.Year(), now.Month(), 2, 0, 0, 0, 0, now.Location()) + beginTime = time.Date(lastMonthTime.Year(), lastMonthTime.Month(), 1, 0, 0, 0, 0, now.Location()) + endTime = time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, now.Location()) } else { return now, now, fmt.Errorf("The value of type parameter is wrong.")