Permalink
Browse files

Date and time format configurable in config.json.

  • Loading branch information...
TheOnly92 committed Jun 15, 2011
1 parent ec4fa45 commit ed08b4b5dba7561d0b061fa322dd1a51fcc4ee94
Showing with 4 additions and 3 deletions.
  1. +2 −1 config.json
  2. +2 −2 controllers/index.go
View
@@ -5,5 +5,6 @@
"adminuser": "admin",
"adminpasswd": "123456",
"host": "127.0.0.1",
- "port": "9999"
+ "port": "9999",
+ "date_format": "2006 Jan 02 15:04"
}
View
@@ -23,7 +23,7 @@ func readPost(ctx *web.Context, postId string) string {
viewVars := make(map[string]string)
viewVars["Title"] = result.Title
viewVars["Content"] = result.Content
- viewVars["Date"] = time.SecondsToLocalTime(result.Created).Format("2006 Jan 02 15:04")
+ viewVars["Date"] = time.SecondsToLocalTime(result.Created).Format(config.Get("date_format"))
viewVars["Id"] = objectIdHex(result.Id.String())
if result.Status == 0 {
@@ -54,7 +54,7 @@ func readPage(pageSlug string) string {
viewVars := make(map[string]string)
viewVars["Title"] = result.Title
viewVars["Content"] = result.Content
- viewVars["Date"] = time.SecondsToLocalTime(result.Created).Format("2006 Jan 02 15:04")
+ viewVars["Date"] = time.SecondsToLocalTime(result.Created).Format(config.Get("date_format"))
output := mustache.RenderFile("templates/view-page.mustache", viewVars)
return render(output, result.Title)

0 comments on commit ed08b4b

Please sign in to comment.