Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(RSS Feed Trigger Node): Save last item's date instead of last execution date #8572

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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!');
Expand Down Expand Up @@ -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)];
Expand Down
Loading