Fix date formatting on mainpage

This commit is contained in:
2020-10-09 17:22:53 +02:00
parent 251018db1f
commit e725c30cf8
3 changed files with 5 additions and 1 deletions

View File

@@ -9,6 +9,8 @@ import (
"trikotwaschliste/models"
)
const layoutDE = "02.01.2006"
func DbMainpage(pool *pgxpool.Pool) gin.H {
var items []models.Washlist
var persons []models.Person
@@ -24,6 +26,7 @@ func DbMainpage(pool *pgxpool.Pool) gin.H {
if err != nil {
log.Println(err.Error())
}
item.DateString = item.Date.Format(layoutDE)
items = append(items, item)
}

View File

@@ -25,7 +25,7 @@
{{range $item := $items}}
<tr>
<td>{{$item.Person}}</td>
<td>{{$item.Date}}</td>
<td>{{$item.DateString}}</td>
<td>
<div class="center">
<form class="ui form" action="/uploadname" method="POST">

View File

@@ -7,4 +7,5 @@ type Washlist struct {
Person string `json:"person"`
Date time.Time `json:"date"`
Washed int `json:"iswashed"`
DateString string `json:"datestring"`
}