Using variable in Luxon fromFormat

I´m a bit confused about using variables in a Luxon function. From a HTTP request I got a date as a string in DD.MM.YYY format.

Now I want to convert this to a more usable Date format. Luxons DateTime.fromFormat() works great when it is hardcoded:

But when I use a variable from a previous node containing the date string, this doesn´t work:

Can someone explain what’s wrong with my expression? Do I have to enter the variable in another way?

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

hi,

tried it, works on my version 1.8.2. Here’s the screenshot:

may be related to the version you are using, can you answer the previous question, n8n version, database etc. also if possible can you post your workflow ?

Thank you @slenderwrist for your quick reply.

I´m running version 1.42.2 on docker on Ubuntu 22.04 with a PostgreSQL database. Not quite sure what is meant with EXECUTIONS_PROCESS setting and where to change it.

found the problem, here’s the screenshot:

Datum fields have space at the end thats why fromFormat returned invalidDatetime. i added trim() method and then it worked.

1 Like

Oh, I can´t tell you how much you helped me. Thanks a lot for this. I think I would have never considered something like this. You made my day :innocent:

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