06f4bf49 by JessonChan

ignore nil time

1 parent fdb5672b
......@@ -144,8 +144,12 @@ 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)
if t.IsZero() {
value = nil
} else {
value = t
}
}
default:
switch {
case fi.fieldType&IsPostiveIntegerField > 0:
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!