Remove value if date occurred before 01.01.1900

I have to remove value if its date occurred after 01.01.1900.

I get seven different dates from google sheets. For example I got them in Set node. But I need only dates what occurred after 01.01.1900. I have to remove other. I wrote a function in code node but it doesn’t working. What can I do to get rid of unnecessary dates?

My example workflow

Output example

Information on your n8n setup

  • n8n version: 0.224.4
  • Database: SQLite
  • n8n EXECUTIONS_PROCESS setting: main
  • Running n8n via: Docker Compose
  • Operating system: Ubuntu

In your current example all the dates are in a single item. Is this expected, or will the dates be coming through as individual items all under a date key? Can you share a redacted sample of the incoming data?

All these dates are coming from single google sheets row in a single item. I can share with you an actual example of workflow and outputs:


This is actual data from google sheets

A JSON blob of a redacted item would be useful. A few more questions:

  • Is that set of fields with dates predictable, or does it sometimes change?
  • Do you want to drop the entire item if ANY or ALL of the dates are before 01.01.1990
  • OR do you just want to remove that field from the item if it’s before 01.01.1990

Thank you for your help.
I get seven different dates from google sheets. The number of dates is permanent but the actual dates can be different. I’m not interested in dates if it’s before 01.01.1990. So I want to remove all fields from item if it’s BEFORE 01.01.1990 and keep fields if it’s AFTER 01.01.1990.

Something like this

Thank you for your work!
But I’m getting this error while executing your workflow


I’m pretty bad in JS, maybe I did something wrong

With my own data I’ve got same issue

Sorry for the dud workflow… it works in 0.225, but not 0.224 something changed quite recently :stuck_out_tongue:. I just changed the return from return newItem to return { json: newItem}

This should work for you:

1 Like

Thank you so much!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.