# Date sent from N8N not accepted

**URL:** <https://forum.seatable.com/t/date-sent-from-n8n-not-accepted/3432>\
**Category:** API\
**Tags:** n8n\
**Created:** [April 30, 2024, 5:24pm UTC](https://forum.seatable.com/t/date-sent-from-n8n-not-accepted/3432 "2024-04-30T17:24:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lcx\_at](https://forum.seatable.com/user_avatar/forum.seatable.com/lcx_at/32/2402_2.png) [@lcx\_at](https://forum.seatable.com/u/lcx_at)\
**Post date:** [April 30, 2024, 5:24pm UTC](https://forum.seatable.com/t/date-sent-from-n8n-not-accepted/3432/1 "2024-04-30T17:24:48Z")

</div>

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  
 ![CleanShot_2024-04-30_at_19.21.54](https://forum.seatable.io/uploads/default/original/2X/b/ba74693d7252413f02c5e3f107ef64d503863bdf.png)

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

 ![CleanShot_2024-04-30_at_19.23.01](https://forum.seatable.io/uploads/default/original/2X/6/6ab961201a72100640128873184cb35742ce82ea.png)

what am I doing wrong?

this is how the JSON looks like

```json
[
  {
    "Invoice Number": "6281894002",
    "Invoice Date": "2024-04-23",
    "Due Date": "2024-05-03"
  }
]

```

same thing happens with the due date.

---

<div class="post-metadata">

**Author:** ![bha](https://forum.seatable.com/user_avatar/forum.seatable.com/bha/32/4702_2.png) [@bha](https://forum.seatable.com/u/bha)\
**Post date:** [April 30, 2024, 7:11pm UTC](https://forum.seatable.com/t/date-sent-from-n8n-not-accepted/3432/2 "2024-04-30T19:11:38Z")

</div>

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 :

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

```

Bests,  
Benjamin

---

<div class="post-metadata">

**Author:** ![lcx\_at](https://forum.seatable.com/user_avatar/forum.seatable.com/lcx_at/32/2402_2.png) [@lcx\_at](https://forum.seatable.com/u/lcx_at)\
**Post date:** [May 2, 2024, 12:00pm UTC](https://forum.seatable.com/t/date-sent-from-n8n-not-accepted/3432/3 "2024-05-02T12:00:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lcx\_at](https://forum.seatable.com/user_avatar/forum.seatable.com/lcx_at/32/2402_2.png) [@lcx\_at](https://forum.seatable.com/u/lcx_at)\
**Post date:** [May 2, 2024, 12:07pm UTC](https://forum.seatable.com/t/date-sent-from-n8n-not-accepted/3432/4 "2024-05-02T12:07:44Z")

</div>

I could at least shorten it up a bit:

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

```

still have to see how this handles with null values.

---

<div class="post-metadata">

**Author:** ![bha](https://forum.seatable.com/user_avatar/forum.seatable.com/bha/32/4702_2.png) [@bha](https://forum.seatable.com/u/bha)\
**Post date:** [May 2, 2024, 12:13pm UTC](https://forum.seatable.com/t/date-sent-from-n8n-not-accepted/3432/5 "2024-05-02T12:13:49Z")

</div>

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.

Bests,  
Benjamin

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

---

<div class="post-metadata">

**Author:** ![system](https://forum.seatable.com/uploads/default/original/1X/04603423fe81a46c321283663086c475429e8ccb.png) [@system](https://forum.seatable.com/u/system)\
**Post date:** [May 4, 2024, 12:13pm UTC](https://forum.seatable.com/t/date-sent-from-n8n-not-accepted/3432/6 "2024-05-04T12:13:50Z")

</div>

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