diff options
Diffstat (limited to 'srv/src/api/tpl.go')
-rw-r--r-- | srv/src/api/tpl.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/srv/src/api/tpl.go b/srv/src/api/tpl.go index 5e33bea..9818b10 100644 --- a/srv/src/api/tpl.go +++ b/srv/src/api/tpl.go @@ -8,6 +8,7 @@ import ( "net/http" "path/filepath" "strings" + "time" "github.com/mediocregopher/blog.mediocregopher.com/srv/api/apiutil" ) @@ -50,6 +51,9 @@ func (a *api) mustParseTpl(name string) *template.Template { path := filepath.Join("posts", id) return blogURL(path) }, + "DateTimeFormat": func(t time.Time) string { + return t.Format("2006-01-02") + }, }) tpl = template.Must(tpl.Parse(mustReadTplFile(name))) |