mirror of
https://codeberg.org/pluja/kycnot.me
synced 2025-07-05 12:04:37 -04:00
add dateString function
This commit is contained in:
parent
e6ed22561c
commit
577c97336f
1 changed files with 13 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue