fix/change string to time.Time where possible

This commit is contained in:
diPhantxm
2023-03-12 23:11:00 +03:00
parent ca40ab4559
commit c9a0f83145
5 changed files with 165 additions and 174 deletions

10
core.go
View File

@@ -4,6 +4,8 @@ import (
"fmt"
"net/http"
"reflect"
"testing"
"time"
)
type CommonResponse struct {
@@ -99,3 +101,11 @@ func isZero(v interface{}) (bool, error) {
}
return v == reflect.Zero(t).Interface(), nil
}
func TimeFromString(t *testing.T, datetime string) time.Time {
dt, err := time.Parse("2006-01-02T15:04:05Z", datetime)
if err != nil {
t.Errorf("error when parsing time: %s", err)
}
return dt
}