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.

    Calendar CustomEvents

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    8 Posts 3 Posters 143 Views 3 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.
    • D Offline
      daportelli
      last edited by

      Hi,

      I am trying to update the text in the customEvents section of the default calendar using a transform, but I am unable to make it work. Any thoughts on what I am doing wrong?

      {keyword: 'Canterbury-Bankstown Bulldogs', transform: { search: 'Canterbury-Bankstown Bulldogs', replace: 'Bulldogs'},
      {keyword: 'Spotify', transform: { search: 'Spotify', replace: 'Music'}},
      

      Thanks
      David

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

        @daportelli can you show me the calendar module config, xxx out any cal urls

        Sam

        How to add modules

        learning how to use browser developers window for css changes

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

          @sdetweil said:

          show me the calendar module config, xxx out any cal urls

          Here is the full module config, everything else works. I cannot figure this out. Thanks for the assist.

          	{
          			module: 'MMM-GoogleCalendar',
          			header: "David's Calendar",
          			position: "top_left",
          			classes: "clalendar-full",
          			disabled: false,
          			config: {
          				colored: true,
          				maximumNumberOfDays: 10,
          				maximumEntries: 30,
          				maxTitleLength: 35,
          				displayRepeatingCountTitle: true,
          				defaultRepeatingCountTitle: "",
          				getRelative: 12,
          				fade: false,
          				fadePoint: 0.00,
          
          */
          
          			customEvents: [
          						{keyword: 'Spotify', transform: { search: '(?i)Spotify\\s*$', replace: 'Music'}}, 
                                                          {keyword: 'Canterbury-Bankstown Bulldogs', transform: { search: 'Canterbury-Bankstown Bulldogs', replace: 'Bulldogs'},
          						{keyword: 'Photo', symbol: 'camera', color: 'Silver'},
          						{keyword: 'Benji', symbol: 'paw', color: 'LightGoldenrodYellow'},
          						{keyword: 'Doctor', symbol: 'staff-snake', color: '#0048ba'},
          						{keyword: 'Dr ', symbol: 'staff-snake', color: '##58B1CD'},
          						{keyword: 'Dentist', symbol: 'tooth'},
          						{keyword: 'Orthodontist', symbol: 'teeth'},
          						{keyword: 'Party', symbol: 'gift'},
          						{keyword: 'Christmas', symbol: 'sleigh'},				
          						{keyword: 'BMC', symbol: 'staff-snake', color: '##58B1CD'},
          						{keyword: 'Anzac Day', symbol: 'monument'},
          						{keyword: 'Big w', symbol: 'building'},
          						{keyword: 'Recycling', symbol: 'recycle'},
          						{keyword: 'Rubbish', symbol: 'trash-can'},
          						{keyword: 'tennis', symbol:'table-tennis-paddle-ball', color:'#ff7518'}  // Pumkin
          			  ],							
          			calendars: [
          						{
          							symbol: "calendar", //Main Calendar
          							color: "#89cff0",  //Baby Blue
          							calendarID: "XXXXXXX@gmail.com"
          						},
          						{
          							symbol: "calendar-week", //bills
          							color: "#e95c4b",  //Fire Opal
          							calendarID: "XXXXXXX@group.calendar.google.com"
          						},  
          						{
          							symbol: "birthday-cake",
          							color: "#87a96b",  //Asparagus
          							calendarID: ""
          						},
          						{
          							symbol: "briefcase",	//work
          							color: "#7fffd4",  //Aquamarine
          							calendarID: "XXXXXXX@group.calendar.google.com"
          						},
          						{
          							symbol: "football",   //NRL
          							color: "#458b74",  //Aquamarine4
          							calendarID: "XXXXXXX@group.calendar.google.com"
          						},
          						{
          							symbol: "calendar",  //Public Holidays
          							color: "#f767d8",  //pink
          							calendarID: "en-gb.australian#holiday@group.v.calendar.google.com"
          						},
          						
          							// add another calendar HERE if needed          // To add more calendars, replicate the above entry within this array with the respective ID
          						],
          					},
          			},
          			
          
          
          S 2 Replies Last reply Reply Quote 0
          • S Offline
            sdetweil @daportelli
            last edited by

            @daportelli I won’t be able to get to looking at this til late today

            Can you use an online regex tester on you regex and data

            Like
            https://fossa.com/resources/devops-tools/regex-tester/

            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 @daportelli
              last edited by sdetweil

              @daportelli said:

              (?i)Spotify\s*$

              this didn’t work for my tests, find any title with the word Spotify in it, and change it to only Music

              this works (I use https://regex101.com/ to test my regex’s)

              search: '^.*\b(Spotify)\b.*$', replace:'Music'
              

              on the other… do you know that the space looking thing between is actually presented as a space?

              open the developers window, ctrl-shift-i, go to the sources tab, navigate the left pane
              to the modules/default/calendar, select calendar.js

              put a stop on the line in the listed in this image (click the line number),
              press ctrl-r to refresh the page,
              code will stop there, move the mouse over the word calendarData
              it will popup the box, mouse up to click the list,
              and it will expand, scroll to find the event, and click to expand it to look at the text…

              Snip20260302_3.png

              Sam

              How to add modules

              learning how to use browser developers window for css changes

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

                Sorry for the delayed response. Work and life got in the way. I went to the regex tester and used the example from the calendar config for customEvents {keyword: ‘in Hamburg’, transform: { search: ’ in Hamburg$’ , replace: ‘’}} and I could not make it work as per the example in the documentation.

                (https://fossa.com/resources/devops-tools/regex-tester/)
                

                Screenshot 2026-03-14 111031.jpg

                I also tried the other checker with a simplier transform.

                (https://regex101.com/)

                Screenshot 2026-03-14 164904.jpg

                I am struggling to understand what I am doing wrong.

                Your help is appreciated.

                David

                evroomE 1 Reply Last reply Reply Quote 0
                • evroomE Offline
                  evroom @daportelli
                  last edited by evroom

                  @daportelli said:

                  https://fossa.com/resources/devops-tools/regex-tester/

                  The ‘Regular Expression’ is your ‘search’ from the config line, hence ‘in Hamburg$’.
                  The ‘Replacement Pattern’ is your ‘Replace’ from the config line, hence ‘’ (nothing)
                  The ‘Test String’ is what is triggered by your ‘keyword’ so in this case ‘Geburtstag in Hamburg’ will trigger the search and replace.

                  So, fill in:
                  Regular Expression: in Hamburg$
                  Test String: Geburtstag in Hamburg
                  Replacement Pattern: ‘’

                  Then your Match will be ‘in Hamburg’ and your Highlighted will be ‘Geburtstag’ (that what remains white).

                  For testing search & replace on https://regex101.com, you will need to choose Function - Substitution on the left side.

                  Regular Expression: .in.Hamburg$
                  Test String: Geburtstag in Hamburg
                  Substitution:
                  This will result in: Geburtstag

                  This will only match on ‘in Hamburg’, so to make it more flexible you will need to make use of so called grouping:
                  Regular Expression: (Geburtstag).+$
                  Substitution: $1
                  This will result in: Geburtstag

                  MagicMirror version: 2.33.0
                  Raspberry Pi 4 Model B Rev 1.5 (8 GB RAM)
                  Raspbian GNU/Linux 12 (bookworm)

                  Test environment:
                  MagicMirror version: v2.33.0
                  Raspberry Pi 3 Model B Plus Rev 1.3 (1 GB RAM)
                  Raspbian GNU/Linux 12 (bookworm)

                  1 Reply Last reply Reply Quote 0
                  • D Offline
                    daportelli
                    last edited by

                    Thanks for explaining this in a language I can understand. I got that to work.

                    In my calendar I have “amex” typed in lower case and I want the transform it to upper “AMEX” to show this works.

                    Screenshot 2026-03-16 090228.jpg

                    However when I use the below code on a calendar event that only has an event titled ‘amex’ in lower case does not work.

                    {keyword: 'amex', transform: { search: 'amex', replace: 'AMEX'}},
                    

                    This simple thing is confusing me. I have removed all variables, and it still does not work.

                    Thanks again for everyone help.

                    1 Reply Last reply Reply Quote 0

                    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 / 1
                    • 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