The backend for the AiteStory website
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

7 years ago
  1. package view
  2. import (
  3. "html/template"
  4. "strings"
  5. "time"
  6. )
  7. func formatDate(date time.Time) string {
  8. return date.Format("Jan _2, 2006")
  9. }
  10. func formatDateLong(date time.Time) string {
  11. return date.Format("Jan _2, 2006 15:04 MST")
  12. }
  13. func formatUserID(userid string) string {
  14. split := strings.SplitN(userid, ":", 2)
  15. return split[len(split)-1]
  16. }
  17. var funcMap = template.FuncMap{
  18. "formatDate": formatDate,
  19. "formatDateLong": formatDateLong,
  20. "formatUserID": formatUserID,
  21. "tolower": strings.ToLower,
  22. }