mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 23:00:56 +01:00
using DateTime::to() instead of common::dateformatorder/formattime
This commit is contained in:
parent
ed8f6f45c4
commit
1484c94c28
@ -224,17 +224,7 @@ class Customfields implements \IteratorAggregate
|
|||||||
case 'date-time':
|
case 'date-time':
|
||||||
if ($value)
|
if ($value)
|
||||||
{
|
{
|
||||||
$format = $field['len'] ? $field['len'] : ($field['type'] == 'date' ? 'Y-m-d' : 'Y-m-d H:i:s');
|
$value = DateTime::to($value, $field['type'] == 'date' ? true : '');
|
||||||
$formats = preg_split('/[\\/. :-]/',$format);
|
|
||||||
$values = preg_split('/[\\/. :-]/', is_numeric($value) ? DateTime::to($value, $format) : $value);
|
|
||||||
if (count($formats) != count($values))
|
|
||||||
{
|
|
||||||
//error_log(__METHOD__."(".array2string($field).", value='$value') format='$format', formats=".array2string($formats).", values=".array2string($values));
|
|
||||||
$values = array_slice($values, 0, count($formats));
|
|
||||||
}
|
|
||||||
$date = array_combine($formats, $values);
|
|
||||||
$value = common::dateformatorder($date['Y'], $date['m'], $date['d'],true);
|
|
||||||
if (isset($date['H'])) $value .= ' '.common::formattime($date['H'], $date['i']);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user