Ensure trigger node properties work with evaluateNodeProperty

This commit is contained in:
Nick O'Leary 2024-10-21 16:26:03 +01:00
parent d0ad62a82b
commit b3aff3a3e6
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -24,6 +24,14 @@ module.exports = function(RED) {
this.op2 = n.op2 || "0";
this.op1type = n.op1type || "str";
this.op2type = n.op2type || "str";
// If the op1/2type is 'date', then we need to leave op1/2 alone so that
// evaluateNodeProperty works as expected.
if (this.op1type === 'date' && this.op1 === '1') {
this.op1 = ''
}
if (this.op2type === 'date' && this.op2 === '0') {
this.op2 = ''
}
this.second = (n.outputs == 2) ? true : false;
this.topic = n.topic || "topic";
@ -213,7 +221,6 @@ module.exports = function(RED) {
}
else {
msg2.payload = node.topics[topic].m2;
if (node.op2type === "date") { msg2.payload = Date.now(); }
if (node.second === true) { msgInfo.send([null,msg2]); }
else { msgInfo.send(msg2); }
}