Hi All,
I am new to the airtable and Airtable Automations.
I have a table with a column ‘Filled Date’. I wanted to schedule an automation to happen every night to delete the records with a date that is 60 days prior to today.
I don’t know if am doing it wrong, but I tried to filter the rows using below code, but it’s filtering entire records:
var today = new Date();
const table = base.getTable(“Table1”);
const query = await table.selectRecordsAsync({
fields: [“Filled Date”]
});
const todelete = query.records.filter(rec => Math.ceil(Math.abs(today.getTime() - new Date(rec.getCellValue(“Filled Date”)).getTime()/ (1000 * 60 * 60 * 24))) > 60);
console.log(todelete);
Can anyone help me on this. Any advise is much appreciated. Thank you.