mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 08:34:29 +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-time':
|
||||
$widget->attrs['dataformat'] = $type == 'date' ? 'Y-m-d' : 'Y-m-d H:i:s';
|
||||
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';
|
||||
}
|
||||
if($field['values']['min']) $widget->attrs['min'] = $field['values']['min'];
|
||||
if($field['values']['max']) $widget->attrs['min'] = $field['values']['max'];
|
||||
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 ($this->attrs['dataformat'] && !is_numeric($value))
|
||||
if ($this->attrs['dataformat'])
|
||||
{
|
||||
$date = Api\DateTime::createFromFormat($this->attrs['dataformat'], $value, Api\DateTime::$user_timezone);
|
||||
}
|
||||
@ -158,6 +158,7 @@ class Date extends Transformer
|
||||
}
|
||||
catch(\Exception $e)
|
||||
{
|
||||
unset($e);
|
||||
$date = null;
|
||||
$value = '';
|
||||
// this is not really a user error, but one of the clientside engine
|
||||
@ -177,7 +178,7 @@ class Date extends Transformer
|
||||
{
|
||||
$valid = (string)$value === '' ? '' : (int)$value;
|
||||
}
|
||||
|
||||
|
||||
if (!empty($this->attrs['min']))
|
||||
{
|
||||
if(is_numeric($this->attrs['min']))
|
||||
|
Loading…
Reference in New Issue
Block a user