mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 04:04:06 -08:00
fix(RSS Feed Trigger Node): Save last item's date instead of last execution date (#8572)
This commit is contained in:
parent
2db8231af5
commit
a822588012
|
@ -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)];
|
||||
|
|
Loading…
Reference in a new issue