mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-28 17:48:56 +01:00
Calendar: Fix all-day events in a different timezone could slide by a day
Ex: 1977-04-29 created in CET (+1) on a server in UTC would change to the 28th after a few years (1980) Fixed by staying in server timezone for the recurrence calculations.
This commit is contained in:
parent
408eda8eb3
commit
173eb4e110
@ -1160,16 +1160,22 @@ class calendar_bo
|
|||||||
// unset exceptions, as we need to add them as recurrence too, but marked as exception
|
// unset exceptions, as we need to add them as recurrence too, but marked as exception
|
||||||
unset($event['recur_exception']);
|
unset($event['recur_exception']);
|
||||||
// loop over all recurrences and insert them, if they are after $start
|
// loop over all recurrences and insert them, if they are after $start
|
||||||
$rrule = calendar_rrule::event2rrule($event, !$event['whole_day'], Api\DateTime::$user_timezone->getName()); // true = we operate in usertime, like the rest of calendar_bo
|
$rrule = calendar_rrule::event2rrule($event, !$event['whole_day'], // true = we operate in usertime, like the rest of calendar_bo
|
||||||
|
// For whole day events, just stay in server time
|
||||||
|
$event['whole_day'] ? Api\DateTime::$server_timezone->getName() : Api\DateTime::$user_timezone->getName()
|
||||||
|
);
|
||||||
foreach($rrule as $time)
|
foreach($rrule as $time)
|
||||||
{
|
{
|
||||||
$time->setUser(); // $time is in timezone of event, convert it to usertime used here
|
// $time is in timezone of event, convert it to usertime used here
|
||||||
if($event['whole_day'])
|
if($event['whole_day'])
|
||||||
{
|
{
|
||||||
// All day events are processed in server timezone
|
// All day events are processed in server timezone
|
||||||
$time->setServer();
|
|
||||||
$time->setTime(0,0,0);
|
$time->setTime(0,0,0);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$time->setUser();
|
||||||
|
}
|
||||||
if (($ts = $this->date2ts($time)) < $start-$event_length)
|
if (($ts = $this->date2ts($time)) < $start-$event_length)
|
||||||
{
|
{
|
||||||
//echo "<p>".$time." --> ignored as $ts < $start-$event_length</p>\n";
|
//echo "<p>".$time." --> ignored as $ts < $start-$event_length</p>\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user