好像没有找到特别合适的库,只能自己随便撸一个了,下面是一些例子:
humanizeCronInChinese('* * * * *'); // 每分钟
humanizeCronInChinese('0 0 * * *'); // 每日 00:00
humanizeCronInChinese('0 0 1 * *'); // 每月 1 日 00:00
humanizeCronInChinese('*/2 * * * *'); // 每隔 2 分钟
humanizeCronInChinese('45 4 1,10,20 * *') // 每月 1,10,20 日 04:45
humanizeCronInChinese('0 0 * * 1-5') // 每周一~周五 00:00
https://github.com/ikesnowy/cron-chinese
征集一些奇怪的 cron 测试用例 hhhh