Date sent from N8N not accepted

I’m using N8N to create a new row, everything works as expected except for the date.
I’m sending this Date in the Format YYYY-MM-DD

but in seatable the date remains nil.
If I use a string column instead, the date is written as expected.

what am I doing wrong?

this is how the JSON looks like

    "Invoice Number": "6281894002",
    "Invoice Date": "2024-04-23",
    "Due Date": "2024-05-03"

same thing happens with the due date.

Hi @lcx_at,
After trying few things, it seems that a date column needs a date object as input… Something like that should do the trick in your Column value :

{{ new Date($('Switch').item.json["Invoice Date"].split('-')[0],$('Switch').item.json["Invoice Date"].split('-')[1],$('Switch').item.json["Invoice Date"].split('-')[2]) }}


thanks, guess it does kind of work but complicates everything a bit, since it looks quite messy and sometimes dates can be null.
These are the painful moments where I just think to myself that I would have been so much faster writing code than using n8n.

I could at least shorten it up a bit:

{{ new Date(DateTime.fromISO($('Switch').item.json["Invoice Date"])) }}

still have to see how this handles with null values.

I realized that a simple {{ new Date($('Switch').item.json['Invoice Date']) }} works just as well. If Invoice Date is "", or event if it doesn’t exist at all in the JSON response, it still creates a new row with the InvoiceDate column empty without throwing an error. Not sure if this is the desired behaviour, but it does have the advantage of being simpler than my previous answer.


Edit : sorry I didn’t see your last answer as I was posting myself… I see that we had the same idea!

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