ignore nil time

This commit is contained in:
JessonChan 2014-06-10 22:10:58 +08:00
parent fdb5672b7a
commit 06f4bf493d
1 changed files with 5 additions and 1 deletions

View File

@ -144,7 +144,11 @@ func (d *dbBase) collectFieldValue(mi *modelInfo, fi *fieldInfo, ind reflect.Val
value = field.Interface()
if t, ok := value.(time.Time); ok {
d.ins.TimeToDB(&t, tz)
value = t
if t.IsZero() {
value = nil
} else {
value = t
}
}
default:
switch {