I believe the node-schedule package will suit your needs. Generally, you want so-called cron to schedule and run your server tasks.
With node-schedule:
import schedule from 'node-schedule'
schedule.scheduleJob('0 0 * * *', () => { ... }) // run everyday at midnight