Help

Re: Script to convert google form date to AT-compatible format

793 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Noah_Coleman
6 - Interface Innovator
6 - Interface Innovator

I’m making an automation that edits an Airtable record with a date pulled from a Google Forms submission. I know from this post that the formats are incompatible, but I didn’t know if there’s a way to convert the date in a script to a format that Airtable finds more palatable? Is there something like DATETIME_PARSE() for scripting?
I could create a column for the incoming date and a column for the DATETIME_PARSE() formula, but I’d prefer to do it in a script and avoid cluttering my base.

2 Replies 2

Yes, there are many ways to manipulate the dates using javascript date functions.

Noah_Coleman
6 - Interface Innovator
6 - Interface Innovator

Update:
I think I was able to correctly parse the date. I’m no longer getting the error “Field “x” cannot accept the provided value: Could not convert string to date”. So, I assume it is in the right format. I am now getting an “Updating the record failed due to insufficient permissions” error.

Script code:

let inputConfig = input.config(); // pulls in inputs
// console.log(`The value of gsTimestamp is ${inputConfig.gsTimestamp}`);
var toFormat = new Date(inputConfig.gsTimestamp); // create a variable with the input as a Date
var atTimestamp = toFormat.toJSON(); // convert the date format to JSON
// console.log(atTimestamp);
output.set('atTimestamp', atTimestamp); // output in correct format

So, I think it worked, but it is still not updating my record.