diff options
author | Thomas Bruederli <bruederli@kolabsys.com> | 2012-05-23 13:39:53 (GMT) |
---|---|---|
committer | Thomas Bruederli <bruederli@kolabsys.com> | 2012-05-23 13:39:53 (GMT) |
commit | 7d1882ad7636c900232cbee369b4d702d0d9489f (patch) | |
tree | 45b5dc66e669273da6ea3933eb4914bfbe0f529c | |
parent | eca8ebafc32cf3261f5d91d7ac5ba8f7bfe836c1 (diff) | |
download | roundcubemail-plugins-kolab-7d1882ad7636c900232cbee369b4d702d0d9489f.tar.gz |
Enforce local time for birthday and anniversary fields
-rw-r--r-- | plugins/libkolab/lib/kolab_format.php | 8 | ||||
-rw-r--r-- | plugins/libkolab/lib/kolab_format_contact.php | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/plugins/libkolab/lib/kolab_format.php b/plugins/libkolab/lib/kolab_format.php index 883eb7f..b6215e0 100644 --- a/plugins/libkolab/lib/kolab_format.php +++ b/plugins/libkolab/lib/kolab_format.php @@ -64,13 +64,13 @@ abstract class kolab_format * Convert the given date/time value into a cDateTime object * * @param mixed Date/Time value either as unix timestamp, date string or PHP DateTime object - * @param DateTimeZone The timezone the date/time is in. Use global default if empty + * @param DateTimeZone The timezone the date/time is in. Use global default if Null, local time if False * @param boolean True of the given date has no time component * @return object The libkolabxml date/time object */ public static function get_datetime($datetime, $tz = null, $dateonly = false) { - if (!$tz) $tz = self::$timezone; + if (!$tz && $tz !== false) $tz = self::$timezone; $result = new cDateTime(); // got a unix timestamp (in UTC) @@ -79,7 +79,7 @@ abstract class kolab_format if ($tz) $datetime->setTimezone($tz); } else if (is_string($datetime) && strlen($datetime)) - $datetime = new DateTime($datetime, $tz); + $datetime = new DateTime($datetime, $tz ?: null); if (is_a($datetime, 'DateTime')) { $result->setDate($datetime->format('Y'), $datetime->format('n'), $datetime->format('j')); @@ -89,7 +89,7 @@ abstract class kolab_format if ($tz && $tz->getName() == 'UTC') $result->setUTC(true); - else if ($tz) + else if ($tz !== false) $result->setTimezone($tz->getName()); } diff --git a/plugins/libkolab/lib/kolab_format_contact.php b/plugins/libkolab/lib/kolab_format_contact.php index d39b32e..d2634a0 100644 --- a/plugins/libkolab/lib/kolab_format_contact.php +++ b/plugins/libkolab/lib/kolab_format_contact.php @@ -233,9 +233,9 @@ class kolab_format_contact extends kolab_format if (isset($object['freebusyurl'])) $this->obj->setFreeBusyUrl($object['freebusyurl']); if (isset($object['birthday'])) - $this->obj->setBDay(self::get_datetime($object['birthday'], null, true)); + $this->obj->setBDay(self::get_datetime($object['birthday'], false, true)); if (isset($object['anniversary'])) - $this->obj->setAnniversary(self::get_datetime($object['anniversary'], null, true)); + $this->obj->setAnniversary(self::get_datetime($object['anniversary'], false, true)); if (!empty($object['photo'])) { if ($type = rc_image_content_type($object['photo'])) |