1、问题
云函数部署后cron-parser解析0点会变成8点
考虑可能是时区的问题
然后看文档发现果然有问题,云函数环境是utc+0
2、解决
看了半天cron-parser文档发现
Using `Date` as an input can be problematic specially when using the `tz` option. The issue being that, when creating a new `Date` object without
any timezone information, it will be created in the timezone of the system that is running the code. This (most of times) won't be what the user
will be expecting. Using one of the supported `string` formats will solve the issue(see timezone example).
* *iterator* - Return ES6 compatible iterator object
* *utc* - Enable UTC
* *tz* - Timezone string. It won't be used in case `utc` is enabled
大概就是tz就是设置时区的方法
然后查找时区字符值
中国, 亚洲: 当前本地时间 & 日期、时区和时差
parser.parseExpression(task.do_cron,{tz: 'Asia/Shanghai'});
果然可以 问题解决~