Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const TaskDetailsDialogContent: React.FC<TaskDetailsDialogContentProps> = ({
/>
) : (
<TaskScheduleSection
schedule={task.schedule}
schedule={task.schedule || ""}
nextRun={task.next_run || ""}
isDeleted={isDeleted}
/>
Expand Down
4 changes: 2 additions & 2 deletions components/VercelChat/tools/tasks/TaskCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ const TaskCard: React.FC<TaskCardProps> = ({ task, isDeleted, ownerEmail }) => {

<div className="flex items-center space-x-4">
<div className="flex items-center space-x-2">
{isRecurring(task.schedule) && (
{task.schedule && isRecurring(task.schedule) && (
<Repeat className="h-4 w-4 text-muted-foreground dark:text-muted-foreground flex-shrink-0" />
)}
<span className="text-base text-muted-foreground dark:text-muted-foreground">
{parseCronToHuman(task.schedule.trim())}
{task.schedule ? parseCronToHuman(task.schedule.trim()) : "No schedule"}
</span>
</div>
<div className="flex items-center space-x-2 w-20 justify-end relative">
Expand Down
1 change: 1 addition & 0 deletions lib/tasks/isRecurring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Checks if a cron expression represents a recurring schedule (daily, weekly, or monthly)
*/
export const isRecurring = (cronExpression: string): boolean => {
if (!cronExpression) return false;
try {
const parts = cronExpression.split(" ");
if (parts.length >= 5) {
Expand Down
1 change: 1 addition & 0 deletions lib/tasks/parseCronToHuman.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import cronstrue from "cronstrue";

export const parseCronToHuman = (cronExpression: string): string => {
if (!cronExpression) return "No schedule";
try {
return cronstrue.toString(cronExpression);
} catch (e) {
Expand Down