-
Notifications
You must be signed in to change notification settings - Fork 275
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
Allday property resulting in incorrect event #164
Comments
Adding info from Android Developer's page:
https://developer.android.com/reference/android/provider/CalendarContract.Events#writing-to-events |
But the class "Event" in "device_calendar" has no property "timezone". |
@Bernhard7, this issue is only for Android so I'll need to do a fix on Android native code, not Flutter. |
Thanks for updating device_calendar to ^3.0.0+3. Now it works. |
I think I was also wondering if this code works as expected: |
@kinex I've already found a solution for this and will be fixed in next release |
@Brett09 Ok, great. And hopefully you noticed that my previous comment is probably related to a different issue than originally reported in this issue (sorry my bad, I should have created a new issue). In my opinion this is the most annoying issue at the moment what I have seen in this plugin, as for example all events retrieved from holiday calendars have invalid timestamps. Waiting for the fixes, thanks! |
This has been fixed in v3.1.0. You will be able to set all day events without any time issues in Android |
@Brett09 I don't think this has been fixed. I am still receiving events from a holiday calendar with invalid offsets. For example "New Year Day" starts 2am in local time. It should start at 0:00, Did you check my comments above? I think there are clear related issues in the code. Please test this using some holiday calendar which has events with different timezone than your test device. If you just add your own events you won't see the issue. |
@kinex the reason it's not showing the time as 0:00 is because the example app is not using The all day event functionality has been fixed however, if you'd like to view the all day events as 0:00, then I recommend for you to add |
@Brett09 The start time should 0:00 in local time. In UTC time it should be 22:00 (previous day, if my timezone is GMT+2). In other words holidays in a local holiday calendar should always start at 0:00 in local time. For example in a German holiday calendar a holiday (all day event) should start at 0:00 in German time (=local time). Any other start time would not make any sense. |
I am facing something similar to @kinex 's problem: my app receives a list of events from the server in local time (the same timezone of the device), and it has to save them as allday events. |
Issue is probably related to code starting from here https://github.com/builttoroam/device_calendar/blob/develop/android/src/main/kotlin/com/builttoroam/devicecalendar/CalendarDelegate.kt#L424. I don't even understand what is it trying to do but you cannot just reset event time to 00:00 and then set timezone to UTC. Based on my quick code reviews earlier I can say that this plugin has a lot of timezone related issues and hazards (few of them mentioned in my comments above). It works only with good luck and if you happen to live in the "correct" timezone. My own project is currently paused so I haven't had time to investigate these issues further. Someone should really review, understand and fix all timezone related code in this plugin. |
@kinex have you restarted your project and if so, did you find a better calendar plugin? This repo seems to have stopped progressing |
@hyouuu I will continue my calendar project later, few other apps in queue.... I have not searched other calendar plugins yet. |
Hi all, Apologies for this repo being dormant for so long - the last year has had other priorities as you can only imagine I guess. |
@nickrandolph thank you very much for providing this package and helping improve it!! Timezone & all day events are annoying problems that's hard to get right - thanks for putting effort in it. I might be able to help after a couple of weeks - let me know if you find some part of the problem worth separating. Looking forward to the improvements :D |
I want to fix one of my earlier comment above regarding test('DateTime', () {
final now = DateTime.now();
expect(now.microsecondsSinceEpoch == now.toUtc().microsecondsSinceEpoch,
isTrue);
final utcNow = DateTime.now().toUtc();
expect(
utcNow.microsecondsSinceEpoch ==
utcNow.toLocal().microsecondsSinceEpoch,
isTrue);
expect(
DateTime.fromMicrosecondsSinceEpoch(1000, isUtc: false)
.isAtSameMomentAs(
DateTime.fromMicrosecondsSinceEpoch(1000, isUtc: true)),
isTrue);
}); |
Can be closed after #297 publishing. |
Reported issue: 'the property "Event.allDay = true;" doesn't save the event correctly in the calendar.'
Further comments: this appears to be an issue on Android based on the timezone of the event (eg setting an all day event with a start day before 11am AEST results in the event being for the previous day)
The text was updated successfully, but these errors were encountered: