diff --git a/calendar/inc/class.calendar_boupdate.inc.php b/calendar/inc/class.calendar_boupdate.inc.php index 37ee10312a..fbc87daf07 100644 --- a/calendar/inc/class.calendar_boupdate.inc.php +++ b/calendar/inc/class.calendar_boupdate.inc.php @@ -1220,11 +1220,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 diff --git a/calendar/inc/class.calendar_rrule.inc.php b/calendar/inc/class.calendar_rrule.inc.php index 7f9f9b21f0..25eea2ee11 100644 --- a/calendar/inc/class.calendar_rrule.inc.php +++ b/calendar/inc/class.calendar_rrule.inc.php @@ -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'])) { diff --git a/calendar/inc/class.calendar_so.inc.php b/calendar/inc/class.calendar_so.inc.php index 1430c7f8c0..f91b51acad 100644 --- a/calendar/inc/class.calendar_so.inc.php +++ b/calendar/inc/class.calendar_so.inc.php @@ -726,7 +726,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']))