From: Andrea Zagli Date: Mon, 12 Dec 2016 10:31:52 +0000 (+0100) Subject: Specified date/time format in ::format. X-Git-Tag: v0.1.0~9 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=b45777454abc5dfb40cd3353c258e29e498d0483;p=zakform%2Flibzakform Specified date/time format in ::format. --- diff --git a/src/formelement.c b/src/formelement.c index 431219a..447bc33 100644 --- a/src/formelement.c +++ b/src/formelement.c @@ -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);