[Pkg-owncloud-commits] [php-sabre-vobject] 30/43: Correctly serializing floating DATE-TIME in jCal.

David Prévot taffit at moszumanska.debian.org
Sat Jan 10 14:20:16 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository php-sabre-vobject.

commit 02cd2b55bdb636bab5465d5f5b2b8e630da98d7e
Author: Evert Pot <me at evertpot.com>
Date:   Thu Jan 8 13:39:39 2015 -0500

    Correctly serializing floating DATE-TIME in jCal.
    
    Fixes #179.
---
 ChangeLog.md                        |  2 ++
 lib/Property/ICalendar/DateTime.php | 19 ++++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/ChangeLog.md b/ChangeLog.md
index 9d3e711..f9a7ef7 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -9,6 +9,8 @@ ChangeLog
 * #177: SCHEDULE-STATUS should not contain a reason phrase, only a status
   code.
 * #175: Parser can now read and skip the UTF-8 BOM.
+* #179: Added `isFloating` to `DATE-TIME` properties.
+* #179: Fixed jCal serialization of floating `DATE-TIME` properties.
 
 
 3.3.4 (2014-11-19)
diff --git a/lib/Property/ICalendar/DateTime.php b/lib/Property/ICalendar/DateTime.php
index e197451..47dc34b 100644
--- a/lib/Property/ICalendar/DateTime.php
+++ b/lib/Property/ICalendar/DateTime.php
@@ -110,6 +110,22 @@ class DateTime extends Property {
     }
 
     /**
+     * Returns true if this is a floating DATE or DATE-TIME.
+     *
+     * Note that DATE is always floating.
+     */
+    public function isFloating() {
+
+        return
+            !$this->hasTime() ||
+            (
+                !isset($this['TZID']) &&
+                strpos($this->getValue(),'Z')===false
+            );
+
+    }
+
+    /**
      * Returns a date-time value.
      *
      * Note that if this property contained more than 1 date-time, only the
@@ -258,9 +274,10 @@ class DateTime extends Property {
 
         $dts = $this->getDateTimes();
         $hasTime = $this->hasTime();
+        $isFloating = $this->isFloating();
 
         $tz = $dts[0]->getTimeZone();
-        $isUtc = in_array($tz->getName() , array('UTC', 'GMT', 'Z'));
+        $isUtc = $isFloating ? false : in_array($tz->getName() , array('UTC', 'GMT', 'Z'));
 
         return array_map(
             function($dt) use ($hasTime, $isUtc) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabre-vobject.git



More information about the Pkg-owncloud-commits mailing list