MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    2.32.0 Calendar module limitDays and excludedEvents stopped working

    Scheduled Pinned Locked Moved Solved Troubleshooting
    41 Posts 5 Posters 7.9k Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      sdetweil @AndyHazz
      last edited by sdetweil

      @AndyHazz note that the excluded events is an ARRAY (so for loop to look thru them )
      test ALL til find one that is true (CalendarFetcherUtils.titleFilterApplies returns true) , or not

      AND the item in the array can be an object with more specific controls, or a string

      MM doc entries on separate lines

      [
      'Birthday',     // text 
      'Hide This Event',    // text 
      {filterBy: 'Payment', until: '6 days', caseSensitive: true},  // complex, but text
      {filterBy: '^[0-9]{1,}.*', regex: true} // complex, uses regex
      ]
      

      AND the list/array can be a MIX of those things,

      and the string test is the test string is SOMEWHERE in the title, doesn’t have to BE the entire title

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      A 1 Reply Last reply Reply Quote 0
      • A Offline
        AndyHazz Project Sponsor @sdetweil
        last edited by

        @sdetweil fair enough, complexity no doubt warranted!

        Perhaps is there any reason why shouldEventBeExcluded function might not be getting called at all for me? I’m stumped why after making all these changes including console.log messages, nothing is appearing any different -

        S 3 Replies Last reply Reply Quote 0
        • S Offline
          sdetweil @AndyHazz
          last edited by

          @AndyHazz can’t think of any, MM is case sensitive, some times people get the case wrong and we don’t report unexpected parms or missing parms…

          but you’ve been using that so, it doesn’t shouldn’t be an issue for you

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • S Offline
            sdetweil @AndyHazz
            last edited by sdetweil

            @AndyHazz I copied your post in exactly, i reverted back to 2.32 original first

            and got the right debug and results

            [2025-07-09 16:27:38.473] [DEBUG] Processing entry…
            [2025-07-09 16:27:38.473] [DEBUG] title: Dad’s Birthday
            [2025-07-09 16:27:38.473] [LOG] should be excluded dad’s birthday birthday false g
            [2025-07-09 16:27:38.473] [LOG] event should be excluded = true, dad’s birthday
            [2025-07-09 16:27:38.473] [LOG] filter applies result = { excluded: true, until: null }
            [2025-07-09 16:27:38.473] [LOG] filter applies returning = { excluded: true, until: null }

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @AndyHazz
              last edited by sdetweil

              @AndyHazz and

              the fetcherutils processes this exclude list very early after getting the events parsed

                              // loop thru the parsed data, one event at a time
              		Object.entries(data).forEach(([key, event]) => {
              			Log.debug("Processing entry...");
              
              			const title = CalendarFetcherUtils.getTitleFromEvent(event);
              			Log.debug(`title: ${title}`);
              
              			// Return quickly if event should be excluded.
              			let { excluded, eventFilterUntil } = this.shouldEventBeExcluded(config, title);
              			if (excluded) {
              				return;
              			}
              

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              A 1 Reply Last reply Reply Quote 0
              • A Offline
                AndyHazz Project Sponsor @sdetweil
                last edited by

                @sdetweil should I see a console message from loader.js about calendarfetcherutils.js being loaded?

                I see

                Load script: modules/default/calendar/calendar.js
                Load script: modules/default/calendar/calendarutils.js
                

                but no mention in the console of calendarfetcherutils.js

                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  sdetweil @AndyHazz
                  last edited by

                  @AndyHazz no.

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  A 1 Reply Last reply Reply Quote 0
                  • A Offline
                    AndyHazz Project Sponsor @sdetweil
                    last edited by

                    @sdetweil I’ve no idea then, but if you were able to reproduce the issue I had, and then fix it on your end, I probably just messed something up somewhere and without any access to logs on my docker setup that may remain a mystery … I’ve just had another go at trying to figure out what that may be, no luck.

                    No rush at all but I guess if you’re happy with the fix it’ll show up in a new MM version at some point and I’ll update to that.

                    S 2 Replies Last reply Reply Quote 0
                    • S Offline
                      sdetweil @AndyHazz
                      last edited by

                      @AndyHazz next release isn’t til Oct 1

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      S 1 Reply Last reply Reply Quote 0
                      • S Offline
                        sdetweil @sdetweil
                        last edited by sdetweil

                        @AndyHazz weird…

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        1 Reply Last reply Reply Quote 0
                        • S Offline
                          sdetweil @AndyHazz
                          last edited by

                          @AndyHazz would you be willing to test another implementation of the limitDays code fix

                          another author has changed the code quite a bit,
                          copy the existing calendar.js so not losing what you have
                          new code

                          		if (this.config.limitDays > 0 && events.length>0) {   // line 708
                          			// Group all events by date, events on the same date will be in a list with the key being the date.
                          			Log.info("limitdays starting, events list length=", events.length)
                          			const eventsByDate = Object.groupBy(events, (ev) => this.timestampToMoment(ev.startDate).format("YYYY-MM-DD"));
                          			Log.info("eventsByDate keys=",Object.keys(eventsByDate))
                          			const newEvents = [];
                          			let currentDate = moment().subtract(1,'days');
                          			let daysCollected = 0;
                          
                          			while (daysCollected < this.config.limitDays) {
                          				const dateStr = currentDate.format("YYYY-MM-DD");
                          				Log.info("limitDays checking=",dateStr)
                          				// Check if there are events on the currentDate
                          				if (eventsByDate[dateStr])
                          					Log.info("eventsByDate[",dateStr,"] length=",eventsByDate[dateStr].length)
                          				if (eventsByDate[dateStr] && eventsByDate[dateStr].length > 0) {
                          					// If there are any events today then get all those events and select the currently active events and the events that are starting later in the day.
                          					newEvents.push(...eventsByDate[dateStr].filter((ev) => this.timestampToMoment(ev.endDate).isAfter(moment())));
                          					// Since we found a day with events, increase the daysCollected by 1
                          					daysCollected++;
                          					Log.info("limitDays, found day with events, count=",daysCollected)
                          				}
                          			        // Search for the next day
                          				currentDate.add(1, "day");
                          			}
                          			Log.info("limitDays done")
                          			events = newEvents;
                          		}
                          

                          this line is unchanged after replacing above code

                          		Log.info(`slicing events total maxcount=${this.config.maximumEntries}`);  // this line is unchanged
                          

                          Sam

                          How to add modules

                          learning how to use browser developers window for css changes

                          A 1 Reply Last reply Reply Quote 0
                          • A Offline
                            AndyHazz Project Sponsor @sdetweil
                            last edited by

                            @sdetweil no problem, that new code seems to work fine for me.

                            However, I don’t seem to have a great setup for testing - after making the changes, I can load up MM in my remote/laptop browser and immediately see the changes working, but if I try and refresh the electron browser on the raspberry pi running my mirror (using MMM-Remote-Control), it seems to take ages, crash, and then reverts the code back to the docker image default 😮‍💨

                            I can see this in the docker container logs so I reckon it’s reverting any changes I make there?

                            [entrypoint 18:36:04.283] [INFO]   copy default modules
                            [entrypoint 18:36:04.918] [INFO]   copy css files
                            > magicmirror@2.32.0 start
                            > node --run start:x11
                            
                            karsten13K 1 Reply Last reply Reply Quote 0
                            • karsten13K Offline
                              karsten13 @AndyHazz
                              last edited by

                              @AndyHazz said in 2.32.0 Calendar module limitDays and excludedEvents stopped working:

                              I can see this in the docker container logs so I reckon it’s reverting any changes I make there?

                              yes it overrides the default modules but you can change this behavior

                              A 1 Reply Last reply Reply Quote 0
                              • A Offline
                                AndyHazz Project Sponsor @karsten13
                                last edited by

                                @karsten13 aha, good to know, although I already started and now finished setting up from scratch again 🙄 no docker this time … I kept it on a spare sd card though so may switch back.

                                @sdetweil new code for limitDays reapplied on a fresh install, still seems fine. Previous suggestions to fix the excludedEvents still not working though.

                                A 1 Reply Last reply Reply Quote 0
                                • A Offline
                                  AndyHazz Project Sponsor @AndyHazz
                                  last edited by

                                  said in 2.32.0 Calendar module limitDays and excludedEvents stopped working:

                                  Previous suggestions to fix the excludedEvents still not working though.

                                  @sdetweil hold up - it’s all working now! I don’t think I changed anything else, just an extra refresh. So, all your fixes are good. Sorry that took a while to figure out, and if I’d read @karsten13’s docker instructions properly I think that docker module override feature was probably the cause of earlier confusion.

                                  S 2 Replies Last reply Reply Quote 1
                                  • S Offline
                                    sdetweil @AndyHazz
                                    last edited by

                                    @AndyHazz thanks for the feedback and extra effort

                                    Sam

                                    How to add modules

                                    learning how to use browser developers window for css changes

                                    1 Reply Last reply Reply Quote 0
                                    • S Offline
                                      sdetweil @AndyHazz
                                      last edited by

                                      @AndyHazz these fixes are in the next release Oct 1

                                      Sam

                                      How to add modules

                                      learning how to use browser developers window for css changes

                                      1 Reply Last reply Reply Quote 1
                                      • S sdetweil has marked this topic as solved on
                                      • J Jacky5 referenced this topic on

                                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                      With your input, this post could be even better 💗

                                      Register Login
                                      • 1
                                      • 2
                                      • 3
                                      • 2 / 3
                                      • First post
                                        Last post
                                      Enjoying MagicMirror? Please consider a donation!
                                      MagicMirror created by Michael Teeuw.
                                      Forum managed by Sam, technical setup by Karsten.
                                      This forum is using NodeBB as its core | Contributors
                                      Contact | Privacy Policy