some bugfixes:

- date-time: empty date not recogniced
- date-timeonly, date-houronly: use only seconds, no timezone converstation between server-time and UTC (default for mktime())
This commit is contained in:
Ralf Becker 2005-04-10 21:25:42 +00:00
parent f2be05f26f
commit 7a39be36b6

View File

@ -66,7 +66,7 @@
{
if (!is_object($GLOBALS['phpgw']->jscalendar))
{
$GLOBALS['phpgw']->jscalendar = CreateObject('phpgwapi.jscalendar');
$GLOBALS['phpgw']->jscalendar =& CreateObject('phpgwapi.jscalendar');
}
$this->jscal =& $GLOBALS['phpgw']->jscalendar;
}
@ -127,6 +127,9 @@
}
else
{
// for the timeformats we use only seconds, no timezone conversation between server-time and UTC
if (substr($type,-4) == 'only') $value -= adodb_date('Z',0);
$value = array(
'Y' => adodb_date('Y',$value),
'm' => adodb_date('m',$value),
@ -325,6 +328,8 @@
{
return False;
}
$no_date = substr($extension_data['type'],-4) == 'only';
if ($value['today'])
{
$set = array('Y','m','d');
@ -341,8 +346,8 @@
}
$value += $this->jscal->input2date($value_in['str'],False,'d','m','Y');
}
if ($value['d'] || isset($value['H']) && $value['H'] !== '' ||
isset($value['i']) && $value['i'] !== '')
if ($value['d'] || $no_date &&
(isset($value['H']) && $value['H'] !== '' || isset($value['i']) && $value['i'] !== ''))
{
if ($value['d'])
{
@ -380,7 +385,9 @@
$data_format = $extension_data['data_format'];
if (empty($data_format))
{
$value = adodb_mktime((int) $value['H'],(int) $value['i'],0,$value['m'],$value['d'],$value['Y']);
// for time or hour format we use just seconds (and no timezone correction between server-time and UTC)
$value = $no_date ? 3600 * (int) $value['H'] + 60 * (int) $value['i'] :
adodb_mktime((int) $value['H'],(int) $value['i'],0,$value['m'],$value['d'],$value['Y']);
}
else
{