Hello. I need to be able to check when the date changes (when the day is over and a new one starts) ever 5 seconds. For that I have a function node that checks the date and saves it in a msg.var , another delay node for 5s and another function node that gets the date again and compares it to the one saved in msg. var. At least that is what I WANTED to do, but I keep getting errors.
This is my first function node:
var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
msg.var=date
return msg;
Then I have 5 seconds of delay and the next function node:
var today = new Date();
var newdate = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
if (msg.var == newdate){
return [0,0]}
else{
return[msg, 0]}
I keep getting this error message in the FIRST function node and the flow stops because of it:
"Function tried to send a message of type string"
Can anyone offer any guidance¿?