Merge pull request #165 from lanrenwo/remove_utc

删除冗余代码.
This commit is contained in:
bjdgyc 2022-10-21 11:50:54 +08:00 committed by GitHub
commit 9e58f3121f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 12 deletions

View File

@ -43,10 +43,5 @@ func getTimeAgo(days int) string {
ts := time.Now().AddDate(0, 0, -days)
tsZero := time.Date(ts.Year(), ts.Month(), ts.Day(), 0, 0, 0, 0, time.Local)
timeS = tsZero.Format(dbdata.LayoutTimeFormat)
// UTC
switch base.Cfg.DbType {
case "sqlite3", "postgres":
timeS = tsZero.UTC().Format(dbdata.LayoutTimeFormat)
}
return timeS
}

View File

@ -15,7 +15,7 @@ func TestSearchAudit(t *testing.T) {
defer closeIpdata()
currDateVal := "2022-07-24 00:00:00"
CreatedAt, _ := time.Parse("2006-01-02 15:04:05", currDateVal)
CreatedAt, _ := time.ParseInLocation("2006-01-02 15:04:05", currDateVal, time.Local)
dataTest := AccessAudit{
Username: "Test",

View File

@ -199,12 +199,6 @@ func (s *StatsInfo) getScopeDetail(scope string) (sd *ScopeDetail) {
}
sd.fsTime = sd.sTime.Format(LayoutTimeFormat)
sd.feTime = sd.eTime.Format(LayoutTimeFormat)
// UTC
switch base.Cfg.DbType {
case "sqlite3", "postgres":
sd.fsTime = sd.sTime.UTC().Format(LayoutTimeFormat)
sd.feTime = sd.eTime.UTC().Format(LayoutTimeFormat)
}
return
}