bitfireAT / vcard4android

Allows usage of vCard resources with the Android contacts provider
GNU General Public License v3.0
11 stars 6 forks source link

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

Closed ArnyminerZ closed 11 months ago

devvv4ever commented 11 months ago

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 https://github.com/bitfireAT/davx5-ose/discussions/385

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

fwiep commented 9 months ago

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 commented 9 months ago

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: https://github.com/bitfireAT/vcard4android/blob/a7a1f426f2d6bbd50851c8271eebef54edf06611/lib/src/main/java/at/bitfire/vcard4android/contactrow/EventBuilder.kt#L75-L77

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 commented 9 months ago

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 commented 9 months ago

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.