forked from extern/egroupware
Calendar - change how we're dealing with (all day) timezones, keeping the event in the assigned timezone instead of always changing it to the server timezone.
This commit is contained in:
parent
cb58842ac8
commit
f618128b07
@ -1121,6 +1121,7 @@ class calendar_bo
|
||||
// insert at least the event itself, if it's behind the horizont
|
||||
$event['recur_enddate'] = $this->date2ts($end) < $this->date2ts($event['end']) ? $event['end'] : $end;
|
||||
}
|
||||
$event['recur_enddate'] = new Api\DateTime($event['recur_enddate'], calendar_timezones::DateTimeZone($event['tzid']));
|
||||
// unset exceptions, as we need to add them as recurrence too, but marked as exception
|
||||
unset($event['recur_exception']);
|
||||
// loop over all recurrences and insert them, if they are after $start
|
||||
|
@ -1178,11 +1178,14 @@ class calendar_boupdate extends calendar_bo
|
||||
{
|
||||
$old_event = null;
|
||||
}
|
||||
if (!isset($event['whole_day'])) $event['whole_day'] = $this->isWholeDay($event);
|
||||
|
||||
// set recur-enddate/range-end to real end-date of last recurrence
|
||||
if ($event['recur_type'] != MCAL_RECUR_NONE && $event['recur_enddate'])
|
||||
{
|
||||
$rrule = calendar_rrule::event2rrule($event);
|
||||
$event['recur_enddate'] = new Api\DateTime($event['recur_enddate'], calendar_timezones::DateTimeZone($event['tzid']));
|
||||
$event['recur_enddate']->setTime(23,59,59);
|
||||
$rrule = calendar_rrule::event2rrule($event, true, Api\DateTime::$server_timezone->getName());
|
||||
$rrule->rewind();
|
||||
$enddate = $rrule->current();
|
||||
do
|
||||
@ -1190,13 +1193,13 @@ class calendar_boupdate extends calendar_bo
|
||||
$rrule->next_no_exception();
|
||||
$occurrence = $rrule->current();
|
||||
}
|
||||
while ($rrule->valid(true) && ($enddate = $occurrence));
|
||||
while ($rrule->valid() && ($enddate = $occurrence));
|
||||
$enddate->modify(($event['end'] - $event['start']).' second');
|
||||
$event['recur_enddate'] = $enddate->format('ts');
|
||||
//$enddate->setTimezone();
|
||||
//$event['recur_enddate'] = $enddate->format('ts');
|
||||
//error_log(__METHOD__."($event[title]) start=".Api\DateTime::to($event['start'],'string').', end='.Api\DateTime::to($event['end'],'string').', range_end='.Api\DateTime::to($event['recur_enddate'],'string'));
|
||||
}
|
||||
|
||||
if (!isset($event['whole_day'])) $event['whole_day'] = $this->isWholeDay($event);
|
||||
$save_event = $event;
|
||||
if ($event['whole_day'])
|
||||
{
|
||||
@ -1222,17 +1225,15 @@ class calendar_boupdate extends calendar_bo
|
||||
{
|
||||
// all-day events are handled in server time
|
||||
$time = $this->so->startOfDay(
|
||||
new Api\DateTime($event['recur_enddate'], Api\DateTime::$user_timezone),
|
||||
new Api\DateTime($event['recur_enddate'], Api\DateTime::$server_timezone),
|
||||
Api\DateTime::$server_timezone->getName()
|
||||
);
|
||||
$time->modify(($event['end'] - $event['start'] + 1).' seconds');
|
||||
$event['recur_enddate'] = Api\DateTime::to($time, 'ts') - 1;
|
||||
$time->setUser();
|
||||
$save_event['recur_enddate'] = Api\DateTime::to($time, 'ts') - 1;
|
||||
$time->modify(($event['end'] - $event['start']).' seconds');
|
||||
//$event['recur_enddate'] = $save_event['recur_enddate'] = Api\DateTime::to($time, 'ts');
|
||||
}
|
||||
$timestamps = array('modified','created');
|
||||
// all-day events are handled in server time
|
||||
$event['tzid'] = $save_event['tzid'] = Api\DateTime::$server_timezone->getName();
|
||||
// $event['tzid'] = $save_event['tzid'] = Api\DateTime::$server_timezone->getName();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -760,7 +760,7 @@ class calendar_rrule implements Iterator
|
||||
if ($event['recur_enddate'])
|
||||
{
|
||||
$enddate = is_a($event['recur_enddate'],'DateTime') ? $event['recur_enddate'] : new Api\DateTime($event['recur_enddate'],$timestamp_tz);
|
||||
$enddate->setTime(23,59,59);
|
||||
// $enddate->setTime(23,59,59);
|
||||
$enddate->setTimezone(self::$tz_cache[$to_tz]);
|
||||
}
|
||||
if (is_array($event['recur_exception']))
|
||||
|
Loading…
Reference in New Issue
Block a user