ERROR: The value "undefined" is not a valid DateTime

Describe the issue/error/question

date conversion.
seems I dont understand how dates work.

I scrape HTML and managed to convert the scraped html dates to a JS date
Now in the final IF node the node complains about the date… when I just converted it to a JS date in the format n8n seems to want.

the IF node then complains its undefined
ERROR: The value "undefined" is not a valid DateTime..

I scrolled through all the 170 entries and couldnt see one which is undefined

What is the error message (if any)?

ERROR: The value "undefined" is not a valid DateTime.

Please share the workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database you’re using (default: SQLite):
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker, npm,, desktop app]:

Hello @thomastraum,

There are two reasons the workflow is returning this error:

You have a white space in the date key in front of the date. To fix that, in the expression use:


The second issue is in the second expression. In the output you can see only one item when comparing dates, to fix that use the below expression:

{{$item(0).$node["now minus some time"].json["data"]}}

To learn more about what the $item() does, check out this link.

Hope this helps.


@rdt ah amzing… thanks so much for helping this fixed the issue. I don’t understand it, though… Even after reading the link, I don’t understand what item(0) is.

do I need to use it as it doesn’t have multiple entries but just one date, which the node should use to compare against the 170 from the first input of the IF node? Wouldn’t you expect it then to be on the end of the expression like index 0 in an array: {{$node["now minus some time"].json["data"][0]}}