Help

The date entered in a record via a script using createRecordsAsync doesn't correspond to its value!

Topic Labels: Scripting extentions
868 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Jeremy_Lambert
5 - Automation Enthusiast
5 - Automation Enthusiast

Hello everyone,
Now this is a strange one: I obtain a date object from an entry by a user, then I use that date to fill in a cell in a new record…

output.text(HandoverDate is ${handOverDate});

let table2 = base.getTable(“Timeline”);
let recordIds = await table2.createRecordsAsync([
{
fields: {
“Start date”: handOverDate,
“Project”: [{ id: projectsDict[projectName].id }],
“Milestone”: { name: ‘Launch’ },
“Task start date”: launchDate,
“Task End date”: launchDate
},
},

The output text shows the actual date inserted by the user (it is processed a bit earlier in the code)… but the value in the ‘Start Date’ column is exactly one day earlier…

I have also tried different dates and the behaviour is consistent (across months, etc…). I want to add that this portion of code is as is: I haven’t hidden any lines for this post.
Any suggestions?

1 Reply 1

This could be a timezone issue. Airtable stores all date/times in GMT, but often displays them in local time. Check the format options for the date field to see if it is displaying local time or GMT time.