mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 01:13:25 +01:00
fixing the fix: whole-day fix affected adding/updating regular events (non-whole-day) via CalDAV
Adding/updating events via CalDAV with timezone different to user-timezone seems to be broken since some time before the fix :(
This commit is contained in:
parent
cdf2247047
commit
07a0717a18
@ -378,15 +378,7 @@ class DateTime extends \DateTime
|
||||
case 'integer':
|
||||
case 'ts':
|
||||
// EGroupware's integer timestamp is NOT the usual UTC timestamp, but has a timezone offset applied!
|
||||
// calendar_ical unfortunately sets different timezones, breaking all sorts of things, if we're not setting the TZ back to our server-timezone
|
||||
if (date_default_timezone_get() !== self::$server_timezone->getName())
|
||||
{
|
||||
$tz_backup = date_default_timezone_get();
|
||||
date_default_timezone_set(self::$server_timezone->getName());
|
||||
}
|
||||
$ret = mktime(parent::format('H'),parent::format('i'),parent::format('s'),parent::format('m'),parent::format('d'),parent::format('Y'));
|
||||
if (isset($tz_backup)) date_default_timezone_set($tz_backup);
|
||||
return $ret;
|
||||
return mktime(parent::format('H'),parent::format('i'),parent::format('s'),parent::format('m'),parent::format('d'),parent::format('Y'));
|
||||
case 'utc': // alias for "U" / timestamp in UTC
|
||||
return $this->getTimestamp();
|
||||
case 'object':
|
||||
|
@ -615,11 +615,11 @@ class calendar_ical extends calendar_boupdate
|
||||
$event['end'] = new Api\DateTime($event['end'], self::$tz_cache[$event['tzid']]);
|
||||
}
|
||||
$event['end-nextday'] = clone $event['end'];
|
||||
$event['end-nextday']->add("1 day"); // we need the date of the next day, as DTEND is non-inclusive (= exclusive) in rfc2445
|
||||
$event['end-nextday']->add("60 sec"); // we need the date of the next day, as DTEND is non-inclusive (= exclusive) in rfc2445
|
||||
foreach (array('start' => 'DTSTART','end-nextday' => 'DTEND') as $f => $t)
|
||||
{
|
||||
$time = new Api\DateTime($event[$f], self::$tz_cache[$event['tzid']]);
|
||||
$arr = Api\DateTime::to($time,'array');
|
||||
// we need to convert whole-day events to user-timezone, as only there they start at midnight
|
||||
$arr = Api\DateTime::server2user($event[$f],'array');
|
||||
$vevent->setAttribute($t, array('year' => $arr['year'],'month' => $arr['month'],'mday' => $arr['day']),
|
||||
array('VALUE' => 'DATE'));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user