3
0

Fix empty datetime record value handling to not return zero timestamp

This commit is contained in:
Tomaž Jerman 2024-02-26 14:12:30 +01:00
parent dce1b8e573
commit 6fe0b8ae83

View File

@ -242,7 +242,12 @@ func (r *Record) setValue(name string, pos uint, value any) (err error) {
case "DateTime":
// @note temporary solution to make timestamps consistent; we should handle
// timezones (or the lack of) more properly
auxv = cast.ToTime(auxv).Format(time.RFC3339)
auxt, err := cast.ToTimeE(auxv)
if err != nil || auxt.IsZero() {
auxv = ""
} else {
auxv = cast.ToTime(auxv).Format(time.RFC3339)
}
}
}
}