1

const parts = dateFormat.formatToParts(date).filter(part => { 'RangeError: Invalid time value'. at DateTimeFormat.formatToParts ()
at buidDateParts

getting error in Cron Job Scheduler using with node '20.18.3' and "node-cron": "^4.0.5". is there any Javascript date problem, i have tested with moment but same error.

cron.schedule('* * * * *', async() => {

  try {
    await jobScheduler.turnOffActivity();
  } catch (error) {
    console.log(error);
    
  }
});


exports.turnOffActivity = async () => {
  
  try {
    const now = new Date();
     
    const result = await Post.update(
      { is_active: false },
      {
        where: {
          end_time: { [Op.lte]: now },
          is_active: true,
          type:{[Op.in]:['liveactivity','plannedactivity']}
        }
      }
    );

  } catch (error) {
    console.error('Error turning off activities:', error);
  }
};
1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.