From: Cedric Duval Date: Sat, 26 Aug 2006 19:16:41 +0000 (+0000) Subject: clean up ISO 8601 string generation X-Git-Tag: upstream/0.6.1~2^2~100 X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=02bbd99f49680226d24128b8af1c187c42d61c9b;p=pkg%2Fabook.git clean up ISO 8601 string generation --- diff --git a/edit.c b/edit.c index ef956ef..17ac5f3 100644 --- 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"));