My HTTP Request node returns an array with multiple objects which themselves are arrays. I want to filter using the If node to only select objects where the created_at date is within the last 24 hours - but I can only seem to apply it to an individual object:
Regarding the topic of age and dealing about date/time: I personally find it much simpler and easier to understand when using something like difference in days as a basis. To make things clearer, I’ve adjusted the query accordingly: {{ ($today - new Date($json.created_at)) / (1000 * 60 * 60 * 24) }} → age in days. Of course, this is just a personal preference that helps me understand things more easily.
The SET nodes at the end are simply for verification purposes, to check what comes out at each step.
Hahah, that was literally the first thing I tried but I used the expression {{ $json.data }} instead of just the fixed “data” string, that gave me the error “this.getNodeParameter(…).split is not a function”.
I spent nearly half an hour trying to troubleshoot that before going down other rabbitholes, but still don’t understand why the fixed string worked but referencing the same array using Javascript didn’t - do you know?
Also thanks for the suggestion for calculating the difference in timestamps, I hadn’t thought of that!