diff --git a/ent/admin/handler.go b/ent/admin/handler.go index 670854d..c6108a8 100644 --- a/ent/admin/handler.go +++ b/ent/admin/handler.go @@ -16,6 +16,7 @@ import ( ) const dateTimeFormat = "2006-01-02T15:04:05" +const dateTimeFormatNoSeconds = "2006-01-02T15:04" type Handler struct { client *ent.Client @@ -307,8 +308,11 @@ func (h *Handler) bind(ctx echo.Context, entity any) error { // 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. - if t, err := time.Parse(dateTimeFormat, v[0]); err == nil { - ctx.Request().Form[k][0] = t.Format(time.RFC3339) + 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) diff --git a/ent/admin/templates/handler.tmpl b/ent/admin/templates/handler.tmpl index 95fb415..4318219 100644 --- a/ent/admin/templates/handler.tmpl +++ b/ent/admin/templates/handler.tmpl @@ -21,6 +21,7 @@ ) const dateTimeFormat = "2006-01-02T15:04:05" + const dateTimeFormatNoSeconds = "2006-01-02T15:04" type Handler struct { client *{{ $pkg }}.Client @@ -248,8 +249,11 @@ // 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. - if t, err := time.Parse(dateTimeFormat, v[0]); err == nil { - ctx.Request().Form[k][0] = t.Format(time.RFC3339) + 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) diff --git a/pkg/ui/layouts/auth.go b/pkg/ui/layouts/auth.go index a7586f9..8f7e7c5 100644 --- a/pkg/ui/layouts/auth.go +++ b/pkg/ui/layouts/auth.go @@ -13,6 +13,7 @@ func Auth(r *ui.Request, content Node) Node { return Doctype( HTML( Lang("en"), + Data("theme", "light"), Head( Metatags(r), CSS(), diff --git a/pkg/ui/layouts/primary.go b/pkg/ui/layouts/primary.go index 623d087..a2b6256 100644 --- a/pkg/ui/layouts/primary.go +++ b/pkg/ui/layouts/primary.go @@ -14,6 +14,7 @@ func Primary(r *ui.Request, content Node) Node { return Doctype( HTML( Lang("en"), + Data("theme", "light"), Head( Metatags(r), CSS(), @@ -31,9 +32,12 @@ func Primary(r *ui.Request, content Node) Node { ), Div( Class("column is-10"), - If(len(r.Title) > 0, H1(Class("title"), Text(r.Title))), - FlashMessages(r), - content, + Div( + Class("box"), + If(len(r.Title) > 0, H1(Class("title"), Text(r.Title))), + FlashMessages(r), + content, + ), ), ), ),