event display/edit forms now properly show timezone-adjusted date/time

This commit is contained in:
Michał 'rysiek' Woźniak 2014-02-11 02:26:58 +01:00
parent b232d96522
commit 8381f056be
2 changed files with 6 additions and 4 deletions

View file

@ -94,14 +94,14 @@ $dtstart = $vevent->DTSTART;
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
switch($dtstart->getDateType()) {
case Sabre\VObject\Property\DateTime::UTC:
$timezone = new DateTimeZone(OC_Calendar_App::getTimezone());
case Sabre\VObject\Property\DateTime::LOCALTZ:
$timezone = new DateTimeZone(OC_Calendar_App::$tz);
$newDT = $dtstart->getDateTime();
$newDT->setTimezone($timezone);
$dtstart->setDateTime($newDT);
$newDT = $dtend->getDateTime();
$newDT->setTimezone($timezone);
$dtend->setDateTime($newDT);
case Sabre\VObject\Property\DateTime::LOCALTZ:
case Sabre\VObject\Property\DateTime::LOCAL:
$startdate = $dtstart->getDateTime()->format('d-m-Y');
$starttime = $dtstart->getDateTime()->format('H:i');

View file

@ -32,16 +32,17 @@ $permissions = OC_Calendar_App::getPermissions($id, OC_Calendar_App::EVENT, $acc
$dtstart = $vevent->DTSTART;
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
switch($dtstart->getDateType()) {
case Sabre\VObject\Property\DateTime::UTC:
$timezone = new DateTimeZone(OC_Calendar_App::getTimezone());
case Sabre\VObject\Property\DateTime::LOCALTZ:
$timezone = new DateTimeZone(OC_Calendar_App::$tz);
$newDT = $dtstart->getDateTime();
$newDT->setTimezone($timezone);
$dtstart->setDateTime($newDT);
$newDT = $dtend->getDateTime();
$newDT->setTimezone($timezone);
$dtend->setDateTime($newDT);
case Sabre\VObject\Property\DateTime::LOCALTZ:
case Sabre\VObject\Property\DateTime::LOCAL:
$startdate = $dtstart->getDateTime()->format('d-m-Y');
$starttime = $dtstart->getDateTime()->format('H:i');
@ -49,6 +50,7 @@ switch($dtstart->getDateType()) {
$endtime = $dtend->getDateTime()->format('H:i');
$allday = false;
break;
// all-day event
case Sabre\VObject\Property\DateTime::DATE:
$startdate = $dtstart->getDateTime()->format('d-m-Y');
$starttime = '';