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.

    Is there a way to show specific compliments on specific dates?

    Scheduled Pinned Locked Moved Troubleshooting
    21 Posts 6 Posters 14.4k Views 6 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.
    • C Offline
      CyanKali
      last edited by

      @romain I figured it out! The console showed me it was April 29 today (which is the right date), but it was written as “Apr. 29”, so with a dot behind the month. I tried writing it like this in the code and now it works!
      So it has to be:

      if (moment().format('MMM D') == 'Apr. 29')
      

      and then it works :)
      And now I know how to run my mirror in dev mode, which will be useful in the future ;) Thank you!

      romainR 1 Reply Last reply Reply Quote 0
      • romainR Offline
        romain @CyanKali
        last edited by

        @CyanKali Great =D . I guess that for some reason your moment.js doesn’t print the same thing as mine x) (which is kinda weird but fine)

        strawberry 3.141S 1 Reply Last reply Reply Quote 0
        • strawberry 3.141S Offline
          strawberry 3.141 Project Sponsor Module Developer @romain
          last edited by

          @romain moment uses different locales for dates and so on based on the language set

          Please create a github issue if you need help, so I can keep track

          1 Reply Last reply Reply Quote 0
          • ItsMeCobra2006I Offline
            ItsMeCobra2006
            last edited by ItsMeCobra2006

            In case someone is still wondering how to simply display set compliments on set days: ```

            complimentArray: function() {
            		var hour = moment().hour();
            		var date = moment().format('DDMM');  \\add this into compliments.js
            		var compliments;
            
            		if (hour >= this.config.morningStartTime && hour < this.config.morningEndTime && this.config.compliments.hasOwnProperty("morning")) {
            			compliments = this.config.compliments.morning.slice(0);
            		} else if (hour >= this.config.afternoonStartTime && hour < this.config.afternoonEndTime && this.config.compliments.hasOwnProperty("afternoon")) {
            			compliments = this.config.compliments.afternoon.slice(0);
            		} else if(this.config.compliments.hasOwnProperty("evening")) {
            			compliments = this.config.compliments.evening.slice(0);
            		}
            
            		if (typeof compliments === "undefined") {
            			compliments = new Array();
            		}
            		
            
            		if (this.currentWeatherType in this.config.compliments) {
            			compliments.push.apply(compliments, this.config.compliments[this.currentWeatherType]);
            		}
            
              	    if (date in this.config.compliments) {
            			compliments.push.apply(compliments, this.config.compliments[date]);
            		} \\add these 3 lines into compliments.js
            
            		compliments.push.apply(compliments, this.config.compliments.anytime);
            
            		return compliments;
            	}, 
            

            Example:

            anytime: [
            				"Hey there sexy!"
            			],
            			morning: [
            				"Good morning, handsome!",
            				"Enjoy your day!",
            				"How was your sleep?"
            			],
            			afternoon: [
            				"Hello, beauty!",
            				"You look sexy!",
            				"Looking good today!"
            			],
            			"1005": [
            				"Today is May 10th",
            				"You look nice!",
            				"Hi, sexy!"
            			] 
            		},
            

            EDIT:
            Anyone know how to show compliments on days without a set date each year, like Christmas, but something like the second Sunday of May, like Mother’s day?

            Z 1 Reply Last reply Reply Quote 1
            • Z Offline
              zolabus @ItsMeCobra2006
              last edited by yawns

              @itsmecobra2006
              Hi this is my config

              {
              			module: "compliments",
              			position: "lower_third",
              			config: {	
              			        "1401": [
              				"Auguri!!"			
              			] 
              			}
              			},
              

              But today 14/01/2019 the “Auguri!!” doesn’t show.
              Any Idea?
              Thanks

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