-
Notifications
You must be signed in to change notification settings - Fork 279
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
RecurrenceRule needs different endDate #557
Comments
Please share a bit more of your code so we can fully understand your issue. I believe the first |
I don't have any problem with my code. It's working fine. What is the scenario where those dates are different? |
As I tried to explain in my earlier comment, imagine the following scenario: You would create such an event as follows: Event(
calendarId,
start: TZDateTime.local(2024, 12, 1, 17), // 5pm on December 1st, 2024
end: TZDateTime.local(2024, 12, 1, 19), // 7pm on December 1st, 2024
recurrenceRule: RecurrenceRule(
RecurrenceFrequency.Daily,
endDate: DateTime(2024, 12, 31), // December 31st, 2024
),
) As you can see in the example above, the If you set |
Ok, I see that now. The In my case, users select the start and date from a calendar. They don't select any time because the event is always for the whole day. Does that mean that I need to pass always the same I don't know if I could have any problem with other type of calendar of this should be sent differently with Me event:
|
You have two options, both are equally valid. It depends on your use case which one suits you better.
Your code above shows a variation of option 2. Details on option 1: 5 different events, each 24 hours: Event(
calendar.id,
start: Helpers.convertToTZDate(fromDate!), // December 1st, 2024
end: Helpers.convertToTZDate(fromDate!), // December 1st, 2024 as well
allDay: true, // event has same `start` and `end` date but is `allDay`, so 24 hours
recurrenceRule: RecurrenceRule(
RecurrenceFrequency.Daily, // repeat each day until (and including):
endDate: toDate, // December 5th, 2024
),
) If your user was to go in their calendar application and delete, say the event on December 3rd, 2024, there would still be the full day event on December 1st, 2nd, 4th, and 5th remaining, as they are different instances of an 24-hour event. Details on option 2: a single event instance of 120 hours Event(
calendar.id,
start: Helpers.convertToTZDate(fromDate!), // December 1st, 2024
end: Helpers.convertToTZDate(toDate!), // December 5th, 2024
allDay: true, // event is `allDay` multi-day
recurrenceRule: null, // event never repeats, is only a single event spanning 5 days, you don't even need this line of code as `recurrenceRule` is `null` by default
) If you chose option 2 and the user goes in their calendar application and tries to delete December 3rd, 2024, they would delete the single event, so the calendar would then be empty also on December 1st, 2nd, 4th, and 5th, i.e. either all or nothing. Your code above is a variation of option two so far as you create a single event spanning (in my example) 5 full days = 120 hours. But you then specify to repeat the event until and including the date on which the first instance of your repeating event ends. This means in practice: stop repeating after the first time, i.e. don't repeat at all. At which point you could simply set I hope this clarifies what you are trying to understand. If there are any questions left, feel free to reply. |
Ok, I think first option makes more sense in case the user wants to remove just one event. He'd have the option to remove the series anyway. Since my default calendar was doing it right (that's why I couldn't see much difference), I forced it to use Google's calendar. First I saw what I was creating: Definitely not right. The events should take one day. So I made the change to send the same start/end date: That's more like it. Thanks! Also, I noticed that I needed to have Google's calendar closed, otherwise, it wouldn't display the new events. I had to close it and open it again, but sometimes twice. Do you know why? |
I could only guess as to why the events are delayed. I think it just takes some time for your Google Calendar to sync with the system calendar. Maybe this discussion is helpful: #534 |
I have something like this:
The event is created ok, but despite I pass the endDate correctly, it creates events for a longer period.
This fixes it, but I was wondering why we'd need 2 end dates:
The text was updated successfully, but these errors were encountered: