Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Birthdays not synced from Nextcloud 27 to Android 12/13 #26

Merged

Conversation

ArnyminerZ
Copy link
Member

No description provided.

@ArnyminerZ ArnyminerZ added the bug Something isn't working label Nov 5, 2023
@ArnyminerZ ArnyminerZ self-assigned this Nov 5, 2023
@ArnyminerZ ArnyminerZ linked an issue Nov 5, 2023 that may be closed by this pull request
Signed-off-by: Arnau Mora <[email protected]>
@ArnyminerZ ArnyminerZ marked this pull request as ready for review November 5, 2023 12:03
@ArnyminerZ ArnyminerZ requested a review from rfc2822 November 5, 2023 12:03
Copy link
Member

@rfc2822 rfc2822 left a comment

Choose a reason for hiding this comment

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

Seems that the vCard 3 and 4 RFCs don't allow ZonedDateTime, so I have removed it and added a warning for unknown types.

Also added the BDAY to the "all fields" test so that we can be sure that it's actually interpreted correctly. This test would detect the problem we had (for instance if OffsetDateTime would again be wrong).

@rfc2822 rfc2822 merged commit a7a1f42 into main Nov 5, 2023
4 checks passed
@rfc2822 rfc2822 deleted the 24-birthdays-not-synced-from-nextcloud-27-to-android-1213 branch November 5, 2023 19:23
@devvv4ever
Copy link
Member

devvv4ever commented Nov 18, 2023

Shouldn't this fix be included in 4.3.10? @rfc2822 @ArnyminerZ

It seems we didn't include the latest vcard4android version in the latest DAVx5 (4.3.10). Maybe we forgot to update. Can we please use the latest vcard4android in 4.3.11 so that the parsing finally works for the reported birthday in #24 and bitfireAT/davx5-ose#385

Or maybe there is a reason for not using the latest vcard4android (any blocker)?

@fwiep
Copy link

fwiep commented Dec 29, 2023

Hello again, using v4.3.12.1-ose in my local timezone (Europe/Amsterdam).

The birthdays now do sync, but seem off by one day. For example, the VCARD has a BDAY-property of 19730928T000000+0100. After syncing with DAVx5, in the Android contacts app, this shows as 27 september 1973.

Could this (still) be timezone related? Should a separate issue be created for this?

Kind regards,
FWieP

@rfc2822
Copy link
Member

rfc2822 commented Dec 29, 2023

As far as I know, the Contacts storage doesn't support time zones and always requires UTC.

So vcard4android stores the date/time as UTC:

// time zones not supported by Contacts storage, convert to UTC
val utc = date.atZoneSameInstant(ZoneOffset.UTC)
DateTimeFormatter.ofPattern(DATE_AND_TIME_FORMAT, Locale.US).format(utc)

19730928T000000+0100 is 27 Sep 1973 23:00 UTC. So the birth at exactly midnight local time actually happened on 27 Sep 1973 UTC.

If your contacts app shows another time, it probably doesn't handle the UTC correctly (it should at least indicate that it is UTC or convert to the current device time zone).

@fwiep
Copy link

fwiep commented Dec 29, 2023

As far as I know, the Contacts storage doesn't support time zones and always requires UTC.
So vcard4android stores the date/time as UTC:
...
If your contacts app shows another time, it probably doesn't handle the UTC correctly (it should at least indicate that it is UTC or convert to the current device time zone).

Case solved thanks to this comment.

I compared the datetimes in both my source application and the Nextcloud instance. The first was stored without timezone information (MariaDB DATETIME), the latter inside the VCard's BDAY: 19730928T000000+0100, synced from my source application using Sabre\VObject\Component\VCard. Once I forced these datetimes to UTC, all is well and Android Contacts shows the correct birthdays.

Thank you very much!
FWieP

@rfc2822
Copy link
Member

rfc2822 commented Dec 29, 2023

Good that it now works. I'd still specify it as a date (without time), if there's no time available, and 00:00:00 indicates this case. Dates (without time) don't have timezones and don't cause such problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Birthdays not synced from Nextcloud 27 to Android 12/13
4 participants