Using API to link a date field in local format

Our calendar table has a primary field of type datetime with the local format
When using the API to update a link record in our bookings table with the recordId from the calendar, it is displayed in the US format
image
A linked table shows the local format, it is just the lookup table that is wrongly presented
In the picture above 3rd record we copied and pasted the date which is then the correct format
Is this a bug?

Hi @Mike_Wilson,

Welcome to Airtable Community! :slight_smile:

When sending the data using the API send it in the ISO date format, it will then be formatted automatically into the format you specify in the Field. Any other way will create wrong dates (and I have tried it a lot!)

If this helps you, Please mark it as Solution so others can see it.

BR,
Mo

Thank you for your help - Just to be clear

I am using ISO date format when creating the primary field of Table1 (this works OK)
I remember the recordID of the newly created record

Then in Table2 I set the linked field to the RecordID (from table 1) - this is displayed incorrectly

Are you saying I should not use the recordID, instead I should use the ISO date?

Mike

There shouldnt be any difference between the Record name in the primary field of Table 1 and what is displayed in the Linked Record field. What im seeing is this creates another record in Table 1 with this “new” name, can you check if the record with the wrong name actually links to the correct record?

I would choose the date from the list that pops up when you click on the plus button in the Linked Field.

Hi, I tried updated the linked field as a ISO date but get the following
“Value is not an array of record IDs.(INVALID_VALUE_FOR_COLUMN)[Http code 422]”

To answer you question, Yes they are linked correctly
Please look at the picture at the top of the thread - some of these dates are impossible
9/23/2020 is US format
27/5/2021 is UK format
They are all UK format in Table A

The error message you listed confirms what you asked about earlier: links should be sent as an array of record IDs. Some integration systems use internal methods that let the user pass the name in the primary field of the linked record instead of its ID, but the API requires the ID.

If you haven’t already done so, I strongly suggest taking this question to Airtable support.

Hi @Mike_Wilson - yes this does look like a bug. I’m getting the same behaviour as you when creating a linked record via the API (using the record id for the calendar record):

The linked field has no format options and doesn’t seem to pick up the underlying format options of the date field. Side note, if you change the format in the root table, then all of the dates reset their format, but this isn’t a very usable workaround:

Format reset to ISO:

Then reset to local:

Thanks for your reply. Re the previous message - I contacted Airtable support, who responded quickly. Confirming it looked wrong and are investigating
They suggested trying “European” format - which works - so just an issue with “local”

1 Like

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