i fixed it with
export default {
unpublishExpiredNews: {
task: async ({ strapi }) => {
await strapi.db.query("api::news-item.news-item").updateMany({
where: { ExpirationDate: { $lte: new Date() } },
data: { publishedAt: null },
});
},
options: {
// Run daily at 3 AM
rule: "0 0 3 * * *",
},
},
};