How does sequelize query the data within seven days?

In

mysql, the time type is datetime , orm is sequelize ,
how to get the data within 7 days and 30 days in the table, how to write the query conditions
(is it where date_col > 7 days ago datetime), and whether
sequelize provides a more convenient way to write

Jun.29,2022

Model.findAll({
  where: 
    time_col: {
        [Op.lt]: new Date(),
        [Op.gt]: new Date(new Date() - 7 * 24 * 60 * 60 * 1000)
    }
});
Menu