mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-25 20:31:31 +02:00
if data_format given, try that first, before leaving it to Api\DateTime to figure it out
This commit is contained in:
parent
582459242f
commit
1215762f04
@ -24,11 +24,11 @@ class Customfields extends Transformer
|
|||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allowd types of customfields
|
* Allowed types of customfields
|
||||||
*
|
*
|
||||||
* The additionally allowed app-names from the link-class, will be add by the edit-method only,
|
* The additionally allowed app-names from the link-class, will be added by the edit-method only,
|
||||||
* as the link-class has to be called, which can NOT be instanciated by the constructor, as
|
* as the link-class has to be called, which can NOT be instantiated by the constructor, as
|
||||||
* we get a loop in the instanciation.
|
* we get a loop in the instantiation.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
|
@ -120,15 +120,17 @@ class Date extends Transformer
|
|||||||
{
|
{
|
||||||
$date = Api\DateTime::server2user($value);
|
$date = Api\DateTime::server2user($value);
|
||||||
}
|
}
|
||||||
elseif (!empty($this->attrs['data_format']) && $this->attrs['data_format'] !== 'object')
|
// if data_format given, try that first, before leaving it to Api\DateTime to figure it out
|
||||||
|
elseif (!empty($this->attrs['data_format']) && $this->attrs['data_format'] !== 'object' &&
|
||||||
|
($date = Api\DateTime::createFromFormat($this->attrs['data_format'], $value, Api\DateTime::$user_timezone)))
|
||||||
{
|
{
|
||||||
$date = Api\DateTime::createFromFormat($this->attrs['data_format'], $value, Api\DateTime::$user_timezone);
|
// set AND checked above
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$date = new Api\DateTime($value);
|
$date = new Api\DateTime($value);
|
||||||
}
|
}
|
||||||
if($this->type == 'date-timeonly' && $date)
|
if($this->type === 'date-timeonly' && $date)
|
||||||
{
|
{
|
||||||
$date->setDate(1970, 1, 1);
|
$date->setDate(1970, 1, 1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user