fix: for time.Time field, when time is zero and db field has default value, then return nil to use db default value
This commit is contained in:
parent
b07c406703
commit
75e384df91
|
@ -1547,7 +1547,7 @@ func (engine *Engine) nowTime(col *core.Column) (interface{}, time.Time) {
|
||||||
|
|
||||||
func (engine *Engine) formatColTime(col *core.Column, t time.Time) (v interface{}) {
|
func (engine *Engine) formatColTime(col *core.Column, t time.Time) (v interface{}) {
|
||||||
if t.IsZero() {
|
if t.IsZero() {
|
||||||
if col.Nullable {
|
if col.Nullable || !col.DefaultIsEmpty {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
|
|
Loading…
Reference in New Issue