]> saetta.ns0.it Git - zakegg_go/commitdiff
Form: in Map2FormElements non teneva conto della data null.
authorAndrea Zagli <azagli@libero.it>
Wed, 17 Aug 2022 10:36:58 +0000 (12:36 +0200)
committerAndrea Zagli <azagli@libero.it>
Wed, 17 Aug 2022 10:36:58 +0000 (12:36 +0200)
form.go

diff --git a/form.go b/form.go
index 22fa73c62b1264b4f65114d873c97c96718292f5..51b332792fa0d24391369766c3b4d2787326ea02 100644 (file)
--- a/form.go
+++ b/form.go
@@ -177,7 +177,9 @@ func Map2FormElements(s map[string]interface{}, f map[string]*FormElement) {
                                        vg.Value = strings.ReplaceAll(vg.Value, ".", ",")
                                /* TODO */
                                } else if strings.Contains(vg.Validation, "mydate") {
-                                       vg.Value = v.(time.Time).Format("02/01/2006")
+                                       if v != nil {
+                                               vg.Value = v.(time.Time).Format("02/01/2006")
+                                       }
                                } else {
                                        vg.Value = fmt.Sprintf("%v", v)
                                }