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

Android - events format #2

Closed
Billy-80 opened this issue Feb 1, 2021 · 3 comments
Closed

Android - events format #2

Billy-80 opened this issue Feb 1, 2021 · 3 comments

Comments

@Billy-80
Copy link

Billy-80 commented Feb 1, 2021

Hello, I am facing a formatting issue on Android when creating an event item. The event is created, edited and read successfully via code but cannot be modified on the phone contacts native menu as it contains time besides the date. The DateTime to what I have checked should be in the format yyyy-MM-dd without time. on IOS all seems to be working fine. I tested on a real device the time appears next to the date on the native contacts dates field while on an emulator, the field doesn't seem to appear to me at all yet readable via code. I face the same behavior on both create and update.

newContact = Contact.create()..name = Name(first: 'First', last: 'Last')..events = [Event(DateTime(2000, 1, 1), noYear: false, label: EventLabel.birthday)];

One secondary point that I noted is also when using updateContact(), it doesn't seem to support deleting an event item. Not sure if this is by design or not.

@joachimvalente
Copy link
Contributor

Thanks for reporting this!

The core problem is that on Android the event date is encoded as a free-form string in the contacts database with no specified format, so every app is free to choose its own format and there is no guarantee an event added from one app will be properly readable by another app.

In this case, what we were currently doing was serializing DateTime using date.toIso8601String which is understood by the default contact app, but apparently cannot be mutated. The default contact app, instead, encodes dates using the format YYYY-MM-DD (or --MM-DD if there's no year).

Presumably, the behavior of the default contact app is the closest to a standard format so in dc0af99 I changed the serialization so we're getting the same behavior.

It will be included in version 0.1.1 – let me know if that doesn't fix the issue.

@joachimvalente
Copy link
Contributor

joachimvalente commented Feb 14, 2021

As for the second issue, I was able to reproduce it for birthdays (but not other types of events like anniversaries) and on iOS only. 09e98b6 seems to fix it for me (see 75ebe94 for an example).

@joachimvalente
Copy link
Contributor

Closing, feel free to reopen if that didn't solve your issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants