From aa2852b6d79a408ee41dfa4d1db5419adb31af00 Mon Sep 17 00:00:00 2001 From: Dries De Peuter Date: Thu, 29 Dec 2022 02:42:22 +0100 Subject: [PATCH] fix: Consistent date between mysql and sqlite --- internal/pkg/versions/versions.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/pkg/versions/versions.go b/internal/pkg/versions/versions.go index 077c845..4d474ef 100644 --- a/internal/pkg/versions/versions.go +++ b/internal/pkg/versions/versions.go @@ -89,7 +89,7 @@ type CountResult struct { } func CountByDay() []CountResult { - rows, err := storage.Db.Query("SELECT count(id), SUBSTR(DATE(`timestamp`), 0, 11) AS date_formatted FROM versions GROUP BY date_formatted") + rows, err := storage.Db.Query("SELECT count(id), DATE(`timestamp`) AS date_formatted FROM versions GROUP BY date_formatted") if err != nil { logrus.Fatal(err) } @@ -99,6 +99,7 @@ func CountByDay() []CountResult { for rows.Next() { var item CountResult err := rows.Scan(&item.Count, &item.Timestamp) + item.Timestamp = item.Timestamp[0:10] if err != nil { log.Fatal(err) }