fetch records in sequelize for createdDate only is less than year from today

33 Views Asked by At

How to check and get records in a sql using sequelize

I have table with id and createdDate fields

id createdDate
1.  30-6-2023
2.  31-7-2024

I would like to know how to fetch records having createdDate less than one year from today using sequelize

ExpectedRecord
id createdDate
1.  30-6-2023

Tried
 return this.findAll({
      createdDate: {
        between: [new Date(), Date.parse('createdDate
')]
      }
    });
  }
0

There are 0 best solutions below