From 4d4d66ea9cc0ba05c954cfb9849676d2e044a412 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 20 Dec 2007 03:08:07 +0000 Subject: [PATCH] Allow 00:00 times or 0h in date-(time|hour)only widgets, by differing between 0 and ''/null --- etemplate/inc/class.date_widget.inc.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etemplate/inc/class.date_widget.inc.php b/etemplate/inc/class.date_widget.inc.php index 899747d50e..8e092ad1a9 100644 --- a/etemplate/inc/class.date_widget.inc.php +++ b/etemplate/inc/class.date_widget.inc.php @@ -105,7 +105,8 @@ 'data_format' => $data_format, ); } - if (!$value) + // for date-(time|hour)only widgets we distinct between between 0 and ''/null timestamps + if (!$value && ($type != 'date-timeonly' && $type != 'date-houronly' || (string)$value === '')) { $value = array( 'Y' => '', @@ -200,7 +201,7 @@ ); for ($str='',$n = substr($type,-4) == 'only' ? 3 : 0; $n < count($format); ++$n) { - if ($value[$format[$n]] && $n < 3 || $n >= 3 && ($value[$format[3]] || $value[$format[4]])) + if ($value[$format[$n]] && $n < 3 || $n >= 3 && ($value[$format[3]] !== '' || $value[$format[4]] !== '')) { if (!$n && $options & 16 ) {