fix(RSS Feed Trigger Node): Use newest date instead of first item for new items (#9182)

Co-authored-by: Jonathan Bennetts <jonathan.bennetts@gmail.com>
This commit is contained in:
Egor Malykh 2024-05-22 10:23:53 +02:00 committed by GitHub
parent a591f63e3f
commit 7236a558b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -76,7 +76,10 @@ export class RssFeedReadTrigger implements INodeType {
returnData.push(item);
}
});
pollData.lastItemDate = feed.items[0].isoDate;
const maxIsoDate = feed.items.reduce((a, b) =>
new Date(a.isoDate as string) > new Date(b.isoDate as string) ? a : b,
).isoDate;
pollData.lastItemDate = maxIsoDate;
}
if (Array.isArray(returnData) && returnData.length !== 0) {