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.

    Default Compliments Module - Special Days

    Scheduled Pinned Locked Moved General Discussion
    4 Posts 2 Posters 392 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.
    • W Offline
      WallysWellies
      last edited by

      I wasn’t sure where to put this but I wanted to make use of the “special days” feature of the default compliments and it didn’t behave as I was expecting. I assumed it would override the normally configured compliments and show only the one(s) specific to that day, however it appears to just add the day’s compliments to the existing list.

      For example I have this in my config:

      "....-12-25": ["Happy Christmas WallysWellies!"]
      

      But that message just gets added to my many already configured compliments (I changed the date to test).

      For anyone like me that wants to show only this message on your chosen day I tweaked the compliments.js file around line 98 from this:

      // Add compliments for special days
      for (let entry in this.config.compliments) {
        if (new RegExp(entry).test(date)) {
          Array.prototype.push.apply(compliments, this.config.compliments[entry]);
        }
      }
      

      to this:

      // Add compliments for special days
      for (let entry in this.config.compliments) {
        if (new RegExp(entry).test(date)) {
          compliments = []; // Empty the array if it's a special day in config.js
          Array.prototype.push.apply(compliments, this.config.compliments[entry]);
        }
      }
      

      It just empties the compliments array if it’s a date specified in the config file (or at least I assume that’s how it works - seemed happy in a quick test!).

      I didn’t see much info when searching for answers so I thought I might throw it out there for info / discussion.

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

        @WallysWellies you should submit that as a bug to the github repo

        Sam

        How to add modules

        learning how to use browser developers window for css changes

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

          @sdetweil I can do that. I wasn’t sure if it was considered a bug but I’ll log it and see what they say.

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

            @WallysWellies said in Default Compliments Module - Special Days:

            see what they say.

            i help decide too

            Sam

            How to add modules

            learning how to use browser developers window for css changes

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