Describe the problem/error/question
Getting error of “Dates must be in valid ISO 8601 time format” even if the date-time format is correct for the node.
What is the error message (if any)?
ERROR: Bad request - please check your parameters
Dates must be in valid ISO 8601 time format
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
Share the output returned by the last node
Information on your n8n setup
n8n version: 0.228.2
Database (default: SQLite):
n8n EXECUTIONS_PROCESS setting (default: own, main): default
Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
Operating system: MAC
Hi @Gouravdev ,
it looks like the Mailchimp APIs have some problems with some Date formatting.
Formats they accept:
2023-02-22T08:04:10+00:00
2023-02-22T08:04:53Z
Not accepted:
Luckily in n8n you can shape Dates as you want using the Luxon library.
In your case you could do:
{{ DateTime.fromISO($json.lastExecution2).toFormat("yyyy-LL-dd'T'hh:mm:ss'Z'") }}
What it does:
Converts the original string into a Luxon DateTime object
Formats it again using the Luxon toFormat
method
The only caveat is that the timezone is hardcoded in this way, but if that’s a problem you can play with the Luxon documentation (luxon - Immutable date wrapper ) to find a better solution.
Hope this helps
Let me know if you need more support
All the best
3 Likes
system
Closed
June 28, 2023, 12:47pm
4
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.