mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 00:13:35 +01:00
allow to specify a date-format in custom-fields using eg. format=Ymd, as it was possible in 11.1 in len field
This commit is contained in:
parent
43927f0bd5
commit
b408c8b464
@ -298,7 +298,14 @@ class Customfields extends Transformer
|
|||||||
{
|
{
|
||||||
case 'date':
|
case 'date':
|
||||||
case 'date-time':
|
case 'date-time':
|
||||||
|
if (!empty($field['values']['format']))
|
||||||
|
{
|
||||||
|
$widget->attrs['dataformat'] = $field['values']['format'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$widget->attrs['dataformat'] = $type == 'date' ? 'Y-m-d' : 'Y-m-d H:i:s';
|
$widget->attrs['dataformat'] = $type == 'date' ? 'Y-m-d' : 'Y-m-d H:i:s';
|
||||||
|
}
|
||||||
if($field['values']['min']) $widget->attrs['min'] = $field['values']['min'];
|
if($field['values']['min']) $widget->attrs['min'] = $field['values']['min'];
|
||||||
if($field['values']['max']) $widget->attrs['min'] = $field['values']['max'];
|
if($field['values']['max']) $widget->attrs['min'] = $field['values']['max'];
|
||||||
break;
|
break;
|
||||||
|
@ -107,7 +107,7 @@ class Date extends Transformer
|
|||||||
{
|
{
|
||||||
if (!$value) return $value; // otherwise we will get current date or 1970-01-01 instead of an empty value
|
if (!$value) return $value; // otherwise we will get current date or 1970-01-01 instead of an empty value
|
||||||
|
|
||||||
if ($this->attrs['dataformat'] && !is_numeric($value))
|
if ($this->attrs['dataformat'])
|
||||||
{
|
{
|
||||||
$date = Api\DateTime::createFromFormat($this->attrs['dataformat'], $value, Api\DateTime::$user_timezone);
|
$date = Api\DateTime::createFromFormat($this->attrs['dataformat'], $value, Api\DateTime::$user_timezone);
|
||||||
}
|
}
|
||||||
@ -158,6 +158,7 @@ class Date extends Transformer
|
|||||||
}
|
}
|
||||||
catch(\Exception $e)
|
catch(\Exception $e)
|
||||||
{
|
{
|
||||||
|
unset($e);
|
||||||
$date = null;
|
$date = null;
|
||||||
$value = '';
|
$value = '';
|
||||||
// this is not really a user error, but one of the clientside engine
|
// this is not really a user error, but one of the clientside engine
|
||||||
|
Loading…
Reference in New Issue
Block a user