I am fairly new to Airtable and was having trouble finding information on the filterByFormula option in the API. I was trying to get rows back based on a DATE field using a date range, so any date that fell between my startDate and endDate. I couldn’t find any specific examples, so I am posting this to hopefully help someone else that tries to do this. Below is some javascript code using airtable.js and this is what I used to be able to get results back within the range:
let data = await base(‘Timelogs’).select({
filterByFormula: IF(AND(IS_AFTER({DATE}, '${startDate}'), IS_BEFORE({DATE}, '${endDate}')), 1, 0)
}).all()
This may have been elementary but I about ripped my hair out trying to get this UBER simple process to work.
Edit: There are backticks (quotes would work too of course) around the IF() portion. This editor doesn’t seem to print them. startDate and endDate are variables in the code and I am using template literals to pull the values in.
