From 21f6aa296ba7cf0b049bf2fd720c7bfec6aba07f Mon Sep 17 00:00:00 2001 From: Bruno Inec Date: Wed, 7 Feb 2024 15:09:23 +0100 Subject: [PATCH] fix(RSS Feed Trigger Node): Save last item's date instead of last execution date --- .../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 366b5d07b84ec..114bcb15e3161 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)];