In Sequelize, how can I:
Only return entries that are at least 30 minutes old or older (as indicated by their created_at datetime field).
This isn't working properly (using postgreSQL).
where: {
[Op.and]: [
{
active: true,
},
{
updated_at: { // DataTypes.DATE
// Return only if this datetime value is >= 30 minutes
[Op.gte]: Sequelize.literal("NOW() - (INTERVAL '30 MINUTE')"),
},
}
}
Does not seem to be working properly.
Should I be using EXTRACT or taking the diff between the updated_at and new Date(updated_at) - 30?
Sequelize.where(
Sequelize.literal(`EXTRACT(MINUTE FROM TIMESTAMP '???')`),
{
[Op.gte]: 30,
}
)