calendarfetcherutils.js (#3976)
The bottom line of this PR is, that it fixes an issue and simplifies the code by dealing with the TODOs in the code. For review, I suggest looking at each commit individually. If there are too many changes for a PR, let me know and I'll split it up 🙂 ## 1. [fix(calendar): prevent excessive fetching with smart refresh strategy](8892cd3d5a) - Add lastFetch timestamp tracking to CalendarFetcher - Add shouldRefetch() method with configurable minimum interval (default: 3 minutes) - When reusing existing fetcher: fetch if data is stale (>3 min), otherwise broadcast cached events - Prevents double broadcasts to consuming modules while maintaining fresh data - Balances rate limit prevention (Issue https://github.com/MagicMirrorOrg/MagicMirror/issues/3971) with data freshness on user reload - Prevents excessive fetching during rapid reloads (e.g., Fully Kiosk screensaver use case) - Allows fresh calendar data when enough time has passed since last fetch ## 2. [refactor(calendar): simplify event exclusion logic](d507aba82d) - Extract filtering logic from `shouldEventBeExcluded` into new helper `checkEventAgainstFilter` - Simplify the main loop in `shouldEventBeExcluded It resolves a TODO from the comments in the code: * `This seems like an overly complicated way to exclude events based on the title.` ## 3. [refactor(calendar): extract recurring event expansion logic](d510160bd2) This change separates the expansion of recurring events from the main filtering loop into a new helper function 'expandRecurringEvent'. It resolves two TODOs from the comments in the code: - `This should be a separate function` - `This should create an event per moment so we can change anything we want` This improves code readability, reduces complexity in 'filterEvents', and allows for cleaner handling of individual recurrence instances. ## 4. [refactor(calendar): simplify recurring event handling](b04f716cc0) - Simplify 'getMomentsFromRecurringEvent' using modern syntax - Improve handling of full-day events across different timezones ## 5. [test(calendar): fix UNTIL date in fullday_until.ics fixture](1d762b2ade) The issue was with the UNTIL date being May 4th while DTSTART was May 5th. This created an invalid recurrence rule where the end date came before the start date. The fix only adjusts the UNTIL date from May 4th to May 5th, so it matches the start date.
calendarfetcherutils.js (#3976)
calendarfetcherutils.js (#3976)
calendarfetcherutils.js (#3976)
MagicMirror² is an open source modular smart mirror platform. With a growing list of installable modules, the MagicMirror² allows you to convert your hallway or bathroom mirror into your personal assistant. MagicMirror² is built by the creator of the original MagicMirror with the incredible help of a growing community of contributors.
MagicMirror² focuses on a modular plugin system and uses Electron as an application wrapper. So no more web server or browser installs necessary!
Documentation
For the full documentation including installation instructions, please visit our dedicated documentation website: https://docs.magicmirror.builders.
Links
- Website: https://magicmirror.builders
- Documentation: https://docs.magicmirror.builders
- Forum: https://forum.magicmirror.builders
- Technical discussions: https://forum.magicmirror.builders/category/11/core-system
- Discord: https://discord.gg/J5BAtvx
- Blog: https://michaelteeuw.nl/tagged/magicmirror
- Donations: https://magicmirror.builders/#donate
Contributing Guidelines
Contributions of all kinds are welcome, not only in the form of code but also with regards to
- bug reports
- documentation
- translations
For the full contribution guidelines, check out: https://docs.magicmirror.builders/about/contributing.html
Enjoying MagicMirror? Consider a donation!
MagicMirror² is Open Source and free. That doesn't mean we don't need any money.
Please consider a donation to help us cover the ongoing costs like webservers and email services. If we receive enough donations we might even be able to free up some working hours and spend some extra time improving the MagicMirror² core.
To donate, please follow this link.

