From da05782002fd24a6030c5b64a0b3c77dfc5d37ee Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Sat, 14 Nov 2015 21:14:20 +0100 Subject: [PATCH] Allow date formats to miss time parts. In case the seconds field are not provided just use "00" rather than NIL as currently... --- src/parsers/date-format.lisp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/parsers/date-format.lisp b/src/parsers/date-format.lisp index 8ce699f..d7b7fc6 100644 --- a/src/parsers/date-format.lisp +++ b/src/parsers/date-format.lisp @@ -62,13 +62,15 @@ ;; now format the time part (format s "~a:~a:~a" - (let ((hint (parse-integer hour))) - (cond ((and am (= hint 12)) "00") - ((and pm (= hint 12)) "12") - ((and pm (< hint 12)) (+ hint 12)) - (t hour))) - minute - seconds) + (if hour + (let ((hint (parse-integer hour))) + (cond ((and am (= hint 12)) "00") + ((and pm (= hint 12)) "12") + ((and pm (< hint 12)) (+ hint 12)) + (t hour))) + "00") + (or minute "00") + (or seconds "00")) ;; and maybe format the micro seconds part (if usecs (format s ".~a" usecs)