From 78f1cb8a66804e201e0da75917bd4a85eff3beff Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Tue, 1 Dec 2020 23:05:22 +0000 Subject: [PATCH] ensure trigger timestamp option sends .now() To close #2771 --- .../@node-red/nodes/core/function/89-trigger.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/nodes/core/function/89-trigger.js b/packages/node_modules/@node-red/nodes/core/function/89-trigger.js index 7b5b820b7..910043d33 100644 --- a/packages/node_modules/@node-red/nodes/core/function/89-trigger.js +++ b/packages/node_modules/@node-red/nodes/core/function/89-trigger.js @@ -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); } }