]> saetta.ns0.it Git - zakform/libzakform/commitdiff
Added spacial value @now as default-value in ZakFormElement.
authorAndrea Zagli <azagli@libero.it>
Wed, 30 Dec 2015 14:39:44 +0000 (15:39 +0100)
committerAndrea Zagli <azagli@libero.it>
Wed, 30 Dec 2015 14:39:44 +0000 (15:39 +0100)
src/formelement.c

index 80491a8a53335f0681a8b33555ec3d666432ae1c..26c601266ed459b5c35a22e08520f9ab824c3f45 100644 (file)
@@ -408,7 +408,15 @@ static gchar
                        gchar *datetime_format;
 
                        datetime_format = (gchar *)g_hash_table_lookup (format, "content");
-                       gdt = zak_utils_get_gdatetime_from_string (value, NULL);
+
+                       if (g_strcmp0 (value, "@now") == 0)
+                               {
+                                       gdt = g_date_time_new_now_local ();
+                               }
+                       else
+                               {
+                                       gdt = zak_utils_get_gdatetime_from_string (value, NULL);
+                               }
                        ret = zak_utils_gdatetime_format (gdt, datetime_format);
 
                        if (gdt != NULL)