2 commits - plugins/libkolab
Thomas Brüderli
bruederli at kolabsys.com
Thu Jul 5 12:04:57 CEST 2012
plugins/libkolab/lib/kolab_format.php | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
New commits:
commit 8f775bc5fc2cf35ebb3753c99aaa4c7b2edc4a01
Merge: 4b774c0 95f1717
Author: Thomas Bruederli <thomas at roundcube.net>
Date: Thu Jul 5 12:04:31 2012 +0200
Merge branch 'master' of ssh://git.kolabsys.com/git/roundcube
commit 4b774c06c9cc99aeea3b78414f7a2c48833ae38e
Author: Thomas Bruederli <thomas at roundcube.net>
Date: Thu Jul 5 11:43:22 2012 +0200
Respect timezone information in DateTime argument
diff --git a/plugins/libkolab/lib/kolab_format.php b/plugins/libkolab/lib/kolab_format.php
index caae38f..23246d3 100644
--- a/plugins/libkolab/lib/kolab_format.php
+++ b/plugins/libkolab/lib/kolab_format.php
@@ -73,7 +73,13 @@ abstract class kolab_format
*/
public static function get_datetime($datetime, $tz = null, $dateonly = false)
{
- if (!$tz && $tz !== false) $tz = self::$timezone;
+ // use timezone information from datetime of global setting
+ if (!$tz && $tz !== false) {
+ if ($datetime instanceof DateTime)
+ $tz = $datetime->getTimezone();
+ if (!$tz)
+ $tz = self::$timezone;
+ }
$result = new cDateTime();
// got a unix timestamp (in UTC)
@@ -84,7 +90,7 @@ abstract class kolab_format
else if (is_string($datetime) && strlen($datetime))
$datetime = new DateTime($datetime, $tz ?: null);
- if (is_a($datetime, 'DateTime')) {
+ if ($datetime instanceof DateTime) {
$result->setDate($datetime->format('Y'), $datetime->format('n'), $datetime->format('j'));
if (!$dateonly)
More information about the commits
mailing list