diff --git a/mysql/resultset_helper.go b/mysql/resultset_helper.go index fee929506..21487afdd 100644 --- a/mysql/resultset_helper.go +++ b/mysql/resultset_helper.go @@ -3,7 +3,6 @@ package mysql import ( "bytes" "encoding/binary" - "fmt" "math" "strconv" "time" @@ -56,7 +55,7 @@ func toBinaryDateTime(t time.Time) ([]byte, error) { var buf bytes.Buffer if t.IsZero() { - return nil, fmt.Errorf("zero time") + return nil, nil } year, month, day := t.Year(), t.Month(), t.Day() diff --git a/mysql/util_test.go b/mysql/util_test.go index 9d326e768..9ad0fa118 100644 --- a/mysql/util_test.go +++ b/mysql/util_test.go @@ -75,7 +75,6 @@ func TestToBinaryDateTime(t *testing.T) { Name: "Zero time", Data: time.Time{}, Expect: nil, - Error: true, }, { Name: "Date with nanoseconds",