I want to find upcoming birthday for every users based on 2 scenarios,
- In between Date1 to Date2.
- In between Current date to "N" months.
I was trying to implement this by,
{
[Op.and]: [
Sequelize.where(Sequelize.fn('DATE_FORMAT', Sequelize.col('user.dob'), '%m-%d'), {
[Op.between]: [
moment(dateFrom).format('MM-DD'),
moment(dateTo).format('MM-DD')
]
}),
]
}
But this is not returning the expected results.
FYI, The data type of DOB is, dob: DataTypes.DATEONLY