diff --git a/includes/controller/shifts_controller.php b/includes/controller/shifts_controller.php index 2c5055fe..9b1b4b9b 100644 --- a/includes/controller/shifts_controller.php +++ b/includes/controller/shifts_controller.php @@ -1,5 +1,6 @@ $shift) { + $shifts[$row]['start_date'] = Carbon::createFromTimestamp($shift['start'])->toRfc3339String(); + $shifts[$row]['end_date'] = Carbon::createFromTimestamp($shift['end'])->toRfc3339String(); + } header('Content-Type: application/json; charset=utf-8'); raw_output(json_encode($shifts)); diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php index b071a069..3e7d76aa 100644 --- a/includes/model/Shifts_model.php +++ b/includes/model/Shifts_model.php @@ -619,7 +619,8 @@ function Shifts_by_user($userId, $include_freeload_comments = false) `ShiftEntry`.`Comment`, ' . ($include_freeload_comments ? '`ShiftEntry`.`freeload_comment`, ' : '') . ' `Shifts`.*, - @@session.time_zone AS timezone + @@session.time_zone AS timezone, + ? AS event_timezone FROM `ShiftEntry` JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID`) JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`) @@ -628,7 +629,8 @@ function Shifts_by_user($userId, $include_freeload_comments = false) ORDER BY `start` ', [ - $userId + config('timezone'), + $userId, ] ); } diff --git a/includes/pages/user_ical.php b/includes/pages/user_ical.php index 2f3a7ccc..6af4cd5d 100644 --- a/includes/pages/user_ical.php +++ b/includes/pages/user_ical.php @@ -1,5 +1,6 @@ utc()->format('Ymd\THis\Z') . "\r\n"; + $output .= 'DTSTART:' . $start->utc()->format('Ymd\THis\Z') . "\r\n"; + $output .= 'DTEND:' . $end->utc()->format('Ymd\THis\Z') . "\r\n"; $output .= 'LOCATION:' . $shift['Name'] . "\r\n"; $output .= "END:VEVENT\r\n"; return $output;