Do a bad thing to time.
authorPete <pete@debu.gs>
Sat, 3 Apr 2021 07:46:28 +0000 (00:46 -0700)
committerPete <pete@debu.gs>
Sat, 3 Apr 2021 07:46:28 +0000 (00:46 -0700)
renderer/renderer.go
templates/status.tmpl

index 44e372081535c8ce2018d7e56819fa3f09483b95..3897287821bfc9822c05885dd24820b0721f2653 100644 (file)
@@ -134,6 +134,10 @@ func formatTimeRFC822(t time.Time) string {
        return t.Format(time.RFC822)
 }
 
+func formatTimeSimple(t time.Time) string {
+       return t.Format("2006-01-02 15:04:05")
+}
+
 func withContext(data interface{}, ctx *Context) TemplateData {
        return TemplateData{data, ctx}
 }
@@ -157,6 +161,7 @@ func NewRenderer(templateGlobPattern string) (r *renderer, err error) {
                "TimeUntil":               timeUntil,
                "FormatTimeRFC3339":       formatTimeRFC3339,
                "FormatTimeRFC822":        formatTimeRFC822,
+               "FormatTimeSimple":        formatTimeSimple,
                "WithContext":             withContext,
        }).ParseGlob(templateGlobPattern)
        if err != nil {
index 34f19e5f3c04148cfd67cda3b695bf0753b24413..4098e2e089210a0033f5c9e8dfaf0efe7eb4a0c6 100644 (file)
                                <div class="status-action status-action-last">
                                        <a class="status-time" href="{{if not .ShowReplies}}/thread/{{.ID}}{{end}}#status-{{.ID}}"
                                                {{if $.Ctx.ThreadInNewTab}}target="_blank"{{end}}> 
-                                               <time datetime="{{FormatTimeRFC3339 .CreatedAt}}" title="{{FormatTimeRFC822 .CreatedAt}}">
-                                                       {{TimeSince .CreatedAt}}
+                                               <time datetime="{{FormatTimeRFC3339 .CreatedAt}}" title="{{FormatTimeRFC3339 .CreatedAt}}">
+                                                       {{FormatTimeSimple .CreatedAt}} ({{TimeSince .CreatedAt}})
                                                </time> 
                                        </a>
                                </div>