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.

    CalendarExt3 - Event transformer wildcard

    Scheduled Pinned Locked Moved Solved Troubleshooting
    15 Posts 2 Posters 2.2k Views 2 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.
    • BKeyportB Offline
      BKeyport Module Developer @sdetweil
      last edited by

      @sdetweil What I meant is to replace the Client’s name with “Client” - it’s a wildcard.

      The “YCBM” is in the event description to help my booking manager (YouCanBook.ME) to track the bookings for me.

      The "E" in "Javascript" stands for "Easy"

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

        @BKeyport ok, what does ‘clients name’ look like

        any examples?

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        BKeyportB 1 Reply Last reply Reply Quote 0
        • BKeyportB Offline
          BKeyport Module Developer @sdetweil
          last edited by BKeyport

          @sdetweil 27799f75-889c-40e7-8345-527b308231cb-image.png

          BEGIN:VEVENT
          DTSTART:20250417T020000Z
          DTEND:20250417T030000Z
          DTSTAMP:20250215T064845Z
          UID:sla6c0fbp2f6m06mscbt8961hg@google.com
          CREATED:20250215T064259Z
          DESCRIPTION:<p>Phone: +12015551212<br />Email: test@email.com<br />Notes: S
           pecial Request</p>\n<p><a href="">Reschedule this booking</a><br /><a href="">Cance
           l this booking</a></p>\n<p>YCBM link ref: e4c41a9e-28a5-4528-90e8-dd8a18c64
           ae5</p>
          LAST-MODIFIED:20250215T064333Z
          SEQUENCE:0
          STATUS:CONFIRMED
          SUMMARY:Client Name
          TRANSP:OPAQUE
          END:VEVENT
          

          Web links removed, Test client deleted, so no clicky. The event title is solely the client name, but that can be adjusted if need be, I think.

          The "E" in "Javascript" stands for "Easy"

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

            @BKeyport ok, this should work

            if(ev.description.search("YCBM")>-1){
                   		ev.title = "Client"
             }
            

            you already have the
            return ev

            you can
            console.log(ev.description)
            to make sure it is what you expect

            better if mmm-logging is installed to copy the browser log to startup log

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            BKeyportB 1 Reply Last reply Reply Quote 0
            • BKeyportB Offline
              BKeyport Module Developer @sdetweil
              last edited by

              @sdetweil perfection, thanks. Never even thought about direct replacement - only seen more complex solutions.

              The "E" in "Javascript" stands for "Easy"

              BKeyportB 1 Reply Last reply Reply Quote 1
              • S sdetweil has marked this topic as solved on
              • BKeyportB Offline
                BKeyport Module Developer @BKeyport
                last edited by

                I think we’re gonna have to call @MMRIZE in on this one. it worked initially - however, if the description is blank in any event, it’ll stop completely, and not process anything. Here’s what I got now.

                				eventTransformer: (ev) => {
                					if (ev.title.search("🏠") > -1) {
                						ev.title = ev.title.replace("🏠 Personal Commitment", "Personal Event");
                						ev.color = 'yellow';
                					}
                					if (ev.title.search("✈ Flight") > -1) {
                						ev.title = ev.title.replace("✈ Flight", "Personal Event");
                						ev.color = 'yellow';
                					}
                					if(ev.description.search("YCBM") > -1) {
                       					 	ev.title = "Client"
                 					} 
                				return ev 
                				},
                

                The "E" in "Javascript" stands for "Easy"

                S 1 Reply Last reply Reply Quote 0
                • BKeyportB BKeyport has marked this topic as unsolved on
                • S Offline
                  sdetweil @BKeyport
                  last edited by sdetweil

                  @BKeyport add the test

                  if (

                  ev.description && 
                  

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  BKeyportB 1 Reply Last reply Reply Quote 0
                  • BKeyportB Offline
                    BKeyport Module Developer @sdetweil
                    last edited by

                    @sdetweil That did it… Well, other than typing out event rather than ev. :)

                    All the same, Maybe it should be a check inside the javascript…

                    The "E" in "Javascript" stands for "Easy"

                    BKeyportB S 2 Replies Last reply Reply Quote 0
                    • BKeyportB BKeyport has marked this topic as solved on
                    • BKeyportB Offline
                      BKeyport Module Developer @BKeyport
                      last edited by

                      For completeness - here’s the answer:

                      	if(ev.description && ev.description.search("YCBM") > -1) {
                             					 	ev.title = "Client"
                       					} 
                      

                      The "E" in "Javascript" stands for "Easy"

                      1 Reply Last reply Reply Quote 1
                      • BKeyportB BKeyport has marked this topic as solved on
                      • S Offline
                        sdetweil @BKeyport
                        last edited by

                        @BKeyport sorry, phone decided to autocorrect for me.

                        but you got it. this IS javascript. without the test, the transformer crashed

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        BKeyportB 1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 1 / 2
                        • 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