1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

ensure trigger timestamp option sends .now()

To close #2771
This commit is contained in:
Dave Conway-Jones 2020-12-01 23:05:22 +00:00
parent 4bfe9a9ae9
commit 78f1cb8a66
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF

View File

@ -179,7 +179,10 @@ module.exports = function(RED) {
/* istanbul ignore else */
if (node.op1type !== "nul") {
var msg2 = RED.util.cloneMessage(msg);
node.topics[topic].tout = setInterval(function() { node.send(RED.util.cloneMessage(msg2)); }, delayDuration);
node.topics[topic].tout = setInterval(function() {
if (node.op1type === "date") { msg2.payload = Date.now(); }
node.send(RED.util.cloneMessage(msg2));
}, delayDuration);
}
}
else {
@ -209,6 +212,7 @@ module.exports = function(RED) {
}
else {
msg2.payload = node.topics[topic].m2;
if (node.op2type === "date") { msg2.payload = Date.now(); }
if (node.second === true) { node.send([null,msg2]); }
else { node.send(msg2); }
}