Allow 00:00 times or 0h in date-(time|hour)only widgets, by differing

between 0 and ''/null
This commit is contained in:
Ralf Becker 2007-12-20 03:08:07 +00:00
parent b195b3cb8d
commit 4d4d66ea9c

View File

@ -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 )
{