Date and time node : invalid date format

Hello
I am trying to schedule to send an email to my customers 11 month after they opt in to our newsletter.
I have a field “received-at-date” for the submission date
My plan is to add 11 months to this date and to send an email at this new date

here is my workflow

last node ouput : ERROR: Invalid date format
NodeOperationError: Invalid date format
at Object.parseDate (/app/code/node_modules/n8n-nodes-base/nodes/DateTime/V2/GenericFunctions.ts:46:10)
at Object.execute (/app/code/node_modules/n8n-nodes-base/nodes/DateTime/V2/DateTimeV2.node.ts:119:33)
at Workflow.runNode (/app/code/node_modules/n8n-workflow/src/Workflow.ts:1307:31)
at /app/code/node_modules/n8n-core/src/WorkflowExecute.ts:1048:44
at processTicksAndRejections (node:internal/process/task_queues:95:5)

I tried to set my date whith this same node to DD/MM/YYYY
but no succes
I am running the last stable version of n8n : 1.15.2

Thanks for your help, n8n is so greaaaat !!

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:

You might want to use DateTime.fromISO() or DateTime.fromFormat() depending on the format you receive from the previous node.

something like

{{ DateTime.fromFormat($json.received_at_date, "yyyy-MM-dd") }}

Edit:
you could also add the delta right there
{{ DateTime.fromFormat($json.received_at_date, "yyyy-MM-dd").plus(11, "months") }}

1 Like

Yes thank you !!
Your solution works great, but I also found I should change my timezone to Paris in the workflow settings.
Thanks for your quick reply,
Greetings from France

1 Like

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