Fix date fields not being nulled correctly when cleared (#3243)

* Interpret empty string date as null
* Fix setSQLiteDate for null
This commit is contained in:
WithoutPants
2022-12-06 13:33:58 +11:00
committed by GitHub
parent c9b0841184
commit 782bed9df8
3 changed files with 7 additions and 6 deletions

View File

@@ -102,11 +102,11 @@ func (r *updateRecord) setSQLiteDate(destField string, v models.OptionalDate) {
if v.Set {
if v.Null {
r.set(destField, models.SQLiteDate{})
} else {
r.set(destField, models.SQLiteDate{
String: v.Value.String(),
Valid: true,
})
}
r.set(destField, models.SQLiteDate{
String: v.Value.String(),
Valid: true,
})
}
}