mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-29 04:29:41 +00:00
Add basic compliment on a specific day of the year
This commit is contained in:
parent
39cb582e07
commit
82b50d3059
@ -28,7 +28,10 @@ Module.register("compliments", {
|
||||
"Wow, you look hot!",
|
||||
"You look nice!",
|
||||
"Hi, sexy!"
|
||||
]
|
||||
],
|
||||
date: [
|
||||
["12-10", "Happy birthday, Ada Lovelace!"]
|
||||
],
|
||||
},
|
||||
updateInterval: 30000,
|
||||
remoteFile: null,
|
||||
@ -102,6 +105,8 @@ Module.register("compliments", {
|
||||
*/
|
||||
complimentArray: function() {
|
||||
var hour = moment().hour();
|
||||
var year = moment().year();
|
||||
var today = moment(new Date());
|
||||
var compliments;
|
||||
|
||||
if (hour >= this.config.morningStartTime && hour < this.config.morningEndTime && this.config.compliments.hasOwnProperty("morning")) {
|
||||
@ -122,6 +127,12 @@ Module.register("compliments", {
|
||||
|
||||
compliments.push.apply(compliments, this.config.compliments.anytime);
|
||||
|
||||
this.config.compliments.date.forEach(d => {
|
||||
if (today.isSame(year + "-" + d[0], "month")) {
|
||||
compliments.push(d[1]);
|
||||
}
|
||||
});
|
||||
|
||||
return compliments;
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user