Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Date and time format configurable in config.json.

  • Loading branch information...
commit ed08b4b5dba7561d0b061fa322dd1a51fcc4ee94 1 parent ec4fa45
@TheOnly92 authored
Showing with 4 additions and 3 deletions.
  1. +2 −1  config.json
  2. +2 −2 controllers/index.go
View
3  config.json
@@ -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
4 controllers/index.go
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.