[Pkg-owncloud-commits] [php-sabre-vobject] 285/341: Identify "+00:00" as UTC

David Prévot taffit at moszumanska.debian.org
Tue Aug 11 13:35:57 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 26d515f38f8a62daaad85a09a5fd3826900a89ff
Author: Christian Schmidt <c960657 at users.noreply.github.com>
Date:   Tue Jun 23 18:00:38 2015 +0200

    Identify "+00:00" as UTC
---
 lib/Property/ICalendar/DateTime.php               |  2 +-
 tests/VObject/Property/ICalendar/DateTimeTest.php | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/lib/Property/ICalendar/DateTime.php b/lib/Property/ICalendar/DateTime.php
index 4f46d3a..a7e29af 100644
--- a/lib/Property/ICalendar/DateTime.php
+++ b/lib/Property/ICalendar/DateTime.php
@@ -224,7 +224,7 @@ class DateTime extends Property {
                 }
                 if (is_null($tz)) {
                     $tz = $d->getTimeZone();
-                    $isUtc = in_array($tz->getName(), ['UTC', 'GMT', 'Z']);
+                    $isUtc = in_array($tz->getName(), ['UTC', 'GMT', 'Z', '+00:00']);
                     if (!$isUtc) {
                         $this->offsetSet('TZID', $tz->getName());
                     }
diff --git a/tests/VObject/Property/ICalendar/DateTimeTest.php b/tests/VObject/Property/ICalendar/DateTimeTest.php
index bf36a5c..fa12060 100644
--- a/tests/VObject/Property/ICalendar/DateTimeTest.php
+++ b/tests/VObject/Property/ICalendar/DateTimeTest.php
@@ -63,6 +63,20 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase {
         $this->assertTrue($elem->hasTime());
     }
 
+    function testSetDateTimeFromUnixTimestamp() {
+
+        // When initialized from a Unix timestamp, the timezone is set to "+00:00".
+        $dt = new \DateTime('@489288600');
+
+        $elem = $this->vcal->createProperty('DTSTART');
+        $elem->setDateTime($dt);
+
+        $this->assertEquals('19850704T013000Z', (string)$elem);
+        $this->assertNull($elem['TZID']);
+
+        $this->assertTrue($elem->hasTime());
+    }
+
     function testSetDateTimeLOCALTZ() {
 
         $tz = new \DateTimeZone('Europe/Amsterdam');

-- 
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