Browse Source

Sabre/VObject returns a DateAndOrTime object now, so adapt to it in Birthday service

Signed-off-by: Georg Ehrke <developer@georgehrke.com>
tags/v18.0.0beta1
Georg Ehrke 4 years ago
parent
commit
3487f0d281
No account linked to committer's email address
1 changed files with 11 additions and 4 deletions
  1. 11
    4
      apps/dav/lib/CalDAV/BirthdayService.php

+ 11
- 4
apps/dav/lib/CalDAV/BirthdayService.php View File

@@ -243,7 +243,11 @@ class BirthdayService {
}

try {
$date = new \DateTime($birthday);
if ($birthday instanceof DateAndOrTime) {
$date = $birthday->getDateTime();
} else {
$date = new \DateTimeImmutable($birthday);
}
} catch (Exception $e) {
return null;
}
@@ -259,10 +263,13 @@ class BirthdayService {
);
$vEvent->DTSTART['VALUE'] = 'DATE';
$vEvent->add('DTEND');
$date->add(new \DateInterval('P1D'));

$dtEndDate = (new \DateTime())->setTimestamp($date->getTimeStamp());
$dtEndDate->add(new \DateInterval('P1D'));
$vEvent->DTEND->setDateTime(
$date
$dtEndDate
);

$vEvent->DTEND['VALUE'] = 'DATE';
$vEvent->{'UID'} = $doc->UID . $postfix;
$vEvent->{'RRULE'} = 'FREQ=YEARLY';
@@ -306,7 +313,7 @@ class BirthdayService {
foreach($books as $book) {
$cards = $this->cardDavBackEnd->getCards($book['id']);
foreach($cards as $card) {
$this->onCardChanged($book['id'], $card['uri'], $card['carddata']);
$this->onCardChanged((int) $book['id'], $card['uri'], $card['carddata']);
}
}
}

Loading…
Cancel
Save