diff options
| author | Samuel Wilhelmsson <samuel.wilhelmsson@gmail.com> | 2024-04-01 17:11:50 +0200 |
|---|---|---|
| committer | Samuel Wilhelmsson <samuel.wilhelmsson@gmail.com> | 2024-11-14 09:27:54 +0000 |
| commit | 191e2ddf095a5e57b33caf4a9235c686a462232c (patch) | |
| tree | 183e0dab0166d32a33e6179d7d4a0221007e20a0 /index_templ.go | |
| parent | 9e8b98891bc6446532bd8be203a4aadf30f326be (diff) | |
| download | tinygram-191e2ddf095a5e57b33caf4a9235c686a462232c.tar.gz tinygram-191e2ddf095a5e57b33caf4a9235c686a462232c.zip | |
render time as sweden
Diffstat (limited to 'index_templ.go')
| -rw-r--r-- | index_templ.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/index_templ.go b/index_templ.go index ff198bb..f4b3f93 100644 --- a/index_templ.go +++ b/index_templ.go @@ -14,7 +14,7 @@ import "fmt" import "time" import "net/url" -func index(ps []Post) templ.Component { +func index(ps []Post, tz *time.Location) templ.Component { return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) if !templ_7745c5c3_IsBuffer { @@ -31,7 +31,7 @@ func index(ps []Post) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = posts(ps).Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = posts(ps, tz).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -110,7 +110,7 @@ func uploadPage(csrfToken string) templ.Component { }) } -func posts(posts []Post) templ.Component { +func posts(posts []Post, tz *time.Location) templ.Component { return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) if !templ_7745c5c3_IsBuffer { @@ -158,9 +158,9 @@ func posts(posts []Post) templ.Component { return templ_7745c5c3_Err } var templ_7745c5c3_Var6 string - templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(post.CreatedAt.Format("2006-01-02 - 15:04")) + templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(post.CreatedAt.In(tz).Format("2006-01-02 - 15:04")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `index.templ`, Line: 98, Col: 65} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `index.templ`, Line: 98, Col: 72} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { |
