Calculate next scheduled time based on cron spec

后端 未结 2 433
轻奢々
轻奢々 2021-02-01 21:05

What\'s an efficient way to calculate the next run time of an event given the current time and a cron spec?

I\'m looking for something other than \"loop through every mi

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-01 21:31

    Later.js is a javascript library that does just this. It is able to parse a Cron expression and then calculate future occurrences of the schedule. It's algorithm isn't very fancy, but it does the job. Might be worth a look.

提交回复
热议问题