diff --git a/database/mainpage.go b/database/mainpage.go index 614f4f6..48e74b5 100644 --- a/database/mainpage.go +++ b/database/mainpage.go @@ -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) } diff --git a/html/mainpage/index.html b/html/mainpage/index.html index 7eea9f5..3794de3 100644 --- a/html/mainpage/index.html +++ b/html/mainpage/index.html @@ -25,7 +25,7 @@ {{range $item := $items}} {{$item.Person}} - {{$item.Date}} + {{$item.DateString}}
diff --git a/models/washitem.go b/models/washitem.go index f57e964..6786715 100644 --- a/models/washitem.go +++ b/models/washitem.go @@ -7,4 +7,5 @@ type Washlist struct { Person string `json:"person"` Date time.Time `json:"date"` Washed int `json:"iswashed"` + DateString string `json:"datestring"` }