]> saetta.ns0.it Git - zakform/libzakform/commitdiff
Specified date/time format in ::format.
authorAndrea Zagli <azagli@libero.it>
Mon, 12 Dec 2016 10:31:52 +0000 (11:31 +0100)
committerAndrea Zagli <azagli@libero.it>
Mon, 12 Dec 2016 10:31:52 +0000 (11:31 +0100)
src/formelement.c

index 431219a21854f9c17b7d162bae78a8348d066ab4..447bc338be02057063b3089a0e92c59002a6cf9a 100644 (file)
@@ -480,7 +480,18 @@ gchar
                                }
                        else
                                {
-                                       gdt = zak_utils_get_gdatetime_from_string (value, NULL);
+                                       if (g_ascii_strcasecmp (type, "date") == 0)
+                                               {
+                                                       gdt = zak_utils_get_gdatetime_from_string (value, "%Y-%m-%d");
+                                               }
+                                       else if (g_ascii_strcasecmp (type, "time") == 0)
+                                               {
+                                                       gdt = zak_utils_get_gdatetime_from_string (value, "%H:%M:%S");
+                                               }
+                                       else /* if (g_ascii_strcasecmp (type, "datetime") == 0) */
+                                               {
+                                                       gdt = zak_utils_get_gdatetime_from_string (value, NULL);
+                                               }
                                }
                        ret = zak_utils_gdatetime_format (gdt, datetime_format);