feat(cron): get next run date/time from backend#3643
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5853f7d3f6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| limit := t.AddDate(4, 0, 0) | ||
| candidate := t | ||
| for candidate.Before(limit) { |
There was a problem hiding this comment.
Remove 4-year cutoff when searching AND cron matches
andSchedule.Next stops scanning at t.AddDate(4, 0, 0), but valid day-of-month/day-of-week intersections can be much farther away (for example, 0 0 29 2 1 only matches when Feb 29 is Monday, which is often >4 years out). In those cases this returns zero and both /schedules/next and the real scheduler path (SchedulePool.addRunner) treat the schedule as having no future run, so valid cron jobs are silently never scheduled.
Useful? React with 👍 / 👎.
| data: { cron_format: this.item.cron_format }, | ||
| responseType: 'json', | ||
| }); | ||
| this.cronNextRunTime = new Date(resp.data.next_run_time); |
There was a problem hiding this comment.
Handle empty next_run_time before constructing Date
The API explicitly returns next_run_time: "" when no next occurrence exists, but this code always does new Date(resp.data.next_run_time), which yields Invalid Date for an empty string. Downstream formatters only guard null and call Intl.DateTimeFormat(...).formatToParts(date), which throws RangeError on invalid dates, so the schedule form can crash for cron expressions with no computed next run.
Useful? React with 👍 / 👎.
No description provided.