Skip to content
Advertisement

Sequelize How compare year of a date in query

I’m trying to make this query:

JavaScript

How can I perfome this query above in sequelize style?

JavaScript

Thanks!

Advertisement

Answer

JavaScript

You have to use .where here, because the lefthand side of the expression (the key) is an object, so it cannot be used in the regular POJO style as an object key.

If you want to combine it with other conditions you could do:

JavaScript

https://sequelize.org/v3/docs/querying/#operators

Advertisement