From a822588012b66711f37d3ca363fcd04742eda1b8 Mon Sep 17 00:00:00 2001 From: Bruno Inec Date: Thu, 8 Feb 2024 14:29:20 +0100 Subject: [PATCH] fix(RSS Feed Trigger Node): Save last item's date instead of last execution date (#8572) --- .../nodes/RssFeedRead/RssFeedReadTrigger.node.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/nodes-base/nodes/RssFeedRead/RssFeedReadTrigger.node.ts b/packages/nodes-base/nodes/RssFeedRead/RssFeedReadTrigger.node.ts index 366b5d07b8..114bcb15e3 100644 --- a/packages/nodes-base/nodes/RssFeedRead/RssFeedReadTrigger.node.ts +++ b/packages/nodes-base/nodes/RssFeedRead/RssFeedReadTrigger.node.ts @@ -42,9 +42,8 @@ export class RssFeedReadTrigger implements INodeType { const feedUrl = this.getNodeParameter('feedUrl') as string; const now = moment().utc().format(); - const startDate = (pollData.lastTimeChecked as string) || now; - - const endDate = now; + const dateToCheck = + (pollData.lastItemDate as string) || (pollData.lastTimeChecked as string) || now; if (!feedUrl) { throw new NodeOperationError(this.getNode(), 'The parameter "URL" has to be set!'); @@ -73,12 +72,12 @@ export class RssFeedReadTrigger implements INodeType { return [this.helpers.returnJsonArray(feed.items[0])]; } feed.items.forEach((item) => { - if (Date.parse(item.isoDate as string) >= Date.parse(startDate)) { + if (Date.parse(item.isoDate as string) > Date.parse(dateToCheck)) { returnData.push(item); } }); + pollData.lastItemDate = feed.items[0].isoDate; } - pollData.lastTimeChecked = endDate; if (Array.isArray(returnData) && returnData.length !== 0) { return [this.helpers.returnJsonArray(returnData)];