Updated readme.

This commit is contained in:
mikestefanello 2025-04-21 20:42:35 -04:00
parent a7948a9f69
commit bbf51211cd
5 changed files with 46 additions and 42 deletions

View file

@ -242,21 +242,21 @@
for k, v := range ctx.Request().Form {
// Remove empty field values so Echo's bind does not fail when trying to parse things like
// times, etc.
if len(v) == 1 && len(v[0]) == 0 {
delete(ctx.Request().Form, k)
continue
}
if len(v) == 1 && len(v[0]) == 0 {
delete(ctx.Request().Form, k)
continue
}
// Echo expects datetime values to be in a certain format but that does not align with the datetime-local
// HTML form element format, so we will attempt to convert it here.
for _, format := range []string{dateTimeFormatNoSeconds, dateTimeFormat} {
// Echo expects datetime values to be in a certain format but that does not align with the datetime-local
// HTML form element format, so we will attempt to convert it here.
for _, format := range []string{dateTimeFormatNoSeconds, dateTimeFormat} {
if t, err := time.Parse(format, v[0]); err == nil {
ctx.Request().Form[k][0] = t.Format(time.RFC3339)
break
}
}
}
return ctx.Bind(entity)
}
return ctx.Bind(entity)
}
{{ end }}