You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
513 B
28 lines
513 B
package view
|
|
|
|
import (
|
|
"html/template"
|
|
"strings"
|
|
"time"
|
|
)
|
|
|
|
func formatDate(date time.Time) string {
|
|
return date.Format("Jan _2, 2006")
|
|
}
|
|
|
|
func formatDateLong(date time.Time) string {
|
|
return date.Format("Jan _2, 2006 15:04 MST")
|
|
}
|
|
|
|
func formatUserID(userid string) string {
|
|
split := strings.SplitN(userid, ":", 2)
|
|
return split[len(split)-1]
|
|
}
|
|
|
|
var funcMap = template.FuncMap{
|
|
"formatDate": formatDate,
|
|
"formatDateLong": formatDateLong,
|
|
"formatUserID": formatUserID,
|
|
|
|
"tolower": strings.ToLower,
|
|
}
|