Hi Guys,
Related to my last topic, I am trying to put together a flow which starts a process at a time (hour+minute) specified on the UI.
I use the below logic to store the start time (hour and minute) in global. "hour" and "minute" is coming from the UI.
var mytime = new Date();
mytime.setHours(hour, minute, 0);
mytime.setMilliseconds(0);
mytime.setFullYear(2000,01,01);
global.set("start",mytime);
When I output this variable, I see this in the debug: Tue Feb 01 2000 20:22:00 GMT+0100 (CET). This looks OK for me.
Next, I create a inject to execute every second and send out the timestamp. In a function connected to the inject, I convert the message like this:
var current = new Date();
current.setFullYear(2000,01,01);
current.setMilliseconds(0);
msg.payload = current;
In the next step I compare the msg.payload == global.start in a switch node. And it never comes true.
I added the payload to debug and it is definitely firing every second. I can see that it picks up the same value as in the global variable in the debug. In both cases I have setMilliseconds(0) to make sure the sub-second values are nil for both. And it is still not happening.
If I am using operators other than == it works just fine. So I am sure switch can compare dates.
Any ideas where I have gone wrong?