repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
c2105f9
parent
e018289
author
Eric Bower
date
2024-06-26 18:07:30 +0000 UTC
style: use `time.DateOnly` format for dates
2 files changed,  +8, -8
M pastes/api.go
+4, -4
 1@@ -118,7 +118,7 @@ func blogHandler(w http.ResponseWriter, r *http.Request) {
 2 			URL:            template.URL(cfg.FullPostURL(curl, post.Username, post.Slug)),
 3 			BlogURL:        template.URL(cfg.FullBlogURL(curl, post.Username)),
 4 			Title:          post.Filename,
 5-			PublishAt:      post.PublishAt.Format("02 Jan, 2006"),
 6+			PublishAt:      post.PublishAt.Format(time.DateOnly),
 7 			PublishAtISO:   post.PublishAt.Format(time.RFC3339),
 8 			UpdatedTimeAgo: shared.TimeAgo(post.UpdatedAt),
 9 			UpdatedAtISO:   post.UpdatedAt.Format(time.RFC3339),
10@@ -188,7 +188,7 @@ func postHandler(w http.ResponseWriter, r *http.Request) {
11 		}
12 		expiresAt := "never"
13 		if post.ExpiresAt != nil {
14-			expiresAt = post.ExpiresAt.Format("02 Jan, 2006")
15+			expiresAt = post.ExpiresAt.Format(time.DateOnly)
16 		}
17 
18 		unlisted := false
19@@ -204,7 +204,7 @@ func postHandler(w http.ResponseWriter, r *http.Request) {
20 			BlogURL:      template.URL(cfg.BlogURL(username)),
21 			Description:  post.Description,
22 			Title:        post.Filename,
23-			PublishAt:    post.PublishAt.Format("02 Jan, 2006"),
24+			PublishAt:    post.PublishAt.Format(time.DateOnly),
25 			PublishAtISO: post.PublishAt.Format(time.RFC3339),
26 			Username:     username,
27 			BlogName:     blogName,
28@@ -220,7 +220,7 @@ func postHandler(w http.ResponseWriter, r *http.Request) {
29 			Description:  "Paste not found",
30 			Title:        "Paste not found",
31 			BlogURL:      template.URL(cfg.BlogURL(username)),
32-			PublishAt:    time.Now().Format("02 Jan, 2006"),
33+			PublishAt:    time.Now().Format(time.DateOnly),
34 			PublishAtISO: time.Now().Format(time.RFC3339),
35 			Username:     username,
36 			BlogName:     blogName,
M prose/api.go
+4, -4
 1@@ -248,7 +248,7 @@ func blogHandler(w http.ResponseWriter, r *http.Request) {
 2 			URL:            template.URL(cfg.FullPostURL(curl, post.Username, post.Slug)),
 3 			BlogURL:        template.URL(cfg.FullBlogURL(curl, post.Username)),
 4 			Title:          shared.FilenameToTitle(post.Filename, post.Title),
 5-			PublishAt:      post.PublishAt.Format("02 Jan, 2006"),
 6+			PublishAt:      post.PublishAt.Format(time.DateOnly),
 7 			PublishAtISO:   post.PublishAt.Format(time.RFC3339),
 8 			UpdatedTimeAgo: shared.TimeAgo(post.UpdatedAt),
 9 			UpdatedAtISO:   post.UpdatedAt.Format(time.RFC3339),
10@@ -431,7 +431,7 @@ func postHandler(w http.ResponseWriter, r *http.Request) {
11 			Description:  post.Description,
12 			Title:        shared.FilenameToTitle(post.Filename, post.Title),
13 			Slug:         post.Slug,
14-			PublishAt:    post.PublishAt.Format("02 Jan, 2006"),
15+			PublishAt:    post.PublishAt.Format(time.DateOnly),
16 			PublishAtISO: post.PublishAt.Format(time.RFC3339),
17 			Username:     username,
18 			BlogName:     blogName,
19@@ -481,7 +481,7 @@ func postHandler(w http.ResponseWriter, r *http.Request) {
20 			PageTitle:    title,
21 			Description:  desc,
22 			Title:        title,
23-			PublishAt:    time.Now().Format("02 Jan, 2006"),
24+			PublishAt:    time.Now().Format(time.DateOnly),
25 			PublishAtISO: time.Now().Format(time.RFC3339),
26 			Username:     username,
27 			BlogName:     blogName,
28@@ -579,7 +579,7 @@ func readHandler(w http.ResponseWriter, r *http.Request) {
29 			Title:          shared.FilenameToTitle(post.Filename, post.Title),
30 			Description:    post.Description,
31 			Username:       post.Username,
32-			PublishAt:      post.PublishAt.Format("02 Jan, 2006"),
33+			PublishAt:      post.PublishAt.Format(time.DateOnly),
34 			PublishAtISO:   post.PublishAt.Format(time.RFC3339),
35 			UpdatedTimeAgo: shared.TimeAgo(post.UpdatedAt),
36 			UpdatedAtISO:   post.UpdatedAt.Format(time.RFC3339),