(crontab: string, date = new Date())
| 85 | * - 否则直接返回下一次执行时间字符串 |
| 86 | */ |
| 87 | export const nextTimeDisplay = (crontab: string, date = new Date()): string => { |
| 88 | try { |
| 89 | const res = nextTimeInfo(crontab, date); |
| 90 | const nextTimeFormatted = res.next.toFormat(res.format); |
| 91 | return res.once ? t(`cron_oncetype.${res.once}`, { next: nextTimeFormatted }) : nextTimeFormatted; |
| 92 | } catch (e) { |
| 93 | console.error(`nextTimeDisplay: Invalid cron expression "${crontab}"`, e); |
| 94 | return t("cron_invalid_expr"); |
| 95 | } |
| 96 | }; |
| 97 | |
| 98 | /** |
| 99 | * 解析 cron 表达式,提取 once 信息并转换为标准 cron 表达式。 |
no test coverage detected