How can I set the new Date to 1 minute later?

Tags: , , ,



I made the second argument function of the schedule run one day later through the new Date. However, I want to change it in a minute, not in a day. How do I fix the code?

this is my code

    if (user.change === true) {
      await User.update(
        { nickname: req.body.nick, change: false },

        {
          where: { id: req.user.id },
        }
      );
      const end = new Date();
      end.setDate(end.getDate() + 1); // 
      schedule.scheduleJob(end, async () => {
    
        await User.update(
          {change: true},

          {
            where: { id: req.user.id },
          }
        );

      });

Answer

var d = new Date();
d.setMinutes(d.getMinutes()+1);

console.log(d)


Source: stackoverflow