mirror of
https://codeberg.org/pluja/kycnot.me
synced 2025-01-24 05:11:01 -05:00
add dateString function
This commit is contained in:
parent
e6ed22561c
commit
577c97336f
@ -138,6 +138,19 @@ func (s *Server) RegisterViews() {
|
|||||||
}
|
}
|
||||||
return humanize.Time(tm)
|
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 {
|
"isNew": func(t string) bool {
|
||||||
if t == "" {
|
if t == "" {
|
||||||
return false
|
return false
|
||||||
|
Loading…
Reference in New Issue
Block a user