summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2012-05-23 13:39:53 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2012-05-23 13:39:53 (GMT)
commit7d1882ad7636c900232cbee369b4d702d0d9489f (patch)
tree45b5dc66e669273da6ea3933eb4914bfbe0f529c
parenteca8ebafc32cf3261f5d91d7ac5ba8f7bfe836c1 (diff)
downloadroundcubemail-plugins-kolab-7d1882ad7636c900232cbee369b4d702d0d9489f.tar.gz
Enforce local time for birthday and anniversary fields
-rw-r--r--plugins/libkolab/lib/kolab_format.php8
-rw-r--r--plugins/libkolab/lib/kolab_format_contact.php4
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']))