Read the statement by Michael Teeuw here.
read csv-data and put it in an array
-
and where i have to place it ?
-
@Perlchamp see my updated post above
-
i get this for each entry (here i only posted one of them):
[2020-05-02 17:50:36.803] [LOG] LOOK >>>>>>{} (/home/dirk/MagicMirror/modules/MMM-Logging/node_helper.js:34 Class.socketNotificationReceived)
empty: {}
-
@Perlchamp ok, so the data collection didn’t work…
so I would step thru that code
what is the 1st row of your csv file? the column headers
-
before you do this. stop. i make an error. the code you posted is not in the notification section. it’s in the getDom section … so i placed it there. was this wrong ?
-
@Perlchamp there is NOT an this. updateDom() in the getDom() section…
still doesn’t change the result… there are no birthdays found that match 02/05
-
the columns are:
birth, nameand is called “birthdays.csv”
the data are:
23.01.1987,Thomas Roth -
@Perlchamp so there are no birthdays for today… we are ONLY selecting for TODAY. not every day
-
why for TODAY ? and not for current MONTH ?
getDon:getDom: function() { var self = this; var wrapper = document.createElement("div"); // tell MM to call and get our content Log.log("LOOK >>>>>>" + JSON.stringify(this.active_birthdays)) // add this line self.updateDom(); // before this line in the notification code.. for(var birthday of Object.keys(this.active_birthdays)) { for(var name of this.active_birthdays[birthday]) { var m = document.createElement("div"); Log.log("BIRTHDAY >> " + birthday); Log.log("NAME >> " + name); m.innerText = birthday + " " + name; wrapper.appendChild(m); } } // pass the created content back to MM to add to DOM. return wrapper; }
-
@Perlchamp said in read csv-data and put it in an array:
// tell MM to call and get our content
Log.log(“LOOK >>>>>>” + JSON.stringify(this.active_birthdays)) // add this line
self.updateDom();not that way
// save the persons name and age on the list self.active_birthdays[birth_date].push({'name':birthday.name, 'age': now.diff(moment(birthday.birth,'DD.MM.YYYY'), 'years') }) } } // tell MM to call and get our content Log.log(JSON.stringify(this.active_birthdays)) // add this line self.updateDom(); // before this line }
sorry, didn’t see the ‘month’.
still doesn’t matter, that birthday is for january, so nothing to show for may
change this compare to do only month
// if the date is the same or later, don't use time of day if(birth_date_moment.startOf('day').isSameOrAfter(now.startOf('day')) && birth_date_moment.startOf('day').isSameOrBefore(birthday_time_window.startOf('day'))
hint, google get month from moment