Fix: Format timestamps in CET
This commit is contained in:
parent
ae88ec1b9b
commit
b4e38376ea
@ -97,7 +97,7 @@
|
||||
{{range .events}}
|
||||
<tr class="hover:bg-gray-100">
|
||||
<td class="px-6 py-4 text-sm text-gray-700">{{.ID}}</td>
|
||||
<td class="px-6 py-4 text-sm text-gray-700">{{.Timestamp}}</td>
|
||||
<td class="px-6 py-4 text-sm text-gray-700">{{.Timestamp | formatTimestamp }}</td>
|
||||
<td class="px-6 py-4 text-sm text-gray-700">{{.EventType}}</td>
|
||||
<td class="px-6 py-4 text-sm text-gray-700">
|
||||
<a href="/events/edit/{{.ID}}">Editar</a>
|
||||
|
@ -57,6 +57,11 @@ func LoadTemplate(c echo.Context, templateName string, data interface{}) error {
|
||||
funcs := template.FuncMap{
|
||||
"date": FormatDate, // Asignamos la función FormatDate con el nombre "date"
|
||||
"json": ToJson, // Agregamos la función ToJson con el nombre "json"
|
||||
"formatTimestamp": func(t time.Time) string {
|
||||
location, _ := time.LoadLocation("Europe/Madrid")
|
||||
localTime := t.In(location)
|
||||
return localTime.Format("2006-01-02 15:04 (MST)")
|
||||
},
|
||||
}
|
||||
|
||||
// Cargar las plantillas desde los directorios
|
||||
|
Loading…
Reference in New Issue
Block a user