summaryrefslogtreecommitdiffstats
path: root/apps/dav
diff options
context:
space:
mode:
authorSven Strickroth <email@cs-ware.de>2020-11-13 15:57:12 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2020-11-20 20:39:34 +0000
commit75cdfd8dc22ae4c44b9b750a87a04a345297c6e5 (patch)
tree07b961b79d9b205bbe389290583a62a18b2356d2 /apps/dav
parent7d2968aca0bbd7beba29804e58a9d6af5a203ab2 (diff)
downloadnextcloud-server-75cdfd8dc22ae4c44b9b750a87a04a345297c6e5.tar.gz
nextcloud-server-75cdfd8dc22ae4c44b9b750a87a04a345297c6e5.zip
Use correct year for generated birthdays events
'X-APPLE-OMIT-YEAR' is not always present, at least iOS 12.4 uses the hard coded date of 1604 (the start of the gregorian calendar) when the year is unknown. cf. https://forums.bitfire.at/topic/2050/bday-without-year-for-vcard-3-0-if-server-drops-property-x-apple-omit-year and https://gitlab.com/CardBook/CardBook/-/issues/586 Signed-off-by: Sven Strickroth <email@cs-ware.de>
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/lib/CalDAV/BirthdayService.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/dav/lib/CalDAV/BirthdayService.php b/apps/dav/lib/CalDAV/BirthdayService.php
index e64e886a01c..8be7e8298b9 100644
--- a/apps/dav/lib/CalDAV/BirthdayService.php
+++ b/apps/dav/lib/CalDAV/BirthdayService.php
@@ -235,7 +235,12 @@ class BirthdayService {
}
} else {
$originalYear = (int)$dateParts['year'];
-
+ // 'X-APPLE-OMIT-YEAR' is not always present, at least iOS 12.4 uses the hard coded date of 1604 (the start of the gregorian calendar) when the year is unknown
+ if ($originalYear == 1604) {
+ $originalYear = null;
+ $unknownYear = true;
+ $birthday = '1970-' . $dateParts['month'] . '-' . $dateParts['date'];
+ }
if ($originalYear < 1970) {
$birthday = '1970-' . $dateParts['month'] . '-' . $dateParts['date'];
}