How can I use datediff of postgresql with sequelizejs
this is my code
notices = await RecruitmentNotice.findAll({
distinct: true,
where: noticeConfig.whereQuery,
attributes: {
include: [
[
Sequelize.fn(
'DATEDIFF',
'year',
Sequelize.col('RecruitmentNotice.createdAt'),
Sequelize.col('RecruitmentNotice.endDate'),
),
'datediff',
],
],
},
});
This code causes the following error.
name: 'SequelizeDatabaseError',
parent: error: function datediff(unknown, timestamp with time zone, timestamp with time zone) does not exist
hint: 'No function matches the given name and argument types. You might need to add explicit type casts.',
Please help me.