Fix saving created/changed dates: always use UTC timezone
This commit is contained in:
parent
e8dff87018
commit
5caf7915a3
1 changed files with 3 additions and 3 deletions
|
@ -401,13 +401,13 @@ abstract class kolab_format
|
||||||
// set some automatic values if missing
|
// set some automatic values if missing
|
||||||
if (empty($object['created']) && method_exists($this->obj, 'setCreated')) {
|
if (empty($object['created']) && method_exists($this->obj, 'setCreated')) {
|
||||||
$cdt = $this->obj->created();
|
$cdt = $this->obj->created();
|
||||||
$object['created'] = $cdt && $cdt->isValid() ? self::php_datetime($cdt) : new DateTime('now', self::$timezone);
|
$object['created'] = $cdt && $cdt->isValid() ? self::php_datetime($cdt) : new DateTime('now', new DateTimeZone('UTC'));
|
||||||
if (!$cdt || !$cdt->isValid())
|
if (!$cdt || !$cdt->isValid())
|
||||||
$this->obj->setCreated(self::get_datetime($object['created']));
|
$this->obj->setCreated(self::get_datetime($object['created']));
|
||||||
}
|
}
|
||||||
|
|
||||||
$object['changed'] = new DateTime('now', self::$timezone);
|
$object['changed'] = new DateTime('now', new DateTimeZone('UTC'));
|
||||||
$this->obj->setLastModified(self::get_datetime($object['changed'], new DateTimeZone('UTC')));
|
$this->obj->setLastModified(self::get_datetime($object['changed']));
|
||||||
|
|
||||||
// Save custom properties of the given object
|
// Save custom properties of the given object
|
||||||
if (isset($object['x-custom'])) {
|
if (isset($object['x-custom'])) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue