]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
convert activity stream RFC3339 dates to mysql datetime format when saving remote...
authorHannes Mannerheim <h@nnesmannerhe.im>
Fri, 9 Oct 2015 22:11:54 +0000 (00:11 +0200)
committerHannes Mannerheim <h@nnesmannerhe.im>
Fri, 9 Oct 2015 22:11:54 +0000 (00:11 +0200)
plugins/Event/EventPlugin.php

index 4e9d153b1616c3e7ddfafe8d8cdfb5b84c419b4b..1cd574086ac7bb67b5a75d79398c956104f20eee 100644 (file)
@@ -157,6 +157,14 @@ class EventPlugin extends MicroAppPlugin
             throw new Exception(_m('No end date for event.'));
         }
 
+        // dates are saved as UTC in database
+        $start_time = new DateTime($dtstart->item(0)->nodeValue);
+        $start_time->setTimezone(new DateTimeZone('UTC'));
+        $start_time = $start_time->format('Y-m-d H:i:s');
+        $end_time = new DateTime($dtend->item(0)->nodeValue);
+        $end_time->setTimezone(new DateTimeZone('UTC'));
+        $end_time = $end_time->format('Y-m-d H:i:s');
+
         // location is optional
         $location = null;
         $location_object = $happeningObj->element->getElementsByTagName('location');
@@ -177,8 +185,8 @@ class EventPlugin extends MicroAppPlugin
         case ActivityVerb::POST:
                // FIXME: get startTime, endTime, location and URL
             $notice = Happening::saveNew($actor,
-                                         $dtstart->item(0)->nodeValue,
-                                         $dtend->item(0)->nodeValue,
+                                         $start_time,
+                                         $end_time,
                                          $happeningObj->title,
                                          $location,
                                          $happeningObj->summary,