Skip to content

Commit

Permalink
Fix empty datetime record value handling to not return zero timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
tjerman committed Feb 26, 2024
1 parent dce1b8e commit 6fe0b8a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/compose/types/record.go
Expand Up @@ -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)
}
}
}
}
Expand Down

0 comments on commit 6fe0b8a

Please sign in to comment.