Invalid Date Time with Set Node

I did a set to change the date from UTC format to the y-LL-dd HH:mm:ss format. I use luxon expression like below

{{DateTime. fromISO($json[“created_at”]).toFormat(‘y-LL-dd HH:mm:ss’)}}

When previewed in the set section, the results match, but when executed, an invalid datetime error appears. (see picture below)

Why this happened? is something not quite right?

Thank you.

Information on your n8n setup

  • n8n version: 0.227.1
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • *Running n8n via Docker
  • Operating system: Linux

Hi @rusdiaman, I am sorry to hear you’re having trouble.

Is the node you’re sending the data from a Postgres node by any chance? This node would occasionally not return the expected string iirc, a behaviour that has been fixed with [email protected]. So you might want to update your n8n version in a first step.

If the problem still persists afterwards, could you perhaps include example data in your demo workflow using which the problem can be reproduced?

Thank you so much!

Hi @MutedJam ,

Thank you for your response.
yes, you’re right. The data come from PostgresSQL.

I have upgraded my n8n version to 0.228.2 and try run it again. but the result is same.
created_at still “Invalid Date” when use Set Node.

But a strange thing happened when I tried to input the datetime manually for the example I’m about to post here. the following is the workflow

Everything is ok when I did Set and converted to the format I wanted.

But if the data comes from Postgres all become invalid datetime.
Do you know anything about this? maybe there is something wrong from me.

Thank you.

1 Like

Hi @rusdiaman, can you try removing the existing Postgres node from your workflow and add a new one from scratch? Otherwise n8n would keep using the old node version (and sorry, I really should have mentioned that in my previous post).

If this doesn’t fix the problem, can you share your Postgres table schema and an example workflow using which the problem can be reproduced (including the Postgres node as well as the Set node)? Thank you so much and sorry for the trouble!

Hi @MutedJam ,
sorry for late reply.
i want to confirmation about our problem.
when i try to build from scratch as you said. its work perfectly.

Thank you for your support.

1 Like

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