Skip to content

Commit

Permalink
fix: Consistent date between mysql and sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
NoUseFreak committed Dec 29, 2022
1 parent 74b75e1 commit aa2852b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/pkg/versions/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down

0 comments on commit aa2852b

Please sign in to comment.