this repo has no description

blog: use standard time formatting helper

Signed-off-by: oppiliappan <me@oppi.li>

oppi.li a05fa510 91dcca51

verified
+7 -4
+3
appview/pages/funcmap.go
··· 195 195 {D: math.MaxInt64, Format: "a long while %s", DivBy: 1}, 196 196 }) 197 197 }, 198 + "shortTimeFmt": func(t time.Time) string { 199 + return t.Format("Jan 2, 2006") 200 + }, 198 201 "longTimeFmt": func(t time.Time) string { 199 202 return t.Format("Jan 2, 2006, 3:04 PM MST") 200 203 },
+2 -2
blog/templates/index.html
··· 31 31 </div> 32 32 <div class="flex flex-col flex-1 px-5 py-4"> 33 33 <div class="text-xs text-gray-400 dark:text-gray-500 mb-2"> 34 - {{ $date := .ParsedDate }}{{ $date.Format "Jan 2, 2006" }} 34 + {{ $date := .ParsedDate }}{{ $date | shortTimeFmt}} 35 35 {{ if .Meta.Draft }}<span class="text-red-500">[draft]</span>{{ end }} 36 36 </div> 37 37 <h2 class="font-bold text-gray-900 dark:text-white text-base leading-snug mb-1 group-hover:underline">{{ .Meta.Title }}</h2> ··· 67 67 </span> 68 68 </div> 69 69 <div class="text-sm text-gray-400 dark:text-gray-500 shrink-0"> 70 - {{ $date := .ParsedDate }}{{ $date.Format "Jan 02, 2006" }} 70 + {{ $date := .ParsedDate }}{{ $date | shortTimeFmt }} 71 71 </div> 72 72 </a> 73 73 {{ end }}
+1 -1
blog/templates/post.html
··· 35 35 {{ $authors := .Post.Meta.Authors }} 36 36 <p class="mb-1 text-sm text-gray-600 dark:text-gray-400"> 37 37 {{ $date := .Post.ParsedDate }} 38 - {{ $date.Format "02 Jan, 2006" }} 38 + {{ $date | shortTimeFmt }} 39 39 </p> 40 40 41 41 <h1 class="mb-0 text-2xl font-bold dark:text-white">
+1 -1
blog/templates/text.html
··· 51 51 <p class="px-6 mb-0 text-sm text-gray-600 dark:text-gray-400"> 52 52 {{ $dateStr := index .Meta "date" }} 53 53 {{ $date := parsedate $dateStr }} 54 - {{ $date.Format "02 Jan, 2006" }} 54 + {{ $date.Format | shortTimeFmt }} 55 55 56 56 <span class="mx-2 select-none">&middot;</span> 57 57