Skip to content
Snippets Groups Projects
Unverified Commit d43a4788 authored by Roeland Jago Douma's avatar Roeland Jago Douma Committed by GitHub
Browse files

Merge pull request #17159 from nextcloud/bugfix/17004/birthday_service_fixes

Sabre/VObject returns a DateAndOrTime object now, so adapt to it in Birthday service
parents 9629015b 3487f0d2
No related branches found
No related tags found
No related merge requests found
......@@ -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']);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment