修复定时任务列表格式化 crontab

This commit is contained in:
whyour
2023-02-06 23:26:59 +08:00
parent fcbcfc3a03
commit cc9a17afa3
3 changed files with 15 additions and 10 deletions
+12
View File
@@ -1,4 +1,5 @@
import { LOG_END_SYMBOL } from './const';
import cron_parser from 'cron-parser';
export default function browserType() {
// 权重:系统 + 系统版本 > 平台 > 内核 + 载体 + 内核版本 + 载体版本 > 外壳 + 外壳版本
@@ -326,3 +327,14 @@ export function getCommandScript(
}
return [s, p];
}
export function parseCrontab(schedule: string): Date {
try {
const time = cron_parser.parseExpression(schedule);
if (time) {
return time.next().toDate();
}
} catch (error) {}
return new Date('1970');
}