/* tolgo la formattazione */
campi[elem.DBName] = strings.ReplaceAll(elem.Value, ".", "")
campi[elem.DBName] = strings.ReplaceAll(campi[elem.DBName].(string), ",", ".")
- } else if strings.Contains(elem.Validation, "mydate") && elem.Value != "" {
+ } else if strings.Contains(elem.Validation, "mydate") {
/* metto la data in formato sql */
- t, err := time.Parse("02/01/2006", elem.Value)
- if err == nil {
- campi[elem.DBName] = t.Format("2006-01-02")
+ if elem.Value == "" {
+ campi[elem.DBName] = nil
} else {
- fmt.Println(err)
+ t, err := time.Parse("02/01/2006", elem.Value)
+ if err == nil {
+ campi[elem.DBName] = t.Format("2006-01-02")
+ } else {
+ fmt.Println(err)
+ }
}
} else {
campi[elem.DBName] = elem.Value