Airtable unset date field

I want to unset an existing date field in Airtable, I tried sending {{ null }} and it doesn’t work.

Invalid input for 'last_run' [item 0]
'last_run' expects a dateTime but we got ' '

Consider using DateTime.fromFormat to work with custom date formats.

n8n version 1.83.2

Looks like essentially the same question was answered recently here

That sets a date, not unsets a date. I already have a date, I want it removed.

{{ DateTime.fromFormat('', "dd-MM-yyyy").toISODate() }}

sets date field to: 1/1/2000 12:00am

Right, so you need to set it to null or blank. The example workflow/node in that post says it even works with blank values. Did you try that?

ya i tried:

{{ DateTime.fromFormat(‘’, “dd-MM-yyyy”).toISODate() }}
{{ DateTime.fromFormat(null, “dd-MM-yyyy”).toISODate() }}

I poked around at this a bit more and noticed that part of the problem is n8n being “helpful” and validating the date value before sending it to Airtable. I could sorta hack around that with an expression that makes the validation happy with a real date, but then sends a different value to the Airtable API like: {{ (new Error().stack.toString().indexOf('validate')) ? $now : null }}

The second part of the problem is that there doesn’t seem to be anything you can send to the Airtable API to represent a blank or null date value (contrary to what this suggests. Tried null, 'null', '', ' ', -1, 0, and various other things not worth mentioning, with the typecast option off, and with the typecast option on (which converts most things to the current time, so still not reset/blank/null).

One other idea I had but didn’t try is to add an Airtable trigger to match a “special” date value and overwrite it on the Airtable server end.

As far as I can tell, the “answer” for doing this in n8n is that it is not possible. Assuming your application has logic that depends on a null/blank value in a date field, you may just need to include || theDate == someSpecialValue

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