Search code examples
javascriptexpresscronnode-cron

Sync node-cron with system time


I want to know if I can change system time on computer for node-cron to re-run?, if not how can I test a function that runs every month without waiting for a month


Solution

  • Changing time back and forth can have negative/strange effects on database, run on this server, other scheduled jobs, logs and so on. So the better way is to duplicate the cron records and change the time of new record to next 10-15 minutes. After this do not forget to remove this new record from cron.