fix wrong timezone in creation time, if configured server-timezone does not match the one from the DB

This commit is contained in:
Ralf Becker 2020-10-19 13:45:46 +02:00
parent cb49caaad0
commit 6fc6ed7bd9

View File

@ -125,7 +125,8 @@ class notifications_popup implements notifications_iface {
'account_id' => $this->recipient->account_id, 'account_id' => $this->recipient->account_id,
'notify_message' => $_message, 'notify_message' => $_message,
'notify_type' => self::_type, 'notify_type' => self::_type,
'notify_data' => is_array($_data) ? json_encode($_data) : NULL 'notify_data' => is_array($_data) ? json_encode($_data) : NULL,
'notify_created' => Api\DateTime::user2server('now'),
), false,__LINE__,__FILE__,self::_appname); ), false,__LINE__,__FILE__,self::_appname);
if ($result === false) throw new Exception("Can't save notification into SQL table"); if ($result === false) throw new Exception("Can't save notification into SQL table");
$push = new Api\Json\Push($this->recipient->account_id); $push = new Api\Json\Push($this->recipient->account_id);
@ -161,8 +162,8 @@ class notifications_popup implements notifications_iface {
'id' => $notification['notify_id'], 'id' => $notification['notify_id'],
'message' => $notification['notify_message'], 'message' => $notification['notify_message'],
'status' => $notification['notify_status'], 'status' => $notification['notify_status'],
'created' => Api\DateTime::to($notification['notify_created']), 'created' => Api\DateTime::server2user($notification['notify_created']),
'current' => new DateTime(), 'current' => new Api\DateTime('now'),
'actions' => is_array($actions)?$actions:NULL, 'actions' => is_array($actions)?$actions:NULL,
'extra_data' => ($data['data'] ? $data['data'] : array()) 'extra_data' => ($data['data'] ? $data['data'] : array())
); );