Skip to content

Commit ce5e60d

Browse files
authored
Merge pull request #24108 from csware/apple-unknown-year
Use correct year for generated birthdays events
2 parents 12098f0 + e526e76 commit ce5e60d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

apps/dav/lib/CalDAV/BirthdayService.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,12 @@ public function buildDateFromContact(string $cardData,
235235
}
236236
} else {
237237
$originalYear = (int)$dateParts['year'];
238-
238+
// '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
239+
if ($originalYear == 1604) {
240+
$originalYear = null;
241+
$unknownYear = true;
242+
$birthday = '1970-' . $dateParts['month'] . '-' . $dateParts['date'];
243+
}
239244
if ($originalYear < 1970) {
240245
$birthday = '1970-' . $dateParts['month'] . '-' . $dateParts['date'];
241246
}

0 commit comments

Comments
 (0)