Skip to content

Commit

Permalink
fixup! fix: add VTIMEZONE to Appointments
Browse files Browse the repository at this point in the history
  • Loading branch information
miaulalala committed Jul 20, 2023
1 parent 40af520 commit 33994a5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
3 changes: 0 additions & 3 deletions lib/Service/Appointments/BookingCalendarWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
use DateTimeImmutable;
use OCA\Calendar\AppInfo\Application;
use OCA\Calendar\Db\AppointmentConfig;
use OCA\Calendar\Service\Appointments\TimezoneGenerator;
use OCP\Calendar\Exceptions\CalendarException;
use OCP\Calendar\ICreateFromString;
use OCP\Calendar\IManager;
Expand All @@ -38,9 +37,7 @@
use OCP\IUserManager;
use OCP\Security\ISecureRandom;
use RuntimeException;
use Sabre\VObject\Component;
use Sabre\VObject\Component\VCalendar;
use Sabre\VObject\TimeZoneUtil;
use function abs;

class BookingCalendarWriter {
Expand Down
15 changes: 3 additions & 12 deletions lib/Service/Appointments/TimezoneGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,9 @@

namespace OCA\Calendar\Service\Appointments;

use DateInterval;
use DatePeriod;
use DateTimeImmutable;
use DateTimeZone;
use OCA\Calendar\Db\AppointmentConfig;
use OCA\Calendar\Service\Appointments\Interval;
use OCP\AppFramework\Utility\ITimeFactory;
use Sabre\VObject\Component;
use Sabre\VObject\Component\VCalendar;
use Sabre\VObject\TimeZoneUtil;
use function ceil;
use function max;
use function min;

Expand All @@ -76,11 +68,10 @@ class TimezoneGenerator {
* @return null|Component A Sabre\VObject\Component object representing a VTIMEZONE definition
* or null if no timezone information is available
*/
public function generateVtimezone(string $timezone,int $from, int $to): ?Component {
public function generateVtimezone(string $timezone, int $from, int $to): ?Component {
try {
$tz = new \DateTimeZone($timezone);
}
catch (\Exception $e) {
} catch (\Exception $e) {
return null;
}

Expand Down Expand Up @@ -122,7 +113,7 @@ public function generateVtimezone(string $timezone,int $from, int $to): ?Compone

$component->DTSTART = $date->format('Ymd\THis');
$component->TZOFFSETFROM = sprintf('%s%02d%02d', $tzfrom >= 0 ? '+' : '-', abs(floor($tzfrom)), ($tzfrom - floor($tzfrom)) * 60);
$component->TZOFFSETTO = sprintf('%s%02d%02d', $offset >= 0 ? '+' : '-', abs(floor($offset)), ($offset - floor($offset)) * 60);
$component->TZOFFSETTO = sprintf('%s%02d%02d', $offset >= 0 ? '+' : '-', abs(floor($offset)), ($offset - floor($offset)) * 60);

// add abbreviated timezone name if available
if (!empty($trans['abbr'])) {
Expand Down

0 comments on commit 33994a5

Please sign in to comment.