add dateString function

This commit is contained in:
pluja 2024-02-05 07:38:26 +01:00
parent e6ed22561c
commit 577c97336f

View File

@ -138,6 +138,19 @@ func (s *Server) RegisterViews() {
}
return humanize.Time(tm)
},
"dateString": func(t string) string {
if t == "" {
return "Unknown"
}
layout := "2006-01-02 15:04:05.000Z"
tm, err := time.Parse(layout, t)
if err != nil {
return t
}
return tm.Format("2006-01-02")
},
"isNew": func(t string) bool {
if t == "" {
return false