Calendar - all day recurring events would extend one day longer for some timezone combinations

This commit is contained in:
nathangray 2017-05-23 13:37:34 -06:00
parent 19536925b5
commit 9cf6685a77
3 changed files with 10 additions and 5 deletions

View File

@ -1245,11 +1245,15 @@ class calendar_boupdate extends calendar_bo
}
if (!empty($event['recur_enddate']))
{
$time = $this->so->startOfDay(new Api\DateTime($event['recur_enddate'], Api\DateTime::$user_timezone));
// all-day events are handled in server time
$time = $this->so->startOfDay(
new Api\DateTime($event['recur_enddate'], Api\DateTime::$user_timezone),
Api\DateTime::$server_timezone->getName()
);
$time->modify(($event['end'] - $event['start'] + 1).' seconds');
$event['recur_enddate'] = Api\DateTime::to($time, 'ts');
$event['recur_enddate'] = Api\DateTime::to($time, 'ts') - 1;
$time->setUser();
$save_event['recur_enddate'] = Api\DateTime::to($time, 'ts');
$save_event['recur_enddate'] = Api\DateTime::to($time, 'ts') - 1;
}
$timestamps = array('modified','created');
// all-day events are handled in server time

View File

@ -759,8 +759,9 @@ 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'],self::$tz_cache[$to_tz]);
$enddate = is_a($event['recur_enddate'],'DateTime') ? $event['recur_enddate'] : new Api\DateTime($event['recur_enddate'],$timestamp_tz);
$enddate->setTime(23,59,59);
$enddate->setTimezone(self::$tz_cache[$to_tz]);
}
if (is_array($event['recur_exception']))
{

View File

@ -730,7 +730,7 @@ class calendar_so
{
$all_cols = self::get_columns('calendar', $this->cal_table);
$all_cols[0] = $this->db->to_varchar($this->cal_table.'.cal_id');
$cols = "$this->repeats_table.recur_type,$this->repeats_table.recur_interval,$this->repeats_table.recur_data,range_end AS recur_enddate,".implode(',',$all_cols).",cal_start,cal_end,$this->user_table.cal_recur_date";
$cols = "$this->repeats_table.recur_type,$this->repeats_table.recur_interval,$this->repeats_table.recur_data,range_end - 1 AS recur_enddate,".implode(',',$all_cols).",cal_start,cal_end,$this->user_table.cal_recur_date";
}
$where = array();
if (is_array($params['query']))