use DateOnly as local constant instead of using the imported time package

This commit is contained in:
Sergio Moura 2023-09-11 10:15:42 -04:00
parent cab480b4e6
commit f9ee8ed189
2 changed files with 6 additions and 3 deletions

View File

@ -109,13 +109,13 @@ func usageStatsHandler(w http.ResponseWriter, r *http.Request) {
tbl.WithWriter(w)
for _, data := range usageData {
versions := strings.ReplaceAll(strings.ReplaceAll(data.Versions, "Unknown", ""), ", ", "")
lastQueryStr := strings.ReplaceAll(data.LastQueried.Format(time.DateOnly), "1970-01-01", "")
lastQueryStr := strings.ReplaceAll(data.LastQueried.Format(shared.DateOnly), "1970-01-01", "")
tbl.AddRow(
data.RegistrationDate.Format(time.DateOnly),
data.RegistrationDate.Format(shared.DateOnly),
data.NumDevices,
data.NumEntries,
data.NumQueries,
data.LastUsedDate.Format(time.DateOnly),
data.LastUsedDate.Format(shared.DateOnly),
lastQueryStr,
versions,
data.IpAddresses,

3
shared/time.go Normal file
View File

@ -0,0 +1,3 @@
package shared
const DateOnly = "2006-01-02"