Add Support for Recurrence In Calendar Collection#8799
Add Support for Recurrence In Calendar Collection#8799BeatLink wants to merge 3 commits intoTriliumNext:mainfrom
Conversation
Summary of ChangesHello @BeatLink, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the calendar collection functionality by introducing support for recurring events. It allows users to define repeating events using iCalendar RRULE strings, which are dynamically processed to display multiple instances in the calendar view. The changes involve integrating a new FullCalendar plugin, adapting event data structures, and updating documentation to guide users on how to leverage this new feature. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request successfully adds support for recurring events in the calendar collection by integrating the @fullcalendar/rrule package. The changes involve updating dependencies, modifying the event building logic to handle recurrence rules, and updating documentation. My review includes one critical comment to fix a bug where recurring events would not work correctly if they had an end date, and also to improve the readability of the duration calculation logic.
Replace end with duration if recurrence set. Make duration calculation clearer Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
Closes #8798 |
|
Closes #7114 |
|
@eliandoran Hey, I was wondering if you could take a look at this. |
There was a problem hiding this comment.
Overall seems fine.
But there is a critical issue: Using an invalid value like FREQ=WEEKLY;INTERVAL=1;BYDAY= crashes the calendar with Invalid weekday string, and the calendar becomes unusable. Report invalid values via toast, without crashing and without affecting other valid calendar events.
Make sure to write tests for this scenario. Note that the event builder is UI-agnostic, so the toast should be handled in the consumer of the event builder.
| if (recurrence) { | ||
| delete eventData.end; | ||
| eventData.rrule = `DTSTART:${startDate.replace(/[-:]/g, "")}\n${recurrence}`; | ||
| if (endDate){ | ||
| const diffMs = new Date(endDate).getTime() - new Date(startDate).getTime(); | ||
| const hours = Math.floor(diffMs / 3600000); | ||
| const minutes = Math.floor((diffMs / 60000) % 60); | ||
| eventData.duration = `${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}`; | ||
| } | ||
| } |
There was a problem hiding this comment.
Missing tests. The event builder has pretty decent coverage and I would like to keep it that way.
| | `#endDate` | Similar to `startDate`, mentions the end date if the event spans across multiple days. The date is inclusive, so the end day is also considered. The attribute can be missing for single-day events. | | ||
| | `#startTime` | The time the event starts at. If this value is missing, then the event is considered a full-day event. The format is `HH:MM` (hours in 24-hour format and minutes). | | ||
| | `#endTime` | Similar to `startTime`, it mentions the time at which the event ends (in relation with `endDate` if present, or `startDate`). | | ||
| | `#recurrence` | This is an optional CalDAV `RRULE` string that if present, determines whether a task should repeat or not. Note that it does not include the `DTSTART` attribute, which is derived from the `#startDate` and `#startTime` directly. For examples of valid `RRULE` strings see [https://icalendar.org/rrule-tool.html](https://icalendar.org/rrule-tool.html) | |
There was a problem hiding this comment.
Although it's good that it's mentioned in the attribute reference, an important feature such as recurrence needs its own heading in the Calendar documentation.
The tool provided is decent, but I would also add some concrete examples. Mention also that promoted attributes can be used to define an easy way to input recurrence.
Of course, in the future we ought to have a nice recurrence editor.
This PR enables the calendar collection to support recurrences.
If a child note of a calendar collection has a
#recurrence labelwith an ICAL recurrence string e.g.FREQ=WEEKLY;INTERVAL=5;it will repeat multiple times in the calendar view based on its recurrence.Normally the FullCalendar recurrence plugin requires a recurrence string with DTSTART, but this is not included in the string, in favor of generating the DTSTART value based on the already existing
#startDatelabel.Also, fullCalendar requires a duration property to be added when using recurrence, otherwise it would treat it as an all day event. This is solved by dynamically calculating and setting the duration property from the difference of the start and end date if the latter exists.