]> git.deb.at Git - pkg/abook.git/commitdiff
clean up ISO 8601 string generation
authorCedric Duval <cedricduval@free.fr>
Sat, 26 Aug 2006 19:16:41 +0000 (19:16 +0000)
committerCedric Duval <cedricduval@free.fr>
Sat, 26 Aug 2006 19:16:41 +0000 (19:16 +0000)
edit.c

diff --git a/edit.c b/edit.c
index ef956ef80c364ae4813842ec49335422f8cc3093..17ac5f3f876579adf03503d85a176fa6f14d1d0c 100644 (file)
--- a/edit.c
+++ b/edit.c
@@ -500,8 +500,12 @@ edit_date(int item, int nb)
 
        /* ISO 8601 date, of the YYYY-MM-DD or --MM-DD format */
        if(is_valid_date(date[0], date[1], date[2])) {
-               s = strdup_printf(date[2] ? "%04d-%02d-%02d" : "%c-%02d-%02d",
-                       date[2] ? date[2] : '-', date[1], date[0]);
+               if(date[2])
+                       s = strdup_printf("%04d-%02d-%02d",
+                               date[2], date[1], date[0]);
+               else
+                       s = strdup_printf("--%02d-%02d", date[1], date[0]);
+
                db_fput_byid(item, nb, xstrdup(s));
        } else
                statusline_msg(_("Invalid date"));