Skip to content

Fix cron expression validation for 6-field format (with seconds)#2916

Draft
Copilot wants to merge 3 commits intodevelopfrom
copilot/fix-corn-expression-support
Draft

Fix cron expression validation for 6-field format (with seconds)#2916
Copilot wants to merge 3 commits intodevelopfrom
copilot/fix-corn-expression-support

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 29, 2026

Frontend validation rejected cron expressions with seconds field (e.g., */8 * * * * ?). Backend validation already worked correctly.

Root Cause

Default import of cron-parser fails when bundled for browser:

import CronExpressionParser from 'cron-parser';
// CronExpressionParser.parse() is undefined after webpack bundling

TypeScript's esModuleInterop handles this correctly for CommonJS backend, but frontend bundler does not.

Changes

Use named export instead:

-import CronExpressionParser from 'cron-parser';
+import { CronExpressionParser } from 'cron-parser';

Applied to:

  • src/pages/crontab/modal.tsx
  • src/pages/subscription/modal.tsx
  • src/utils/index.ts

Both 5-field (* * * * *) and 6-field (* * * * * *) cron expressions now validate correctly.

Original prompt

This section details on the original issue you should resolve

<issue_title>新建定时任务时候 如果corn表达式有秒 那么不会创建成功</issue_title>
<issue_description>### Qinglong version

2.20.1

Steps to reproduce

Image

What is expected?

corn可以兼容秒级

What is actually happening?

corn不支持秒

System Info

Need to install the following packages:
  envinfo
Ok to proceed? (y) y

  System:
    OS: Windows 11 10.0.22635
    CPU: (12) x64 AMD Ryzen 5 5600 6-Core Processor
    Memory: 5.71 GB / 15.93 GB
  Binaries:
    Node: 16.13.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.1.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.10.0 - C:\Users\24786\AppData\Local\pnpm\pnpm.EXE
  Browsers:
    Chrome: 143.0.7499.170
    Edge: Chromium (142.0.3595.53)
    Internet Explorer: 11.0.22621.3566

Any additional comments?

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel
Copy link
Copy Markdown

vercel bot commented Jan 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
qinglong Ready Ready Preview, Comment Jan 29, 2026 11:47am
qinglong-back Ready Ready Preview, Comment Jan 29, 2026 11:47am

Copilot AI and others added 2 commits January 29, 2026 11:31
Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix corn expression handling for seconds in scheduled tasks Fix cron expression validation for 6-field format (with seconds) Jan 29, 2026
Copilot AI requested a review from whyour January 29, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

新建定时任务时候 如果corn表达式有秒 那么不会创建成功

2 participants