Skip to content

Use correct year for generated birthdays events - #24108

Merged
skjnldsv merged 1 commit into
nextcloud:masterfrom
csware:apple-unknown-year
Nov 17, 2020
Merged

Use correct year for generated birthdays events#24108
skjnldsv merged 1 commit into
nextcloud:masterfrom
csware:apple-unknown-year

Conversation

@csware

@cswarecsware commented Nov 13, 2020

Copy link
Copy Markdown
Contributor

'X-APPLE-OMIT-YEAR' is not always present, at least iOS 12.4 uses the hard coded date of 1604 when the year is unknown.

Without this PR people are shown as born in 1604 if not year is entered.

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

Also needed for older Nextcloud versions such as 19

'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>

@rullzerrullzer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oo man... 🍎

@skjnldsvskjnldsv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙈

@skjnldsv
skjnldsv merged commit ce5e60d into nextcloud:masterNov 17, 2020
if ($originalYear == 1604) {
$originalYear = null;
$unknownYear = true;
$birthday = '1970-' . $dateParts['month'] . '-' . $dateParts['date'];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be omitted as $originalYear = null; triggers if ($originalYear < 1970) { below?
Or it should be an elseif to be more explicit?

@csware

csware commented Nov 17, 2020

Copy link
Copy Markdown
ContributorAuthor

Thanks, please also backport this to NC19

@csware
csware deleted the apple-unknown-year branch November 17, 2020 09:24
@csware

Copy link
Copy Markdown
ContributorAuthor

/backport to stable19

@csware

Copy link
Copy Markdown
ContributorAuthor

/backport to stable20

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewWaiting for reviewsenhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@csware@rullzer@nickvergessen@skjnldsv